mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-14 00:10:10 -04:00
Make push_dir()/pop_dir() accept a stack as first argument
This commit is contained in:
parent
79cdb4f9aa
commit
69bae139bb
@ -79,7 +79,7 @@ static struct stacked_dir *dirstack;
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
push_dir(char *path)
|
push_dir(struct stacked_dir **s, char *path)
|
||||||
{
|
{
|
||||||
struct stacked_dir *d;
|
struct stacked_dir *d;
|
||||||
|
|
||||||
@ -97,23 +97,23 @@ push_dir(char *path)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->next = dirstack;
|
d->next = *s;
|
||||||
dirstack = d;
|
*s = d;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
pop_dir(void)
|
pop_dir(struct stacked_dir **s)
|
||||||
{
|
{
|
||||||
struct stacked_dir *d;
|
struct stacked_dir *d;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
if (!dirstack)
|
if (!*s)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
d = dirstack;
|
d = *s;
|
||||||
dirstack = d->next;
|
*s = d->next;
|
||||||
ret = d->path;
|
ret = d->path;
|
||||||
|
|
||||||
free(d);
|
free(d);
|
||||||
@ -519,7 +519,7 @@ process_directory(int libidx, char *path, int flags)
|
|||||||
if (S_ISREG(sb.st_mode))
|
if (S_ISREG(sb.st_mode))
|
||||||
process_file(entry, sb.st_mtime, sb.st_size, compilation, flags);
|
process_file(entry, sb.st_mtime, sb.st_size, compilation, flags);
|
||||||
else if (S_ISDIR(sb.st_mode))
|
else if (S_ISDIR(sb.st_mode))
|
||||||
push_dir(entry);
|
push_dir(&dirstack, entry);
|
||||||
else
|
else
|
||||||
DPRINTF(E_LOG, L_SCAN, "Skipping %s, not a directory, symlink nor regular file\n", entry);
|
DPRINTF(E_LOG, L_SCAN, "Skipping %s, not a directory, symlink nor regular file\n", entry);
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ process_directories(int libidx, char *root, int flags)
|
|||||||
if (scan_exit)
|
if (scan_exit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while ((path = pop_dir()))
|
while ((path = pop_dir(&dirstack)))
|
||||||
{
|
{
|
||||||
process_directory(libidx, path, flags);
|
process_directory(libidx, path, flags);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user