Mercurial > gnulib
changeset 38870:58d19d2598a1
uniname/uniname-tests: Tighten code.
* tests/uniname/test-uninames.c (fill_names, fill_aliases): Merge two
local variables into one.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 27 Sep 2017 01:59:12 +0200 |
parents | bfac7cd81366 |
children | 977a78c97855 |
files | ChangeLog tests/uniname/test-uninames.c |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Sep 26 19:48:39 2017 +0200 +++ b/ChangeLog Wed Sep 27 01:59:12 2017 +0200 @@ -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.
--- a/tests/uniname/test-uninames.c Tue Sep 26 19:48:39 2017 +0200 +++ b/tests/uniname/test-uninames.c Wed Sep 27 01:59:12 2017 +0200 @@ -63,8 +63,7 @@ { char *p; char *comment; - unsigned int i; - unsigned long ul; + unsigned long i; lineno++; @@ -95,13 +94,12 @@ 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 @@ { char *p; char *comment; - unsigned int uc; - unsigned long ul; + unsigned long uc; comment = strchr (line, '#'); if (comment != NULL) @@ -164,13 +161,12 @@ } *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) {