if(dir != NULL) {
char** r = malloc(sizeof(*r));
struct dirent* d;
+ char** old;
+ int len;
+ int i;
r[0] = NULL;
while((d = readdir(dir)) != NULL) {
if(strcmp(d->d_name, ".") != 0 && strcmp(d->d_name, "..") != 0) {
stat(p, &s);
free(p);
- char** old = r;
- int i;
+ old = r;
for(i = 0; old[i] != NULL; i++)
;
r = malloc(sizeof(*r) * (i + 2));
free(old);
}
}
- int len;
for(len = 0; r[len] != NULL; len++)
;
qsort(r, len, sizeof(char*), cm_sort);
- char** old = r;
- int i;
+ old = r;
for(i = 0; old[i] != NULL; i++)
;
r = malloc(sizeof(*r) * (i + 2));