From: Bruno Haible Date: Tue, 26 Sep 2017 23:59:12 +0000 (+0200) Subject: uniname/uniname-tests: Tighten code. X-Git-Tag: v1.0~5896 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7244c6bb38e1e8317c4481b33e342cc61468d2ad;p=thirdparty%2Fgnulib.git uniname/uniname-tests: Tighten code. * tests/uniname/test-uninames.c (fill_names, fill_aliases): Merge two local variables into one. --- diff --git a/ChangeLog b/ChangeLog index af67c6bb66..8a9bbe6253 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-09-26 Bruno Haible + + 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 vma-iter: Improvements for Linux and BSD platforms. diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c index 476bb07f05..46a9a9184e 100644 --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -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) {