diff options
Diffstat (limited to 'include.c')
-rw-r--r-- | include.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -164,8 +164,6 @@ newinclude(const char *newfile, const char *incstring) void included_by(struct inclist *ip, struct inclist *newfile) { - int i; - if (ip == NULL) return; /* @@ -179,7 +177,7 @@ included_by(struct inclist *ip, struct inclist *newfile) ip->i_merged = malloc(sizeof(boolean) * ip->i_listlen); } else { - for (i = 0; i < ip->i_listlen; i++) + for (int i = 0; i < ip->i_listlen; i++) if (ip->i_list[i] == newfile) { i = strlen(newfile->i_file); if (!(ip->i_flags & INCLUDED_SYM) && @@ -225,7 +223,6 @@ static const char * find_full_inc_path(const char *file, const char *include, int type) { static char path[BUFSIZ]; - const char **pp, *p; struct stat st; if (inclistnext == inclist) { @@ -247,6 +244,8 @@ find_full_inc_path(const char *file, const char *include, int type) * in the directory of the file being parsed. */ if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT)) { + const char *p; + for (p = file + strlen(file); p > file; p--) if (*p == '/') break; @@ -272,9 +271,8 @@ find_full_inc_path(const char *file, const char *include, int type) */ if ((type == INCLUDE) || (type == INCLUDEDOT)) includedirsnext = includedirs; - pp = includedirsnext; - for (; *pp; pp++) { + for (const char **pp = includedirsnext; *pp; pp++) { snprintf(path, sizeof(path), "%s/%s", *pp, include); remove_dotdot(path); if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) { |