From a2e33147134b43f5696ec91db137038c323d2067 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Wed, 29 Apr 2020 11:32:07 +0300 Subject: [PATCH] Avoid predeclaring variables and localize their decl. See: * http://perl-begin.org/tutorials/bad-elements/#declaring_all_vars_at_top * https://en.wikipedia.org/wiki/Perl_Best_Practices --- fortune-mod/util/strfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fortune-mod/util/strfile.c b/fortune-mod/util/strfile.c index 6c31816..4ba18e1 100644 --- a/fortune-mod/util/strfile.c +++ b/fortune-mod/util/strfile.c @@ -357,7 +357,6 @@ int main(int ac, char **av) { char *sp; FILE *inf, *outf; - int32_t *p; STR *fp; bool len_was_set = false; @@ -512,7 +511,7 @@ int main(int ac, char **av) if (storing_ptrs()) { int cnt = (int)Num_pts; - for (p = Seekpts; cnt--; ++p) + for (int32_t *p = Seekpts; cnt--; ++p) { *p = (int32_t)htonl((uint32_t)*p); fwrite(p, sizeof *p, 1, outf); -- 2.40.0