Use path[len] instead of *(path + len)

Maybe it's time to go to bed...
This commit is contained in:
FRIGN 2015-03-03 00:31:27 +01:00
parent 903d43bbb8
commit 0b9c02cd22
1 changed files with 2 additions and 2 deletions

View File

@ -36,8 +36,8 @@ recurse(const char *path, void (*fn)(const char *, int), int depth)
while ((d = readdir(dp))) {
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
continue;
buf = emalloc(len + (*(path + len) != '/') + strlen(d->d_name) + 1);
sprintf(buf, "%s%s%s", path, (*(path + len) == '/') ? "" : "/", d->d_name);
buf = emalloc(len + (path[len] != '/') + strlen(d->d_name) + 1);
sprintf(buf, "%s%s%s", path, (path[len] == '/') ? "" : "/", d->d_name);
fn(buf, depth + 1);
free(buf);
}