From: Mark Wooding Date: Tue, 16 Jul 2024 17:42:56 +0000 (+0100) Subject: checkpath,c, chpath.c, tmpdir.c: : Hoist declarations to function head. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/checkpath/commitdiff_plain/de5dde29b9dc4352622975d788133915c7484280?ds=sidebyside checkpath,c, chpath.c, tmpdir.c: : Hoist declarations to function head. --- diff --git a/checkpath.c b/checkpath.c index d874246..440a6ab 100644 --- a/checkpath.c +++ b/checkpath.c @@ -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 --- */ diff --git a/chkpath.c b/chkpath.c index c5ef46e..a7158d3 100644 --- a/chkpath.c +++ b/chkpath.c @@ -133,8 +133,8 @@ int main(int argc, char *argv[]) { "verbose", 0, 0, 'v' }, { 0, 0, 0, 0 } }; - int i = mdwopt(argc, argv, "hVu" "g:pqstv", opts, 0, 0, 0); + i = mdwopt(argc, argv, "hVu" "g:pqstv", opts, 0, 0, 0); if (i < 0) break; switch (i) { diff --git a/tmpdir.c b/tmpdir.c index c561c1c..18eb440 100644 --- a/tmpdir.c +++ b/tmpdir.c @@ -311,6 +311,7 @@ int main(int argc, char *argv[]) { int shell = 0; int duff = 0; + int i; char *p; enum { @@ -348,8 +349,8 @@ int main(int argc, char *argv[]) { "verbose", 0, 0, 'v' }, { 0, 0, 0, 0 } }; - int i = mdwopt(argc, argv, "hVu" "C:bcg:v", opts, 0, 0, 0); + i = mdwopt(argc, argv, "hVu" "C:bcg:v", opts, 0, 0, 0); if (i < 0) break; switch (i) {