add queue popping functions

This commit is contained in:
discomfitor 2011-08-16 19:04:25 -04:00 committed by Con Kolivas
parent e111d890ee
commit 8d299570e9
2 changed files with 20 additions and 0 deletions

View file

@ -277,6 +277,15 @@ bool lrzip_file_del(Lrzip *lr, FILE *file)
return true;
}
FILE *lrzip_file_pop(Lrzip *lr)
{
FILE *ret;
if ((!lr) || (!lr->infile_buckets)) return NULL;
ret = lr->infiles[0];
lrzip_file_del(lr, ret);
return ret;
}
void lrzip_files_clear(Lrzip *lr)
{
if ((!lr) || (!lr->infile_buckets)) return;
@ -328,6 +337,15 @@ bool lrzip_filename_del(Lrzip *lr, const char *file)
return true;
}
const char *lrzip_filename_pop(Lrzip *lr)
{
static char buf[4096];
if ((!lr) || (!lr->infilename_buckets)) return NULL;
strcat(buf, lr->infilenames[0]);
lrzip_filename_del(lr, buf);
return &buf[0];
}
void lrzip_filenames_clear(Lrzip *lr)
{
size_t x;

View file

@ -87,9 +87,11 @@ FILE **lrzip_files_get(Lrzip *lr);
char **lrzip_filenames_get(Lrzip *lr);
bool lrzip_file_add(Lrzip *lr, FILE *file);
bool lrzip_file_del(Lrzip *lr, FILE *file);
FILE *lrzip_file_pop(Lrzip *lr);
void lrzip_files_clear(Lrzip *lr);
bool lrzip_filename_add(Lrzip *lr, const char *file);
bool lrzip_filename_del(Lrzip *lr, const char *file);
const char *lrzip_filename_pop(Lrzip *lr);
void lrzip_filenames_clear(Lrzip *lr);
void lrzip_suffix_set(Lrzip *lr, const char *suffix);
const char *lrzip_suffix_get(Lrzip *lr);