]> Savannah Git Hosting - gnulib.git/commitdiff
uniname/uniname-tests: Tighten code.
authorBruno Haible <bruno@clisp.org>
Tue, 26 Sep 2017 23:59:12 +0000 (01:59 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 26 Sep 2017 23:59:12 +0000 (01:59 +0200)
* tests/uniname/test-uninames.c (fill_names, fill_aliases): Merge two
local variables into one.

ChangeLog
tests/uniname/test-uninames.c

index af67c6bb668b0e52a8209c761574f966109149bc..8a9bbe6253753c6dc7d4f4eff606f525cf048e9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-26  Bruno Haible  <bruno@clisp.org>
+
+       uniname/uniname-tests: Tighten code.
+       * tests/uniname/test-uninames.c (fill_names, fill_aliases): Merge two
+       local variables into one.
+
 2017-09-26  Bruno Haible  <bruno@clisp.org>
 
        vma-iter: Improvements for Linux and BSD platforms.
index 476bb07f0509c8c1880e2562930cdc0702f22812..46a9a9184e1a091ca742820470a44d1a973dc914 100644 (file)
@@ -63,8 +63,7 @@ fill_names (const char *unicodedata_filename)
     {
       char *p;
       char *comment;
-      unsigned int i;
-      unsigned long ul;
+      unsigned long i;
 
       lineno++;
 
@@ -95,13 +94,12 @@ fill_names (const char *unicodedata_filename)
           exit (EXIT_FAILURE);
         }
       *p = '\0';
-      ul = strtoul (field0, NULL, 16);
-      if (ul >= 0x110000)
+      i = strtoul (field0, NULL, 16);
+      if (i >= 0x110000)
         {
           fprintf (stderr, "index too large\n");
           exit (EXIT_FAILURE);
         }
-      i = ul;
       unicode_names[i] = xstrdup (field1);
     }
   if (ferror (stream) || fclose (stream))
@@ -133,8 +131,7 @@ fill_aliases (const char *namealiases_filename)
     {
       char *p;
       char *comment;
-      unsigned int uc;
-      unsigned long ul;
+      unsigned long uc;
 
       comment = strchr (line, '#');
       if (comment != NULL)
@@ -164,13 +161,12 @@ fill_aliases (const char *namealiases_filename)
         }
       *p = '\0';
 
-      ul = strtoul (field0, NULL, 16);
-      if (ul >= 0x110000)
+      uc = strtoul (field0, NULL, 16);
+      if (uc >= 0x110000)
         {
           fprintf (stderr, "index too large\n");
           exit (EXIT_FAILURE);
         }
-      uc = ul;
 
       if (aliases_count == ALIASLEN)
         {