chiark / gitweb /
checkpath,c, chpath.c, tmpdir.c: : Hoist declarations to function head.
[checkpath] / checkpath.c
index d874246025f69ed4b69fe14259226569304a88fa..440a6ab2a9faf6945db529e6637f554456240e32 100644 (file)
@@ -87,9 +87,9 @@ static dstr d = DSTR_INIT;            /* Current path string */
 static struct elt *splitpath(const char *path, struct elt *tail)
 {
   struct elt *head, **ee = &head, *e;
+  size_t n;
 
   while (*path) {
-    size_t n;
 
     /* --- Either a leading `/', or a doubled one --- *
      *
@@ -353,6 +353,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp)
   struct stat st;
   unsigned bad = 0;
   dstr buf = DSTR_INIT;
+  int i;
 
   /* --- Initialize stack pointer and path string --- */
 
@@ -420,7 +421,6 @@ unsigned checkpath(const char *p, const struct checkpath *cp)
     /* --- Handle symbolic links specially --- */
 
     if (S_ISLNK(st.st_mode)) {
-      int i;
 
       /* --- Resolve the link --- */