if (path_is_absolute(p))
return strdup(p);
- if (!(cwd = get_current_dir_name()))
+ cwd = get_current_dir_name();
+ if (!cwd)
return NULL;
r = path_make_absolute(p, cwd);
errno = 0;
u = canonicalize_file_name(t);
-
if (!u) {
if (errno == ENOENT)
u = t;
continue;
}
- }
+ } else
+ free(t);
l[k++] = u;
}
return l;
}
-char **path_strv_remove_empty(char **l) {
- char **f, **t;
-
- if (!l)
- return NULL;
-
- for (f = t = l; *f; f++) {
-
- if (dir_is_empty(*f) > 0) {
- free(*f);
- continue;
- }
-
- *(t++) = *f;
- }
-
- *t = NULL;
- return l;
-}
-
char *path_kill_slashes(char *path) {
char *f, *t;
bool slash = false;