From: Jim Meyering Date: Tue, 13 Mar 2001 08:34:38 +0000 (+0000) Subject: (merge): Move declarations of local variables into X-Git-Tag: FILEUTILS-4_0_42~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=593d17ffe4e4be8a96d123b98b49bcf0024c09ef;p=platform%2Fupstream%2Fcoreutils.git (merge): Move declarations of local variables into the inner scope where they're used. (sort): Likewise. --- diff --git a/src/sort.c b/src/sort.c index bdc535c..981c97f 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1837,13 +1837,11 @@ check (char **files, int nfiles) static void merge (char **files, int nfiles, int max_merge, char const *output_file) { - int i, t; - char *temp; - FILE *tfp; - while (max_merge < nfiles) { - t = 0; + FILE *tfp; + int i, t = 0; + char *temp; for (i = 0; i < nfiles / NMERGE; ++i) { temp = create_temp_file (&tfp); @@ -1867,10 +1865,7 @@ static void sort (char **files, int nfiles, char const *output_file) { struct buffer buf; - FILE *tfp; - struct tempnode *node; int n_temp_files = 0; - char **tempfiles; buf.alloc = 0; @@ -1879,6 +1874,7 @@ sort (char **files, int nfiles, char const *output_file) char const *temp_output; char const *file = *files; FILE *fp = xfopen (file, "r"); + FILE *tfp; if (! buf.alloc) initbuf (&buf, 2 * sizeof (struct line), @@ -1944,7 +1940,8 @@ sort (char **files, int nfiles, char const *output_file) if (n_temp_files) { int i = n_temp_files; - tempfiles = (char **) xmalloc (n_temp_files * sizeof (char *)); + struct tempnode *node; + char **tempfiles = (char **) xmalloc (n_temp_files * sizeof (char *)); for (node = temphead; i > 0; node = node->next) tempfiles[--i] = node->name; merge (tempfiles, n_temp_files, NMERGE, output_file);