]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(check_file): Move declarations of local variables
authorJim Meyering <jim@meyering.net>
Sun, 22 Aug 1999 08:16:34 +0000 (08:16 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 22 Aug 1999 08:16:34 +0000 (08:16 +0000)
into the scopes where they're used.
(min): Remove macro definition.
(different): Use MIN, not min.

src/uniq.c

index c50337b097fd341aff1c44c526f5411825cb4e30..7af6072f142b184b1474fba8b78a17c731d2009a 100644 (file)
@@ -173,9 +173,9 @@ different (const char *old, const char *new, size_t oldlen, size_t newlen)
      avoid portability hassles of getting a non-conflicting declaration
      of memcmp.  */
   if (ignore_case)
-    order = memcasecmp (old, new, min (oldlen, newlen));
+    order = memcasecmp (old, new, MIN (oldlen, newlen));
   else
-    order = memcmp (old, new, min (oldlen, newlen));
+    order = memcmp (old, new, MIN (oldlen, newlen));
 
   if (order == 0)
     return oldlen - newlen;
@@ -210,9 +210,9 @@ check_file (const char *infile, const char *outfile)
   FILE *istream;
   FILE *ostream;
   struct linebuffer lb1, lb2;
-  struct linebuffer *thisline, *prevline, *exch;
-  char *prevfield, *thisfield;
-  size_t prevlen, thislen;
+  struct linebuffer *thisline, *prevline;
+  char *prevfield;
+  size_t prevlen;
   int match_count = 0;
 
   if (STREQ (infile, "-"))
@@ -243,6 +243,8 @@ check_file (const char *infile, const char *outfile)
   while (!feof (istream))
     {
       int match;
+      char *thisfield;
+      size_t thislen;
       if (readline (thisline, istream) == 0)
        break;
       thisfield = find_field (thisline);
@@ -254,10 +256,11 @@ check_file (const char *infile, const char *outfile)
 
       if (!match || mode == output_all_repeated)
        {
+         struct linebuffer *tmp;
          writeline (prevline, ostream, match_count);
-         exch = prevline;
+         tmp = prevline;
          prevline = thisline;
-         thisline = exch;
+         thisline = tmp;
          prevfield = thisfield;
          prevlen = thislen;
          if (!match)