Use path[len] instead of *(path + len)
Maybe it's time to go to bed...
This commit is contained in:
parent
903d43bbb8
commit
0b9c02cd22
|
@ -36,8 +36,8 @@ recurse(const char *path, void (*fn)(const char *, int), int depth)
|
||||||
while ((d = readdir(dp))) {
|
while ((d = readdir(dp))) {
|
||||||
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
|
||||||
continue;
|
continue;
|
||||||
buf = emalloc(len + (*(path + len) != '/') + strlen(d->d_name) + 1);
|
buf = emalloc(len + (path[len] != '/') + strlen(d->d_name) + 1);
|
||||||
sprintf(buf, "%s%s%s", path, (*(path + len) == '/') ? "" : "/", d->d_name);
|
sprintf(buf, "%s%s%s", path, (path[len] == '/') ? "" : "/", d->d_name);
|
||||||
fn(buf, depth + 1);
|
fn(buf, depth + 1);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user