]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
tests: Use C99 initialization syntax for single-variable 'for' loops.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Nov 2025 14:05:22 +0000 (15:05 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 16 Nov 2025 14:05:22 +0000 (15:05 +0100)
* tests/altstack-util.h (check_alternate_stack_no_overflow): Declare
variable of single-variable 'for' loops in the 'for' clause.
* tests/atomic-int-gnulib.h (init_atomic_int): Likewise.
* tests/atomic-int-isoc.h (init_atomic_int): Likewise.
* tests/atomic-int-posix.h (init_atomic_int): Likewise.
* tests/bench-crc.c (main): Likewise.
* tests/bench-digest.h (main): Likewise.
* tests/bench-mbiter.c (do_test, main): Likewise.
* tests/bench-mbiterf.c (do_test, main): Likewise.
* tests/bench-mbswidth.c (do_test, main): Likewise.
* tests/bench-mbuiter.c (do_test, main): Likewise.
* tests/bench-mbuiterf.c (do_test, main): Likewise.
* tests/bench-mcel.c (noop_test, main): Likewise.
* tests/bench-pagealign_alloc.c (allocate_some_pages, main): Likewise.
* tests/bench-totalorder.c (do_float_test, do_double_test,
do_long_double_test, main): Likewise.
* tests/test-access.h (is_administrator): Likewise.
* tests/test-aligned-malloc.c (main): Likewise.
* tests/test-aligned_alloc.c (main): Likewise.
* tests/test-alloca-opt.c (main): Likewise.
* tests/test-arcfour.c (main): Likewise.
* tests/test-arctwo.c (main): Likewise.
* tests/test-argp.c (parse_opt, main): Likewise.
* tests/test-argv-iter.c (main): Likewise.
* tests/test-array-mergesort.c (main): Likewise.
* tests/test-array_list.c (check_equals, main): Likewise.
* tests/test-array_map.c (check_equals, main): Likewise.
* tests/test-array_omap.c (check_equals, main): Likewise.
* tests/test-array_oset.c (check_equals, gl_sortedlist_indexof_atleast,
main): Likewise.
* tests/test-array_set.c (check_equals, main): Likewise.
* tests/test-asyncsafe-linked_list-strong.c (sigint_handler,
signal_sending_thread, main): Likewise.
* tests/test-asyncsafe-linked_list-weak.c (init_bag_empty, bag_is_empty,
bag_is_subset, bag_equals, bag_or, bag_xor, bag_and_not, sigint_handler,
signal_sending_thread, main): Likewise.
* tests/test-asyncsafe-spin1.c (main): Likewise.
* tests/test-asyncsafe-spin2.c (check_accounts, lock_mutator_thread,
test_asyncsafe_spin): Likewise.
* tests/test-at-init-2.c (init_squares): Likewise.
* tests/test-at-init-3.c (init_cubes): Likewise.
* tests/test-avltree_list.c (check_equals, main): Likewise.
* tests/test-avltree_omap.c (check_equals, main): Likewise.
* tests/test-avltree_oset.c (check_equals, main): Likewise.
* tests/test-avltreehash_list.c (check_equals, main): Likewise.
* tests/test-btoc32.c (main): Likewise.
* tests/test-btowc.c (main): Likewise.
* tests/test-c-ctype.c (test_agree_with_C_locale, test_all): Likewise.
* tests/test-c-strcasestr.c (main): Likewise.
* tests/test-c-strstr.c (main): Likewise.
* tests/test-c32isalnum.c (main): Likewise.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isblank.c (main): Likewise.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isdigit.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32isspace.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.
* tests/test-c32isxdigit.c (main): Likewise.
* tests/test-c32rtomb.c (main): Likewise.
* tests/test-c32rtomb-w32.c (test_one_locale, main): Likewise.
* tests/test-c32snrtombs.c (main): Likewise.
* tests/test-c32srtombs.c (main): Likewise.
* tests/test-c32stombs.c (main): Likewise.
* tests/test-c32tolower.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.
* tests/test-c32width.c (main): Likewise.
* tests/test-call_once2.c (once_contender_thread, test_once): Likewise.
* tests/test-carray_list.c (check_equals, main): Likewise.
* tests/test-cbrt.h (test_function): Likewise.
* tests/test-ceil2.c (main): Likewise.
* tests/test-ceilf2.c (main): Likewise.
* tests/test-count-leading-zeros.c (TEST_COUNT_LEADING_ZEROS): Likewise.
* tests/test-count-one-bits.c (TEST_COUNT_ONE_BITS): Likewise.
* tests/test-count-trailing-zeros.c (TEST_COUNT_TRAILING_ZEROS):
Likewise.
* tests/test-crc.c (main): Likewise.
* tests/test-des.c (main, cipher): Likewise.
* tests/test-di-set.c (main): Likewise.
* tests/test-digest.h (test_digest_on_files): Likewise.
* tests/test-dirent-safer.c (main): Likewise.
* tests/test-dirname.c (main): Likewise.
* tests/test-dprintf-posix2.c (main): Likewise.
* tests/test-dup-safer.c (main): Likewise.
* tests/test-dup3.c (main): Likewise.
* tests/test-dynarray.c (main): Likewise.
* tests/test-exec-child.c (main): Likewise.
* tests/test-execle-main.c (get_environ_assignment): Likewise.
* tests/test-execute-child.c (main): Likewise.
* tests/test-execute-main.c (main): Likewise.
* tests/test-execute-script.c (main): Likewise.
* tests/test-execve-main.c (get_environ_assignment): Likewise.
* tests/test-execvpe-main.c (get_environ_assignment): Likewise.
* tests/test-exp.h (test_function): Likewise.
* tests/test-exp2.h (test_function): Likewise.
* tests/test-explicit_bzero.c (test_stack): Likewise.
* tests/test-expm1.h (test_function): Likewise.
* tests/test-fabs.h (test_function): Likewise.
* tests/test-fchdir.c (main): Likewise.
* tests/test-fdatasync.c (main): Likewise.
* tests/test-fdopen.c (COUNT): Likewise.
* tests/test-fenv-except-trapping-1.c (main): Likewise.
* tests/test-ffs.c (naive, main): Likewise.
* tests/test-ffsl.c (naive, main): Likewise.
* tests/test-ffsll.c (naive, main): Likewise.
* tests/test-filemode.c (main): Likewise.
* tests/test-filenamecat.c (main): Likewise.
* tests/test-filevercmp.c (main): Likewise.
* tests/test-float-h.c (test_float, test_double, test_long_double):
Likewise.
* tests/test-floor2.c (main): Likewise.
* tests/test-floorf2.c (main): Likewise.
* tests/test-fma2.h (test_function): Likewise.
* tests/test-fmod.h (test_function): Likewise.
* tests/test-fnmatch-w32.c (main): Likewise.
* tests/test-fprintf-posix3.c (main): Likewise.
* tests/test-fpurge.c (main): Likewise.
* tests/test-free.c (N, __has_feature): Likewise.
* tests/test-frexp.h (test_function): Likewise.
* tests/test-fsync.c (main): Likewise.
* tests/test-fts.c (needles, main): Likewise.
* tests/test-gc-arcfour.c (main): Likewise.
* tests/test-gc-arctwo.c (main): Likewise.
* tests/test-gc-des.c (main): Likewise.
* tests/test-gc-hmac-md5.c (main): Likewise.
* tests/test-gc-hmac-sha1.c (main): Likewise.
* tests/test-gc-hmac-sha256.c (main): Likewise.
* tests/test-gc-hmac-sha512.c (main): Likewise.
* tests/test-gc-md2.c (main): Likewise.
* tests/test-gc-md4.c (main): Likewise.
* tests/test-gc-md5.c (main): Likewise.
* tests/test-gc-pbkdf2.c (main): Likewise.
* tests/test-gc-pbkdf2-sha1.c (main): Likewise.
* tests/test-gc-rijndael.c (main): Likewise.
* tests/test-gc-sha1.c (main): Likewise.
* tests/test-gc-sha256.c (main): Likewise.
* tests/test-gc-sha512.c (main): Likewise.
* tests/test-gc-sm3.c (main): Likewise.
* tests/test-getaddrinfo.c (simple): Likewise.
* tests/test-getcwd.c (test_long_name): Likewise.
* tests/test-getgroups.c (main): Likewise.
* tests/test-getlogin_r.c (main): Likewise.
* tests/test-getndelim2.c (main): Likewise.
* tests/test-getopt.h (test_getopt): Likewise.
* tests/test-getopt_long.h (test_getopt_long, test_getopt_long_posix):
Likewise.
* tests/test-getrusage.c (main): Likewise.
* tests/test-getusershell.c (second_pass): Likewise.
* tests/test-hash.c (main): Likewise.
* tests/test-hash_map.c (check_equals, main): Likewise.
* tests/test-hash_set.c (check_equals, string_hashcode, main): Likewise.
* tests/test-hmac-md5.c (hmac_check): Likewise.
* tests/test-hmac-sha1.c (hmac_check): Likewise.
* tests/test-hmac-sha256.c (hmac_check): Likewise.
* tests/test-hmac-sha512.c (hmac_check): Likewise.
* tests/test-hypot.h (test_function): Likewise.
* tests/test-idpriv-drop.c (main): Likewise.
* tests/test-idpriv-droptemp.c (main): Likewise.
* tests/test-ieee754-h.c (main): Likewise.
* tests/test-ilogb.h (test_function): Likewise.
* tests/test-ino-map.c (INO_MAP_INIT): Likewise.
* tests/test-integer_length.c (naive, main): Likewise.
* tests/test-integer_length_l.c (naive, main): Likewise.
* tests/test-integer_length_ll.c (naive, main): Likewise.
* tests/test-isalnum_l.c (test_single_locale_common): Likewise.
* tests/test-isalpha_l.c (test_single_locale_common): Likewise.
* tests/test-isblank.c (main): Likewise.
* tests/test-isblank_l.c (test_single_locale_common): Likewise.
* tests/test-iscntrl_l.c (test_single_locale_common): Likewise.
* tests/test-isdigit_l.c (test_single_locale_common): Likewise.
* tests/test-isgraph_l.c (test_single_locale_common): Likewise.
* tests/test-islower_l.c (test_single_locale_common): Likewise.
* tests/test-isprint_l.c (test_single_locale_common): Likewise.
* tests/test-ispunct_l.c (test_single_locale_common): Likewise.
* tests/test-isspace_l.c (test_single_locale_common): Likewise.
* tests/test-isupper_l.c (test_single_locale_common): Likewise.
* tests/test-iswdigit.c (main): Likewise.
* tests/test-iswpunct.c (main): Likewise.
* tests/test-iswxdigit.c (main): Likewise.
* tests/test-isxdigit_l.c (test_single_locale_common): Likewise.
* tests/test-ldexp.h (test_function): Likewise.
* tests/test-ldexp-ieee.h (test_function): Likewise.
* tests/test-libtextstyle.c (main): Likewise.
* tests/test-linkat.c (main): Likewise.
* tests/test-linked_list.c (check_equals, main): Likewise.
* tests/test-linkedhash_list.c (check_equals, main): Likewise.
* tests/test-linkedhash_map.c (check_equals, main): Likewise.
* tests/test-linkedhash_set.c (check_equals, string_hashcode, main):
Likewise.
* tests/test-localename.c (test_locale_name, test_locale_name_thread):
Likewise.
* tests/test-lock.c (check_accounts, gl_lock_define_initialized,
test_lock, gl_rwlock_define_initialized, test_rwlock,
reclock_mutator_thread, test_recursive_lock, once_contender_thread,
test_once): Likewise.
* tests/test-log.h (test_function): Likewise.
* tests/test-log10.h (test_function): Likewise.
* tests/test-log1p.h (test_function): Likewise.
* tests/test-log2.h (test_function): Likewise.
* tests/test-logb.h (test_function): Likewise.
* tests/test-login_tty.c (main): Likewise.
* tests/test-malloca.c (main): Likewise.
* tests/test-mbrlen.c (main): Likewise.
* tests/test-mbrlen-w32.c (test_one_locale, main): Likewise.
* tests/test-mbrtoc16.c (main): Likewise.
* tests/test-mbrtoc16-w32.c (test_one_locale, main): Likewise.
* tests/test-mbrtoc32.c (main): Likewise.
* tests/test-mbrtoc32-w32.c (test_one_locale, main): Likewise.
* tests/test-mbrtowc.c (main): Likewise.
* tests/test-mbrtowc-w32.c (test_one_locale, main): Likewise.
* tests/test-mbsnrtoc32s.c (main): Likewise.
* tests/test-mbsnrtowcs.c (main): Likewise.
* tests/test-mbsrtoc32s.c (main): Likewise.
* tests/test-mbsrtowcs.c (main): Likewise.
* tests/test-mbstoc32s.c (main): Likewise.
* tests/test-mbstowcs.c (main): Likewise.
* tests/test-md2-buffer.c (main): Likewise.
* tests/test-md4-buffer.c (main): Likewise.
* tests/test-md5-buffer.c (main): Likewise.
* tests/test-memalign.c (main): Likewise.
* tests/test-memcasecmp.c (main): Likewise.
* tests/test-memchr.c (main): Likewise.
* tests/test-memchr2.c (main): Likewise.
* tests/test-memcmp.c (main): Likewise.
* tests/test-memmem.c (main): Likewise.
* tests/test-memrchr.c (main): Likewise.
* tests/test-memset_explicit.c (test_stack): Likewise.
* tests/test-mkfifoat.c (main): Likewise.
* tests/test-modf.h (test_function): Likewise.
* tests/test-mountlist.c (main): Likewise.
* tests/test-mtx.c (check_accounts, lock_mutator_thread, test_mtx_plain,
reclock_mutator_thread, test_mtx_recursive): Likewise.
* tests/test-nl_langinfo2.c (main): Likewise.
* tests/test-nonblocking-misc.h (init_data): Likewise.
* tests/test-nstrftime.h (posixtm_test, tzalloc_test, quarter_test):
Likewise.
* tests/test-obstack-printf.h (test_function): Likewise.
* tests/test-obstack-zprintf-big.c (main): Likewise.
* tests/test-obstack-zprintf-posix.c (RESULT_EQ): Likewise.
* tests/test-open.h (test_open): Likewise.
* tests/test-openat-safer.c (main): Likewise.
* tests/test-options.c (test_getopt_long, test_getopt_long_posix):
Likewise.
* tests/test-pagealign_alloc.c (main): Likewise.
* tests/test-parse-datetime.c (main): Likewise.
* tests/test-perror2.c (main): Likewise.
* tests/test-pipe-filter-gi1.c (done_read): Likewise.
* tests/test-pipe-filter-ii1.c (done_read): Likewise.
* tests/test-pipe2.c (main): Likewise.
* tests/test-popen.h (main): Likewise.
* tests/test-posix_memalign.c (main): Likewise.
* tests/test-posix_spawn-script.c (main): Likewise.
* tests/test-posix_spawnp-script.c (main): Likewise.
* tests/test-posixtm.c (main): Likewise.
* tests/test-pread.c (main): Likewise.
* tests/test-pthread-mutex.c (check_accounts, lock_mutator_thread,
test_pthread_mutex_normal, reclock_mutator_thread,
test_pthread_mutex_recursive): Likewise.
* tests/test-pthread-once2.c (once_contender_thread, test_once):
Likewise.
* tests/test-pthread-rwlock.c (check_accounts, rwlock_mutator_thread,
test_rwlock): Likewise.
* tests/test-pthread-spin.c (check_accounts, lock_mutator_thread,
test_pthread_spin): Likewise.
* tests/test-pthread-tss.c (worker_thread, test_tss, dtorcheck1_thread,
test_tss_dtorcheck1, dtorcheck2_thread, test_tss_dtorcheck2,
racecheck_thread, test_tss_racecheck): Likewise.
* tests/test-ptsname.c (main): Likewise.
* tests/test-ptsname_r.c (test_errors, main): Likewise.
* tests/test-pwrite.c (main): Likewise.
* tests/test-quotearg-simple.c (main): Likewise.
* tests/test-random.c (main): Likewise.
* tests/test-random-mt.c (random_invocator_thread, main): Likewise.
* tests/test-random_r.c (test_failed, main): Likewise.
* tests/test-rawmemchr.c (main): Likewise.
* tests/test-rbtree_list.c (check_equals, main): Likewise.
* tests/test-rbtree_omap.c (check_equals, main): Likewise.
* tests/test-rbtree_oset.c (check_equals, main): Likewise.
* tests/test-rbtreehash_list.c (check_equals, main): Likewise.
* tests/test-readlink.h (test_readlink): Likewise.
* tests/test-readutmp.c (main): Likewise.
* tests/test-remainder.h (test_function): Likewise.
* tests/test-renameat.c (main): Likewise.
* tests/test-renameatu.c (main): Likewise.
* tests/test-rijndael.c (main): Likewise.
* tests/test-rint.h (test_function): Likewise.
* tests/test-round2.c (main): Likewise.
* tests/test-sameacls.c (main, room): Likewise.
* tests/test-scratch-buffer.c (main): Likewise.
* tests/test-sethostname2.c (main): Likewise.
* tests/test-sh-quote.c (main): Likewise.
* tests/test-sha1-buffer.c (main): Likewise.
* tests/test-sha224-buffer.c (main): Likewise.
* tests/test-sha256-buffer.c (main): Likewise.
* tests/test-sha3-224-buffer.c (check): Likewise.
* tests/test-sha3-256-buffer.c (check): Likewise.
* tests/test-sha3-384-buffer.c (check): Likewise.
* tests/test-sha3-512-buffer.c (check): Likewise.
* tests/test-sha384-buffer.c (main): Likewise.
* tests/test-sha512-buffer.c (main): Likewise.
* tests/test-simple-atomic.c (int_mutator_thread, ptr_mutator_thread,
main): Likewise.
* tests/test-sm3-buffer.c (test, main): Likewise.
* tests/test-snprintf.c (main): Likewise.
* tests/test-snprintf-posix.h (test_function, value, word): Likewise.
* tests/test-snzprintf-posix.h (test_function): Likewise.
* tests/test-spawn-pipe-child.c (main): Likewise.
* tests/test-spawn-pipe-main.c (main): Likewise.
* tests/test-spawn-pipe-script.c (main): Likewise.
* tests/test-spin1.c (gl_spinlock_define_initialized): Likewise.
* tests/test-spin2.c (check_accounts, gl_spinlock_define,
test_asyncsafe_spin): Likewise.
* tests/test-sprintf-posix.h (value, word): Likewise.
* tests/test-sqrt.h (test_function): Likewise.
* tests/test-ssfmalloc.c (main): Likewise.
* tests/test-stat-time.c (prepare_test, test_mtime, test_birthtime):
Likewise.
* tests/test-stpncpy.c (main): Likewise.
* tests/test-strcasestr.c (main): Likewise.
* tests/test-strchrnul.c (main): Likewise.
* tests/test-strerror_r.c (main): Likewise.
* tests/test-striconveh.c (main): Likewise.
* tests/test-striconveha.c (main): Likewise.
* tests/test-strnlen.c (main): Likewise.
* tests/test-strstr.c (main): Likewise.
* tests/test-system-quote-main.c (check_all, main): Likewise.
* tests/test-szprintf-posix.h (test_function): Likewise.
* tests/test-thread_local.c (worker_thread, test_thread_local):
Likewise.
* tests/test-times.c (main): Likewise.
* tests/test-timespec.c (main): Likewise.
* tests/test-tls.c (worker_thread, test_tls, dtorcheck1_thread,
test_tls_dtorcheck1, dtorcheck2_thread, test_tls_dtorcheck2,
racecheck_thread, test_tls_racecheck): Likewise.
* tests/test-tolower_l.c (test_single_locale_common): Likewise.
* tests/test-toupper_l.c (test_single_locale_common): Likewise.
* tests/test-trunc2.c (main): Likewise.
* tests/test-truncf2.c (main): Likewise.
* tests/test-tsearch.c (memfry, walk_tree, mangle_tree, main): Likewise.
* tests/test-tss.c (worker_thread, test_tss, dtorcheck1_thread,
test_tss_dtorcheck1, dtorcheck2_thread, test_tss_dtorcheck2,
racecheck_thread, test_tss_racecheck): Likewise.
* tests/test-userspec.c (main): Likewise.
* tests/test-vasnprintf.c (test_function): Likewise.
* tests/test-vasnprintf-big.c (main): Likewise.
* tests/test-vasnprintf-posix.c (test_function, value, word): Likewise.
* tests/test-vasnwprintf.c (test_function): Likewise.
* tests/test-vasnwprintf-big.c (main): Likewise.
* tests/test-vasnwprintf-posix.c (test_function, value, word): Likewise.
* tests/test-vasprintf.c (test_vasprintf, test_asprintf): Likewise.
* tests/test-vasprintf-posix.c (test_function, value, word): Likewise.
* tests/test-vaszprintf-posix.c (test_function): Likewise.
* tests/test-vsnprintf.c (main): Likewise.
* tests/test-wcrtomb.c (main): Likewise.
* tests/test-wcrtomb-w32.c (test_one_locale, main): Likewise.
* tests/test-wcsnrtombs.c (main): Likewise.
* tests/test-wcsrtombs.c (main): Likewise.
* tests/test-wcwidth.c (main): Likewise.
* tests/test-xstrtol.c (main): Likewise.
* tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Likewise.
* tests/unicase/test-mapping-part2.h (main): Likewise.
* tests/unicase/test-predicate-part2.h (main): Likewise.
* tests/uniconv/test-u8-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u8-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u8-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u8-strconv-to-enc.c (main): Likewise.
* tests/uniconv/test-u16-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u16-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u16-strconv-to-enc.c (main): Likewise.
* tests/uniconv/test-u32-conv-from-enc.c (main): Likewise.
* tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
* tests/uniconv/test-u32-strconv-from-enc.c (main): Likewise.
* tests/uniconv/test-u32-strconv-to-enc.c (main): Likewise.
* tests/unictype/test-bidi_test.c (main): Likewise.
* tests/unictype/test-block_list.c (main): Likewise.
* tests/unictype/test-block_of.c (main): Likewise.
* tests/unictype/test-categ_byname.c (main): Likewise.
* tests/unictype/test-categ_none.c (main): Likewise.
* tests/unictype/test-categ_of.c (main): Likewise.
* tests/unictype/test-decdigit.c (main): Likewise.
* tests/unictype/test-digit.c (main): Likewise.
* tests/unictype/test-incb_of.c (main): Likewise.
* tests/unictype/test-joininggroup_of.c (main): Likewise.
* tests/unictype/test-joiningtype_of.c (main): Likewise.
* tests/unictype/test-numeric.c (main): Likewise.
* tests/unictype/test-pr_byname.c (main): Likewise.
* tests/unictype/test-pr_test.c (main): Likewise.
* tests/unictype/test-predicate-part2.h (main): Likewise.
* tests/unictype/test-scripts.c (main): Likewise.
* tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
Likewise.
* tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next):
Likewise.
* tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
Likewise.
* tests/unigbrk/test-u16-grapheme-breaks.c (test_u16_grapheme_breaks):
Likewise.
* tests/unigbrk/test-u16-grapheme-next.c (test_u16_grapheme_next):
Likewise.
* tests/unigbrk/test-u16-grapheme-prev.c (test_u16_grapheme_prev):
Likewise.
* tests/unigbrk/test-u32-grapheme-breaks.c (test_u32_grapheme_breaks):
Likewise.
* tests/unigbrk/test-u32-grapheme-next.c (test_u32_grapheme_next):
Likewise.
* tests/unigbrk/test-u32-grapheme-prev.c (test_u32_grapheme_prev):
Likewise.
* tests/unigbrk/test-uc-gbrk-prop.c (main): Likewise.
* tests/unigbrk/test-uc-grapheme-breaks.c (test_uc_grapheme_breaks):
Likewise.
* tests/unigbrk/test-ulc-grapheme-breaks.c (sizeof): Likewise.
* tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-u8-width-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-u16-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-u16-width-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-u32-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-u32-width-linebreaks.c (test_function): Likewise.
* tests/unilbrk/test-uc-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-ulc-possible-linebreaks.c (test_function):
Likewise.
* tests/unilbrk/test-ulc-width-linebreaks.c (test_function): Likewise.
* tests/uniname/test-uninames.c (name_has_alias, test_name_lookup,
test_inverse_lookup, test_alias_lookup, main): Likewise.
* tests/uninorm/test-u8-nfc.c (test_u8_nfc): Likewise.
* tests/uninorm/test-u8-nfd.c (test_u8_nfd): Likewise.
* tests/uninorm/test-u8-nfkc.c (test_u8_nfkc): Likewise.
* tests/uninorm/test-u8-nfkd.c (test_u8_nfkd): Likewise.
* tests/uninorm/test-u16-nfc.c (test_u16_nfc): Likewise.
* tests/uninorm/test-u16-nfd.c (test_u16_nfd): Likewise.
* tests/uninorm/test-u16-nfkc.c (test_u16_nfkc): Likewise.
* tests/uninorm/test-u16-nfkd.c (test_u16_nfkd): Likewise.
* tests/uninorm/test-u32-nfc.c (test_u32_nfc): Likewise.
* tests/uninorm/test-u32-nfd.c (test_u32_nfd): Likewise.
* tests/uninorm/test-u32-nfkc.c (test_u32_nfkc): Likewise.
* tests/uninorm/test-u32-nfkd.c (test_u32_nfkd): Likewise.
* tests/uninorm/test-u32-normalize-big.c (read_normalization_test_file,
test_specific, test_other, free_normalization_test_file): Likewise.
* tests/uninorm/test-uninorm-filter-nfc.c (check): Likewise.
* tests/unistdio/test-u8-asnprintf-big.c (main): Likewise.
* tests/unistdio/test-u8-asnprintf1.h (test_function): Likewise.
* tests/unistdio/test-u16-asnprintf1.h (test_function): Likewise.
* tests/unistdio/test-u32-asnprintf1.h (test_function): Likewise.
* tests/unistdio/test-ulc-asnprintf-big.c (main): Likewise.
* tests/unistdio/test-ulc-asnprintf1.h (test_function): Likewise.
* tests/unistr/test-chr.h (main): Likewise.
* tests/unistr/test-cmp.h (test_cmp): Likewise.
* tests/unistr/test-cpy-alloc.h (main): Likewise.
* tests/unistr/test-cpy.h (main): Likewise.
* tests/unistr/test-move.h (main): Likewise.
* tests/unistr/test-pcpy.h (main): Likewise.
* tests/unistr/test-set.h (NMAX, main): Likewise.
* tests/unistr/test-stpcpy.h (main): Likewise.
* tests/unistr/test-stpncpy.h (check_single, check): Likewise.
* tests/unistr/test-strcat.h (main): Likewise.
* tests/unistr/test-strchr.h (test_strchr): Likewise.
* tests/unistr/test-strcpy.h (main): Likewise.
* tests/unistr/test-strdup.h (main): Likewise.
* tests/unistr/test-strncat.h (check_single, check): Likewise.
* tests/unistr/test-strncpy.h (check_single, check): Likewise.
* tests/unistr/test-strnlen.h (check): Likewise.
* tests/unistr/test-u-strstr.h (test_u_strstr): Likewise.
* tests/unistr/test-u16-mblen.c (main): Likewise.
* tests/unistr/test-u16-mbsnlen.c (main): Likewise.
* tests/unistr/test-u16-mbtouc.h (test_function): Likewise.
* tests/unistr/test-u16-mbtoucr.c (main): Likewise.
* tests/unistr/test-u16-next.c (main): Likewise.
* tests/unistr/test-u16-prev.c (check, check_invalid, main): Likewise.
* tests/unistr/test-u16-strmblen.c (main): Likewise.
* tests/unistr/test-u16-strmbtouc.c (main): Likewise.
* tests/unistr/test-u16-uctomb.c (main): Likewise.
* tests/unistr/test-u32-mblen.c (main): Likewise.
* tests/unistr/test-u32-mbsnlen.c (main): Likewise.
* tests/unistr/test-u32-mbtouc.h (test_function): Likewise.
* tests/unistr/test-u32-mbtoucr.c (main): Likewise.
* tests/unistr/test-u32-next.c (main): Likewise.
* tests/unistr/test-u32-prev.c (check, check_invalid, main): Likewise.
* tests/unistr/test-u32-strmblen.c (main): Likewise.
* tests/unistr/test-u32-strmbtouc.c (main): Likewise.
* tests/unistr/test-u32-uctomb.c (main): Likewise.
* tests/unistr/test-u8-mblen.c (main): Likewise.
* tests/unistr/test-u8-mbsnlen.c (main): Likewise.
* tests/unistr/test-u8-mbtouc.c (test_safe_function): Likewise.
* tests/unistr/test-u8-mbtouc.h (test_function): Likewise.
* tests/unistr/test-u8-mbtoucr.c (main): Likewise.
* tests/unistr/test-u8-next.c (main): Likewise.
* tests/unistr/test-u8-prev.c (check, check_invalid, main): Likewise.
* tests/unistr/test-u8-strmblen.c (main): Likewise.
* tests/unistr/test-u8-strmbtouc.c (main): Likewise.
* tests/unistr/test-u8-uctomb.c (main): Likewise.
* tests/uniwbrk/test-u8-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-u16-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-u32-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-uc-wordbreaks.c (main): Likewise.
* tests/uniwbrk/test-ulc-wordbreaks.c (main): Likewise.
* tests/uniwidth/test-uc_width.c (main): Likewise.
* tests/uniwidth/test-uc_width2.c (main): Likewise.
* tests/virtualbox.h (is_running_under_virtualbox_kvm, num_cpus):
Likewise.
* tests/test-regex.c (bug_regex11, main): Likewise. Rename local
variables.

457 files changed:
ChangeLog
tests/altstack-util.h
tests/atomic-int-gnulib.h
tests/atomic-int-isoc.h
tests/atomic-int-posix.h
tests/bench-crc.c
tests/bench-digest.h
tests/bench-mbiter.c
tests/bench-mbiterf.c
tests/bench-mbswidth.c
tests/bench-mbuiter.c
tests/bench-mbuiterf.c
tests/bench-mcel.c
tests/bench-pagealign_alloc.c
tests/bench-totalorder.c
tests/test-access.h
tests/test-aligned-malloc.c
tests/test-aligned_alloc.c
tests/test-alloca-opt.c
tests/test-arcfour.c
tests/test-arctwo.c
tests/test-argp.c
tests/test-argv-iter.c
tests/test-array-mergesort.c
tests/test-array_list.c
tests/test-array_map.c
tests/test-array_omap.c
tests/test-array_oset.c
tests/test-array_set.c
tests/test-asyncsafe-linked_list-strong.c
tests/test-asyncsafe-linked_list-weak.c
tests/test-asyncsafe-spin1.c
tests/test-asyncsafe-spin2.c
tests/test-at-init-2.c
tests/test-at-init-3.c
tests/test-avltree_list.c
tests/test-avltree_omap.c
tests/test-avltree_oset.c
tests/test-avltreehash_list.c
tests/test-btoc32.c
tests/test-btowc.c
tests/test-c-ctype.c
tests/test-c-strcasestr.c
tests/test-c-strstr.c
tests/test-c32isalnum.c
tests/test-c32isalpha.c
tests/test-c32isblank.c
tests/test-c32iscntrl.c
tests/test-c32isdigit.c
tests/test-c32isgraph.c
tests/test-c32islower.c
tests/test-c32isprint.c
tests/test-c32ispunct.c
tests/test-c32isspace.c
tests/test-c32isupper.c
tests/test-c32isxdigit.c
tests/test-c32rtomb-w32.c
tests/test-c32rtomb.c
tests/test-c32snrtombs.c
tests/test-c32srtombs.c
tests/test-c32stombs.c
tests/test-c32tolower.c
tests/test-c32toupper.c
tests/test-c32width.c
tests/test-call_once2.c
tests/test-carray_list.c
tests/test-cbrt.h
tests/test-ceil2.c
tests/test-ceilf2.c
tests/test-count-leading-zeros.c
tests/test-count-one-bits.c
tests/test-count-trailing-zeros.c
tests/test-crc.c
tests/test-des.c
tests/test-di-set.c
tests/test-digest.h
tests/test-dirent-safer.c
tests/test-dirname.c
tests/test-dprintf-posix2.c
tests/test-dup-safer.c
tests/test-dup3.c
tests/test-dynarray.c
tests/test-exec-child.c
tests/test-execle-main.c
tests/test-execute-child.c
tests/test-execute-main.c
tests/test-execute-script.c
tests/test-execve-main.c
tests/test-execvpe-main.c
tests/test-exp.h
tests/test-exp2.h
tests/test-explicit_bzero.c
tests/test-expm1.h
tests/test-fabs.h
tests/test-fchdir.c
tests/test-fdatasync.c
tests/test-fdopen.c
tests/test-fenv-except-trapping-1.c
tests/test-ffs.c
tests/test-ffsl.c
tests/test-ffsll.c
tests/test-filemode.c
tests/test-filenamecat.c
tests/test-filevercmp.c
tests/test-float-h.c
tests/test-floor2.c
tests/test-floorf2.c
tests/test-fma2.h
tests/test-fmod.h
tests/test-fnmatch-w32.c
tests/test-fprintf-posix3.c
tests/test-fpurge.c
tests/test-free.c
tests/test-frexp.h
tests/test-fsync.c
tests/test-fts.c
tests/test-gc-arcfour.c
tests/test-gc-arctwo.c
tests/test-gc-des.c
tests/test-gc-hmac-md5.c
tests/test-gc-hmac-sha1.c
tests/test-gc-hmac-sha256.c
tests/test-gc-hmac-sha512.c
tests/test-gc-md2.c
tests/test-gc-md4.c
tests/test-gc-md5.c
tests/test-gc-pbkdf2-sha1.c
tests/test-gc-pbkdf2.c
tests/test-gc-rijndael.c
tests/test-gc-sha1.c
tests/test-gc-sha256.c
tests/test-gc-sha512.c
tests/test-gc-sm3.c
tests/test-getaddrinfo.c
tests/test-getcwd.c
tests/test-getgroups.c
tests/test-getlogin_r.c
tests/test-getndelim2.c
tests/test-getopt.h
tests/test-getopt_long.h
tests/test-getrusage.c
tests/test-getusershell.c
tests/test-hash.c
tests/test-hash_map.c
tests/test-hash_set.c
tests/test-hmac-md5.c
tests/test-hmac-sha1.c
tests/test-hmac-sha256.c
tests/test-hmac-sha512.c
tests/test-hypot.h
tests/test-idpriv-drop.c
tests/test-idpriv-droptemp.c
tests/test-ieee754-h.c
tests/test-ilogb.h
tests/test-ino-map.c
tests/test-integer_length.c
tests/test-integer_length_l.c
tests/test-integer_length_ll.c
tests/test-isalnum_l.c
tests/test-isalpha_l.c
tests/test-isblank.c
tests/test-isblank_l.c
tests/test-iscntrl_l.c
tests/test-isdigit_l.c
tests/test-isgraph_l.c
tests/test-islower_l.c
tests/test-isprint_l.c
tests/test-ispunct_l.c
tests/test-isspace_l.c
tests/test-isupper_l.c
tests/test-iswdigit.c
tests/test-iswpunct.c
tests/test-iswxdigit.c
tests/test-isxdigit_l.c
tests/test-ldexp-ieee.h
tests/test-ldexp.h
tests/test-libtextstyle.c
tests/test-linkat.c
tests/test-linked_list.c
tests/test-linkedhash_list.c
tests/test-linkedhash_map.c
tests/test-linkedhash_set.c
tests/test-localename.c
tests/test-lock.c
tests/test-log.h
tests/test-log10.h
tests/test-log1p.h
tests/test-log2.h
tests/test-logb.h
tests/test-login_tty.c
tests/test-malloca.c
tests/test-mbrlen-w32.c
tests/test-mbrlen.c
tests/test-mbrtoc16-w32.c
tests/test-mbrtoc16.c
tests/test-mbrtoc32-w32.c
tests/test-mbrtoc32.c
tests/test-mbrtowc-w32.c
tests/test-mbrtowc.c
tests/test-mbsnrtoc32s.c
tests/test-mbsnrtowcs.c
tests/test-mbsrtoc32s.c
tests/test-mbsrtowcs.c
tests/test-mbstoc32s.c
tests/test-mbstowcs.c
tests/test-md2-buffer.c
tests/test-md4-buffer.c
tests/test-md5-buffer.c
tests/test-memalign.c
tests/test-memcasecmp.c
tests/test-memchr.c
tests/test-memchr2.c
tests/test-memcmp.c
tests/test-memmem.c
tests/test-memrchr.c
tests/test-memset_explicit.c
tests/test-mkfifoat.c
tests/test-modf.h
tests/test-mountlist.c
tests/test-mtx.c
tests/test-nl_langinfo2.c
tests/test-nonblocking-misc.h
tests/test-nstrftime.h
tests/test-obstack-printf.h
tests/test-obstack-zprintf-big.c
tests/test-obstack-zprintf-posix.c
tests/test-open.h
tests/test-openat-safer.c
tests/test-options.c
tests/test-pagealign_alloc.c
tests/test-parse-datetime.c
tests/test-perror2.c
tests/test-pipe-filter-gi1.c
tests/test-pipe-filter-ii1.c
tests/test-pipe2.c
tests/test-popen.h
tests/test-posix_memalign.c
tests/test-posix_spawn-script.c
tests/test-posix_spawnp-script.c
tests/test-posixtm.c
tests/test-pread.c
tests/test-pthread-mutex.c
tests/test-pthread-once2.c
tests/test-pthread-rwlock.c
tests/test-pthread-spin.c
tests/test-pthread-tss.c
tests/test-ptsname.c
tests/test-ptsname_r.c
tests/test-pwrite.c
tests/test-quotearg-simple.c
tests/test-random-mt.c
tests/test-random.c
tests/test-random_r.c
tests/test-rawmemchr.c
tests/test-rbtree_list.c
tests/test-rbtree_omap.c
tests/test-rbtree_oset.c
tests/test-rbtreehash_list.c
tests/test-readlink.h
tests/test-readutmp.c
tests/test-regex.c
tests/test-remainder.h
tests/test-renameat.c
tests/test-renameatu.c
tests/test-rijndael.c
tests/test-rint.h
tests/test-round2.c
tests/test-sameacls.c
tests/test-scratch-buffer.c
tests/test-sethostname2.c
tests/test-sh-quote.c
tests/test-sha1-buffer.c
tests/test-sha224-buffer.c
tests/test-sha256-buffer.c
tests/test-sha3-224-buffer.c
tests/test-sha3-256-buffer.c
tests/test-sha3-384-buffer.c
tests/test-sha3-512-buffer.c
tests/test-sha384-buffer.c
tests/test-sha512-buffer.c
tests/test-simple-atomic.c
tests/test-sm3-buffer.c
tests/test-snprintf-posix.h
tests/test-snprintf.c
tests/test-snzprintf-posix.h
tests/test-spawn-pipe-child.c
tests/test-spawn-pipe-main.c
tests/test-spawn-pipe-script.c
tests/test-spin1.c
tests/test-spin2.c
tests/test-sprintf-posix.h
tests/test-sqrt.h
tests/test-ssfmalloc.c
tests/test-stat-time.c
tests/test-stpncpy.c
tests/test-strcasestr.c
tests/test-strchrnul.c
tests/test-strerror_r.c
tests/test-striconveh.c
tests/test-striconveha.c
tests/test-strnlen.c
tests/test-strstr.c
tests/test-system-quote-main.c
tests/test-szprintf-posix.h
tests/test-thread_local.c
tests/test-times.c
tests/test-timespec.c
tests/test-tls.c
tests/test-tolower_l.c
tests/test-toupper_l.c
tests/test-trunc2.c
tests/test-truncf2.c
tests/test-tsearch.c
tests/test-tss.c
tests/test-userspec.c
tests/test-vasnprintf-big.c
tests/test-vasnprintf-posix.c
tests/test-vasnprintf.c
tests/test-vasnwprintf-big.c
tests/test-vasnwprintf-posix.c
tests/test-vasnwprintf.c
tests/test-vasprintf-posix.c
tests/test-vasprintf.c
tests/test-vaszprintf-posix.c
tests/test-vsnprintf.c
tests/test-wcrtomb-w32.c
tests/test-wcrtomb.c
tests/test-wcsnrtombs.c
tests/test-wcsrtombs.c
tests/test-wcwidth.c
tests/test-xstrtol.c
tests/test-xvasprintf.c
tests/unicase/test-mapping-part2.h
tests/unicase/test-predicate-part2.h
tests/uniconv/test-u16-conv-from-enc.c
tests/uniconv/test-u16-conv-to-enc.c
tests/uniconv/test-u16-strconv-from-enc.c
tests/uniconv/test-u16-strconv-to-enc.c
tests/uniconv/test-u32-conv-from-enc.c
tests/uniconv/test-u32-conv-to-enc.c
tests/uniconv/test-u32-strconv-from-enc.c
tests/uniconv/test-u32-strconv-to-enc.c
tests/uniconv/test-u8-conv-from-enc.c
tests/uniconv/test-u8-conv-to-enc.c
tests/uniconv/test-u8-strconv-from-enc.c
tests/uniconv/test-u8-strconv-to-enc.c
tests/unictype/test-bidi_test.c
tests/unictype/test-block_list.c
tests/unictype/test-block_of.c
tests/unictype/test-categ_byname.c
tests/unictype/test-categ_none.c
tests/unictype/test-categ_of.c
tests/unictype/test-decdigit.c
tests/unictype/test-digit.c
tests/unictype/test-incb_of.c
tests/unictype/test-joininggroup_of.c
tests/unictype/test-joiningtype_of.c
tests/unictype/test-numeric.c
tests/unictype/test-pr_byname.c
tests/unictype/test-pr_test.c
tests/unictype/test-predicate-part2.h
tests/unictype/test-scripts.c
tests/unigbrk/test-u16-grapheme-breaks.c
tests/unigbrk/test-u16-grapheme-next.c
tests/unigbrk/test-u16-grapheme-prev.c
tests/unigbrk/test-u32-grapheme-breaks.c
tests/unigbrk/test-u32-grapheme-next.c
tests/unigbrk/test-u32-grapheme-prev.c
tests/unigbrk/test-u8-grapheme-breaks.c
tests/unigbrk/test-u8-grapheme-next.c
tests/unigbrk/test-u8-grapheme-prev.c
tests/unigbrk/test-uc-gbrk-prop.c
tests/unigbrk/test-uc-grapheme-breaks.c
tests/unigbrk/test-ulc-grapheme-breaks.c
tests/unilbrk/test-u16-possible-linebreaks.c
tests/unilbrk/test-u16-width-linebreaks.c
tests/unilbrk/test-u32-possible-linebreaks.c
tests/unilbrk/test-u32-width-linebreaks.c
tests/unilbrk/test-u8-possible-linebreaks.c
tests/unilbrk/test-u8-width-linebreaks.c
tests/unilbrk/test-uc-possible-linebreaks.c
tests/unilbrk/test-ulc-possible-linebreaks.c
tests/unilbrk/test-ulc-width-linebreaks.c
tests/uniname/test-uninames.c
tests/uninorm/test-u16-nfc.c
tests/uninorm/test-u16-nfd.c
tests/uninorm/test-u16-nfkc.c
tests/uninorm/test-u16-nfkd.c
tests/uninorm/test-u32-nfc.c
tests/uninorm/test-u32-nfd.c
tests/uninorm/test-u32-nfkc.c
tests/uninorm/test-u32-nfkd.c
tests/uninorm/test-u32-normalize-big.c
tests/uninorm/test-u8-nfc.c
tests/uninorm/test-u8-nfd.c
tests/uninorm/test-u8-nfkc.c
tests/uninorm/test-u8-nfkd.c
tests/uninorm/test-uninorm-filter-nfc.c
tests/unistdio/test-u16-asnprintf1.h
tests/unistdio/test-u32-asnprintf1.h
tests/unistdio/test-u8-asnprintf-big.c
tests/unistdio/test-u8-asnprintf1.h
tests/unistdio/test-ulc-asnprintf-big.c
tests/unistdio/test-ulc-asnprintf1.h
tests/unistr/test-chr.h
tests/unistr/test-cmp.h
tests/unistr/test-cpy-alloc.h
tests/unistr/test-cpy.h
tests/unistr/test-move.h
tests/unistr/test-pcpy.h
tests/unistr/test-set.h
tests/unistr/test-stpcpy.h
tests/unistr/test-stpncpy.h
tests/unistr/test-strcat.h
tests/unistr/test-strchr.h
tests/unistr/test-strcpy.h
tests/unistr/test-strdup.h
tests/unistr/test-strncat.h
tests/unistr/test-strncpy.h
tests/unistr/test-strnlen.h
tests/unistr/test-u-strstr.h
tests/unistr/test-u16-mblen.c
tests/unistr/test-u16-mbsnlen.c
tests/unistr/test-u16-mbtouc.h
tests/unistr/test-u16-mbtoucr.c
tests/unistr/test-u16-next.c
tests/unistr/test-u16-prev.c
tests/unistr/test-u16-strmblen.c
tests/unistr/test-u16-strmbtouc.c
tests/unistr/test-u16-uctomb.c
tests/unistr/test-u32-mblen.c
tests/unistr/test-u32-mbsnlen.c
tests/unistr/test-u32-mbtouc.h
tests/unistr/test-u32-mbtoucr.c
tests/unistr/test-u32-next.c
tests/unistr/test-u32-prev.c
tests/unistr/test-u32-strmblen.c
tests/unistr/test-u32-strmbtouc.c
tests/unistr/test-u32-uctomb.c
tests/unistr/test-u8-mblen.c
tests/unistr/test-u8-mbsnlen.c
tests/unistr/test-u8-mbtouc.c
tests/unistr/test-u8-mbtouc.h
tests/unistr/test-u8-mbtoucr.c
tests/unistr/test-u8-next.c
tests/unistr/test-u8-prev.c
tests/unistr/test-u8-strmblen.c
tests/unistr/test-u8-strmbtouc.c
tests/unistr/test-u8-uctomb.c
tests/uniwbrk/test-u16-wordbreaks.c
tests/uniwbrk/test-u32-wordbreaks.c
tests/uniwbrk/test-u8-wordbreaks.c
tests/uniwbrk/test-uc-wordbreaks.c
tests/uniwbrk/test-ulc-wordbreaks.c
tests/uniwidth/test-uc_width.c
tests/uniwidth/test-uc_width2.c
tests/virtualbox.h

index bce004b20225f523bfaacd0a54ae309896238689..f9a11161f2dbfd31b7bda197d9eb7b5b45748e82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,513 @@
+2025-11-16  Bruno Haible  <bruno@clisp.org>
+
+       tests: Use C99 initialization syntax for single-variable 'for' loops.
+       * tests/altstack-util.h (check_alternate_stack_no_overflow): Declare
+       variable of single-variable 'for' loops in the 'for' clause.
+       * tests/atomic-int-gnulib.h (init_atomic_int): Likewise.
+       * tests/atomic-int-isoc.h (init_atomic_int): Likewise.
+       * tests/atomic-int-posix.h (init_atomic_int): Likewise.
+       * tests/bench-crc.c (main): Likewise.
+       * tests/bench-digest.h (main): Likewise.
+       * tests/bench-mbiter.c (do_test, main): Likewise.
+       * tests/bench-mbiterf.c (do_test, main): Likewise.
+       * tests/bench-mbswidth.c (do_test, main): Likewise.
+       * tests/bench-mbuiter.c (do_test, main): Likewise.
+       * tests/bench-mbuiterf.c (do_test, main): Likewise.
+       * tests/bench-mcel.c (noop_test, main): Likewise.
+       * tests/bench-pagealign_alloc.c (allocate_some_pages, main): Likewise.
+       * tests/bench-totalorder.c (do_float_test, do_double_test,
+       do_long_double_test, main): Likewise.
+       * tests/test-access.h (is_administrator): Likewise.
+       * tests/test-aligned-malloc.c (main): Likewise.
+       * tests/test-aligned_alloc.c (main): Likewise.
+       * tests/test-alloca-opt.c (main): Likewise.
+       * tests/test-arcfour.c (main): Likewise.
+       * tests/test-arctwo.c (main): Likewise.
+       * tests/test-argp.c (parse_opt, main): Likewise.
+       * tests/test-argv-iter.c (main): Likewise.
+       * tests/test-array-mergesort.c (main): Likewise.
+       * tests/test-array_list.c (check_equals, main): Likewise.
+       * tests/test-array_map.c (check_equals, main): Likewise.
+       * tests/test-array_omap.c (check_equals, main): Likewise.
+       * tests/test-array_oset.c (check_equals, gl_sortedlist_indexof_atleast,
+       main): Likewise.
+       * tests/test-array_set.c (check_equals, main): Likewise.
+       * tests/test-asyncsafe-linked_list-strong.c (sigint_handler,
+       signal_sending_thread, main): Likewise.
+       * tests/test-asyncsafe-linked_list-weak.c (init_bag_empty, bag_is_empty,
+       bag_is_subset, bag_equals, bag_or, bag_xor, bag_and_not, sigint_handler,
+       signal_sending_thread, main): Likewise.
+       * tests/test-asyncsafe-spin1.c (main): Likewise.
+       * tests/test-asyncsafe-spin2.c (check_accounts, lock_mutator_thread,
+       test_asyncsafe_spin): Likewise.
+       * tests/test-at-init-2.c (init_squares): Likewise.
+       * tests/test-at-init-3.c (init_cubes): Likewise.
+       * tests/test-avltree_list.c (check_equals, main): Likewise.
+       * tests/test-avltree_omap.c (check_equals, main): Likewise.
+       * tests/test-avltree_oset.c (check_equals, main): Likewise.
+       * tests/test-avltreehash_list.c (check_equals, main): Likewise.
+       * tests/test-btoc32.c (main): Likewise.
+       * tests/test-btowc.c (main): Likewise.
+       * tests/test-c-ctype.c (test_agree_with_C_locale, test_all): Likewise.
+       * tests/test-c-strcasestr.c (main): Likewise.
+       * tests/test-c-strstr.c (main): Likewise.
+       * tests/test-c32isalnum.c (main): Likewise.
+       * tests/test-c32isalpha.c (main): Likewise.
+       * tests/test-c32isblank.c (main): Likewise.
+       * tests/test-c32iscntrl.c (main): Likewise.
+       * tests/test-c32isdigit.c (main): Likewise.
+       * tests/test-c32isgraph.c (main): Likewise.
+       * tests/test-c32islower.c (main): Likewise.
+       * tests/test-c32isprint.c (main): Likewise.
+       * tests/test-c32ispunct.c (main): Likewise.
+       * tests/test-c32isspace.c (main): Likewise.
+       * tests/test-c32isupper.c (main): Likewise.
+       * tests/test-c32isxdigit.c (main): Likewise.
+       * tests/test-c32rtomb.c (main): Likewise.
+       * tests/test-c32rtomb-w32.c (test_one_locale, main): Likewise.
+       * tests/test-c32snrtombs.c (main): Likewise.
+       * tests/test-c32srtombs.c (main): Likewise.
+       * tests/test-c32stombs.c (main): Likewise.
+       * tests/test-c32tolower.c (main): Likewise.
+       * tests/test-c32toupper.c (main): Likewise.
+       * tests/test-c32width.c (main): Likewise.
+       * tests/test-call_once2.c (once_contender_thread, test_once): Likewise.
+       * tests/test-carray_list.c (check_equals, main): Likewise.
+       * tests/test-cbrt.h (test_function): Likewise.
+       * tests/test-ceil2.c (main): Likewise.
+       * tests/test-ceilf2.c (main): Likewise.
+       * tests/test-count-leading-zeros.c (TEST_COUNT_LEADING_ZEROS): Likewise.
+       * tests/test-count-one-bits.c (TEST_COUNT_ONE_BITS): Likewise.
+       * tests/test-count-trailing-zeros.c (TEST_COUNT_TRAILING_ZEROS):
+       Likewise.
+       * tests/test-crc.c (main): Likewise.
+       * tests/test-des.c (main, cipher): Likewise.
+       * tests/test-di-set.c (main): Likewise.
+       * tests/test-digest.h (test_digest_on_files): Likewise.
+       * tests/test-dirent-safer.c (main): Likewise.
+       * tests/test-dirname.c (main): Likewise.
+       * tests/test-dprintf-posix2.c (main): Likewise.
+       * tests/test-dup-safer.c (main): Likewise.
+       * tests/test-dup3.c (main): Likewise.
+       * tests/test-dynarray.c (main): Likewise.
+       * tests/test-exec-child.c (main): Likewise.
+       * tests/test-execle-main.c (get_environ_assignment): Likewise.
+       * tests/test-execute-child.c (main): Likewise.
+       * tests/test-execute-main.c (main): Likewise.
+       * tests/test-execute-script.c (main): Likewise.
+       * tests/test-execve-main.c (get_environ_assignment): Likewise.
+       * tests/test-execvpe-main.c (get_environ_assignment): Likewise.
+       * tests/test-exp.h (test_function): Likewise.
+       * tests/test-exp2.h (test_function): Likewise.
+       * tests/test-explicit_bzero.c (test_stack): Likewise.
+       * tests/test-expm1.h (test_function): Likewise.
+       * tests/test-fabs.h (test_function): Likewise.
+       * tests/test-fchdir.c (main): Likewise.
+       * tests/test-fdatasync.c (main): Likewise.
+       * tests/test-fdopen.c (COUNT): Likewise.
+       * tests/test-fenv-except-trapping-1.c (main): Likewise.
+       * tests/test-ffs.c (naive, main): Likewise.
+       * tests/test-ffsl.c (naive, main): Likewise.
+       * tests/test-ffsll.c (naive, main): Likewise.
+       * tests/test-filemode.c (main): Likewise.
+       * tests/test-filenamecat.c (main): Likewise.
+       * tests/test-filevercmp.c (main): Likewise.
+       * tests/test-float-h.c (test_float, test_double, test_long_double):
+       Likewise.
+       * tests/test-floor2.c (main): Likewise.
+       * tests/test-floorf2.c (main): Likewise.
+       * tests/test-fma2.h (test_function): Likewise.
+       * tests/test-fmod.h (test_function): Likewise.
+       * tests/test-fnmatch-w32.c (main): Likewise.
+       * tests/test-fprintf-posix3.c (main): Likewise.
+       * tests/test-fpurge.c (main): Likewise.
+       * tests/test-free.c (N, __has_feature): Likewise.
+       * tests/test-frexp.h (test_function): Likewise.
+       * tests/test-fsync.c (main): Likewise.
+       * tests/test-fts.c (needles, main): Likewise.
+       * tests/test-gc-arcfour.c (main): Likewise.
+       * tests/test-gc-arctwo.c (main): Likewise.
+       * tests/test-gc-des.c (main): Likewise.
+       * tests/test-gc-hmac-md5.c (main): Likewise.
+       * tests/test-gc-hmac-sha1.c (main): Likewise.
+       * tests/test-gc-hmac-sha256.c (main): Likewise.
+       * tests/test-gc-hmac-sha512.c (main): Likewise.
+       * tests/test-gc-md2.c (main): Likewise.
+       * tests/test-gc-md4.c (main): Likewise.
+       * tests/test-gc-md5.c (main): Likewise.
+       * tests/test-gc-pbkdf2.c (main): Likewise.
+       * tests/test-gc-pbkdf2-sha1.c (main): Likewise.
+       * tests/test-gc-rijndael.c (main): Likewise.
+       * tests/test-gc-sha1.c (main): Likewise.
+       * tests/test-gc-sha256.c (main): Likewise.
+       * tests/test-gc-sha512.c (main): Likewise.
+       * tests/test-gc-sm3.c (main): Likewise.
+       * tests/test-getaddrinfo.c (simple): Likewise.
+       * tests/test-getcwd.c (test_long_name): Likewise.
+       * tests/test-getgroups.c (main): Likewise.
+       * tests/test-getlogin_r.c (main): Likewise.
+       * tests/test-getndelim2.c (main): Likewise.
+       * tests/test-getopt.h (test_getopt): Likewise.
+       * tests/test-getopt_long.h (test_getopt_long, test_getopt_long_posix):
+       Likewise.
+       * tests/test-getrusage.c (main): Likewise.
+       * tests/test-getusershell.c (second_pass): Likewise.
+       * tests/test-hash.c (main): Likewise.
+       * tests/test-hash_map.c (check_equals, main): Likewise.
+       * tests/test-hash_set.c (check_equals, string_hashcode, main): Likewise.
+       * tests/test-hmac-md5.c (hmac_check): Likewise.
+       * tests/test-hmac-sha1.c (hmac_check): Likewise.
+       * tests/test-hmac-sha256.c (hmac_check): Likewise.
+       * tests/test-hmac-sha512.c (hmac_check): Likewise.
+       * tests/test-hypot.h (test_function): Likewise.
+       * tests/test-idpriv-drop.c (main): Likewise.
+       * tests/test-idpriv-droptemp.c (main): Likewise.
+       * tests/test-ieee754-h.c (main): Likewise.
+       * tests/test-ilogb.h (test_function): Likewise.
+       * tests/test-ino-map.c (INO_MAP_INIT): Likewise.
+       * tests/test-integer_length.c (naive, main): Likewise.
+       * tests/test-integer_length_l.c (naive, main): Likewise.
+       * tests/test-integer_length_ll.c (naive, main): Likewise.
+       * tests/test-isalnum_l.c (test_single_locale_common): Likewise.
+       * tests/test-isalpha_l.c (test_single_locale_common): Likewise.
+       * tests/test-isblank.c (main): Likewise.
+       * tests/test-isblank_l.c (test_single_locale_common): Likewise.
+       * tests/test-iscntrl_l.c (test_single_locale_common): Likewise.
+       * tests/test-isdigit_l.c (test_single_locale_common): Likewise.
+       * tests/test-isgraph_l.c (test_single_locale_common): Likewise.
+       * tests/test-islower_l.c (test_single_locale_common): Likewise.
+       * tests/test-isprint_l.c (test_single_locale_common): Likewise.
+       * tests/test-ispunct_l.c (test_single_locale_common): Likewise.
+       * tests/test-isspace_l.c (test_single_locale_common): Likewise.
+       * tests/test-isupper_l.c (test_single_locale_common): Likewise.
+       * tests/test-iswdigit.c (main): Likewise.
+       * tests/test-iswpunct.c (main): Likewise.
+       * tests/test-iswxdigit.c (main): Likewise.
+       * tests/test-isxdigit_l.c (test_single_locale_common): Likewise.
+       * tests/test-ldexp.h (test_function): Likewise.
+       * tests/test-ldexp-ieee.h (test_function): Likewise.
+       * tests/test-libtextstyle.c (main): Likewise.
+       * tests/test-linkat.c (main): Likewise.
+       * tests/test-linked_list.c (check_equals, main): Likewise.
+       * tests/test-linkedhash_list.c (check_equals, main): Likewise.
+       * tests/test-linkedhash_map.c (check_equals, main): Likewise.
+       * tests/test-linkedhash_set.c (check_equals, string_hashcode, main):
+       Likewise.
+       * tests/test-localename.c (test_locale_name, test_locale_name_thread):
+       Likewise.
+       * tests/test-lock.c (check_accounts, gl_lock_define_initialized,
+       test_lock, gl_rwlock_define_initialized, test_rwlock,
+       reclock_mutator_thread, test_recursive_lock, once_contender_thread,
+       test_once): Likewise.
+       * tests/test-log.h (test_function): Likewise.
+       * tests/test-log10.h (test_function): Likewise.
+       * tests/test-log1p.h (test_function): Likewise.
+       * tests/test-log2.h (test_function): Likewise.
+       * tests/test-logb.h (test_function): Likewise.
+       * tests/test-login_tty.c (main): Likewise.
+       * tests/test-malloca.c (main): Likewise.
+       * tests/test-mbrlen.c (main): Likewise.
+       * tests/test-mbrlen-w32.c (test_one_locale, main): Likewise.
+       * tests/test-mbrtoc16.c (main): Likewise.
+       * tests/test-mbrtoc16-w32.c (test_one_locale, main): Likewise.
+       * tests/test-mbrtoc32.c (main): Likewise.
+       * tests/test-mbrtoc32-w32.c (test_one_locale, main): Likewise.
+       * tests/test-mbrtowc.c (main): Likewise.
+       * tests/test-mbrtowc-w32.c (test_one_locale, main): Likewise.
+       * tests/test-mbsnrtoc32s.c (main): Likewise.
+       * tests/test-mbsnrtowcs.c (main): Likewise.
+       * tests/test-mbsrtoc32s.c (main): Likewise.
+       * tests/test-mbsrtowcs.c (main): Likewise.
+       * tests/test-mbstoc32s.c (main): Likewise.
+       * tests/test-mbstowcs.c (main): Likewise.
+       * tests/test-md2-buffer.c (main): Likewise.
+       * tests/test-md4-buffer.c (main): Likewise.
+       * tests/test-md5-buffer.c (main): Likewise.
+       * tests/test-memalign.c (main): Likewise.
+       * tests/test-memcasecmp.c (main): Likewise.
+       * tests/test-memchr.c (main): Likewise.
+       * tests/test-memchr2.c (main): Likewise.
+       * tests/test-memcmp.c (main): Likewise.
+       * tests/test-memmem.c (main): Likewise.
+       * tests/test-memrchr.c (main): Likewise.
+       * tests/test-memset_explicit.c (test_stack): Likewise.
+       * tests/test-mkfifoat.c (main): Likewise.
+       * tests/test-modf.h (test_function): Likewise.
+       * tests/test-mountlist.c (main): Likewise.
+       * tests/test-mtx.c (check_accounts, lock_mutator_thread, test_mtx_plain,
+       reclock_mutator_thread, test_mtx_recursive): Likewise.
+       * tests/test-nl_langinfo2.c (main): Likewise.
+       * tests/test-nonblocking-misc.h (init_data): Likewise.
+       * tests/test-nstrftime.h (posixtm_test, tzalloc_test, quarter_test):
+       Likewise.
+       * tests/test-obstack-printf.h (test_function): Likewise.
+       * tests/test-obstack-zprintf-big.c (main): Likewise.
+       * tests/test-obstack-zprintf-posix.c (RESULT_EQ): Likewise.
+       * tests/test-open.h (test_open): Likewise.
+       * tests/test-openat-safer.c (main): Likewise.
+       * tests/test-options.c (test_getopt_long, test_getopt_long_posix):
+       Likewise.
+       * tests/test-pagealign_alloc.c (main): Likewise.
+       * tests/test-parse-datetime.c (main): Likewise.
+       * tests/test-perror2.c (main): Likewise.
+       * tests/test-pipe-filter-gi1.c (done_read): Likewise.
+       * tests/test-pipe-filter-ii1.c (done_read): Likewise.
+       * tests/test-pipe2.c (main): Likewise.
+       * tests/test-popen.h (main): Likewise.
+       * tests/test-posix_memalign.c (main): Likewise.
+       * tests/test-posix_spawn-script.c (main): Likewise.
+       * tests/test-posix_spawnp-script.c (main): Likewise.
+       * tests/test-posixtm.c (main): Likewise.
+       * tests/test-pread.c (main): Likewise.
+       * tests/test-pthread-mutex.c (check_accounts, lock_mutator_thread,
+       test_pthread_mutex_normal, reclock_mutator_thread,
+       test_pthread_mutex_recursive): Likewise.
+       * tests/test-pthread-once2.c (once_contender_thread, test_once):
+       Likewise.
+       * tests/test-pthread-rwlock.c (check_accounts, rwlock_mutator_thread,
+       test_rwlock): Likewise.
+       * tests/test-pthread-spin.c (check_accounts, lock_mutator_thread,
+       test_pthread_spin): Likewise.
+       * tests/test-pthread-tss.c (worker_thread, test_tss, dtorcheck1_thread,
+       test_tss_dtorcheck1, dtorcheck2_thread, test_tss_dtorcheck2,
+       racecheck_thread, test_tss_racecheck): Likewise.
+       * tests/test-ptsname.c (main): Likewise.
+       * tests/test-ptsname_r.c (test_errors, main): Likewise.
+       * tests/test-pwrite.c (main): Likewise.
+       * tests/test-quotearg-simple.c (main): Likewise.
+       * tests/test-random.c (main): Likewise.
+       * tests/test-random-mt.c (random_invocator_thread, main): Likewise.
+       * tests/test-random_r.c (test_failed, main): Likewise.
+       * tests/test-rawmemchr.c (main): Likewise.
+       * tests/test-rbtree_list.c (check_equals, main): Likewise.
+       * tests/test-rbtree_omap.c (check_equals, main): Likewise.
+       * tests/test-rbtree_oset.c (check_equals, main): Likewise.
+       * tests/test-rbtreehash_list.c (check_equals, main): Likewise.
+       * tests/test-readlink.h (test_readlink): Likewise.
+       * tests/test-readutmp.c (main): Likewise.
+       * tests/test-remainder.h (test_function): Likewise.
+       * tests/test-renameat.c (main): Likewise.
+       * tests/test-renameatu.c (main): Likewise.
+       * tests/test-rijndael.c (main): Likewise.
+       * tests/test-rint.h (test_function): Likewise.
+       * tests/test-round2.c (main): Likewise.
+       * tests/test-sameacls.c (main, room): Likewise.
+       * tests/test-scratch-buffer.c (main): Likewise.
+       * tests/test-sethostname2.c (main): Likewise.
+       * tests/test-sh-quote.c (main): Likewise.
+       * tests/test-sha1-buffer.c (main): Likewise.
+       * tests/test-sha224-buffer.c (main): Likewise.
+       * tests/test-sha256-buffer.c (main): Likewise.
+       * tests/test-sha3-224-buffer.c (check): Likewise.
+       * tests/test-sha3-256-buffer.c (check): Likewise.
+       * tests/test-sha3-384-buffer.c (check): Likewise.
+       * tests/test-sha3-512-buffer.c (check): Likewise.
+       * tests/test-sha384-buffer.c (main): Likewise.
+       * tests/test-sha512-buffer.c (main): Likewise.
+       * tests/test-simple-atomic.c (int_mutator_thread, ptr_mutator_thread,
+       main): Likewise.
+       * tests/test-sm3-buffer.c (test, main): Likewise.
+       * tests/test-snprintf.c (main): Likewise.
+       * tests/test-snprintf-posix.h (test_function, value, word): Likewise.
+       * tests/test-snzprintf-posix.h (test_function): Likewise.
+       * tests/test-spawn-pipe-child.c (main): Likewise.
+       * tests/test-spawn-pipe-main.c (main): Likewise.
+       * tests/test-spawn-pipe-script.c (main): Likewise.
+       * tests/test-spin1.c (gl_spinlock_define_initialized): Likewise.
+       * tests/test-spin2.c (check_accounts, gl_spinlock_define,
+       test_asyncsafe_spin): Likewise.
+       * tests/test-sprintf-posix.h (value, word): Likewise.
+       * tests/test-sqrt.h (test_function): Likewise.
+       * tests/test-ssfmalloc.c (main): Likewise.
+       * tests/test-stat-time.c (prepare_test, test_mtime, test_birthtime):
+       Likewise.
+       * tests/test-stpncpy.c (main): Likewise.
+       * tests/test-strcasestr.c (main): Likewise.
+       * tests/test-strchrnul.c (main): Likewise.
+       * tests/test-strerror_r.c (main): Likewise.
+       * tests/test-striconveh.c (main): Likewise.
+       * tests/test-striconveha.c (main): Likewise.
+       * tests/test-strnlen.c (main): Likewise.
+       * tests/test-strstr.c (main): Likewise.
+       * tests/test-system-quote-main.c (check_all, main): Likewise.
+       * tests/test-szprintf-posix.h (test_function): Likewise.
+       * tests/test-thread_local.c (worker_thread, test_thread_local):
+       Likewise.
+       * tests/test-times.c (main): Likewise.
+       * tests/test-timespec.c (main): Likewise.
+       * tests/test-tls.c (worker_thread, test_tls, dtorcheck1_thread,
+       test_tls_dtorcheck1, dtorcheck2_thread, test_tls_dtorcheck2,
+       racecheck_thread, test_tls_racecheck): Likewise.
+       * tests/test-tolower_l.c (test_single_locale_common): Likewise.
+       * tests/test-toupper_l.c (test_single_locale_common): Likewise.
+       * tests/test-trunc2.c (main): Likewise.
+       * tests/test-truncf2.c (main): Likewise.
+       * tests/test-tsearch.c (memfry, walk_tree, mangle_tree, main): Likewise.
+       * tests/test-tss.c (worker_thread, test_tss, dtorcheck1_thread,
+       test_tss_dtorcheck1, dtorcheck2_thread, test_tss_dtorcheck2,
+       racecheck_thread, test_tss_racecheck): Likewise.
+       * tests/test-userspec.c (main): Likewise.
+       * tests/test-vasnprintf.c (test_function): Likewise.
+       * tests/test-vasnprintf-big.c (main): Likewise.
+       * tests/test-vasnprintf-posix.c (test_function, value, word): Likewise.
+       * tests/test-vasnwprintf.c (test_function): Likewise.
+       * tests/test-vasnwprintf-big.c (main): Likewise.
+       * tests/test-vasnwprintf-posix.c (test_function, value, word): Likewise.
+       * tests/test-vasprintf.c (test_vasprintf, test_asprintf): Likewise.
+       * tests/test-vasprintf-posix.c (test_function, value, word): Likewise.
+       * tests/test-vaszprintf-posix.c (test_function): Likewise.
+       * tests/test-vsnprintf.c (main): Likewise.
+       * tests/test-wcrtomb.c (main): Likewise.
+       * tests/test-wcrtomb-w32.c (test_one_locale, main): Likewise.
+       * tests/test-wcsnrtombs.c (main): Likewise.
+       * tests/test-wcsrtombs.c (main): Likewise.
+       * tests/test-wcwidth.c (main): Likewise.
+       * tests/test-xstrtol.c (main): Likewise.
+       * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Likewise.
+       * tests/unicase/test-mapping-part2.h (main): Likewise.
+       * tests/unicase/test-predicate-part2.h (main): Likewise.
+       * tests/uniconv/test-u8-conv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u8-conv-to-enc.c (main): Likewise.
+       * tests/uniconv/test-u8-strconv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u8-strconv-to-enc.c (main): Likewise.
+       * tests/uniconv/test-u16-conv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
+       * tests/uniconv/test-u16-strconv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u16-strconv-to-enc.c (main): Likewise.
+       * tests/uniconv/test-u32-conv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u32-conv-to-enc.c (main): Likewise.
+       * tests/uniconv/test-u32-strconv-from-enc.c (main): Likewise.
+       * tests/uniconv/test-u32-strconv-to-enc.c (main): Likewise.
+       * tests/unictype/test-bidi_test.c (main): Likewise.
+       * tests/unictype/test-block_list.c (main): Likewise.
+       * tests/unictype/test-block_of.c (main): Likewise.
+       * tests/unictype/test-categ_byname.c (main): Likewise.
+       * tests/unictype/test-categ_none.c (main): Likewise.
+       * tests/unictype/test-categ_of.c (main): Likewise.
+       * tests/unictype/test-decdigit.c (main): Likewise.
+       * tests/unictype/test-digit.c (main): Likewise.
+       * tests/unictype/test-incb_of.c (main): Likewise.
+       * tests/unictype/test-joininggroup_of.c (main): Likewise.
+       * tests/unictype/test-joiningtype_of.c (main): Likewise.
+       * tests/unictype/test-numeric.c (main): Likewise.
+       * tests/unictype/test-pr_byname.c (main): Likewise.
+       * tests/unictype/test-pr_test.c (main): Likewise.
+       * tests/unictype/test-predicate-part2.h (main): Likewise.
+       * tests/unictype/test-scripts.c (main): Likewise.
+       * tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
+       Likewise.
+       * tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next):
+       Likewise.
+       * tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
+       Likewise.
+       * tests/unigbrk/test-u16-grapheme-breaks.c (test_u16_grapheme_breaks):
+       Likewise.
+       * tests/unigbrk/test-u16-grapheme-next.c (test_u16_grapheme_next):
+       Likewise.
+       * tests/unigbrk/test-u16-grapheme-prev.c (test_u16_grapheme_prev):
+       Likewise.
+       * tests/unigbrk/test-u32-grapheme-breaks.c (test_u32_grapheme_breaks):
+       Likewise.
+       * tests/unigbrk/test-u32-grapheme-next.c (test_u32_grapheme_next):
+       Likewise.
+       * tests/unigbrk/test-u32-grapheme-prev.c (test_u32_grapheme_prev):
+       Likewise.
+       * tests/unigbrk/test-uc-gbrk-prop.c (main): Likewise.
+       * tests/unigbrk/test-uc-grapheme-breaks.c (test_uc_grapheme_breaks):
+       Likewise.
+       * tests/unigbrk/test-ulc-grapheme-breaks.c (sizeof): Likewise.
+       * tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-u8-width-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-u16-possible-linebreaks.c (test_function):
+       Likewise.
+       * tests/unilbrk/test-u16-width-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-u32-possible-linebreaks.c (test_function):
+       Likewise.
+       * tests/unilbrk/test-u32-width-linebreaks.c (test_function): Likewise.
+       * tests/unilbrk/test-uc-possible-linebreaks.c (main): Likewise.
+       * tests/unilbrk/test-ulc-possible-linebreaks.c (test_function):
+       Likewise.
+       * tests/unilbrk/test-ulc-width-linebreaks.c (test_function): Likewise.
+       * tests/uniname/test-uninames.c (name_has_alias, test_name_lookup,
+       test_inverse_lookup, test_alias_lookup, main): Likewise.
+       * tests/uninorm/test-u8-nfc.c (test_u8_nfc): Likewise.
+       * tests/uninorm/test-u8-nfd.c (test_u8_nfd): Likewise.
+       * tests/uninorm/test-u8-nfkc.c (test_u8_nfkc): Likewise.
+       * tests/uninorm/test-u8-nfkd.c (test_u8_nfkd): Likewise.
+       * tests/uninorm/test-u16-nfc.c (test_u16_nfc): Likewise.
+       * tests/uninorm/test-u16-nfd.c (test_u16_nfd): Likewise.
+       * tests/uninorm/test-u16-nfkc.c (test_u16_nfkc): Likewise.
+       * tests/uninorm/test-u16-nfkd.c (test_u16_nfkd): Likewise.
+       * tests/uninorm/test-u32-nfc.c (test_u32_nfc): Likewise.
+       * tests/uninorm/test-u32-nfd.c (test_u32_nfd): Likewise.
+       * tests/uninorm/test-u32-nfkc.c (test_u32_nfkc): Likewise.
+       * tests/uninorm/test-u32-nfkd.c (test_u32_nfkd): Likewise.
+       * tests/uninorm/test-u32-normalize-big.c (read_normalization_test_file,
+       test_specific, test_other, free_normalization_test_file): Likewise.
+       * tests/uninorm/test-uninorm-filter-nfc.c (check): Likewise.
+       * tests/unistdio/test-u8-asnprintf-big.c (main): Likewise.
+       * tests/unistdio/test-u8-asnprintf1.h (test_function): Likewise.
+       * tests/unistdio/test-u16-asnprintf1.h (test_function): Likewise.
+       * tests/unistdio/test-u32-asnprintf1.h (test_function): Likewise.
+       * tests/unistdio/test-ulc-asnprintf-big.c (main): Likewise.
+       * tests/unistdio/test-ulc-asnprintf1.h (test_function): Likewise.
+       * tests/unistr/test-chr.h (main): Likewise.
+       * tests/unistr/test-cmp.h (test_cmp): Likewise.
+       * tests/unistr/test-cpy-alloc.h (main): Likewise.
+       * tests/unistr/test-cpy.h (main): Likewise.
+       * tests/unistr/test-move.h (main): Likewise.
+       * tests/unistr/test-pcpy.h (main): Likewise.
+       * tests/unistr/test-set.h (NMAX, main): Likewise.
+       * tests/unistr/test-stpcpy.h (main): Likewise.
+       * tests/unistr/test-stpncpy.h (check_single, check): Likewise.
+       * tests/unistr/test-strcat.h (main): Likewise.
+       * tests/unistr/test-strchr.h (test_strchr): Likewise.
+       * tests/unistr/test-strcpy.h (main): Likewise.
+       * tests/unistr/test-strdup.h (main): Likewise.
+       * tests/unistr/test-strncat.h (check_single, check): Likewise.
+       * tests/unistr/test-strncpy.h (check_single, check): Likewise.
+       * tests/unistr/test-strnlen.h (check): Likewise.
+       * tests/unistr/test-u-strstr.h (test_u_strstr): Likewise.
+       * tests/unistr/test-u16-mblen.c (main): Likewise.
+       * tests/unistr/test-u16-mbsnlen.c (main): Likewise.
+       * tests/unistr/test-u16-mbtouc.h (test_function): Likewise.
+       * tests/unistr/test-u16-mbtoucr.c (main): Likewise.
+       * tests/unistr/test-u16-next.c (main): Likewise.
+       * tests/unistr/test-u16-prev.c (check, check_invalid, main): Likewise.
+       * tests/unistr/test-u16-strmblen.c (main): Likewise.
+       * tests/unistr/test-u16-strmbtouc.c (main): Likewise.
+       * tests/unistr/test-u16-uctomb.c (main): Likewise.
+       * tests/unistr/test-u32-mblen.c (main): Likewise.
+       * tests/unistr/test-u32-mbsnlen.c (main): Likewise.
+       * tests/unistr/test-u32-mbtouc.h (test_function): Likewise.
+       * tests/unistr/test-u32-mbtoucr.c (main): Likewise.
+       * tests/unistr/test-u32-next.c (main): Likewise.
+       * tests/unistr/test-u32-prev.c (check, check_invalid, main): Likewise.
+       * tests/unistr/test-u32-strmblen.c (main): Likewise.
+       * tests/unistr/test-u32-strmbtouc.c (main): Likewise.
+       * tests/unistr/test-u32-uctomb.c (main): Likewise.
+       * tests/unistr/test-u8-mblen.c (main): Likewise.
+       * tests/unistr/test-u8-mbsnlen.c (main): Likewise.
+       * tests/unistr/test-u8-mbtouc.c (test_safe_function): Likewise.
+       * tests/unistr/test-u8-mbtouc.h (test_function): Likewise.
+       * tests/unistr/test-u8-mbtoucr.c (main): Likewise.
+       * tests/unistr/test-u8-next.c (main): Likewise.
+       * tests/unistr/test-u8-prev.c (check, check_invalid, main): Likewise.
+       * tests/unistr/test-u8-strmblen.c (main): Likewise.
+       * tests/unistr/test-u8-strmbtouc.c (main): Likewise.
+       * tests/unistr/test-u8-uctomb.c (main): Likewise.
+       * tests/uniwbrk/test-u8-wordbreaks.c (main): Likewise.
+       * tests/uniwbrk/test-u16-wordbreaks.c (main): Likewise.
+       * tests/uniwbrk/test-u32-wordbreaks.c (main): Likewise.
+       * tests/uniwbrk/test-uc-wordbreaks.c (main): Likewise.
+       * tests/uniwbrk/test-ulc-wordbreaks.c (main): Likewise.
+       * tests/uniwidth/test-uc_width.c (main): Likewise.
+       * tests/uniwidth/test-uc_width2.c (main): Likewise.
+       * tests/virtualbox.h (is_running_under_virtualbox_kvm, num_cpus):
+       Likewise.
+       * tests/test-regex.c (bug_regex11, main): Likewise. Rename local
+       variables.
+
 2025-11-15  Paul Eggert  <eggert@cs.ucla.edu>
 
        -Wunused-const-variable started in GCC 6.1 not 4.4
index 492f046d1c52391d83b7704b80d1c6ef78b31077..0e560cf4a59fb5bbc2fc2d235313fa0efe1f518d 100644 (file)
@@ -49,15 +49,13 @@ prepare_alternate_stack (void)
 static void
 check_alternate_stack_no_overflow (void)
 {
-  unsigned int i;
-
-  for (i = MYSTACK_CRUMPLE_ZONE; i > 0; i--)
+  for (unsigned int i = MYSTACK_CRUMPLE_ZONE; i > 0; i--)
     if (*(mystack - i) != 's')
       {
         printf ("Alternate stack was exceeded by %u bytes!!\n", i);
         exit (1);
       }
-  for (i = MYSTACK_CRUMPLE_ZONE; i > 0; i--)
+  for (unsigned int i = MYSTACK_CRUMPLE_ZONE; i > 0; i--)
     if (*(mystack + MYSTACK_SIZE - 1 + i) != 's')
       {
         printf ("Alternate stack was exceeded by %u bytes!!\n", i);
index 73ded1c8f1f4fe9cd94857fc433375209feff4ea..2a4bb8fec9c404fedae81bc310206dbd8d8fa30c 100644 (file)
@@ -87,8 +87,7 @@ static void
 init_atomic_int (struct atomic_int *ai)
 {
   sem_t *s;
-  unsigned int count;
-  for (count = 0; ; count++)
+  for (unsigned int count = 0; ; count++)
     {
       char name[80];
       /* Use getpid() in the name, so that different processes running at the
index 4e899fd4a0694f6e12f1643b322dfc7cd14a5d98..5e0677a4ff44c49464cfd8dcbbc28e962ff305d4 100644 (file)
@@ -87,8 +87,7 @@ static void
 init_atomic_int (struct atomic_int *ai)
 {
   sem_t *s;
-  unsigned int count;
-  for (count = 0; ; count++)
+  for (unsigned int count = 0; ; count++)
     {
       char name[80];
       /* Use getpid() in the name, so that different processes running at the
index d573e60cb5ac8056d9b7b2e69b37e876d3d9ae7a..9604bfe28c19e0a27c56f5a7caf9a022108ade4e 100644 (file)
@@ -87,8 +87,7 @@ static void
 init_atomic_int (struct atomic_int *ai)
 {
   sem_t *s;
-  unsigned int count;
-  for (count = 0; ; count++)
+  for (unsigned int count = 0; ; count++)
     {
       char name[80];
       /* Use getpid() in the name, so that different processes running at the
index 98e3d22db1a6ea9bad13eea8772675072be6cfbc..fc2ebbfcf59bcaabb168b7504aa33081a3432798 100644 (file)
@@ -38,8 +38,7 @@ main (int argc, char *argv[])
   struct timings_state ts;
   timing_start (&ts);
 
-  int count;
-  for (count = 0; count < repeat; count++)
+  for (int count = 0; count < repeat; count++)
     {
       uint32_t volatile digest = crc32 (randomb, sizeof randomb);
       ASSERT (digest == 0x5299f9d2U);
index 969851b46e0c4b1c143733a9bdc57a4d2b063d2b..15ec609abc0843def8f88bed0ccccc41d8dea022 100644 (file)
@@ -39,18 +39,14 @@ main (int argc, char *argv[])
     }
 
   /* Fill the memory block.  */
-  {
-    size_t i;
-    for (i = 0; i < size; i++)
-      memblock[i] =
-        (unsigned char) (((i * (i-1) * (i-5)) >> 6) + (i % 499) + (i % 101));
-  }
+  for (size_t i = 0; i < size; i++)
+    memblock[i] =
+      (unsigned char) (((i * (i-1) * (i-5)) >> 6) + (i % 499) + (i % 101));
 
   struct timings_state ts;
   timing_start (&ts);
 
-  int count;
-  for (count = 0; count < repeat; count++)
+  for (int count = 0; count < repeat; count++)
     {
       char digest[64];
       FUNC (memblock, size, digest);
index b15ccb4cd0877f29e7a850ffa50eb6505fea438d..df4948335e565434b891b155ce28505f7ba837b9 100644 (file)
@@ -37,8 +37,7 @@ do_test (char test, int repeat, const char *locale_name, const char *text)
       timing_start (&ts);
 
       size_t text_len = strlen (text);
-      int count;
-      for (count = 0; count < repeat; count++)
+      for (int count = 0; count < repeat; count++)
         {
           unsigned long long sum = 0;
           mbi_iterator_t iter;
@@ -87,8 +86,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index e26c8b0cf199e170decc6deaf4ad837396e8b7e4..d82a7faf53a93863aea2fb8de190b2372fe63781 100644 (file)
@@ -37,8 +37,7 @@ do_test (char test, int repeat, const char *locale_name, const char *text)
       timing_start (&ts);
 
       size_t text_len = strlen (text);
-      int count;
-      for (count = 0; count < repeat; count++)
+      for (int count = 0; count < repeat; count++)
         {
           unsigned long long sum = 0;
           const char *text_end = text + text_len;
@@ -91,8 +90,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index d508404bc19d2a2334439f6d4187e7e0f1f40317..42be04f07a04f6f9af7b0e71de1745fd554bfeba 100644 (file)
@@ -34,8 +34,7 @@ do_test (char test, int repeat, const char *locale_name, const char *text)
       struct timings_state ts;
       timing_start (&ts);
 
-      int count;
-      for (count = 0; count < repeat; count++)
+      for (int count = 0; count < repeat; count++)
         {
           mbswidth (text, 0);
         }
@@ -78,8 +77,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index 695e1329639e02ccadc2ed431f044ef028ee01f6..30b706248642370923084076dff48905285e5d5d 100644 (file)
@@ -36,8 +36,7 @@ do_test (char test, int repeat, const char *locale_name, const char *text)
       struct timings_state ts;
       timing_start (&ts);
 
-      int count;
-      for (count = 0; count < repeat; count++)
+      for (int count = 0; count < repeat; count++)
         {
           unsigned long long sum = 0;
           mbui_iterator_t iter;
@@ -86,8 +85,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index 3c31f0c33ae0125cbda077c163746f16015969b3..a0c9c49b3d013af4e4eb516c564a84df16acd6b8 100644 (file)
@@ -36,8 +36,7 @@ do_test (char test, int repeat, const char *locale_name, const char *text)
       struct timings_state ts;
       timing_start (&ts);
 
-      int count;
-      for (count = 0; count < repeat; count++)
+      for (int count = 0; count < repeat; count++)
         {
           unsigned long long sum = 0;
           mbuif_state_t state;
@@ -89,8 +88,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index 444adfe942ad5bf2f120df1c5fc74dc821786675..adbb5c87f3f562e9cf02777a2dcbb3ce56fe34d6 100644 (file)
@@ -39,8 +39,7 @@ noop_test (char const *text, char const *text_end, int repeat)
 
   for (int count = 0; count < repeat; count++)
     {
-      char const *iter;
-      for (iter = text; iter < text_end; iter++)
+      for (char const *iter = text; iter < text_end; iter++)
         sum += (uintptr_t) iter;
     }
 
@@ -284,8 +283,7 @@ main (int argc, char *argv[])
   text_init ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index 13b9747ca7c5644809fbb0819d9976a2fd49b1ca..8413c8da866e43bd891e946160d1b4f980ec4d63 100644 (file)
@@ -35,15 +35,13 @@ static size_t pagesize;
 static int
 allocate_some_pages (void)
 {
-  int i;
-
-  for (i = 1; i <= 9; i++)
+  for (int i = 1; i <= 9; i++)
     if (pagealign_alloc (pagesize) == NULL)
       return -1;
-  for (i = 1; i <= 2; i++)
+  for (int i = 1; i <= 2; i++)
     if (pagealign_alloc (2 * pagesize) == NULL)
       return -1;
-  for (i = 1; i <= 1; i++)
+  for (int i = 1; i <= 1; i++)
     if (pagealign_alloc (3 * pagesize) == NULL)
       return -1;
 
@@ -112,8 +110,7 @@ main (int argc, char *argv[])
   pagesize = getpagesize ();
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index 26f4488f8b8bb6d7f5bec33aa4bf3c58cf4e4d50..dfbedc8a208f195060c23927fe9262fe499bf230 100644 (file)
@@ -74,8 +74,7 @@ do_float_test (char test, int repeat)
   struct timings_state ts;
   timing_start (&ts);
 
-  int count;
-  for (count = 0; count < repeat; count++)
+  for (int count = 0; count < repeat; count++)
     {
       for (int i = 0; i < n; i++)
         for (int j = 0; j < n; j++)
@@ -110,8 +109,7 @@ do_double_test (char test, int repeat)
   struct timings_state ts;
   timing_start (&ts);
 
-  int count;
-  for (count = 0; count < repeat; count++)
+  for (int count = 0; count < repeat; count++)
     {
       for (int i = 0; i < n; i++)
         for (int j = 0; j < n; j++)
@@ -146,8 +144,7 @@ do_long_double_test (char test, int repeat)
   struct timings_state ts;
   timing_start (&ts);
 
-  int count;
-  for (count = 0; count < repeat; count++)
+  for (int count = 0; count < repeat; count++)
     {
       for (int i = 0; i < n; i++)
         for (int j = 0; j < n; j++)
@@ -178,8 +175,7 @@ main (int argc, char *argv[])
   int repeat = atoi (argv[2]);
 
   /* Execute each test.  */
-  size_t i;
-  for (i = 0; i < strlen (tests); i++)
+  for (size_t i = 0; i < strlen (tests); i++)
     {
       char test = tests[i];
 
index c93a1c11618ba671d1c4fd58f303a245b75b48dc..5168ed84665936a1d462b0568ca3163de7cb96b3 100644 (file)
@@ -33,11 +33,10 @@ static int
 is_administrator (void)
 {
   gid_t list[100];
-  int i;
   int count = getgroups (sizeof (list) / sizeof (list[0]), list);
   if (count < 0)
     return 0;
-  for (i = 0; i < count; i++)
+  for (int i = 0; i < count; i++)
     {
       gid_t id = list[i];
       struct group *details = getgrgid (id);
index 1a1795f051b7b5fc4a2c7322b4c29c3d72888ed8..0b448b66e9007eac2281c668f7a320e2f80cc1f3 100644 (file)
@@ -85,9 +85,8 @@ main (int argc, char *argv[])
   void *aligned8_blocks[SIZEOF (sizes)];
   void *aligned16_blocks[SIZEOF (sizes)];
   void *aligned32_blocks[SIZEOF (sizes)];
-  size_t i;
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       size_t size = sizes[i];
 
@@ -108,7 +107,7 @@ main (int argc, char *argv[])
       memset (aligned32_blocks[i], 'z', size);
     }
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       aligned4_free (aligned4_blocks[i]);
       aligned8_free (aligned8_blocks[i]);
index 3f877a5a47be8b786e98d7dcd968e3ee486356db..b931cd3530cfe333882d833015238a628f1a4af7 100644 (file)
@@ -52,9 +52,8 @@ main (int argc, char *argv[])
   void *aligned16_blocks[SIZEOF (sizes)];
   void *aligned32_blocks[SIZEOF (sizes)];
   void *aligned64_blocks[SIZEOF (sizes)];
-  size_t i;
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       size_t size = sizes[i];
 
@@ -89,7 +88,7 @@ main (int argc, char *argv[])
       memset (aligned64_blocks[i], 'z', size);
     }
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       free (aligned2_blocks[i]);
       free (aligned4_blocks[i]);
index 5cd5640518fd9e3d1211cd553460359a6454f152..b730d4c60707f6c365433c377f667da7f28b9b56 100644 (file)
@@ -37,10 +37,8 @@ int
 main ()
 {
 #if HAVE_ALLOCA
-  int i;
-
   /* Repeat a lot of times, to make sure there's no memory leak.  */
-  for (i = 0; i < 100000; i++)
+  for (int i = 0; i < 100000; i++)
     {
       /* Try various values.
          n = 0 gave a crash on Alpha with gcc-2.5.8.
index 85835f0ff7b7972506a074aa7becda4199ed3a2c..8fca6bf19c9cceee02b668a29ce845c6886132d2 100644 (file)
@@ -37,12 +37,11 @@ main (int argc, char *argv[])
   arcfour_stream (&ctx, plaintext_1, scratch, sizeof (plaintext_1));
   if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", ciphertext_1[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -54,12 +53,11 @@ main (int argc, char *argv[])
   arcfour_stream (&ctx, scratch, scratch, sizeof (plaintext_1));
   if (memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", plaintext_1[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
index 49c947504e74154b57052acff039eed1ffa63560..f4bbf2c3c21a2a4ab5dce52cf93c186ee7253ad0 100644 (file)
@@ -114,12 +114,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, ciphertext_4, sizeof (ciphertext_4)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < sizeof (ciphertext_4); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_4); i++)
         printf ("%02x ", ciphertext_4[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < sizeof (ciphertext_4); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_4); i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -136,12 +135,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, ciphertext_5, sizeof (ciphertext_5)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < sizeof (ciphertext_5); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_5); i++)
         printf ("%02x ", ciphertext_5[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < sizeof (ciphertext_5); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_5); i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -158,12 +156,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, ciphertext_6, sizeof (ciphertext_6)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < sizeof (ciphertext_6); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_6); i++)
         printf ("%02x ", ciphertext_6[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < sizeof (ciphertext_6); i++)
+      for (size_t i = 0; i < sizeof (ciphertext_6); i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
index 57afcac7747991b63d5396909b944aaa7667d258..dc5e59e3e594306975f19bd172f7928b4449d81d 100644 (file)
@@ -221,12 +221,11 @@ static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
   struct test_args *args = state->input;
-  int i;
 
   switch (key)
     {
     case ARGP_KEY_INIT:
-      for (i = 0; state->root_argp->children[i].argp; i++)
+      for (int i = 0; state->root_argp->children[i].argp; i++)
         state->child_inputs[i] = args;
       break;
 
@@ -458,7 +457,6 @@ int
 main (int argc, char **argv)
 {
   struct argp_child argp_children[3], group1_children[2], group2_children[2];
-  test_fp *fun;
 
   group1_children[0] = group1_1_child;
   group1_children[1].argp = NULL;
@@ -480,7 +478,7 @@ main (int argc, char **argv)
       return argp_parse (&test_argp, argc, argv, 0, NULL, &test_args);
     }
 
-  for (fun = test_fun; *fun; fun++)
+  for (test_fp *fun = test_fun; *fun; fun++)
     (*fun) (&test_argp);
 
   if (failure_count)
index 63f96b6a01ba4085e05e14454fd72cabd8c7f361..83c77599bfb5314b355d94645bd273d60dea45c7 100644 (file)
@@ -57,11 +57,9 @@ main (void)
     {one, two, three, NULL}
   };
 
-  int use_stream;
-  for (use_stream = 0; use_stream < 2; use_stream++)
+  for (int use_stream = 0; use_stream < 2; use_stream++)
     {
-      size_t i;
-      for (i = 0; i < ARRAY_CARDINALITY (av); i++)
+      for (size_t i = 0; i < ARRAY_CARDINALITY (av); i++)
         {
           FILE *fp;
           struct argv_iterator *ai;
index dd6dc0b272944ea90077e20c1798b1343a574029..3f29c53658f1844e626dc0a5d0db3c2c49ea2dd8 100644 (file)
@@ -301,15 +301,12 @@ cmp_double (const void *a, const void *b)
 int
 main ()
 {
-  size_t n;
-
   /* Test merge_sort_fromto.  */
-  for (n = 1; n <= NMAX; n++)
+  for (size_t n = 1; n <= NMAX; n++)
     {
       struct foo *dst;
       struct foo *tmp;
       double *qsort_result;
-      size_t i;
 
       dst = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
       dst[n].x = 0x4A6A71FE; /* canary */
@@ -324,14 +321,14 @@ main ()
 
       /* Verify the result.  */
       qsort_result = (double *) malloc (n * sizeof (double));
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         qsort_result[i] = data[i].x;
       qsort (qsort_result, n, sizeof (double), cmp_double);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         ASSERT (dst[i].x == qsort_result[i]);
 
       /* Verify the stability.  */
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         if (i > 0 && dst[i - 1].x == dst[i].x)
           ASSERT (dst[i - 1].index < dst[i].index);
 
@@ -341,19 +338,18 @@ main ()
     }
 
   /* Test merge_sort_inplace.  */
-  for (n = 1; n <= NMAX; n++)
+  for (size_t n = 1; n <= NMAX; n++)
     {
       struct foo *src;
       struct foo *tmp;
       double *qsort_result;
-      size_t i;
 
       src = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
       src[n].x = 0x4A6A71FE; /* canary */
       tmp = (struct foo *) malloc ((n + 1) * sizeof (struct foo));
       tmp[n].x = 0x587EF149; /* canary */
 
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         src[i] = data[i];
 
       merge_sort_inplace (src, n, tmp);
@@ -364,14 +360,14 @@ main ()
 
       /* Verify the result.  */
       qsort_result = (double *) malloc (n * sizeof (double));
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         qsort_result[i] = data[i].x;
       qsort (qsort_result, n, sizeof (double), cmp_double);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         ASSERT (src[i].x == qsort_result[i]);
 
       /* Verify the stability.  */
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         if (i > 0 && src[i - 1].x == src[i].x)
           ASSERT (src[i - 1].index < src[i].index);
 
index b77725aabc21876660f6e1cb5cf5df23e07c52d8..f7000bcd454b26367b15e2a3e484cea11aaf1b01 100644 (file)
@@ -34,11 +34,11 @@ static const char *objects[15] =
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -93,10 +93,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -106,7 +104,7 @@ main (int argc, char *argv[])
     /* Create list2.  */
     list2 = gl_list_nx_create_empty (GL_ARRAY_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     check_equals (list1, list2);
@@ -114,7 +112,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -334,7 +332,7 @@ main (int argc, char *argv[])
               const void *elt;
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -355,7 +353,7 @@ main (int argc, char *argv[])
               const void *elt;
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index 6faa02011e69293e8bbadbefa79c53d3299eac2f..0157838ef47375277f55b21842321cac1e448f46 100644 (file)
@@ -84,12 +84,11 @@ check_equals (gl_map_t map1, gl_list_t keys, gl_list_t values)
   gl_map_iterator_t iter1;
   const void *key1;
   const void *value1;
-  size_t i;
 
   ASSERT (gl_list_size (keys) == n);
   ASSERT (gl_list_size (values) == n);
   iter1 = gl_map_iterator (map1);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_map_iterator_next (&iter1, &key1, &value1));
       pairs_of_map1[i].key = key1;
@@ -100,7 +99,7 @@ check_equals (gl_map_t map1, gl_list_t keys, gl_list_t values)
 
   if (n > 0)
     qsort (pairs_of_map1, n, sizeof (struct pair), cmp_pairs_in_array);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (pairs_of_map1[i].key == gl_list_get_at (keys, i));
       ASSERT (pairs_of_map1[i].value == gl_list_get_at (values, i));
@@ -127,8 +126,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_map_nx_create_empty (GL_ARRAY_MAP,
@@ -142,7 +139,7 @@ main (int argc, char *argv[])
     check_all (map1, keys, values);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -160,7 +157,7 @@ main (int argc, char *argv[])
         check_all (map1, keys, values);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index 878b250a2bb4ac05e375245fc6e0c01d8b414464..3be3569df1adcbc5302fdefc2c1586c689ee034d 100644 (file)
@@ -46,12 +46,11 @@ check_equals (gl_omap_t map1, gl_list_t keys, gl_list_t values)
   const void *key2;
   const void *value2;
   gl_list_node_t node;
-  size_t i;
 
   iter1 = gl_omap_iterator (map1);
   iterk = gl_list_iterator (keys);
   iterv = gl_list_iterator (values);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_omap_iterator_next (&iter1, &key1, &value1));
       ASSERT (gl_list_iterator_next (&iterk, &key2, &node));
@@ -86,8 +85,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_omap_nx_create_empty (GL_ARRAY_OMAP, (gl_mapkey_compar_fn) strcmp, NULL, NULL);
@@ -100,7 +97,7 @@ main (int argc, char *argv[])
     check_all (map1, keys, values);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -118,7 +115,7 @@ main (int argc, char *argv[])
         check_all (map1, keys, values);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index f129aa8a4934bd817669fb3472be4b22e89eb7a0..bb15b7000ba6df30108971b68d82e8b8fa3d39ba 100644 (file)
@@ -46,11 +46,10 @@ check_equals (gl_oset_t set1, gl_list_t set2)
   const void *elt1;
   const void *elt2;
   gl_list_node_t node2;
-  size_t i;
 
   iter1 = gl_oset_iterator (set1);
   iter2 = gl_list_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_oset_iterator_next (&iter1, &elt1));
       ASSERT (gl_list_iterator_next (&iter2, &elt2, &node2));
@@ -81,9 +80,8 @@ gl_sortedlist_indexof_atleast (gl_list_t set,
 {
   /* This implementation is slow, but easy to verify.  */
   size_t count = gl_list_size (set);
-  size_t index;
 
-  for (index = 0; index < count; index++)
+  for (size_t index = 0; index < count; index++)
     if (threshold_fn (gl_list_get_at (set, index), threshold))
       return index;
   return (size_t)(-1);
@@ -101,8 +99,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_oset_nx_create_empty (GL_ARRAY_OSET, (gl_setelement_compar_fn) strcmp, NULL);
@@ -114,7 +110,7 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_oset_nx_add (set1, obj)
@@ -124,7 +120,7 @@ main (int argc, char *argv[])
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (4);
         switch (operation)
index 2f1f9ed9d69c3177820cbe98a503951b74252fa4..dace7cf43c061b2d1f4379ae064dc0c9d125adf9 100644 (file)
@@ -55,11 +55,10 @@ check_equals (gl_set_t set1, gl_oset_t set2)
   gl_oset_iterator_t iter2;
   const void *elt1;
   const void *elt2;
-  size_t i;
 
   iter1 = gl_set_iterator (set1);
   iter2 = gl_oset_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_set_iterator_next (&iter1, &elt1));
       ASSERT (gl_oset_iterator_next (&iter2, &elt2));
@@ -76,7 +75,7 @@ check_equals (gl_set_t set1, gl_oset_t set2)
       qsort (elements_of_set1, n, sizeof (const void *), cmp_objects_in_array);
       qsort (elements_of_set2, n, sizeof (const void *), cmp_objects_in_array);
     }
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     ASSERT (elements_of_set1[i] == elements_of_set2[i]);
   free (elements_of_set2);
   free (elements_of_set1);
@@ -100,8 +99,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_set_nx_create_empty (GL_ARRAY_SET, NULL, NULL, NULL);
@@ -113,14 +110,14 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_set_nx_add (set1, obj) == gl_oset_add (set2, obj));
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index 1ff655778ab4c78bcc0806f244fea79d6e6252eb..346b6c27a09efa92b641f6f4327e4d74f8cb3d05 100644 (file)
@@ -161,8 +161,7 @@ sigint_handler (int signo)
          thread.  By the time we get here, the mutator thread can have done
          any number of mutations; it is reasonable to assume that this number
          of mutations is small.  */
-      size_t i;
-      for (i = recent_sums_newest_index - 1;;)
+      for (size_t i = recent_sums_newest_index - 1;;)
         {
           if (sum == recent_sums[i % NUM_RECENT_SUMS]
               && i >= recent_sums_oldest_index)
@@ -228,9 +227,7 @@ signal_sending_thread (void *arg)
   if (test != 3)
     block_sigint ();
 
-  int repeat;
-
-  for (repeat = 1000; repeat > 0; repeat--)
+  for (int repeat = 1000; repeat > 0; repeat--)
     {
       num_signals_sent++; send_signal ();
       num_signals_sent++; send_signal ();
@@ -314,23 +311,22 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     list1 = gl_list_nx_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
     ASSERT (list1 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_first (list1, contents[i]) != NULL);
 
     list2 = gl_list_nx_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     uintptr_t initial_sum = 0;
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       initial_sum += (uintptr_t) contents[i];
     recent_sums_oldest_index = 0;
     recent_sums[0] = initial_sum;
index dd7ed45afc4ccf715a09c7885f043a514f6f9790..421331a7b955fac8a19405bb7ecaa02dd71ef78a 100644 (file)
@@ -93,9 +93,7 @@ typedef struct { uint32_t bits[BAG_SIZE / 32]; } bag_t;
 static void
 init_bag_empty (bag_t *bagp)
 {
-  size_t i;
-
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     bagp->bits[i] = 0;
 }
 
@@ -131,9 +129,7 @@ bag_from_list (gl_list_t list)
 _GL_ATTRIBUTE_MAYBE_UNUSED static bool
 bag_is_empty (bag_t bag)
 {
-  size_t i;
-
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     if (bag.bits[i] != 0)
       return false;
   return true;
@@ -143,9 +139,7 @@ bag_is_empty (bag_t bag)
 static bool
 bag_is_subset (bag_t bag1, bag_t bag2)
 {
-  size_t i;
-
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     if ((bag1.bits[i] & ~bag2.bits[i]) != 0)
       return false;
   return true;
@@ -155,9 +149,7 @@ bag_is_subset (bag_t bag1, bag_t bag2)
 static bool
 bag_equals (bag_t bag1, bag_t bag2)
 {
-  size_t i;
-
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     if (bag1.bits[i] != bag2.bits[i])
       return false;
   return true;
@@ -169,9 +161,8 @@ _GL_ATTRIBUTE_MAYBE_UNUSED static bag_t
 bag_or (bag_t bag1, bag_t bag2)
 {
   bag_t bag;
-  size_t i;
 
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     bag.bits[i] = bag1.bits[i] | bag2.bits[i];
 
   return bag;
@@ -183,9 +174,8 @@ static bag_t
 bag_xor (bag_t bag1, bag_t bag2)
 {
   bag_t bag;
-  size_t i;
 
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     bag.bits[i] = bag1.bits[i] ^ bag2.bits[i];
 
   return bag;
@@ -196,9 +186,8 @@ _GL_ATTRIBUTE_MAYBE_UNUSED static bag_t
 bag_and_not (bag_t bag1, bag_t bag2)
 {
   bag_t bag;
-  size_t i;
 
-  for (i = 0; i < BAG_SIZE / 32; i++)
+  for (size_t i = 0; i < BAG_SIZE / 32; i++)
     bag.bits[i] = bag1.bits[i] & ~bag2.bits[i];
 
   return bag;
@@ -290,11 +279,10 @@ sigint_handler (int signo)
          thread.  By the time we get here, the mutator thread can have done
          any number of mutations; it is reasonable to assume that this number
          of mutations is small.  */
-      size_t i;
       bag_t changes_from_i_to_newest;
       init_bag_empty (&changes_from_i_to_newest);
 
-      for (i = recent_newest_index;;)
+      for (size_t i = recent_newest_index;;)
         {
           if (bag_is_subset (bag_xor (bag, recent_bags[i % NUM_RECENT_BAGS]),
                              changes_from_i_to_newest)
@@ -361,9 +349,7 @@ signal_sending_thread (void *arg)
   if (test != 3)
     block_sigint ();
 
-  int repeat;
-
-  for (repeat = 1000; repeat > 0; repeat--)
+  for (int repeat = 1000; repeat > 0; repeat--)
     {
       num_signals_sent++; send_signal ();
       num_signals_sent++; send_signal ();
@@ -439,19 +425,18 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     list1 = gl_list_nx_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
     ASSERT (list1 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_first (list1, contents[i]) != NULL);
 
     list2 = gl_list_nx_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     recent_oldest_index = 0;
index 9662bb255b46cfe08dea28fa558431a1213cfa11..b44d4110ad936db325dafe4d3d4e13ab6362e5b9 100644 (file)
@@ -43,11 +43,10 @@ main (void)
   /* Check a spin-lock initialized through asyncsafe_spin_init.  */
   {
     asyncsafe_spinlock_t local_spin_lock;
-    int i;
 
     asyncsafe_spin_init (&local_spin_lock);
 
-    for (i = 0; i < 10; i++)
+    for (int i = 0; i < 10; i++)
       {
         sigset_t saved_set;
         asyncsafe_spin_lock (&local_spin_lock, false, &set, &saved_set);
index b6e05637974e1fd1a8cd67aa1a5dfa1137bdaf62..74f1810f66c4f4e0528ec11aa1b251a0930cc26c 100644 (file)
@@ -101,10 +101,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -122,9 +122,7 @@ static asyncsafe_spinlock_t my_lock;
 static void *
 lock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       sigset_t saved_signals;
       int i1, i2, value;
@@ -181,23 +179,22 @@ lock_checker_thread (void *arg)
 static void
 test_asyncsafe_spin (void)
 {
-  int i;
   gl_thread_t checkerthread;
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
 
   /* Spawn the threads.  */
   checkerthread = gl_thread_create (lock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] = gl_thread_create (lock_mutator_thread, NULL);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
   set_atomic_int_value (&lock_checker_done, 1);
   gl_thread_join (checkerthread, NULL);
index 9b0ca7f6e26afc26e4ca72c8b505a21e549619e5..e8fc0f74b74eb42ce3e567ceb0f2501850e40a62 100644 (file)
@@ -29,10 +29,8 @@ AT_INIT (init_squares);
 static void
 init_squares (void)
 {
-  int i;
-
   sum_of_squares = 0;
-  for (i = 0; i <= 100; i++)
+  for (int i = 0; i <= 100; i++)
     sum_of_squares += i * i;
 }
 
index 57c39f2e02181bb75d633c431b4af6b7a9e7f1c4..de6e5c456f59a9462e2f694fe7b602a9081b8092 100644 (file)
@@ -29,10 +29,8 @@ AT_INIT (init_cubes);
 static void
 init_cubes (void)
 {
-  int i;
-
   sum_of_cubes = 0;
-  for (i = 0; i <= 100; i++)
+  for (int i = 0; i <= 100; i++)
     sum_of_cubes += i * i *i;
 }
 
index 71d1003b0397acb06aa86c37737bbcfe389f9f20..03212b3d56119f577c8d0db6d4a8a6b532c60a38 100644 (file)
@@ -37,11 +37,11 @@ static const char *objects[15] =
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -99,10 +99,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -112,7 +110,7 @@ main (int argc, char *argv[])
     /* Create list2.  */
     list2 = gl_list_nx_create_empty (GL_AVLTREE_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -125,7 +123,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -406,7 +404,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -432,7 +430,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index abe1b67dd836d0f70991a8f80bf646c4848ebe59..a62f64f3e982717aa796e6314674b8a234204833 100644 (file)
@@ -45,11 +45,10 @@ check_equals (gl_omap_t map1, gl_omap_t map2)
   const void *value1;
   const void *key2;
   const void *value2;
-  size_t i;
 
   iter1 = gl_omap_iterator (map1);
   iter2 = gl_omap_iterator (map2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_omap_iterator_next (&iter1, &key1, &value1));
       ASSERT (gl_omap_iterator_next (&iter2, &key2, &value2));
@@ -80,8 +79,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_omap_nx_create_empty (GL_ARRAY_OMAP, (gl_mapkey_compar_fn) strcmp, NULL, NULL);
@@ -94,7 +91,7 @@ main (int argc, char *argv[])
     check_all (map1, map2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -102,7 +99,7 @@ main (int argc, char *argv[])
         check_all (map1, map2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index 02019bf4c988f80074e048b393ef353524d0db51..d3c556b1e22d2b0584fc06d72684d9c4af61f946 100644 (file)
@@ -45,11 +45,10 @@ check_equals (gl_oset_t set1, gl_oset_t set2)
   gl_oset_iterator_t iter1, iter2;
   const void *elt1;
   const void *elt2;
-  size_t i;
 
   iter1 = gl_oset_iterator (set1);
   iter2 = gl_oset_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_oset_iterator_next (&iter1, &elt1));
       ASSERT (gl_oset_iterator_next (&iter2, &elt2));
@@ -85,8 +84,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_oset_nx_create_empty (GL_ARRAY_OSET, (gl_setelement_compar_fn) strcmp, NULL);
@@ -99,14 +96,14 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_oset_nx_add (set1, obj) == gl_oset_nx_add (set2, obj));
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (4);
         switch (operation)
index dabd8df09a0b1277f81019e2c419fcfd2c30b4e0..515116c08af48278adfd1dd5235f74eb71c5d68e 100644 (file)
@@ -64,11 +64,11 @@ string_hash (const void *x)
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -126,10 +126,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -141,7 +139,7 @@ main (int argc, char *argv[])
     list2 = gl_list_nx_create_empty (GL_AVLTREEHASH_LIST,
                                      string_equals, string_hash, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -155,7 +153,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -436,7 +434,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -462,7 +460,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index a4664e763ceb499903fcc9442018b81c6bf59f6b..1942fdca95dc47531bcceac4fa52e2b51bb2ce5d 100644 (file)
@@ -32,8 +32,6 @@ SIGNATURE_CHECK (btoc32, wint_t, (int));
 int
 main (int argc, char *argv[])
 {
-  int c;
-
   /* configure should already have checked that the locale is supported.  */
   if (setlocale (LC_ALL, "") == NULL)
     return 1;
@@ -54,7 +52,7 @@ main (int argc, char *argv[])
       {
       case '1':
         /* C or POSIX locale.  */
-        for (c = 0; c < 0x100; c++)
+        for (int c = 0; c < 0x100; c++)
           if (c != 0)
             {
               /* We are testing all nonnull bytes.  */
@@ -75,17 +73,17 @@ main (int argc, char *argv[])
 
       case '2':
         /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
-        for (c = 0; c < 0x80; c++)
+        for (int c = 0; c < 0x80; c++)
           ASSERT (btoc32 (c) == c);
-        for (c = 0xA0; c < 0x100; c++)
+        for (int c = 0xA0; c < 0x100; c++)
           ASSERT (btoc32 (c) != WEOF);
         return test_exit_status;
 
       case '3':
         /* Locale encoding is UTF-8.  */
-        for (c = 0; c < 0x80; c++)
+        for (int c = 0; c < 0x80; c++)
           ASSERT (btoc32 (c) == c);
-        for (c = 0x80; c < 0x100; c++)
+        for (int c = 0x80; c < 0x100; c++)
           ASSERT (btoc32 (c) == WEOF);
         return test_exit_status;
       }
index de3c5603e854eb98dbb837342f0ffd5cb5f7afe2..4792bc7b993a74f587e46feef71a26d9b58636b9 100644 (file)
@@ -31,8 +31,6 @@ SIGNATURE_CHECK (btowc, wint_t, (int));
 int
 main (int argc, char *argv[])
 {
-  int c;
-
   /* configure should already have checked that the locale is supported.  */
   if (setlocale (LC_ALL, "") == NULL)
     return 1;
@@ -53,7 +51,7 @@ main (int argc, char *argv[])
       {
       case '1':
         /* C or POSIX locale.  */
-        for (c = 0; c < 0x100; c++)
+        for (int c = 0; c < 0x100; c++)
           if (c != 0)
             {
               /* We are testing all nonnull bytes.  */
@@ -72,17 +70,17 @@ main (int argc, char *argv[])
 
       case '2':
         /* Locale encoding is ISO-8859-1 or ISO-8859-15.  */
-        for (c = 0; c < 0x80; c++)
+        for (int c = 0; c < 0x80; c++)
           ASSERT (btowc (c) == c);
-        for (c = 0xA0; c < 0x100; c++)
+        for (int c = 0xA0; c < 0x100; c++)
           ASSERT (btowc (c) != WEOF);
         return test_exit_status;
 
       case '3':
         /* Locale encoding is UTF-8.  */
-        for (c = 0; c < 0x80; c++)
+        for (int c = 0; c < 0x80; c++)
           ASSERT (btowc (c) == c);
-        for (c = 0x80; c < 0x100; c++)
+        for (int c = 0x80; c < 0x100; c++)
           ASSERT (btowc (c) == WEOF);
         return test_exit_status;
       }
index c5eadb297e7b9263dbb7c62a32a1941164038582..afde2fae3712baca6ab5086fb81955dd9f2f3e75 100644 (file)
@@ -30,9 +30,7 @@
 static void
 test_agree_with_C_locale (void)
 {
-  int c;
-
-  for (c = 0; c <= UCHAR_MAX; c++)
+  for (int c = 0; c <= UCHAR_MAX; c++)
     {
       if (c_isascii (c))
         {
@@ -57,10 +55,9 @@ test_agree_with_C_locale (void)
 static void
 test_all (void)
 {
-  int c;
   int n_isascii = 0;
 
-  for (c = CHAR_MIN; c <= UCHAR_MAX; c++)
+  for (int c = CHAR_MIN; c <= UCHAR_MAX; c++)
     {
       if (! (0 <= c && c <= CHAR_MAX))
         {
index a84e565be42b65e0f04f72cd326c5c72b1dd7954..95c0b4343cabefdef309683512d19f2516aa7220 100644 (file)
@@ -224,9 +224,8 @@ main ()
       "with_multilib_list\n";
     size_t h_len = strlen (h);
     char *haystack = malloc (h_len + 1);
-    size_t i;
     ASSERT (haystack);
-    for (i = 0; i < h_len - strlen (needle); i++)
+    for (size_t i = 0; i < h_len - strlen (needle); i++)
       {
         const char *p;
         memcpy (haystack, h, h_len + 1);
index 7592bf1c6ecdeb1c366b2782771924b4904a6994..af79c7576e2d71e0f22329db8f6ce1f6f8effd9e 100644 (file)
@@ -198,9 +198,8 @@ main ()
       "with_multilib_list\n";
     size_t h_len = strlen (h);
     char *haystack = malloc (h_len + 1);
-    size_t i;
     ASSERT (haystack);
-    for (i = 0; i < h_len - strlen (needle); i++)
+    for (size_t i = 0; i < h_len - strlen (needle); i++)
       {
         const char *p;
         memcpy (haystack, h, h_len + 1);
index 20e4d30a86be5bc1cfdd74011096772635d51a27..abddb497887064e30f8cc7fcd48d3dc084a8d14e 100644 (file)
@@ -68,61 +68,57 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the alphanumeric characters include only the ASCII A ... Z and a ... z
          and 0 ... 9 characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index c9d2c19ff041592f77d82da2405091008cfb9924..a893546ed4093c0401bf4bd05af8fcb44d0e5e06 100644 (file)
@@ -68,59 +68,55 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the alphabetic characters include only the ASCII A ... Z and a ... z
          characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 0d91986758d93aae3d2f5c3820beb6ca9186358b..abbc792e5efe98094288cbe607cb9c03ca31770a 100644 (file)
@@ -67,49 +67,45 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the blank characters include only the ASCII <space> and <tab>
          characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t':
-        #if !(defined __FreeBSD__ || defined __NetBSD__)
-        case '\v':
-        #endif
-        #if !defined __NetBSD__
-        case '\f':
-        #endif
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          if (c == '\t' || c == ' ')
-            ASSERT (is != 0);
-          else
-            ASSERT (is == 0);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t':
+      #if !(defined __FreeBSD__ || defined __NetBSD__)
+      case '\v':
+      #endif
+      #if !defined __NetBSD__
+      case '\f':
+      #endif
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        if (c == '\t' || c == ' ')
+          ASSERT (is != 0);
+        else
+          ASSERT (is == 0);
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index d9a98f894c834ef58e2d73db31cf43d568dff205..28c5a25c12421eb057f2fdd442af9f9c464e82e2 100644 (file)
@@ -62,48 +62,44 @@ main (int argc, char *argv[])
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of control characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 4300da1886632d546e20bfb6092cfc93d1348792..fe42c48ffaca6ebd1de0badf22da667c647338e1 100644 (file)
@@ -61,49 +61,45 @@ main (int argc, char *argv[])
   /* Test single-byte characters.
      ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits
      include only the ASCII 0 ... 9 characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index f6f7276ff800565217416d096eac847d714712bd..d391989c62f7969df2b73e321f76fc18b6fc9d57 100644 (file)
@@ -62,49 +62,45 @@ main (int argc, char *argv[])
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of graphic characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-            case ' ':
-              ASSERT (is == 0);
-              break;
-            default:
-              ASSERT (is != 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+          case ' ':
+            ASSERT (is == 0);
+            break;
+          default:
+            ASSERT (is != 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index a66199f84ff152549f75a0426c2141f96211f0c6..b0ce4de2d4e04183122adcebf44d06d1073a167b 100644 (file)
@@ -67,53 +67,49 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the lowercase characters include only the ASCII a ... z characters.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index b025d7cb4c3850bce81f8c0e3f7392cc885f718e..ccbe975fe944bbb07e9a519f5b5f3c9af34cba03 100644 (file)
@@ -62,48 +62,44 @@ main (int argc, char *argv[])
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of printable characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-              ASSERT (is == 0);
-              break;
-            default:
-              ASSERT (is != 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+            ASSERT (is == 0);
+            break;
+          default:
+            ASSERT (is != 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 535d0c4998a2a9876262fff981682e8cbc537d16..3f0aa1b614746473dbbffbb2101b265e9550702c 100644 (file)
@@ -62,74 +62,70 @@ main (int argc, char *argv[])
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of punctuation or symbol characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case ' ':
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              /* c is an alphanumeric or space character.  */
-              ASSERT (is == 0);
-              break;
-            case '!': case '"': case '#': case '%':
-            case '&': case '\'': case '(': case ')': case '*':
-            case '+': case ',': case '-': case '.': case '/':
-            case ':': case ';': case '<': case '=': case '>':
-            case '?':
-            case '[': case '\\': case ']': case '^': case '_':
-            case '{': case '|': case '}': case '~':
-              /* These characters are usually expected to be punctuation or
-                 symbol characters.  */
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case ' ':
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            /* c is an alphanumeric or space character.  */
+            ASSERT (is == 0);
+            break;
+          case '!': case '"': case '#': case '%':
+          case '&': case '\'': case '(': case ')': case '*':
+          case '+': case ',': case '-': case '.': case '/':
+          case ':': case ';': case '<': case '=': case '>':
+          case '?':
+          case '[': case '\\': case ']': case '^': case '_':
+          case '{': case '|': case '}': case '~':
+            /* These characters are usually expected to be punctuation or
+               symbol characters.  */
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 6381e42d32a90e8c74814e6bd3dd97f422b63711..f66851332010310d2642d763274df335ad46d1a5 100644 (file)
@@ -68,49 +68,45 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the white-space characters include only the ASCII <space>, <form-feed>,
          <newline>, <carriage-return>, <tab>, <vertical-tab> characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\f': case '\n': case '\r': case '\t': case '\v':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set" or one of the explicitly
-             mentioned white-space characters.  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\f': case '\n': case '\r': case '\t': case '\v':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set" or one of the explicitly
+           mentioned white-space characters.  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 460328ea4619b2a6677f77e25735a144b8494cb0..44277662a4a42029cdb8eb2a2a256db8dd605910 100644 (file)
@@ -67,53 +67,49 @@ main (int argc, char *argv[])
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the uppercase characters include only the ASCII A ... Z characters.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index c433fe441a62ffa94058ff0fea8d5fa7e418eb28..c3d1136ec93f4c67c9a402d79346db841d567bc3 100644 (file)
@@ -61,51 +61,47 @@ main (int argc, char *argv[])
   /* Test single-byte characters.
      ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal
      digits include only the ASCII 0 ... 9 A ... F a ... f characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-            case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+          case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 9ee863013b0381b796e05d9e3fb9a00db88fb897..a13e17d3fc8c7668eb598b6dd0c79dc894b75435 100644 (file)
@@ -97,40 +97,36 @@ test_one_locale (const char *name, int codepage)
   }
 
   /* Test single bytes.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          ret = c32rtomb (buf, btoc32 (c), NULL);
-          ASSERT (ret == 1);
-          ASSERT (buf[0] == (char) c);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        ret = c32rtomb (buf, btoc32 (c), NULL);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == (char) c);
+        break;
+      }
 
   /* Test special calling convention, passing a NULL pointer.  */
   {
@@ -318,10 +314,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index 14dc60fa8543b034738d45741e825662b87fff60..f3bc34dc45552858916cfdc4a37c9cbb60961968 100644 (file)
@@ -72,40 +72,36 @@ main (int argc, char *argv[])
   }
 
   /* Test single bytes.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          ret = c32rtomb (buf, btoc32 (c), NULL);
-          ASSERT (ret == 1);
-          ASSERT (buf[0] == (char) c);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        ret = c32rtomb (buf, btoc32 (c), NULL);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == (char) c);
+        break;
+      }
 
   /* Test special calling convention, passing a NULL pointer.  */
   {
index b1a95e5a8d3ed54e463ec4208781b0d180e3b6bc..388a72154710fb4091a5e1699e23dba6e7d85e22 100644 (file)
@@ -40,17 +40,13 @@ main (int argc, char *argv[])
   if (argc > 1)
     {
       char32_t input[10];
-      size_t n;
       const char32_t *src;
       #define BUFSIZE 20
       char buf[BUFSIZE];
       size_t ret;
 
-      {
-        size_t i;
-        for (i = 0; i < BUFSIZE; i++)
-          buf[i] = '_';
-      }
+      for (size_t i = 0; i < BUFSIZE; i++)
+        buf[i] = '_';
 
       switch (argv[1][0])
         {
@@ -62,7 +58,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = c32snrtombs (NULL, &src, 6, n, NULL);
@@ -91,7 +87,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 src = input;
                 ret = c32snrtombs (NULL, &src, 6, n, NULL);
@@ -128,7 +124,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = c32snrtombs (NULL, &src, 6, n, NULL);
@@ -172,7 +168,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 src = input;
                 ret = c32snrtombs (NULL, &src, 6, n, NULL);
index dc6cec4f3390246fe0c5d824abb1a55c75e10d57..2cb2bd5a329eafe3fba2ad317ea8f216b2ea8d3f 100644 (file)
@@ -40,17 +40,13 @@ main (int argc, char *argv[])
   if (argc > 1)
     {
       char32_t input[10];
-      size_t n;
       const char32_t *src;
       #define BUFSIZE 20
       char buf[BUFSIZE];
       size_t ret;
 
-      {
-        size_t i;
-        for (i = 0; i < BUFSIZE; i++)
-          buf[i] = '_';
-      }
+      for (size_t i = 0; i < BUFSIZE; i++)
+        buf[i] = '_';
 
       switch (argv[1][0])
         {
@@ -62,7 +58,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = c32srtombs (NULL, &src, n, NULL);
@@ -91,7 +87,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 src = input;
                 ret = c32srtombs (NULL, &src, n, NULL);
@@ -128,7 +124,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = c32srtombs (NULL, &src, n, NULL);
@@ -172,7 +168,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 src = input;
                 ret = c32srtombs (NULL, &src, n, NULL);
index 285de6c2758a0dfd51797274261f7461f980ed06..8de53349c0b4dcde2c7552f4adc7a17f79102b58 100644 (file)
@@ -40,16 +40,12 @@ main (int argc, char *argv[])
   if (argc > 1)
     {
       char32_t input[10];
-      size_t n;
       #define BUFSIZE 20
       char buf[BUFSIZE];
       size_t ret;
 
-      {
-        size_t i;
-        for (i = 0; i < BUFSIZE; i++)
-          buf[i] = '_';
-      }
+      for (size_t i = 0; i < BUFSIZE; i++)
+        buf[i] = '_';
 
       switch (argv[1][0])
         {
@@ -61,7 +57,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 ret = c32stombs (NULL, input, n);
                 ASSERT (ret == 5);
@@ -86,7 +82,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 ret = c32stombs (NULL, input, n);
                 ASSERT (ret == 10);
@@ -115,7 +111,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 ret = c32stombs (NULL, input, n);
                 ASSERT (ret == 8);
@@ -151,7 +147,7 @@ main (int argc, char *argv[])
             ret = mbstoc32s (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 15; n++)
+            for (size_t n = 0; n < 15; n++)
               {
                 ret = c32stombs (NULL, input, n);
                 ASSERT (ret == 12);
index f118021ee457e6dae5a45ace85ab6ebfe9494e11..e22f31cc890f5b50cbf06dae84955f53bb07ddf2 100644 (file)
@@ -99,55 +99,51 @@ main (int argc, char *argv[])
      See <https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57339>.  */
   if (!(argc > 1 && argv[1][0] == '4'))
 #endif
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          mb = for_character (buf, 1);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-              ASSERT (mb.nbytes == 1);
-              ASSERT ((unsigned char) mb.buf[0] == (unsigned char) c - 'A' + 'a');
-              break;
-            default:
-              ASSERT (mb.nbytes == 1);
-              ASSERT ((unsigned char) mb.buf[0] == c);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        mb = for_character (buf, 1);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+            ASSERT (mb.nbytes == 1);
+            ASSERT ((unsigned char) mb.buf[0] == (unsigned char) c - 'A' + 'a');
+            break;
+          default:
+            ASSERT (mb.nbytes == 1);
+            ASSERT ((unsigned char) mb.buf[0] == c);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index c868c23d28f45537ca784eebb3d14622d476d82c..6ad946a234c50014381d13c471ae28fca3443b80 100644 (file)
@@ -99,55 +99,51 @@ main (int argc, char *argv[])
      See <https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57339>.  */
   if (!(argc > 1 && argv[1][0] == '4'))
 #endif
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          mb = for_character (buf, 1);
-          switch (c)
-            {
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (mb.nbytes == 1);
-              ASSERT ((unsigned char) mb.buf[0] == (unsigned char) c - 'a' + 'A');
-              break;
-            default:
-              ASSERT (mb.nbytes == 1);
-              ASSERT ((unsigned char) mb.buf[0] == c);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        mb = for_character (buf, 1);
+        switch (c)
+          {
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (mb.nbytes == 1);
+            ASSERT ((unsigned char) mb.buf[0] == (unsigned char) c - 'a' + 'A');
+            break;
+          default:
+            ASSERT (mb.nbytes == 1);
+            ASSERT ((unsigned char) mb.buf[0] == c);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index d9eec4a7402ad0cf3d28fbe6a078e4999e4f839b..0831b59ddbc7472498ccc4871436359bb8621063 100644 (file)
@@ -33,12 +33,10 @@ SIGNATURE_CHECK (c32width, int, (char32_t));
 int
 main ()
 {
-  char32_t wc;
-
 #if !GNULIB_WCHAR_SINGLE_LOCALE
 # ifdef C_CTYPE_ASCII
   /* Test width of ASCII characters.  */
-  for (wc = 0x20; wc < 0x7F; wc++)
+  for (char32_t wc = 0x20; wc < 0x7F; wc++)
     ASSERT (c32width (wc) == 1);
 # endif
 #endif
@@ -53,7 +51,7 @@ main ()
       && strcmp (locale_charset (), "UTF-8") == 0)
     {
       /* Test width of ASCII characters.  */
-      for (wc = 0x20; wc < 0x7F; wc++)
+      for (char32_t wc = 0x20; wc < 0x7F; wc++)
         ASSERT (c32width (wc) == 1);
 
       /* Test width of some non-spacing characters.  */
index 34d6467d774e1aab4793e2d90b6e27e4e881584f..d56736c0ce69ea327241bcd538e2e1b200ba54e1 100644 (file)
@@ -108,9 +108,8 @@ static int
 once_contender_thread (void *arg)
 {
   int id = (int) (intptr_t) arg;
-  int repeat;
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Tell the main thread that we're ready.  */
       ASSERT (mtx_lock (&ready_lock[id]) == thrd_success);
@@ -145,17 +144,16 @@ once_contender_thread (void *arg)
 static void
 test_once (void)
 {
-  int i, repeat;
   thrd_t threads[THREAD_COUNT];
 
   /* Initialize all variables.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     {
       ready[i] = 0;
       ASSERT (mtx_init (&ready_lock[i], mtx_plain) == thrd_success);
     }
 #if ENABLE_LOCKING
-  for (i = 0; i < REPEAT_COUNT; i++)
+  for (int i = 0; i < REPEAT_COUNT; i++)
     gl_rwlock_init (fire_signal[i]);
 #else
   fire_signal_state = 0;
@@ -163,24 +161,24 @@ test_once (void)
 
 #if ENABLE_LOCKING
   /* Block all fire_signals.  */
-  for (i = REPEAT_COUNT-1; i >= 0; i--)
+  for (int i = REPEAT_COUNT-1; i >= 0; i--)
     gl_rwlock_wrlock (fire_signal[i]);
 #endif
 
   /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_create (&threads[i],
                          once_contender_thread, (void *) (intptr_t) i)
             == thrd_success);
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Wait until every thread is ready.  */
       dbgprintf ("Main thread before synchronizing for round %d\n", repeat);
       for (;;)
         {
           int ready_count = 0;
-          for (i = 0; i < THREAD_COUNT; i++)
+          for (int i = 0; i < THREAD_COUNT; i++)
             {
               ASSERT (mtx_lock (&ready_lock[i]) == thrd_success);
               ready_count += ready[i];
@@ -210,7 +208,7 @@ test_once (void)
       performed = 0;
 
       /* Preparation for the next round: Reset the ready flags.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         {
           ASSERT (mtx_lock (&ready_lock[i]) == thrd_success);
           ready[i] = 0;
@@ -227,7 +225,7 @@ test_once (void)
     }
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_join (threads[i], NULL) == thrd_success);
 }
 
index f0182377b90491cf57a9005742ee275c7ebba926..0941ae938f45f3750b420b3560c3316d3684e329 100644 (file)
@@ -35,11 +35,11 @@ static const char *objects[15] =
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -95,10 +95,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -108,7 +106,7 @@ main (int argc, char *argv[])
     /* Create list2.  */
     list2 = gl_list_nx_create_empty (GL_CARRAY_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -121,7 +119,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -402,7 +400,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -428,7 +426,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index 7ef67ebfbd91528df23ac274ec09b2cf5485d563..58ef181569085157342888c781945c0c41037a90 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -30,7 +28,7 @@ test_function (void)
     * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       DOUBLE x = L_(32.0) * RANDOM[i] - L_(16.0); /* -16.0 <= x <= 16.0 */
       DOUBLE y = CBRT (x);
@@ -39,8 +37,8 @@ test_function (void)
               && err < L_(4.0) * L_(16.0) / TWO_MANT_DIG);
     }
 
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
       {
         DOUBLE x = L_(32.0) * RANDOM[i] - L_(16.0); /* -16.0 <= x <= 16.0 */
         DOUBLE y = L_(32.0) * RANDOM[j] - L_(16.0); /* -16.0 <= y <= 16.0 */
index bf02fd3c12927e8e480e4ceec8ca87764e291da5..41ef3552fc6c09a513a9eeaf5cb43d5ee160c57a 100644 (file)
@@ -153,11 +153,9 @@ check (double x)
 int
 main ()
 {
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 64-NUM_HIGHBITS bits.  */
index 4b424430afa8f41aad73e51c64bc92896b1ca656..e549a8082550cc78a40b45760a8f8496834e344a 100644 (file)
@@ -153,11 +153,9 @@ check (float x)
 int
 main ()
 {
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 32-NUM_HIGHBITS bits.  */
index e32e75e2dbe66095834382c98dd905878d3a4785..4d88c574d1f36cbfad13dde81c960f9a84a8fd99 100644 (file)
 int
 main (int argc, char *argv[])
 {
-  int i, j;
-
 #define TEST_COUNT_LEADING_ZEROS(FUNC, TYPE, BITS, MAX, ONE)     \
   ASSERT (FUNC (0) == BITS);                                     \
-  for (i = 0; i < BITS; i++)                                     \
+  for (int i = 0; i < BITS; i++)                                 \
     {                                                            \
       ASSERT (FUNC (ONE << i) == BITS - i - 1);                  \
-      for (j = 0; j < i; j++)                                    \
+      for (int j = 0; j < i; j++)                                \
         ASSERT (FUNC ((ONE << i) | (ONE << j)) == BITS - i - 1); \
     }                                                            \
-  for (i = 0; i < 1000; i++)                                     \
+  for (int i = 0; i < 1000; i++)                                 \
     {                                                            \
       /* RAND_MAX is most often 0x7fff or 0x7fffffff.  */        \
       TYPE value =                                               \
@@ -57,7 +55,7 @@ main (int argc, char *argv[])
            ^ (((TYPE) rand () >> 3) << 22)                       \
            ^ (((TYPE) rand () >> 3) << 22 << 22));               \
       int count = 0;                                             \
-      for (j = 0; j < BITS; j++)                                 \
+      for (int j = 0; j < BITS; j++)                             \
         if (value & (ONE << j))                                  \
           count = BITS - j - 1;                                  \
       ASSERT (count == FUNC (value));                            \
index 4ffa3309b11f5cb1338fd13ce4bdb4e6bfd0b3a3..a44ceb2ed02c8253d628b90aae635c79c1992eb1 100644 (file)
 int
 main (int argc, char *argv[])
 {
-  int i, j;
-
 #define TEST_COUNT_ONE_BITS(FUNC, TYPE, BITS, MAX, ONE)   \
   ASSERT (FUNC (0) == 0);                                 \
-  for (i = 0; i < BITS; i++)                              \
+  for (int i = 0; i < BITS; i++)                          \
     {                                                     \
       ASSERT (FUNC (ONE << i) == 1);                      \
-      for (j = i + 1; j < BITS; j++)                      \
+      for (int j = i + 1; j < BITS; j++)                  \
         ASSERT (FUNC ((ONE << i) | (ONE << j)) == 2);     \
     }                                                     \
-  for (i = 0; i < 1000; i++)                              \
+  for (int i = 0; i < 1000; i++)                          \
     {                                                     \
       /* RAND_MAX is most often 0x7fff or 0x7fffffff.  */ \
       TYPE value =                                        \
@@ -57,7 +55,7 @@ main (int argc, char *argv[])
            ^ (((TYPE) rand () >> 3) << 22)                \
            ^ (((TYPE) rand () >> 3) << 22 << 22));        \
       int count = 0;                                      \
-      for (j = 0; j < BITS; j++)                          \
+      for (int j = 0; j < BITS; j++)                      \
         count += (value & (ONE << j)) != 0;               \
       ASSERT (count == FUNC (value));                     \
     }                                                     \
index ce44a63674360b5daad25cfac765b742f0091e30..99ab851df421c1aea25e2d0c07b6c0eaa9a71325 100644 (file)
 int
 main (int argc, char *argv[])
 {
-  int i, j;
-
 #define TEST_COUNT_TRAILING_ZEROS(FUNC, TYPE, BITS, MAX, ONE) \
   ASSERT (FUNC (0) == BITS);                                  \
-  for (i = 0; i < BITS; i++)                                  \
+  for (int i = 0; i < BITS; i++)                              \
     {                                                         \
       ASSERT (FUNC (ONE << i) == i);                          \
-      for (j = 0; j < i; j++)                                 \
+      for (int j = 0; j < i; j++)                             \
         ASSERT (FUNC ((ONE << i) | (ONE << j)) == j);         \
     }                                                         \
-  for (i = 0; i < 1000; i++)                                  \
+  for (int i = 0; i < 1000; i++)                              \
     {                                                         \
       /* RAND_MAX is most often 0x7fff or 0x7fffffff.  */     \
       TYPE value =                                            \
@@ -57,7 +55,7 @@ main (int argc, char *argv[])
            ^ (((TYPE) rand () >> 3) << 22)                    \
            ^ (((TYPE) rand () >> 3) << 22 << 22));            \
       int count = 0;                                          \
-      for (j = BITS - 1; 0 <= j; j--)                         \
+      for (int j = BITS - 1; 0 <= j; j--)                     \
         if (value & (ONE << j))                               \
           count = j;                                          \
       ASSERT (count == FUNC (value));                         \
index 4a3f8f2721b653a8fba5ff9836147b09a4919434..927b287c76eaf5c1dc7322f48d3356d8a2f0867a 100644 (file)
@@ -60,7 +60,6 @@ int
 main (void)
 {
   uint32_t p;
-  size_t i, j;
   char data[MAX_ALIGNMENT * 3];
 
   p = crc32_update_no_xor (42, "foo", 3);
@@ -101,7 +100,7 @@ main (void)
 
   /* Test for trailing unaligned bytes */
 
-  for (i = 0; i < MAX_ALIGNMENT; i++)
+  for (size_t i = 0; i < MAX_ALIGNMENT; i++)
     {
       p = crc32_update_no_xor (0, randomb, MAX_ALIGNMENT + i);
       if (p != trailing_unaligned_byte_hashes[i])
@@ -114,7 +113,7 @@ main (void)
 
   /* Test for leading unaligned bytes */
 
-  for (i = 0; i < MAX_ALIGNMENT; i++)
+  for (size_t i = 0; i < MAX_ALIGNMENT; i++)
     {
       p = crc32_update_no_xor (0, randomb + i, (MAX_ALIGNMENT * 2) - i);
       if (p != leading_unaligned_byte_hashes[i])
@@ -127,8 +126,8 @@ main (void)
 
   /* Combined test of multiple lengths at multiple alignments */
 
-  for (i = 0; i < MAX_ALIGNMENT; i++)
-    for (j = 0; j < MAX_ALIGNMENT; j++)
+  for (size_t i = 0; i < MAX_ALIGNMENT; i++)
+    for (size_t j = 0; j < MAX_ALIGNMENT; j++)
       {
         memcpy (data + i, randomb, MAX_ALIGNMENT * 2);
         p = crc32_update_no_xor (0, data + i, j);
index 5c8e6319b124a581caf7c9b359ecac93a30a63cc..917fef55e9950284e5d3e377326d4f6acd6d65e2 100644 (file)
@@ -31,14 +31,13 @@ main (int argc, char *argv[])
    * DES Maintenance Test
    */
   {
-    int i;
     char key[8] = { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };
     char input[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
     char result[8] = { 0x24, 0x6e, 0x9d, 0xb9, 0xc5, 0x50, 0x38, 0x1a };
     char temp1[8], temp2[8], temp3[8];
     gl_des_ctx des;
 
-    for (i = 0; i < 64; ++i)
+    for (int i = 0; i < 64; ++i)
       {
         gl_des_setkey (&des, key);
         gl_des_ecb_encrypt (&des, input, temp1);
@@ -57,7 +56,6 @@ main (int argc, char *argv[])
    * Self made Triple-DES test  (Does somebody know an official test?)
    */
   {
-    int i;
     char input[8] = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
     char key1[8] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 };
     char key2[8] = { 0x11, 0x22, 0x33, 0x44, 0xff, 0xaa, 0xcc, 0xdd };
@@ -65,7 +63,7 @@ main (int argc, char *argv[])
 
     gl_3des_ctx des3;
 
-    for (i = 0; i < 16; ++i)
+    for (int i = 0; i < 16; ++i)
       {
         gl_3des_set2keys (&des3, key1, key2);
         gl_3des_ecb_encrypt (&des3, input, key1);
@@ -191,10 +189,9 @@ main (int argc, char *argv[])
     };
 
     char result[8];
-    int i;
     gl_3des_ctx des3;
 
-    for (i = 0; i < sizeof (testdata) / sizeof (*testdata); ++i)
+    for (int i = 0; i < sizeof (testdata) / sizeof (*testdata); ++i)
       {
         gl_3des_set3keys (&des3, testdata[i].key,
                           testdata[i].key + 8, testdata[i].key + 16);
index d7040c0b04f0c07dc900754e44a203478563b633..bddf89d6e1bb5229b6268268ab44fb3e7f1ec164 100644 (file)
@@ -42,13 +42,10 @@ main (void)
   ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 1);
   ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 0); /* dup */
 
-  {
-    unsigned int i;
-    for (i = 0; i < 3000; i++)
-      ASSERT (di_set_insert (dis, 9, i) == 1);
-    for (i = 0; i < 3000; i++)
-      ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
-  }
+  for (unsigned int i = 0; i < 3000; i++)
+    ASSERT (di_set_insert (dis, 9, i) == 1);
+  for (unsigned int i = 0; i < 3000; i++)
+    ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
 
   di_set_free (dis);
 
index 6f6ef738e1024ea150823751ce41ac676ce8c530..4e3e330e2294515c357ce4dae5d84ee61dbf97e5 100644 (file)
@@ -22,10 +22,9 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
                       const void *expected_for_small_file,
                       const void *expected_for_large_file)
 {
-  int pass;
   unlink (TESTFILE);
 
-  for (pass = 0; pass < 5; pass++)
+  for (int pass = 0; pass < 5; pass++)
     {
       {
         FILE *fp = fopen (TESTFILE, "wb");
@@ -53,17 +52,14 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
             FALLTHROUGH;
           case 3:
             /* Fill the large file (8 MiB).  */
-            {
-              unsigned int i;
-              for (i = 0; i < 0x400000; i++)
-                {
-                  unsigned char c[2];
-                  unsigned int j = i * (i-1) * (i-5);
-                  c[0] = (unsigned char)(j >> 6);
-                  c[1] = (i % 499) + (i % 101);
-                  fwrite (c, 1, 2, fp);
-                }
-            }
+            for (unsigned int i = 0; i < 0x400000; i++)
+              {
+                unsigned char c[2];
+                unsigned int j = i * (i-1) * (i-5);
+                c[0] = (unsigned char)(j >> 6);
+                c[1] = (i % 499) + (i % 101);
+                fwrite (c, 1, 2, fp);
+              }
             break;
           }
         if (ferror (fp))
@@ -117,14 +113,13 @@ test_digest_on_files (int (*streamfunc) (FILE *, void *),
           }
         if (memcmp (digest, expected, digest_size) != 0)
           {
-            size_t i;
             fprintf (stderr, "%s produced wrong result.\n", streamfunc_name);
             fprintf (stderr, "Expected: ");
-            for (i = 0; i < digest_size; i++)
+            for (size_t i = 0; i < digest_size; i++)
               fprintf (stderr, "\\x%02x", ((const unsigned char *) expected)[i]);
             fprintf (stderr, "\n");
             fprintf (stderr, "Got:      ");
-            for (i = 0; i < digest_size; i++)
+            for (size_t i = 0; i < digest_size; i++)
               fprintf (stderr, "\\x%02x", ((const unsigned char *) digest)[i]);
             fprintf (stderr, "\n");
             exit (1);
index 024bd3849754da0a2b49b1be30b5e8630b7ba37d..ff9c04fc662271ba71e82da0753f73d530096d4b 100644 (file)
@@ -38,7 +38,6 @@ static FILE *myerr;
 int
 main (void)
 {
-  int i;
   DIR *dp;
   /* The dirent-safer module works without the use of fdopendir (which
      would also pull in fchdir and openat); but if those modules were
@@ -62,7 +61,7 @@ main (void)
 
   /* Four iterations, with progressively more standard descriptors
      closed.  */
-  for (i = -1; i <= STDERR_FILENO; i++)
+  for (int i = -1; i <= STDERR_FILENO; i++)
     {
       if (0 <= i)
         ASSERT (close (i) == 0);
index 0a0799e3864a54a7f0a57545351205370dd25492..b7ae8c12819d760052f2b3410b3473cbb2c14757 100644 (file)
@@ -130,10 +130,9 @@ static struct test tests[] = {
 int
 main (void)
 {
-  struct test *t;
   bool ok = true;
 
-  for (t = tests; t->name; t++)
+  for (struct test *t = tests; t->name; t++)
     {
       char *dir = dir_name (t->name);
       int dirlen = dir_len (t->name);
index 2315a83fe72cd5710c0b509a3bd441ffecad7dfd..088108c3465897a787b708c134d203d05b6babb8 100644 (file)
@@ -127,9 +127,8 @@ main (int argc, char *argv[])
     {
       /* Perform the test and test whether it triggers a permanent memory
          allocation of more than MAX_ALLOC_TOTAL bytes.  */
-      int repeat;
 
-      for (repeat = 0; repeat < NUM_ROUNDS; repeat++)
+      for (int repeat = 0; repeat < NUM_ROUNDS; repeat++)
         {
           /* This may produce a temporary memory allocation of 11000 bytes.
              but should not result in a permanent memory allocation.  */
index de19e8c386d74c9efeb9caeeec514e23c74bd8df..ae71d399c18674bb5138037433d257b32428daaf 100644 (file)
@@ -113,7 +113,6 @@ is_mode (int fd, int mode)
 int
 main (void)
 {
-  int i;
   int fd;
   int bad_fd = getdtablesize ();
 
@@ -128,7 +127,7 @@ main (void)
 
   /* Four iterations, with progressively more standard descriptors
      closed.  */
-  for (i = -1; i <= STDERR_FILENO; i++)
+  for (int i = -1; i <= STDERR_FILENO; i++)
     {
       if (0 <= i)
         ASSERT (close (i) == 0);
index 20d9ea0c7cba9c9c6772cb5aa4f4f5c1fd917338..ac0d58a504ba3deb6ae8d6b71376ed4140042db5 100644 (file)
@@ -78,13 +78,12 @@ is_cloexec (int fd)
 int
 main ()
 {
-  int use_cloexec;
   int bad_fd = getdtablesize ();
 
 #if O_CLOEXEC
-  for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++)
+  for (int use_cloexec = 0; use_cloexec <= 1; use_cloexec++)
 #else
-  use_cloexec = 0;
+  int use_cloexec = 0;
 #endif
     {
       const char *file = "test-dup3.tmp";
index 5a7d18dccc960b2145c4ed97a57942472cf1cd63..70ff3582d63205ab912fd90f84167cf1698d3f42 100644 (file)
@@ -37,12 +37,11 @@ int
 main ()
 {
   struct int_sequence s;
-  int i;
 
   intseq_init (&s);
-  for (i = 0; i < N; i++)
+  for (int i = 0; i < N; i++)
     intseq_add (&s, value_at (i));
-  for (i = N - 1; i >= N / 2; i--)
+  for (int i = N - 1; i >= N / 2; i--)
     {
       ASSERT (* intseq_at (&s, i) == value_at (i));
       intseq_remove_last (&s);
index 8bfe33103758f51853e40e2f0822d00a7daf3147..b589728bbcd0fbddbd1543b845dff4393d8c00e1 100644 (file)
@@ -27,9 +27,8 @@ int
 main (int argc, char* argv[])
 {
   /* Print the arguments.  */
-  int i;
   printf ("argc = %d\n", argc);
-  for (i = 1; i < argc; i++)
+  for (int i = 1; i < argc; i++)
     printf ("argv[%d] = |%s|\n", i, argv[i]);
 
   /* Print a particular environment variable.  */
index 00d67dd062db496f162ed1acec13410561fbdb0d..22846a82bdf18fe1034c450b2f755b958649c3a1 100644 (file)
@@ -33,8 +33,7 @@ static const char *
 get_environ_assignment (const char *name)
 {
   size_t name_len = strlen (name);
-  char **p;
-  for (p = environ; *p != NULL; p++)
+  for (char **p = environ; *p != NULL; p++)
     {
       const char *assignment = *p;
       if (strncmp (assignment, name, name_len) == 0
index 6e5a209eaeaeaeb9fefc2a21a07a2d32352c5c66..3adf6e94e8fb806664900dc36a3da3855bed2ffa 100644 (file)
@@ -185,8 +185,7 @@ main (int argc, char *argv[])
         char buf[300];
         buf[0] = '\0';
         char *p = buf;
-        int fd;
-        for (fd = 0; fd < 20; fd++)
+        for (int fd = 0; fd < 20; fd++)
           if (is_open (fd) && !(is_qemu && fd == 3))
             {
               sprintf (p, "%d ", fd);
index 102ed49f9221068f27816be3f13fac12d676a8a1..f1f2bd1efb9dc0b2a70913fa3bb57bfba12e6699 100644 (file)
@@ -88,11 +88,8 @@ main (int argc, char *argv[])
       #if HAVE_CLOSE_RANGE
       if (close_range (3, 20 - 1, 0) < 0)
       #endif
-        {
-          int fd;
-          for (fd = 3; fd < 20; fd++)
-            close (fd);
-        }
+        for (int fd = 3; fd < 20; fd++)
+          close (fd);
       break;
     default:
       break;
index 130490983730e685189c009f604e6f76f227f2a8..90b2bd75d16e5c91309cc4d9108842641dce70a0 100644 (file)
@@ -46,22 +46,18 @@ main ()
   FILE *fp = freopen (DATA_FILENAME, "w", stdout);
   ASSERT (fp != NULL);
 
-  {
-    size_t i;
-
-    for (i = 0; i < 2; i++)
-      {
-        const char *progname =
-          (i == 0 ? "executable-script" : "executable-script.sh");
-        const char *prog_path =
-          (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
-        const char *prog_argv[2] = { prog_path, NULL };
-
-        int ret = execute (progname, prog_argv[0], prog_argv, NULL, NULL,
-                           false, false, false, false, true, false, NULL);
-        ASSERT (ret == 127);
-      }
-  }
+  for (size_t i = 0; i < 2; i++)
+    {
+      const char *progname =
+        (i == 0 ? "executable-script" : "executable-script.sh");
+      const char *prog_path =
+        (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
+      const char *prog_argv[2] = { prog_path, NULL };
+
+      int ret = execute (progname, prog_argv[0], prog_argv, NULL, NULL,
+                         false, false, false, false, true, false, NULL);
+      ASSERT (ret == 127);
+    }
 
 #if defined _WIN32 && !defined __CYGWIN__
   /* On native Windows, scripts - even with '#!' marker - are not executable.
index 0547dee6ca752e5da9b2fbf21d541870a9fb0e44..e59e46b8506cadc9aef7586a5d0394f29f327cf9 100644 (file)
@@ -33,8 +33,7 @@ static const char *
 get_environ_assignment (const char *name)
 {
   size_t name_len = strlen (name);
-  char **p;
-  for (p = environ; *p != NULL; p++)
+  for (char **p = environ; *p != NULL; p++)
     {
       const char *assignment = *p;
       if (strncmp (assignment, name, name_len) == 0
index 3e2b705103326517960a730d61a200ca211fc036..b19c02904d038898a6395a18701b09ce9f479270 100644 (file)
@@ -33,8 +33,7 @@ static const char *
 get_environ_assignment (const char *name)
 {
   size_t name_len = strlen (name);
-  char **p;
-  for (p = environ; *p != NULL; p++)
+  for (char **p = environ; *p != NULL; p++)
     {
       const char *assignment = *p;
       if (strncmp (assignment, name, name_len) == 0
index 4deebed530cfe4027048493df17f54deb6a574a8..a52cec41771beb26aba40a4ac5ccbdb85542311b 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -46,7 +44,7 @@ test_function (void)
 #endif
        : L_(2.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = EXP (x);
@@ -72,8 +70,8 @@ test_function (void)
 #endif
        : L_(24.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(32.0) * RANDOM[i] - L_(16.0); /* -16.0 <= x <= 16.0 */
           DOUBLE y = L_(32.0) * RANDOM[j] - L_(16.0); /* -16.0 <= y <= 16.0 */
index 04d3104a5be51edb47000abd6610ca612fbb25dd..79b7695ceb9c253c82d2a9a95348e5e8bdbfc579 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -82,7 +80,7 @@ test_function (void)
 #endif
        : L_(3.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = EXP2 (x);
@@ -106,8 +104,8 @@ test_function (void)
 #endif
        : L_(11.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(32.0) * RANDOM[i] - L_(16.0); /* -16.0 <= x <= 16.0 */
           DOUBLE y = L_(32.0) * RANDOM[j] - L_(16.0); /* -16.0 <= y <= 16.0 */
index 2c02e6ae12f957860b5e10d0f6ddb6b2a1761d07..3072b4c431cf024edefca7a08f1d40db025fd182 100644 (file)
@@ -202,10 +202,9 @@ static void
 test_stack (void)
 {
   int count = 0;
-  int repeat;
   char *volatile last_stackbuf;
 
-  for (repeat = 2 * 1000; repeat > 0; repeat--)
+  for (int repeat = 2 * 1000; repeat > 0; repeat--)
     {
       /* This odd way of writing two consecutive statements
            do_secret_stuff (1, &last_stackbuf);
index 01078222082cf3cf556bb7ea237255f1282a15e9..977770ab024252572a17bb2ed3c841e072166323 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -31,6 +29,7 @@ test_function (void)
 
   /* Arguments near zero.  */
   {
+    int i;
     DOUBLE x;
 
     for (i = -1, x = L_(0.5); i >= MIN_EXP; i--, x *= L_(0.5))
@@ -66,7 +65,7 @@ test_function (void)
 #endif
        : L_(5.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(2.0) * RANDOM[i]; /* 0.0 <= x <= 2.0 */
         DOUBLE y = EXPM1 (x);
@@ -92,8 +91,8 @@ test_function (void)
 #endif
        : L_(9.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(2.0) * RANDOM[i] - L_(1.0); /* -1.0 <= x <= 1.0 */
           DOUBLE y = L_(2.0) * RANDOM[j] - L_(1.0); /* -1.0 <= y <= 1.0 */
index 67af96d6612285f12703903f6803c3b9ecf3605f..7f1e0355569ef14427bea9845d1dd92de50fd531 100644 (file)
@@ -32,16 +32,12 @@ test_function (void)
   ASSERT (!signbit (y));
 
   /* Randomized tests.  */
-  {
-    int i;
-
-    for (i = 0; i < SIZEOF (RANDOM); i++)
-      {
-        x = L_(10.0) * RANDOM[i]; /* 0.0 <= x <= 10.0 */
-        ASSERT (FABS (x) == x);
-        ASSERT (FABS (- x) == x);
-      }
-  }
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
+    {
+      x = L_(10.0) * RANDOM[i]; /* 0.0 <= x <= 10.0 */
+      ASSERT (FABS (x) == x);
+      ASSERT (FABS (- x) == x);
+    }
 }
 
 volatile DOUBLE x;
index 3e8d4cb6e6c65bfce077ff936f5d991ce8af5200..d9c65e8f0705af7985d67a53fdff9dfbab324448 100644 (file)
@@ -36,7 +36,6 @@ main (void)
 {
   char *cwd;
   int fd;
-  int i;
 
   cwd = getcwd (NULL, 0);
   ASSERT (cwd);
@@ -75,7 +74,7 @@ main (void)
   }
 
   /* Repeat test twice, once in '.' and once in '..'.  */
-  for (i = 0; i < 2; i++)
+  for (int i = 0; i < 2; i++)
     {
       ASSERT (chdir (&".."[1 - i]) == 0);
       ASSERT (fchdir (fd) == 0);
index ff7b9d8192ab124bf19f9c4ff9fd4ad022636019..f1a736d3780eaa881641786359b3b8ed89d5c5a4 100644 (file)
@@ -29,12 +29,11 @@ SIGNATURE_CHECK (fdatasync, int, (int));
 int
 main (void)
 {
-  int fd;
   const char *file = "test-fdatasync.txt";
 
   /* Assuming stdin and stdout are ttys, fdatasync is allowed to fail, but
      may succeed as an extension.  */
-  for (fd = 0; fd < 2; fd++)
+  for (int fd = 0; fd < 2; fd++)
     if (fdatasync (fd) != 0)
       {
         ASSERT (errno == EINVAL /* POSIX */
@@ -64,22 +63,26 @@ main (void)
   }
 #endif
 
-  fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-  ASSERT (0 <= fd);
-  ASSERT (write (fd, "hello", 5) == 5);
-  ASSERT (fdatasync (fd) == 0);
-  ASSERT (close (fd) == 0);
+  {
+    int fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+    ASSERT (0 <= fd);
+    ASSERT (write (fd, "hello", 5) == 5);
+    ASSERT (fdatasync (fd) == 0);
+    ASSERT (close (fd) == 0);
+  }
 
 #if 0
   /* POSIX is self-contradictory on whether fdatasync must fail on
      read-only file descriptors.  Glibc allows it, as does our
      implementation if fsync allows it.  */
-  fd = open (file, O_RDONLY);
-  ASSERT (0 <= fd);
-  errno = 0;
-  ASSERT (fdatasync (fd) == -1);
-  ASSERT (errno == EBADF);
-  ASSERT (close (fd) == 0);
+  {
+    int fd = open (file, O_RDONLY);
+    ASSERT (0 <= fd);
+    errno = 0;
+    ASSERT (fdatasync (fd) == -1);
+    ASSERT (errno == EBADF);
+    ASSERT (close (fd) == 0);
+  }
 #endif
 
   ASSERT (unlink (file) == 0);
index 5ac7ab744a9deaf9c471679b3749ac61514c691e..6c6614501483b3039f213db19a64f738c0340f6e 100644 (file)
@@ -39,8 +39,7 @@ main (void)
     #define COUNT 1000
   #endif
 
-  int i;
-  for (i = 0; i < COUNT; i++)
+  for (int i = 0; i < COUNT; i++)
     {
       errno = 0;
       if (! fdopen (STDOUT_FILENO, "w"))
index 7da84ca032106722975e29931a42f453db64310a..fb781ee03f68466f78a7006cfde82ee922e27ac2 100644 (file)
@@ -41,16 +41,14 @@ uint_to_exceptions (unsigned int a)
 int
 main ()
 {
-  unsigned int a, b;
-
   /* Run through all possible valid arguments to feenableexcept and
      fedisableexcept.
      An alternative way of coding this iteration, without the uint_to_exceptions
      function, would be using the trick from
      Jörg Arndt: Matters Computational <https://www.jjj.de/fxt/fxtbook.pdf>
      § 1.25.1 Generating bit subsets of a given word  */
-  for (a = 0; a < 0x20; a++)
-    for (b = 0; b < 0x20; b++)
+  for (unsigned int a = 0; a < 0x20; a++)
+    for (unsigned int b = 0; b < 0x20; b++)
       {
         unsigned int c = a & ~b;
 
index 6d297aa4939f45924d0cf5a0f948a65df81a12ca..761397b67ac2dda7aad5cc51eed978a2418f88bb 100644 (file)
@@ -31,8 +31,7 @@ SIGNATURE_CHECK (ffs, int, (int));
 static int
 naive (int i)
 {
-  unsigned int j;
-  for (j = 0; j < NBITS; j++)
+  for (unsigned int j = 0; j < NBITS; j++)
     if (i & (1U << j))
       return j + 1;
   return 0;
@@ -41,23 +40,20 @@ naive (int i)
 int
 main (int argc, char *argv[])
 {
-  int x;
-  int i;
-
-  for (x = -128; x <= 128; x++)
+  for (int x = -128; x <= 128; x++)
     ASSERT (ffs (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (ffs (1U << i) == naive (1U << i));
       ASSERT (ffs (1U << i) == i + 1);
       ASSERT (ffs (-1U << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     {
       ASSERT (ffs (3U << i) == i + 1);
       ASSERT (ffs (-3U << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (ffs (5U << i) == i + 1);
       ASSERT (ffs (-5U << i) == i + 1);
index 003153f52637fca7bc8e3179d2f6139b53db809b..9e15d9cc55217eaf017450f4a417e5de63e3aef8 100644 (file)
@@ -31,8 +31,7 @@ SIGNATURE_CHECK (ffsl, int, (long int));
 static int
 naive (long int i)
 {
-  unsigned long int j;
-  for (j = 0; j < NBITS; j++)
+  for (unsigned long int j = 0; j < NBITS; j++)
     if (i & (1UL << j))
       return j + 1;
   return 0;
@@ -41,23 +40,20 @@ naive (long int i)
 int
 main (int argc, char *argv[])
 {
-  long int x;
-  int i;
-
-  for (x = -128; x <= 128; x++)
+  for (long int x = -128; x <= 128; x++)
     ASSERT (ffsl (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (ffsl (1UL << i) == naive (1UL << i));
       ASSERT (ffsl (1UL << i) == i + 1);
       ASSERT (ffsl (-1UL << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     {
       ASSERT (ffsl (3UL << i) == i + 1);
       ASSERT (ffsl (-3UL << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (ffsl (5UL << i) == i + 1);
       ASSERT (ffsl (-5UL << i) == i + 1);
index ee9c4855dfc19a42d367b1ca0db68b0aa18ef2c5..27ce875f8c9b0a5801710caba397e234af979398 100644 (file)
@@ -31,8 +31,7 @@ SIGNATURE_CHECK (ffsll, int, (long long int));
 static int
 naive (long long int i)
 {
-  unsigned long long int j;
-  for (j = 0; j < NBITS; j++)
+  for (unsigned long long int j = 0; j < NBITS; j++)
     if (i & (1ULL << j))
       return j + 1;
   return 0;
@@ -41,23 +40,20 @@ naive (long long int i)
 int
 main (int argc, char *argv[])
 {
-  long long int x;
-  int i;
-
-  for (x = -128; x <= 128; x++)
+  for (long long int x = -128; x <= 128; x++)
     ASSERT (ffsll (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (ffsll (1ULL << i) == naive (1ULL << i));
       ASSERT (ffsll (1ULL << i) == i + 1);
       ASSERT (ffsll (-1ULL << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     {
       ASSERT (ffsll (3ULL << i) == i + 1);
       ASSERT (ffsll (-3ULL << i) == i + 1);
     }
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (ffsll (5ULL << i) == i + 1);
       ASSERT (ffsll (-5ULL << i) == i + 1);
index d031c98ed189862aa2d2e149fe4f87d4f9dafeaa..8a9371760c1f40dd70a435718d2a6434c92eaa0e 100644 (file)
@@ -65,10 +65,9 @@ static const struct mode_to_string table[] =
 int
 main (void)
 {
-  size_t i;
   char buffer[12];
 
-  for (i = 0; i < SIZEOF (table); ++i)
+  for (size_t i = 0; i < SIZEOF (table); ++i)
     {
       strmode (table[i].mode, buffer);
       ASSERT (STREQ (table[i].str, buffer));
index dfc1ad8a33c3459bed1d9d3def17620f0b2544a5..507f0da882382802ee6333b7d1e0d830548a3f5e 100644 (file)
@@ -47,10 +47,9 @@ main (_GL_UNUSED int argc, char *argv[])
       {"a", "//b",  "a//b"},
       {"", "a", "a"},  /* this might deserve a diagnostic */
     };
-  unsigned int i;
   bool fail = false;
 
-  for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
+  for (unsigned int i = 0; i < sizeof tests / sizeof tests[0]; i++)
     {
       char *base_in_result;
       char const *const *t = tests[i];
index dfead62ca65508738394752bba30bda63bfa793a..c301c9576c51e6cfa612072fc3b9deada4384750 100644 (file)
@@ -166,8 +166,6 @@ test_filevercmp (char const *a, char const *b)
 int
 main (void)
 {
-  const char *const *i;
-
   /* Following tests taken from test-strverscmp.c */
   ASSERT (filevercmp ("", "") == 0);
   ASSERT (filevercmp ("a", "a") == 0);
@@ -179,10 +177,9 @@ main (void)
   ASSERT (filevercmp ("0a", "0") > 0);
 
   /* compare each version string with each other - O(n^2) */
-  for (i = examples; *i; i++)
+  for (const char * const *i = examples; *i; i++)
     {
-      const char *const *j;
-      for (j = examples; *j; j++)
+      for (const char * const *j = examples; *j; j++)
         {
           int result = test_filevercmp (*i, *j);
           if (result < 0)
@@ -194,7 +191,7 @@ main (void)
         }
     }
 
-  for (i = equals; i < equals + sizeof equals / sizeof *equals; i++)
+  for (const char * const *i = equals; i < equals + sizeof equals / sizeof *equals; i++)
     for (; *i; i++)
       for (char const *const *j = i; *j; j++)
         {
index 3fcab3ce25a5bf6aee4a5199b0cb59b22b352f6f..f6299dc7499c4c9ccc920308d199d6f18156909a 100644 (file)
@@ -229,10 +229,9 @@ test_float (void)
   /* Check the value of FLT_MAX.  */
   {
     volatile float m = FLT_MAX;
-    int n;
 
     ASSERT (m + m > m);
-    for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+    for (int n = 0; n <= 2 * FLT_MANT_DIG; n++)
       {
         volatile float pow2_n = pow2f (n); /* 2^n */
         volatile float x = m + (m / pow2_n);
@@ -254,12 +253,11 @@ test_float (void)
   {
     volatile float e = FLT_EPSILON;
     volatile float me;
-    int n;
 
     me = 1.0f + e;
     ASSERT (me > 1.0f);
     ASSERT (me - 1.0f == e);
-    for (n = 0; n <= 2 * FLT_MANT_DIG; n++)
+    for (int n = 0; n <= 2 * FLT_MANT_DIG; n++)
       {
         volatile float half_n = pow2f (- n); /* 2^-n */
         volatile float x = me - half_n;
@@ -328,10 +326,9 @@ test_double (void)
   /* Check the value of DBL_MAX.  */
   {
     volatile double m = DBL_MAX;
-    int n;
 
     ASSERT (m + m > m);
-    for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+    for (int n = 0; n <= 2 * DBL_MANT_DIG; n++)
       {
         volatile double pow2_n = pow2d (n); /* 2^n */
         volatile double x = m + (m / pow2_n);
@@ -353,12 +350,11 @@ test_double (void)
   {
     volatile double e = DBL_EPSILON;
     volatile double me;
-    int n;
 
     me = 1.0 + e;
     ASSERT (me > 1.0);
     ASSERT (me - 1.0 == e);
-    for (n = 0; n <= 2 * DBL_MANT_DIG; n++)
+    for (int n = 0; n <= 2 * DBL_MANT_DIG; n++)
       {
         volatile double half_n = pow2d (- n); /* 2^-n */
         volatile double x = me - half_n;
@@ -463,10 +459,9 @@ test_long_double (void)
   if (LDBL_IS_IEC_60559)
     {
       volatile long double m = LDBL_MAX;
-      int n;
 
       ASSERT (m + m > m);
-      for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+      for (int n = 0; n <= 2 * LDBL_MANT_DIG; n++)
         {
           volatile long double pow2_n = pow2l (n); /* 2^n */
           volatile long double x = m + (m / pow2_n);
@@ -488,12 +483,11 @@ test_long_double (void)
   {
     volatile long double e = LDBL_EPSILON;
     volatile long double me;
-    int n;
 
     me = 1.0L + e;
     ASSERT (me > 1.0L);
     ASSERT (me - 1.0L == e);
-    for (n = 0; n <= 2 * LDBL_MANT_DIG; n++)
+    for (int n = 0; n <= 2 * LDBL_MANT_DIG; n++)
       {
         volatile long double half_n = pow2l (- n); /* 2^-n */
         volatile long double x = normalize_long_double (me - half_n);
index 09ed74c812d052c19aac4cf3cdc40866f7528921..2df6c6d11fcc30aa7d9cb9a9d1d422bbcf58d4db 100644 (file)
@@ -150,11 +150,9 @@ int
 main ()
 {
 #ifdef UINT64_MAX
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 64-NUM_HIGHBITS bits.  */
index 6a83e29532d3fca6cd7393dfc977ca6fa3269ecd..7b47a2e1691a03cbc90a39c8a46042419e6428df 100644 (file)
@@ -149,11 +149,9 @@ check (float x)
 int
 main ()
 {
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 32-NUM_HIGHBITS bits.  */
index a2f996d925ee070563f56a7e36db81b901cd78d3..59fe6955f22b0014540c5fad6bf11b3ca3477cfa 100644 (file)
@@ -53,27 +53,22 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
     volatile DOUBLE z;
     volatile DOUBLE result;
     volatile DOUBLE expected;
-    int xs;
-    int xe;
-    int ys;
-    int ye;
-    int ze;
     DOUBLE sign;
 
-    for (xs = 0; xs < 2; xs++)
-      for (xe = -XE_RANGE; xe <= XE_RANGE; xe++)
+    for (int xs = 0; xs < 2; xs++)
+      for (int xe = -XE_RANGE; xe <= XE_RANGE; xe++)
         {
           x = pow_m1[xs] * POW2 (xe); /* (-1)^xs * 2^xe */
 
-          for (ys = 0; ys < 2; ys++)
-            for (ye = -YE_RANGE; ye <= YE_RANGE; ye++)
+          for (int ys = 0; ys < 2; ys++)
+            for (int ye = -YE_RANGE; ye <= YE_RANGE; ye++)
               {
                 y = pow_m1[ys] * POW2 (ye); /* (-1)^ys * 2^ye */
 
                 sign = pow_m1[xs + ys];
 
                 /* Test addition (same signs).  */
-                for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                   {
                     z = sign * POW2 (ze); /* (-1)^(xs+ys) * 2^ze */
                     result = my_fma (x, y, z);
@@ -94,7 +89,7 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
                   }
 
                 /* Test subtraction (opposite signs).  */
-                for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                   {
                     z = - sign * POW2 (ze); /* (-1)^(xs+ys+1) * 2^ze */
                     result = my_fma (x, y, z);
@@ -125,23 +120,17 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
     volatile DOUBLE z;
     volatile DOUBLE result;
     volatile DOUBLE expected;
-    int i;
-    int xs;
-    int xe;
-    int ys;
-    int ye;
-    int ze;
     DOUBLE sign;
 
-    for (i = 1; i <= MANT_BIT - 1; i++)
-      for (xs = 0; xs < 2; xs++)
-        for (xe = -XE_RANGE; xe <= XE_RANGE; xe++)
+    for (int i = 1; i <= MANT_BIT - 1; i++)
+      for (int xs = 0; xs < 2; xs++)
+        for (int xe = -XE_RANGE; xe <= XE_RANGE; xe++)
           {
             x = /* (-1)^xs * (2^xe + 2^(xe-i)) */
               pow_m1[xs] * (POW2 (xe) + POW2 (xe - i));
 
-            for (ys = 0; ys < 2; ys++)
-              for (ye = -YE_RANGE; ye <= YE_RANGE; ye++)
+            for (int ys = 0; ys < 2; ys++)
+              for (int ye = -YE_RANGE; ye <= YE_RANGE; ye++)
                 {
                   y = /* (-1)^ys * (2^ye + 2^(ye-i)) */
                     pow_m1[ys] * (POW2 (ye) + POW2 (ye - i));
@@ -152,7 +141,7 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
                      (-1)^(xs+ys) * (2^(xe+ye) + 2^(xe+ye-i+1) + 2^(xe+ye-2*i)) */
 
                   /* Test addition (same signs).  */
-                  for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                  for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                     {
                       z = sign * POW2 (ze); /* (-1)^(xs+ys) * 2^ze */
                       result = my_fma (x, y, z);
@@ -249,7 +238,7 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
 
                   /* Test subtraction (opposite signs).  */
                   if (i > 1)
-                    for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                    for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                       {
                         z = - sign * POW2 (ze); /* (-1)^(xs+ys+1) * 2^ze */
                         result = my_fma (x, y, z);
@@ -364,23 +353,17 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
     volatile DOUBLE z;
     volatile DOUBLE result;
     volatile DOUBLE expected;
-    int i;
-    int xs;
-    int xe;
-    int ys;
-    int ye;
-    int ze;
     DOUBLE sign;
 
-    for (i = 1; i <= MANT_BIT - 1; i++)
-      for (xs = 0; xs < 2; xs++)
-        for (xe = -XE_RANGE; xe <= XE_RANGE; xe++)
+    for (int i = 1; i <= MANT_BIT - 1; i++)
+      for (int xs = 0; xs < 2; xs++)
+        for (int xe = -XE_RANGE; xe <= XE_RANGE; xe++)
           {
             x = /* (-1)^xs * (2^xe + 2^(xe-i)) */
               pow_m1[xs] * (POW2 (xe) + POW2 (xe - i));
 
-            for (ys = 0; ys < 2; ys++)
-              for (ye = -YE_RANGE; ye <= YE_RANGE; ye++)
+            for (int ys = 0; ys < 2; ys++)
+              for (int ye = -YE_RANGE; ye <= YE_RANGE; ye++)
                 {
                   y = /* (-1)^ys * (2^ye - 2^(ye-i)) */
                     pow_m1[ys] * (POW2 (ye) - POW2 (ye - i));
@@ -391,7 +374,7 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
                      (-1)^(xs+ys) * (2^(xe+ye) - 2^(xe+ye-2*i)) */
 
                   /* Test addition (same signs).  */
-                  for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                  for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                     {
                       z = sign * POW2 (ze); /* (-1)^(xs+ys) * 2^ze */
                       result = my_fma (x, y, z);
@@ -450,7 +433,7 @@ test_function (DOUBLE (*my_fma) (DOUBLE, DOUBLE, DOUBLE))
 
                   /* Test subtraction (opposite signs).  */
                   if (i > 1)
-                    for (ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
+                    for (int ze = MIN_EXP - MANT_BIT; ze <= MAX_EXP - 1;)
                       {
                         z = - sign * POW2 (ze); /* (-1)^(xs+ys+1) * 2^ze */
                         result = my_fma (x, y, z);
index 02de2db2a686809f34dd217acda7f3290e9f4d6c..ecf9b4ff49e6473d345cdb6bd8cf4d47ab2aafb1 100644 (file)
@@ -27,8 +27,6 @@ my_ldexp (DOUBLE x, int d)
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -40,8 +38,8 @@ test_function (void)
     * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
@@ -63,8 +61,8 @@ test_function (void)
           }
       }
 
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
       {
         DOUBLE x = L_(1.0e9) * RANDOM[i]; /* 0.0 <= x <= 10^9 */
         DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
@@ -101,8 +99,8 @@ test_function (void)
   {
     int large_exp = (MAX_EXP - 1 < 1000 ? MAX_EXP - 1 : 1000);
     DOUBLE large = my_ldexp (L_(1.0), large_exp); /* = 2^large_exp */
-    for (i = 0; i < SIZEOF (RANDOM) / 10; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 10; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 10; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 10; j++)
         {
           DOUBLE x = large * RANDOM[i]; /* 0.0 <= x <= 2^large_exp */
           DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
index d6a2d0199160790564acd5760db01e8e74190d32..491c851234d7640a6720e1c381e9b5b3cfb61909 100644 (file)
@@ -380,10 +380,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index 400b44571b9e5dccdc9db101fe9f4d079fe4f4ce..1cac7a76167ba0a3b314db6e555be58db37ab51e 100644 (file)
@@ -130,9 +130,8 @@ main (int argc, char *argv[])
     {
       /* Perform the test and test whether it triggers a permanent memory
          allocation of more than MAX_ALLOC_TOTAL bytes.  */
-      int repeat;
 
-      for (repeat = 0; repeat < NUM_ROUNDS; repeat++)
+      for (int repeat = 0; repeat < NUM_ROUNDS; repeat++)
         {
           /* This may produce a temporary memory allocation of 11000 bytes.
              but should not result in a permanent memory allocation.  */
index 5452e70e5a7c4bc985dc91cd34ec39e74bf3caa1..2e86ab5774e8b7f0bd9e6a6f661bd47ac31f693d 100644 (file)
@@ -32,9 +32,7 @@
 int
 main (void)
 {
-  int check_filepos;
-
-  for (check_filepos = 0; check_filepos <= 1; check_filepos++)
+  for (int check_filepos = 0; check_filepos <= 1; check_filepos++)
     {
       FILE *fp;
 
index fff1c3a6c5a05ed93812135158d987ae7b2523f1..4cabcc50865bde043406f1357186632a905b3d74 100644 (file)
@@ -53,10 +53,9 @@ main ()
   { /* Small memory allocations.  */
     #define N 10000
     void *ptrs[N];
-    size_t i;
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       ptrs[i] = malloc (15);
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       {
         errno = 1789;
         free (ptrs[i]);
@@ -67,10 +66,9 @@ main ()
   { /* Medium memory allocations.  */
     #define N 1000
     void *ptrs[N];
-    size_t i;
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       ptrs[i] = malloc (729);
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       {
         errno = 1789;
         free (ptrs[i]);
@@ -81,10 +79,9 @@ main ()
   { /* Large memory allocations.  */
     #define N 10
     void *ptrs[N];
-    size_t i;
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       ptrs[i] = malloc (5318153);
-    for (i = 0; i < N; i++)
+    for (size_t i = 0; i < N; i++)
       {
         errno = 1789;
         free (ptrs[i]);
@@ -152,8 +149,7 @@ main ()
               /* Now add as many mappings as we can.
                  Stop at 65536, in order not to crash the machine (in case the
                  limit has been increased by the system administrator).  */
-              size_t i;
-              for (i = 0; i < 65536; i++)
+              for (size_t i = 0; i < 65536; i++)
                 if (mmap (NULL, pagesize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0)
                     == (void *)(-1))
                   break;
index ed687387ff0e2f48402c0cb396a46309b8620982..c95a46ce77c43372249dd537070484fc11db608f 100644 (file)
@@ -27,7 +27,6 @@ my_ldexp (DOUBLE x, int d)
 static void
 test_function (void)
 {
-  int i;
   VOLATILE DOUBLE x;
 
   { /* NaN.  */
@@ -74,100 +73,104 @@ test_function (void)
     ASSERT (signbit (mantissa));
   }
 
-  for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.5));
-    }
-  for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.5));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.5));
-    }
+  {
+    int i;
 
-  for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == - L_(0.5));
-    }
-  for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == - L_(0.5));
-    }
-  for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == - L_(0.5));
-    }
+    for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.5));
+      }
+    for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.5));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.5));
+      }
 
-  for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.505));
-    }
-  for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.505));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa >= L_(0.5));
-      ASSERT (mantissa < L_(1.0));
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
+    for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == - L_(0.5));
+      }
+    for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == - L_(0.5));
+      }
+    for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == - L_(0.5));
+      }
 
-  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.866025));
-    }
-  for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i);
-      ASSERT (mantissa == L_(0.866025));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      int exp = -9999;
-      DOUBLE mantissa = FREXP (x, &exp);
-      ASSERT (exp == i || exp == i + 1);
-      ASSERT (mantissa >= L_(0.5));
-      ASSERT (mantissa < L_(1.0));
-      ASSERT (mantissa == my_ldexp (x, - exp));
-    }
+    for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.505));
+      }
+    for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.505));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa >= L_(0.5));
+        ASSERT (mantissa < L_(1.0));
+        ASSERT (mantissa == my_ldexp (x, - exp));
+      }
+
+    for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.866025));
+      }
+    for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i);
+        ASSERT (mantissa == L_(0.866025));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        int exp = -9999;
+        DOUBLE mantissa = FREXP (x, &exp);
+        ASSERT (exp == i || exp == i + 1);
+        ASSERT (mantissa >= L_(0.5));
+        ASSERT (mantissa < L_(1.0));
+        ASSERT (mantissa == my_ldexp (x, - exp));
+      }
+  }
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
       {
index 999b60e9decc543ddeb432a5f0e7662246197e3e..6b4e37413f74269db6d097e1676b2609b0b84215 100644 (file)
@@ -29,12 +29,11 @@ SIGNATURE_CHECK (fsync, int, (int));
 int
 main (void)
 {
-  int fd;
   const char *file = "test-fsync.txt";
 
   /* Assuming stdin and stdout are ttys, fsync is allowed to fail, but
      may succeed as an extension.  */
-  for (fd = 0; fd < 2; fd++)
+  for (int fd = 0; fd < 2; fd++)
     if (fsync (fd) != 0)
       {
         ASSERT (errno == EINVAL /* POSIX */
@@ -64,24 +63,28 @@ main (void)
   }
 #endif
 
-  fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-  ASSERT (0 <= fd);
-  ASSERT (write (fd, "hello", 5) == 5);
-  ASSERT (fsync (fd) == 0);
-  ASSERT (close (fd) == 0);
+  {
+    int fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+    ASSERT (0 <= fd);
+    ASSERT (write (fd, "hello", 5) == 5);
+    ASSERT (fsync (fd) == 0);
+    ASSERT (close (fd) == 0);
+  }
 
   /* For a read-only regular file input file descriptor, fsync should
      succeed (since at least atime changes can be synchronized).
      On AIX and Cygwin, this test would fail.  */
 #if !(defined _AIX || defined __CYGWIN__)
-  fd = open (file, O_RDONLY);
-  ASSERT (0 <= fd);
   {
-    char buf[1];
-    ASSERT (read (fd, buf, sizeof buf) == sizeof buf);
+    int fd = open (file, O_RDONLY);
+    ASSERT (0 <= fd);
+    {
+      char buf[1];
+      ASSERT (read (fd, buf, sizeof buf) == sizeof buf);
+    }
+    ASSERT (fsync (fd) == 0);
+    ASSERT (close (fd) == 0);
   }
-  ASSERT (fsync (fd) == 0);
-  ASSERT (close (fd) == 0);
 #endif
 
   ASSERT (unlink (file) == 0);
index 31c9898b80e0be3d41f1f2c182f2473ddf60ca45..62c362addb88618c8131f39f3ca3a9f88d55e644 100644 (file)
@@ -127,7 +127,6 @@ main (void)
   FTS *ftsp;
   FTSENT *e;
   char buf[sizeof BASE + 100];
-  int i;
   enum { needles = 4 };
   int needles_seen = 0;
   struct stat st;
@@ -144,7 +143,7 @@ main (void)
     perror_exit (base, 4);
   if (mkdir (base_d, 0777) != 0)
     perror_exit (base_d, 5);
-  for (i = 1; i <= 65536; i++)
+  for (int i = 1; i <= 65536; i++)
     {
       sprintf (buf, "%s/d/%i", base, i);
       if (mkdir (buf, 0777) != 0)
@@ -160,7 +159,7 @@ main (void)
     }
 
   /* Create empty files BASE/d/1/needle etc.  */
-  for (i = 1; i <= needles; i++)
+  for (int i = 1; i <= needles; i++)
     {
       int fd;
       sprintf (buf, "%s/d/%d/needle", base, i);
index e6b8e1190f51f76efdd4e524351fe25876d1743a..1b0860f1d0d378152162043463a9b69302eae3ec 100644 (file)
@@ -56,12 +56,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, ciphertext_1, sizeof (ciphertext_1)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", ciphertext_1[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -79,12 +78,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, plaintext_1, sizeof (plaintext_1)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", plaintext_1[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
index 6f6d79fb6259cc961d5e520093540f1e040c6ed8..8f530e85e6397484b78cc467ffaff4eb8cb4a77e 100644 (file)
@@ -58,12 +58,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, ciphertext, sizeof (ciphertext)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", ciphertext[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -81,12 +80,11 @@ main (int argc, char *argv[])
 
   if (memcmp (scratch, plaintext, sizeof (plaintext)))
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", plaintext[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 5; i++)
+      for (size_t i = 0; i < 5; i++)
         printf ("%02x ", scratch[i] & 0xFF);
       printf ("\n");
       return 1;
index 1d337f229ff689bdb4549f7468be02408efd5913..e1fd29ce4a3041ec85d6529e00aa7f9f1388b941 100644 (file)
@@ -38,14 +38,13 @@ main (int argc, char *argv[])
    * DES Maintenance Test
    */
   {
-    int i;
     char key[8] = { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };
     char input[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
     char result[8] = { 0x24, 0x6e, 0x9d, 0xb9, 0xc5, 0x50, 0x38, 0x1a };
     char temp1[8], temp2[8], temp3[8];
     gc_cipher_handle ctx_array[64];
 
-    for (i = 0; i < 64; ++i)
+    for (int i = 0; i < 64; ++i)
       {
         gc_cipher_handle ctx;
 
@@ -84,7 +83,7 @@ main (int argc, char *argv[])
     if (memcmp (temp3, result, 8))
       return 1;
 
-    for (i = 0; i < 64; ++i)
+    for (int i = 0; i < 64; ++i)
       gc_cipher_close (ctx_array[i]);
   }
 
index afbef890a68fb22fe76ca30701de25c68e1725a5..0fddf52ecb809c7fdec6d0cd405abd187faf90bc 100644 (file)
@@ -62,12 +62,11 @@ main (int argc, char *argv[])
 
     if (memcmp (digest, out, 16) != 0)
       {
-        size_t i;
         printf ("hash 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", digest[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
index 750e92aab8e2a74e787f25700583093870d1c285..9b4e7c0beec83b20ca6c9ba2d3459cfbe8ddc9af 100644 (file)
@@ -53,12 +53,11 @@ main (int argc, char *argv[])
 
     if (memcmp (digest, out, GC_SHA1_DIGEST_SIZE) != 0)
       {
-        size_t i;
         printf ("hash 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", digest[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
index 4ce21978dd331d0241c99dde7274cce5e9eda88b..3814f336b5d29c5ab41728e5eb2b1081de6c714a 100644 (file)
@@ -52,12 +52,11 @@ main (int argc, char *argv[])
 
     if (memcmp (digest, out, GC_SHA256_DIGEST_SIZE) != 0)
       {
-        size_t i;
         printf ("hash 1 mismatch. expected:\n");
-        for (i = 0; i < GC_SHA256_DIGEST_SIZE; i++)
+        for (size_t i = 0; i < GC_SHA256_DIGEST_SIZE; i++)
           printf ("%02x ", digest[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < GC_SHA256_DIGEST_SIZE; i++)
+        for (size_t i = 0; i < GC_SHA256_DIGEST_SIZE; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
index f4bdc70aa85f8d29e9c8766508c6d6211a550129..83a79d85cebe3dc93210e19862a82444f0a7f1d0 100644 (file)
@@ -52,12 +52,11 @@ main (int argc, char *argv[])
 
     if (memcmp (digest, out, GC_SHA512_DIGEST_SIZE) != 0)
       {
-        size_t i;
         printf ("hash 1 mismatch. expected:\n");
-        for (i = 0; i < GC_SHA512_DIGEST_SIZE; i++)
+        for (size_t i = 0; i < GC_SHA512_DIGEST_SIZE; i++)
           printf ("%02x ", digest[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < GC_SHA512_DIGEST_SIZE; i++)
+        for (size_t i = 0; i < GC_SHA512_DIGEST_SIZE; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
index e7c3d0b77c477dbd493a34789ee43591d46eaf7b..a8e02d6695a63e672460e3d711026e8c1dbef61a 100644 (file)
@@ -53,12 +53,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md2 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -72,12 +71,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md2 2 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -106,13 +104,12 @@ main (int argc, char *argv[])
       }
 
     if (memcmp (p, expect, 16) != 0)
-        {
-        size_t i;
+      {
         printf ("md2 3 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index b265419f3980181d9e94594b1f644685974a51f7..5aa1a4d060befbe1a0db942092bb3b580d0abb0b 100644 (file)
@@ -55,12 +55,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md4 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -74,12 +73,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md4 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -109,12 +107,11 @@ main (int argc, char *argv[])
 
     if (memcmp (p, expect, 16) != 0)
       {
-        size_t i;
         printf ("md4 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index 69030b5ebea6644e54d438db973d5f9248f98ecc..d79fd2451d01b589e4b88057a8ab1f6cc1f9d192 100644 (file)
@@ -55,12 +55,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md5 1 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -74,12 +73,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 16) != 0)
       {
-        size_t i;
         printf ("md5 2 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -108,13 +106,12 @@ main (int argc, char *argv[])
       }
 
     if (memcmp (p, expect, 16) != 0)
-        {
-        size_t i;
+      {
         printf ("md5 3 mismatch. expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index 16cd6251fa051feac3de8732a5831b67b7943c63..188197d125c16f69238ee32dbc7ce4bd9bd0820a 100644 (file)
@@ -80,11 +80,10 @@ const struct pkcs5 pkcs5[] = {
 int
 main (int argc, char *argv[])
 {
-  size_t i;
   int rc;
   char out[BUFSIZ];
 
-  for (i = 0; i < sizeof (pkcs5) / sizeof (pkcs5[0]); i++)
+  for (size_t i = 0; i < sizeof (pkcs5) / sizeof (pkcs5[0]); i++)
     {
       rc = gc_pbkdf2_sha1 (pkcs5[i].password, strlen (pkcs5[i].password),
                            pkcs5[i].salt, strlen (pkcs5[i].salt),
index 298f60fbc3a0ce4ffc3195f71e1b722a2a68ceb6..e23d481eeba7fb2f1954002058524d61b685a39e 100644 (file)
@@ -95,7 +95,6 @@ const struct pkcs5 pkcs5[] = {
 int
 main (int argc, char *argv[])
 {
-  size_t i;
   int rc;
   char out[BUFSIZ];
 
@@ -107,7 +106,7 @@ main (int argc, char *argv[])
       return 1;
     }
 
-  for (i = 0; i < sizeof (pkcs5) / sizeof (pkcs5[0]); i++)
+  for (size_t i = 0; i < sizeof (pkcs5) / sizeof (pkcs5[0]); i++)
     {
       rc = gc_pbkdf2_hmac (pkcs5[i].hash,
                            pkcs5[i].password, strlen (pkcs5[i].password),
index c8ea89c7f779069177f4fc3cc7bfb98d400cb562..44b412a836ec3cf6f08a42ce88b402245d500e10 100644 (file)
@@ -43,7 +43,6 @@ main (int argc, char *argv[])
     char ct[] = "\xC3\x4C\x05\x2C\xC0\xDA\x8D\x73"
       "\x45\x1A\xFE\x5F\x03\xBE\x29\x7F";
     gc_cipher_handle ctx;
-    size_t round;
 
     rc = gc_cipher_open (GC_AES128, GC_ECB, &ctx);
     if (rc != GC_OK)
@@ -55,7 +54,7 @@ main (int argc, char *argv[])
 
     memcpy (buf, pt, 16);
 
-    for (round = 0; round < 10000; round++)
+    for (size_t round = 0; round < 10000; round++)
       {
         rc = gc_cipher_encrypt_inline (ctx, 16, buf);
         if (rc != GC_OK)
@@ -67,18 +66,17 @@ main (int argc, char *argv[])
 
     if (memcmp (buf, ct, 16) != 0)
       {
-        size_t i;
         printf ("expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", ct[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", buf[i] & 0xFF);
         printf ("\n");
         return 1;
       }
 
-    for (round = 0; round < 10000; round++)
+    for (size_t round = 0; round < 10000; round++)
       {
         rc = gc_cipher_decrypt_inline (ctx, 16, buf);
         if (rc != GC_OK)
@@ -90,12 +88,11 @@ main (int argc, char *argv[])
 
     if (memcmp (buf, pt, 16) != 0)
       {
-        size_t i;
         printf ("expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", pt[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", buf[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -116,7 +113,6 @@ main (int argc, char *argv[])
     char ct[] = "\x66\xe9\x4b\xd4\xef\x8a\x2c\x3b"
       "\x88\x4c\xfa\x59\xca\x34\x2b\x2e";
     gc_cipher_handle ctx;
-    size_t round;
 
     rc = gc_cipher_open (GC_AES128, GC_CBC, &ctx);
     if (rc != GC_OK)
@@ -132,7 +128,7 @@ main (int argc, char *argv[])
 
     memcpy (buf, pt, 16);
 
-    for (round = 0; round < 10000; round++)
+    for (size_t round = 0; round < 10000; round++)
       {
         rc = gc_cipher_encrypt_inline (ctx, 16, buf);
         if (rc != GC_OK)
@@ -144,12 +140,11 @@ main (int argc, char *argv[])
 
     if (memcmp (buf, ct, 16) != 0)
       {
-        size_t i;
         printf ("expected:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", ct[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 16; i++)
+        for (size_t i = 0; i < 16; i++)
           printf ("%02x ", buf[i] & 0xFF);
         printf ("\n");
         return 1;
index e75f4beb4e22346d7a8420f2be29c05e6a076ca2..9d32517e978e3f3310c2d3b1f3a5695d3f346842 100644 (file)
@@ -51,12 +51,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 20) != 0)
       {
-        size_t i;
         printf ("sha1 test1 mismatch. expected:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -71,12 +70,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 20) != 0)
       {
-        size_t i;
         printf ("sha1 test2 mismatch. expected:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -106,12 +104,11 @@ main (int argc, char *argv[])
 
     if (memcmp (p, expect, 20) != 0)
       {
-        size_t i;
         printf ("sha1 test3 mismatch. expected:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 20; i++)
+        for (size_t i = 0; i < 20; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index db65b01f165e3899487e92766ba52375b6dee410..0114a8959888a71208f1f2a9738f7dcf19217e1f 100644 (file)
@@ -52,12 +52,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 32) != 0)
       {
-        size_t i;
         printf ("sha256 test1 mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -72,12 +71,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 32) != 0)
       {
-        size_t i;
         printf ("sha256 test2 mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -107,12 +105,11 @@ main (int argc, char *argv[])
 
     if (memcmp (p, expect, 32) != 0)
       {
-        size_t i;
         printf ("sha256 test3 mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index a25639d8a0e18fa7a0e638f675ea2586cd11e762..2b04c90465b77f53e8b44ddeb01c71340c424d78 100644 (file)
@@ -54,12 +54,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 64) != 0)
       {
-        size_t i;
         printf ("sha512 test1 mismatch. expected:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -74,12 +73,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 64) != 0)
       {
-        size_t i;
         printf ("sha512 test2 mismatch. expected:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -109,12 +107,11 @@ main (int argc, char *argv[])
 
     if (memcmp (p, expect, 64) != 0)
       {
-        size_t i;
         printf ("sha512 test3 mismatch. expected:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 64; i++)
+        for (size_t i = 0; i < 64; i++)
           printf ("%02x ", p[i] & 0xFF);
         printf ("\n");
         return 1;
index d29b40a0988c3ed3c92642ce7cb6020e13f74246..790016bb11d950c3e76faa2c4d4704e5d60ebd1d 100644 (file)
@@ -54,12 +54,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 32) != 0)
       {
-        size_t i;
         printf ("sm3 mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -74,12 +73,11 @@ main (int argc, char *argv[])
 
     if (memcmp (out, expect, 32) != 0)
       {
-        size_t i;
         printf ("sm3' mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) out[i] & 0xFF);
         printf ("\n");
         return 1;
@@ -109,12 +107,11 @@ main (int argc, char *argv[])
 
     if (memcmp (p, expect, 32) != 0)
       {
-        size_t i;
         printf ("sm3 mismatch. expected:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) expect[i] & 0xFF);
         printf ("\ncomputed:\n");
-        for (i = 0; i < 32; i++)
+        for (size_t i = 0; i < 32; i++)
           printf ("%02x ", (unsigned int) p[i] & 0xFF);
         printf ("\n");
         return 1;
index 62f156a02c4930e5f31c4bbb37c65f812ea1156b..e23fe3fb42e7dca548e7fcf6f3dbe7b62fc5c02b 100644 (file)
@@ -67,7 +67,7 @@ simple (int pass, char const *host, char const *service)
   static int skip = 0;
   struct addrinfo hints;
   struct addrinfo *hints_p;
-  struct addrinfo *ai0, *ai;
+  struct addrinfo *ai0;
   int res;
   int err;
 
@@ -141,7 +141,7 @@ simple (int pass, char const *host, char const *service)
       return 1;
     }
 
-  for (ai = ai0; ai; ai = ai->ai_next)
+  for (struct addrinfo *ai = ai0; ai; ai = ai->ai_next)
     {
       void *ai_addr = ai->ai_addr;
       struct sockaddr_in *sock_addr = ai_addr;
index 2632caea7bcb582cb5f2d2293ae3b90e6f3119d0..2fed69f6d100acd528c2f17bab5f036b57d7e11d 100644 (file)
@@ -240,11 +240,9 @@ test_long_name (void)
      So clean up here, right away, even though the driving
      shell script would also clean up.  */
   {
-    size_t i;
-
     /* Try rmdir first, in case the chdir failed.  */
     rmdir (DIR_NAME);
-    for (i = 0; i <= n_chdirs; i++)
+    for (size_t i = 0; i <= n_chdirs; i++)
       {
         if (chdir ("..") < 0)
           break;
index c8a82311de4c490c4d2d7666ddbe0c2d53d9d539..800f1664601b40621cc0b40f90b4885b29d96801 100644 (file)
@@ -79,8 +79,7 @@ main (int argc, _GL_UNUSED char **argv)
      list the returned groups.  */
   if (1 < argc)
     {
-      int i;
-      for (i = 0; i < result; i++)
+      for (int i = 0; i < result; i++)
         printf ("%d\n", (int) groups[i]);
     }
   free (groups);
index e8a438bf10a10efcfb6e315c345d446859c9d148..d1fac54705f9b63d1a87783de106163239121d37 100644 (file)
@@ -49,9 +49,8 @@ main (void)
   {
     char smallbuf[1024];
     size_t n = strlen (buf);
-    size_t i;
 
-    for (i = 0; i <= n; i++)
+    for (size_t i = 0; i <= n; i++)
       {
         err = getlogin_r (smallbuf, i);
         if (i == 0)
index 8334a06aa6a883440e0aff16587b80c44f9baf74..501b0301823fb49e09b4d2e537718ca752e59728 100644 (file)
@@ -100,11 +100,8 @@ main (void)
 
   /* Larger file size.  */
   rewind (f);
-  {
-    int i;
-    for (i = 0; i < 16; i++)
-      fprintf (f, "%500x%c", i + 0u, i % 2 ? '\n' : '\r');
-  }
+  for (int i = 0; i < 16; i++)
+    fprintf (f, "%500x%c", i + 0u, i % 2 ? '\n' : '\r');
   rewind (f);
   {
     char buffer[502];
index b244ead90068ec9e83d6bb2ff709786b43923b03..b5e873d99d9f496c482784f6dea75679128631cf 100644 (file)
@@ -81,7 +81,6 @@ getopt_loop (int argc, const char **argv,
 static void
 test_getopt (void)
 {
-  int start;
   bool posixly = !!getenv ("POSIXLY_CORRECT");
   /* See comment in getopt.c:
      glibc gets a LSB-compliant getopt.
@@ -94,7 +93,7 @@ test_getopt (void)
 #endif
 
   /* Test processing of boolean options.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -126,7 +125,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -159,7 +158,7 @@ test_getopt (void)
       ASSERT (optind == 3);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -191,7 +190,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -226,7 +225,7 @@ test_getopt (void)
     }
 
   /* Test processing of options with arguments.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -257,7 +256,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -289,7 +288,7 @@ test_getopt (void)
       ASSERT (optind == 3);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -326,7 +325,7 @@ test_getopt (void)
 
 #if GNULIB_TEST_GETOPT_GNU
   /* Test processing of options with optional arguments.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -357,7 +356,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -389,7 +388,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -425,7 +424,7 @@ test_getopt (void)
 
   /* Check that invalid options are recognized; and that both opterr
      and leading ':' can silence output.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -459,7 +458,7 @@ test_getopt (void)
       ASSERT (optind == 5);
       ASSERT (output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -493,7 +492,7 @@ test_getopt (void)
       ASSERT (optind == 5);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -527,7 +526,7 @@ test_getopt (void)
       ASSERT (optind == 5);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -561,7 +560,7 @@ test_getopt (void)
       ASSERT (optind == 5);
       ASSERT (output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -595,7 +594,7 @@ test_getopt (void)
       ASSERT (optind == 5);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -631,7 +630,7 @@ test_getopt (void)
     }
 
   /* Check for missing argument behavior.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -661,7 +660,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -691,7 +690,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -723,7 +722,7 @@ test_getopt (void)
     }
 
   /* Check that by default, non-options arguments are moved to the end.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -790,7 +789,7 @@ test_getopt (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -873,7 +872,7 @@ test_getopt (void)
 
 #if GNULIB_TEST_GETOPT_GNU
   /* Check that the '-' flag causes non-options to be returned in order.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -921,7 +920,7 @@ test_getopt (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -996,7 +995,7 @@ test_getopt (void)
     }
 
   /* Check that the '-' flag has to come first.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1064,7 +1063,7 @@ test_getopt (void)
 
   /* Check that the '+' flag causes the first non-option to terminate the
      loop.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1107,7 +1106,7 @@ test_getopt (void)
       ASSERT (optind == 1);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1138,7 +1137,7 @@ test_getopt (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1194,7 +1193,7 @@ test_getopt (void)
 #endif /* GNULIB_TEST_GETOPT_GNU */
 
   /* Check that the '+' flag has to come first.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1264,7 +1263,7 @@ test_getopt (void)
   /* If GNU extensions are supported, require compliance with POSIX
      interpretation on leading '+' behavior.
      https://austingroupbugs.net/view.php?id=191  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1307,7 +1306,7 @@ test_getopt (void)
       ASSERT (optind == 1);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1336,7 +1335,7 @@ test_getopt (void)
       ASSERT (optind == 2);
       ASSERT (!output);
     }
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int a_seen = 0;
       int b_seen = 0;
@@ -1372,7 +1371,7 @@ test_getopt (void)
      Technically, POSIX says the presence of ';' in the opt-string
      gives unspecified behavior, so we only test this when GNU compliance
      is desired.  */
-  for (start = OPTIND_MIN; start <= 1; start++)
+  for (int start = OPTIND_MIN; start <= 1; start++)
     {
       int argc = 0;
       const char *argv[10];
index 73433cea3b03d248657ac57c3c27bd21f9dee93d..3bbd780a4fb3900cd7e0c05699415f60cc6bdcd0 100644 (file)
@@ -111,8 +111,6 @@ do_getopt_long (int argc, const char **argv, const char *shortopts,
 static void
 test_getopt_long (void)
 {
-  int start;
-
   /* Test disambiguation of options.  */
   {
     int argc = 0;
@@ -334,7 +332,7 @@ test_getopt_long (void)
   }
 
   /* Test processing of boolean short options.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -363,7 +361,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -393,7 +391,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 3);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -422,7 +420,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -454,7 +452,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of boolean long options.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -483,7 +481,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -513,7 +511,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 3);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -547,7 +545,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of boolean long options via -W.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -576,7 +574,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -608,7 +606,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 5);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -642,7 +640,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of short options with arguments.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -670,7 +668,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -699,7 +697,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 3);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -732,7 +730,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of long options with arguments.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -760,7 +758,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -789,7 +787,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 3);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -822,7 +820,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of long options with arguments via -W.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -850,7 +848,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -880,7 +878,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 4);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -914,7 +912,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of short options with optional arguments.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -942,7 +940,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -971,7 +969,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1002,7 +1000,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of long options with optional arguments.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1030,7 +1028,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1059,7 +1057,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1088,7 +1086,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1119,7 +1117,7 @@ test_getopt_long (void)
     }
 
   /* Test processing of long options with optional arguments via -W.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1147,7 +1145,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1176,7 +1174,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1205,7 +1203,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 2);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1235,7 +1233,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 3);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1267,7 +1265,7 @@ test_getopt_long (void)
     }
 
   /* Check that invalid options are recognized.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1298,7 +1296,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 'x');
       ASSERT (optind == 5);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1331,7 +1329,7 @@ test_getopt_long (void)
     }
 
   /* Check that unexpected arguments are recognized.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1361,7 +1359,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 'a');
       ASSERT (optind == 4);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1395,7 +1393,7 @@ test_getopt_long (void)
     }
 
   /* Check that by default, non-options arguments are moved to the end.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1437,7 +1435,7 @@ test_getopt_long (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1489,7 +1487,7 @@ test_getopt_long (void)
     }
 
   /* Check that the '-' flag causes non-options to be returned in order.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1534,7 +1532,7 @@ test_getopt_long (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1606,7 +1604,7 @@ test_getopt_long (void)
     }
 
   /* Check that the '-' flag has to come first.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1649,7 +1647,7 @@ test_getopt_long (void)
 
   /* Check that the '+' flag causes the first non-option to terminate the
      loop.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1689,7 +1687,7 @@ test_getopt_long (void)
       ASSERT (unrecognized == 0);
       ASSERT (optind == 1);
     }
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1718,7 +1716,7 @@ test_getopt_long (void)
     }
 
   /* Check that '--' ends the argument processing.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1770,7 +1768,7 @@ test_getopt_long (void)
     }
 
   /* Check that the '+' flag has to come first.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1819,10 +1817,8 @@ test_getopt_long (void)
 static void
 test_getopt_long_posix (void)
 {
-  int start;
-
   /* Check that POSIXLY_CORRECT stops parsing the same as leading '+'.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1864,7 +1860,7 @@ test_getopt_long_posix (void)
     }
 
   /* Check that POSIXLY_CORRECT doesn't change optional arguments.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
@@ -1894,7 +1890,7 @@ test_getopt_long_posix (void)
     }
 
   /* Check that leading - still sees options after non-options.  */
-  for (start = 0; start <= 1; start++)
+  for (int start = 0; start <= 1; start++)
     {
       const char *p_value = NULL;
       const char *q_value = NULL;
index 537ec1933e1ae3f6277636e509078933a6b08495..a1d618c2561da959e27244a4fd5534c8177a47fe 100644 (file)
@@ -47,9 +47,8 @@ main (void)
     for (;;)
       {
         struct timeval t;
-        int i;
 
-        for (i = 0; i < 1000000; i++)
+        for (int i = 0; i < 1000000; i++)
           counter++;
 
         ASSERT (gettimeofday (&t, NULL) == 0);
index 6c67b9bd1059b051e02b91fcf74aab984c7b62ee..308850bebe58d84c1433f605a9e8e60a3a26da37 100644 (file)
@@ -71,14 +71,13 @@ first_pass (void)
 static void
 second_pass (void)
 {
-  size_t i;
   char *ptr;
 
   /* Return to the start of the file.  */
   setusershell ();
 
   /* Make sure order is preserved.  */
-  for (i = 0; i < shell_count; ++i)
+  for (size_t i = 0; i < shell_count; ++i)
     {
       ptr = getusershell ();
       ASSERT (ptr != NULL);
index 78a1bff37c6b00ea716d206f89fa3bd32fb816f0..99d3725d0ed1c3aa8499a0c63fa82959f054075f 100644 (file)
@@ -80,8 +80,6 @@ get_seed (char const *str, unsigned int *seed)
 int
 main (int argc, char **argv)
 {
-  unsigned int i;
-  unsigned int k;
   unsigned int table_size[] = {1, 2, 3, 4, 5, 23, 53};
   Hash_table *ht;
   Hash_tuning tuning;
@@ -105,7 +103,7 @@ main (int argc, char **argv)
       srand (seed);
     }
 
-  for (i = 0; i < ARRAY_CARDINALITY (table_size); i++)
+  for (unsigned int i = 0; i < ARRAY_CARDINALITY (table_size); i++)
     {
       size_t sz = table_size[i];
       ht = hash_initialize (sz, NULL, hash_pjw, hash_compare_strings, NULL);
@@ -186,14 +184,14 @@ main (int argc, char **argv)
   tuning.growth_threshold = 0.89;
 
   /* Run with default tuning, then with custom tuning settings.  */
-  for (k = 0; k < 2; k++)
+  for (unsigned int k = 0; k < 2; k++)
     {
       Hash_tuning const *tune = (k == 0 ? NULL : &tuning);
       /* Now, each entry is malloc'd.  */
       ht = hash_initialize (4651, tune, hash_pjw,
                             hash_compare_strings, hash_freer);
       ASSERT (ht);
-      for (i = 0; i < 10000; i++)
+      for (unsigned int i = 0; i < 10000; i++)
         {
           unsigned int op = rand () % 10;
           switch (op)
index b435cd229bdf25deac4fd7b7051a028c552d48e3..633e4d16fe2b6fc7e636946315230689c480c8e6 100644 (file)
@@ -87,11 +87,10 @@ check_equals (gl_map_t map1, gl_map_t map2)
   const void *value1;
   const void *key2;
   const void *value2;
-  size_t i;
 
   iter1 = gl_map_iterator (map1);
   iter2 = gl_map_iterator (map2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_map_iterator_next (&iter1, &key1, &value1));
       ASSERT (gl_map_iterator_next (&iter2, &key2, &value2));
@@ -110,7 +109,7 @@ check_equals (gl_map_t map1, gl_map_t map2)
       qsort (pairs_of_map1, n, sizeof (struct pair), cmp_pairs_in_array);
       qsort (pairs_of_map2, n, sizeof (struct pair), cmp_pairs_in_array);
     }
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (pairs_of_map1[i].key == pairs_of_map2[i].key);
       ASSERT (pairs_of_map1[i].value == pairs_of_map2[i].value);
@@ -136,8 +135,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_map_nx_create_empty (GL_ARRAY_MAP,
@@ -152,7 +149,7 @@ main (int argc, char *argv[])
     check_all (map1, map2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -160,7 +157,7 @@ main (int argc, char *argv[])
         check_all (map1, map2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index add5f5e4bf2f4e439ab9ff523e302c913954e6c9..42d1d8e85ec18abcd1f4e24a8202b09af144d75f 100644 (file)
@@ -54,11 +54,10 @@ check_equals (gl_set_t set1, gl_set_t set2)
   gl_set_iterator_t iter2;
   const void *elt1;
   const void *elt2;
-  size_t i;
 
   iter1 = gl_set_iterator (set1);
   iter2 = gl_set_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_set_iterator_next (&iter1, &elt1));
       ASSERT (gl_set_iterator_next (&iter2, &elt2));
@@ -75,7 +74,7 @@ check_equals (gl_set_t set1, gl_set_t set2)
       qsort (elements_of_set1, n, sizeof (const void *), cmp_objects_in_array);
       qsort (elements_of_set2, n, sizeof (const void *), cmp_objects_in_array);
     }
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     ASSERT (elements_of_set1[i] == elements_of_set2[i]);
   free (elements_of_set2);
   free (elements_of_set1);
@@ -97,8 +96,7 @@ static size_t
 string_hashcode (const void *elt)
 {
   size_t hashcode = 0;
-  const char *s;
-  for (s = (const char *) elt; *s != '\0'; s++)
+  for (const char *s = (const char *) elt; *s != '\0'; s++)
     hashcode += (unsigned char) *s;
   return hashcode;
 }
@@ -114,8 +112,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_set_nx_create_empty (GL_ARRAY_SET, string_equals, string_hashcode, NULL);
@@ -128,14 +124,14 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_set_nx_add (set1, obj) == gl_set_nx_add (set2, obj));
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index dda5c61dfdb0cc3932217cafb2679a8d0ed95964..34833836f3f4f98a56f0d268fd6ae5d539f6943a 100644 (file)
@@ -40,12 +40,11 @@ hmac_check (const void *key, size_t key_len,
 
   if (memcmp (digest, out, 16) != 0)
     {
-      size_t i;
       printf ("hash 1 mismatch. expected:\n");
-      for (i = 0; i < 16; i++)
+      for (size_t i = 0; i < 16; i++)
         printf ("%02x ", digest[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 16; i++)
+      for (size_t i = 0; i < 16; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       exit (1);
index 827b8fe3e351d704baf07f9c062ff4ea13288416..7637770c7b2fb3d0bef38feda98eca9ff596da4a 100644 (file)
@@ -38,12 +38,11 @@ hmac_check (const void *key, size_t key_len,
 
   if (memcmp (digest, out, 20) != 0)
     {
-      size_t i;
       printf ("hash 1 mismatch. expected:\n");
-      for (i = 0; i < 20; i++)
+      for (size_t i = 0; i < 20; i++)
         printf ("%02x ", digest[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 20; i++)
+      for (size_t i = 0; i < 20; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       exit (1);
index 2c6e5244de549d433cfa5208317227b6cf950b23..5a9e52a800759307f918393016f9aa5549c51e03 100644 (file)
@@ -38,12 +38,11 @@ hmac_check (const void *key, size_t key_len,
 
   if (memcmp (digest, out, 32) != 0)
     {
-      size_t i;
       printf ("hash 1 mismatch. expected:\n");
-      for (i = 0; i < 32; i++)
+      for (size_t i = 0; i < 32; i++)
         printf ("%02x ", digest[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 32; i++)
+      for (size_t i = 0; i < 32; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       exit (1);
index 8672d95d7c707ccf22fb58f92ce9d96b2e204c4f..cc917953986e932d4b1a8f0c60cf84cdda964158 100644 (file)
@@ -38,12 +38,11 @@ hmac_check (const void *key, size_t key_len,
 
   if (memcmp (digest, out, 64) != 0)
     {
-      size_t i;
       printf ("hash 1 mismatch. expected:\n");
-      for (i = 0; i < 64; i++)
+      for (size_t i = 0; i < 64; i++)
         printf ("%02x ", digest[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < 64; i++)
+      for (size_t i = 0; i < 64; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       exit (1);
index de5587174c686af2999b2cf2bb8843491e88c0c1..10c5526295477e04bdc42798bfc771b33c9ba79c 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -54,8 +52,8 @@ test_function (void)
   }
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5;j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5;j++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = L_(16.0) * RANDOM[j]; /* 0.0 <= y <= 16.0 */
index 253d8831d274cebe70dc76ff57d6bbb58f729b3d..bb52d700299ec78148f97828bec4238c575c95f4 100644 (file)
@@ -77,7 +77,6 @@ int
 main (int argc, char *argv[])
 {
   bool verbose = false;
-  int i;
 
 #if HAVE_GETUID
   int uid = getuid ();
@@ -89,7 +88,7 @@ main (int argc, char *argv[])
   /* Parse arguments.
      -v  enables verbose output.
    */
-  for (i = 1; i < argc; i++)
+  for (int i = 1; i < argc; i++)
     {
       const char *arg = argv[i];
       if (strcmp (arg, "-v") == 0)
index 1d94ab52c4e304912d19e6a5746e247bedb5a256..9639acdfe197b1fe0492a37ca33122a4b4d8c536 100644 (file)
@@ -77,7 +77,6 @@ int
 main (int argc, char *argv[])
 {
   bool verbose = false;
-  int i;
 
 #if HAVE_GETUID
   int uid = getuid ();
@@ -95,14 +94,14 @@ main (int argc, char *argv[])
   /* Parse arguments.
      -v  enables verbose output.
    */
-  for (i = 1; i < argc; i++)
+  for (int i = 1; i < argc; i++)
     {
       const char *arg = argv[i];
       if (strcmp (arg, "-v") == 0)
         verbose = true;
     }
 
-  for (i = 0; i < 3; i++)
+  for (int i = 0; i < 3; i++)
     {
       if (verbose)
         show ("before droptemp:");
index 233f7b38990a6e279833e38f2b47fb57e7e09984..2da03d0a9e855aca45894141923add1a75959e28 100644 (file)
@@ -44,9 +44,7 @@ static struct {
 int
 main (void)
 {
-  int i;
-
-  for (i = 0; i < sizeof float_tests / sizeof *float_tests; i++)
+  for (int i = 0; i < sizeof float_tests / sizeof *float_tests; i++)
     {
       union ieee754_float u;
       u.f = float_tests[i].x;
@@ -58,7 +56,7 @@ main (void)
         return 3;
     }
 
-  for (i = 0; i < sizeof double_tests / sizeof *double_tests; i++)
+  for (int i = 0; i < sizeof double_tests / sizeof *double_tests; i++)
     {
       union ieee754_double u;
       u.d = double_tests[i].x;
index 5392eb503f01e98cf4a60b1fa2a5dbfd0290a576..2d3982414ab22dff419bc6db7e202e4ccda3b919 100644 (file)
@@ -27,7 +27,6 @@ my_ldexp (DOUBLE x, int d)
 static void
 test_function (void)
 {
-  int i;
   VOLATILE DOUBLE x;
   int y;
 
@@ -68,73 +67,76 @@ test_function (void)
   ASSERT (ILOGB (NAN) == FP_ILOGBNAN);
 
   /* From here on, this test assumes FLT_RADIX == 2.  */
-
-  for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-
-  for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-
-  for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-
-  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1);
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = ILOGB (x);
-      ASSERT (y == i - 1 || y == i);
-    }
+  {
+    int i;
+
+    for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+
+    for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+
+    for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+
+    for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1);
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = ILOGB (x);
+        ASSERT (y == i - 1 || y == i);
+      }
+  }
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
       if (x != L_(0.0))
index c8edd05191e30850b552d4cf6e947202ec1ee67e..a8fd53fb6bb5144889b0d6b5bd6ecbf417f0f32b 100644 (file)
@@ -36,13 +36,10 @@ main ()
   ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
   ASSERT (ino_map_insert (ino_map, 0) == INO_MAP_INIT + 2);
 
-  {
-    int i;
-    for (i = 0; i < 100; i++)
-      {
-        ASSERT (ino_map_insert (ino_map, 10000 + i) == INO_MAP_INIT + 3 + i);
-      }
-  }
+  for (int i = 0; i < 100; i++)
+    {
+      ASSERT (ino_map_insert (ino_map, 10000 + i) == INO_MAP_INIT + 3 + i);
+    }
 
   ino_map_free (ino_map);
 
index afe00af08ba07cbf48e41f8df94b419a64118b4c..5d0627e495a04e889a0ed8476279c2309c23331c 100644 (file)
@@ -27,8 +27,7 @@
 static int
 naive (unsigned int x)
 {
-  int j;
-  for (j = NBITS - 1; j >= 0; j--)
+  for (int j = NBITS - 1; j >= 0; j--)
     if (x & (1U << j))
       return j + 1;
   return 0;
@@ -37,27 +36,24 @@ naive (unsigned int x)
 int
 main (int argc, char *argv[])
 {
-  unsigned int x;
-  int i;
-
-  for (x = 0; x <= 256; x++)
+  for (unsigned int x = 0; x <= 256; x++)
     ASSERT (integer_length (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (integer_length (1U << i) == naive (1U << i));
       ASSERT (integer_length (1U << i) == i + 1);
       ASSERT (integer_length (-1U << i) == NBITS);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     ASSERT (integer_length (3U << i) == i + 2);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     ASSERT (integer_length (-3U << i) == NBITS);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (integer_length (5U << i) == i + 3);
       ASSERT (integer_length (7U << i) == i + 3);
     }
-  for (i = 0; i < NBITS - 3; i++)
+  for (int i = 0; i < NBITS - 3; i++)
     {
       ASSERT (integer_length (-5U << i) == NBITS);
       ASSERT (integer_length (-7U << i) == NBITS);
index 4b5cb28b18aadb070ce41be1f57a59068c692b53..0b57606a650849abf0acd056956853a021311d6a 100644 (file)
@@ -27,8 +27,7 @@
 static int
 naive (unsigned long x)
 {
-  int j;
-  for (j = NBITS - 1; j >= 0; j--)
+  for (int j = NBITS - 1; j >= 0; j--)
     if (x & (1UL << j))
       return j + 1;
   return 0;
@@ -37,27 +36,24 @@ naive (unsigned long x)
 int
 main (int argc, char *argv[])
 {
-  unsigned long x;
-  int i;
-
-  for (x = 0; x <= 256; x++)
+  for (unsigned long x = 0; x <= 256; x++)
     ASSERT (integer_length_l (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (integer_length_l (1UL << i) == naive (1UL << i));
       ASSERT (integer_length_l (1UL << i) == i + 1);
       ASSERT (integer_length_l (-1UL << i) == NBITS);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     ASSERT (integer_length_l (3UL << i) == i + 2);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     ASSERT (integer_length_l (-3UL << i) == NBITS);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (integer_length_l (5UL << i) == i + 3);
       ASSERT (integer_length_l (7UL << i) == i + 3);
     }
-  for (i = 0; i < NBITS - 3; i++)
+  for (int i = 0; i < NBITS - 3; i++)
     {
       ASSERT (integer_length_l (-5UL << i) == NBITS);
       ASSERT (integer_length_l (-7UL << i) == NBITS);
index 481a9174c9678469efea44666da4fe65eaff6f0c..b7dc0e17de05520ad52a37526f57a84632004f9c 100644 (file)
@@ -27,8 +27,7 @@
 static int
 naive (unsigned long long x)
 {
-  int j;
-  for (j = NBITS - 1; j >= 0; j--)
+  for (int j = NBITS - 1; j >= 0; j--)
     if (x & (1ULL << j))
       return j + 1;
   return 0;
@@ -37,27 +36,24 @@ naive (unsigned long long x)
 int
 main (int argc, char *argv[])
 {
-  unsigned long x;
-  int i;
-
-  for (x = 0; x <= 256; x++)
+  for (unsigned long x = 0; x <= 256; x++)
     ASSERT (integer_length_ll (x) == naive (x));
-  for (i = 0; i < NBITS; i++)
+  for (int i = 0; i < NBITS; i++)
     {
       ASSERT (integer_length_ll (1ULL << i) == naive (1ULL << i));
       ASSERT (integer_length_ll (1ULL << i) == i + 1);
       ASSERT (integer_length_ll (-1ULL << i) == NBITS);
     }
-  for (i = 0; i < NBITS - 1; i++)
+  for (int i = 0; i < NBITS - 1; i++)
     ASSERT (integer_length_ll (3ULL << i) == i + 2);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     ASSERT (integer_length_ll (-3ULL << i) == NBITS);
-  for (i = 0; i < NBITS - 2; i++)
+  for (int i = 0; i < NBITS - 2; i++)
     {
       ASSERT (integer_length_ll (5ULL << i) == i + 3);
       ASSERT (integer_length_ll (7ULL << i) == i + 3);
     }
-  for (i = 0; i < NBITS - 3; i++)
+  for (int i = 0; i < NBITS - 3; i++)
     {
       ASSERT (integer_length_ll (-5ULL << i) == NBITS);
       ASSERT (integer_length_ll (-7ULL << i) == NBITS);
index 6f18526f5c805902cafc54c030c16f7ec6cad87f..09edc267bc817a44c1c9ca96bc92b8cda75b0d89 100644 (file)
@@ -44,60 +44,56 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the alphanumeric characters include only the ASCII A ... Z and a ... z
          and 0 ... 9 characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isalnum_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isalnum_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 208d6235302036603ade518ef101a0e250fab351..60f91ee4ba55713ca2f034d6cfb2442864eb2a7d 100644 (file)
@@ -44,58 +44,54 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the alphabetic characters include only the ASCII A ... Z and a ... z
          characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isalpha_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isalpha_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 6a66b91703ced548e30c5e43c2286a68c5791d62..45a64a3a9f7a3c078740b40dda935bd5632f8755 100644 (file)
@@ -31,8 +31,6 @@ SIGNATURE_CHECK (isblank, int, (int));
 int
 main ()
 {
-  unsigned int c;
-
   /* Verify the property in the "C" locale.
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
@@ -42,7 +40,7 @@ main ()
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the blank characters include only the ASCII <space> and <tab>
          characters.  */
-  for (c = 0; c <= UCHAR_MAX; c++)
+  for (unsigned int c = 0; c <= UCHAR_MAX; c++)
     ASSERT (!isblank (c) == !(c == ' ' || c == '\t'));
   ASSERT (!isblank (EOF));
 
index eb4f0e0aee4fa234280b58495069d8960aa731f6..492a88f493b413183703e5dda6d5267a4819f7be 100644 (file)
@@ -43,48 +43,44 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the blank characters include only the ASCII <space> and <tab>
          characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t':
-        #if !(defined __FreeBSD__ || defined __NetBSD__)
-        case '\v':
-        #endif
-        #if !defined __NetBSD__
-        case '\f':
-        #endif
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isblank_l ((unsigned char) c, locale);
-          if (c == '\t' || c == ' ')
-            ASSERT (is != 0);
-          else
-            ASSERT (is == 0);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t':
+      #if !(defined __FreeBSD__ || defined __NetBSD__)
+      case '\v':
+      #endif
+      #if !defined __NetBSD__
+      case '\f':
+      #endif
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isblank_l ((unsigned char) c, locale);
+        if (c == '\t' || c == ' ')
+          ASSERT (is != 0);
+        else
+          ASSERT (is == 0);
+        break;
+      }
 }
 
 int
index 4c5e02bb5a2e8ca133d768f8ee8267b721995b35..2e33675157ad251ff18731608ffacccb5742cec0 100644 (file)
@@ -38,47 +38,43 @@ test_single_locale_common (locale_t locale)
   /* POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of control characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = iscntrl_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = iscntrl_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 3dd5f9e43bfac1caa06ffe99852b083f93a577ff..6c06e50bff24151499fee6d048e171f0a5d6747e 100644 (file)
@@ -37,48 +37,44 @@ test_single_locale_common (locale_t locale)
 
   /* ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits
      include only the ASCII 0 ... 9 characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isdigit_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isdigit_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 006e4128171adb22676c42f6556d976de4a60858..b64046da5fc5a8242ce9c9cb9cb100b2883abcc0 100644 (file)
@@ -38,48 +38,44 @@ test_single_locale_common (locale_t locale)
   /* POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of graphic characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isgraph_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-            case ' ':
-              ASSERT (is == 0);
-              break;
-            default:
-              ASSERT (is != 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isgraph_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+          case ' ':
+            ASSERT (is == 0);
+            break;
+          default:
+            ASSERT (is != 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index f3f38da723dd4a29246041ea3c1185faa6dfb07b..868438c918904d59f9884a8b4379b00186cc1dcb 100644 (file)
@@ -43,52 +43,48 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the lowercase characters include only the ASCII a ... z characters.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = islower_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = islower_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 39182e83dd09d2038e33aa1ca001f50979935e29..fc82c09ffe33a9064b3be6659dd03680006abb49 100644 (file)
@@ -38,47 +38,43 @@ test_single_locale_common (locale_t locale)
   /* POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of printable characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isprint_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '\t': case '\v': case '\f':
-              ASSERT (is == 0);
-              break;
-            default:
-              ASSERT (is != 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isprint_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '\t': case '\v': case '\f':
+            ASSERT (is == 0);
+            break;
+          default:
+            ASSERT (is != 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 3e6c6279d3b37a91dabd9c489c0935fea9661395..4c9402297a1523ee5db2771ac09c3114cd3983b0 100644 (file)
@@ -38,73 +38,69 @@ test_single_locale_common (locale_t locale)
   /* POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of punctuation or symbol characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = ispunct_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case ' ':
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              /* c is an alphanumeric or space character.  */
-              ASSERT (is == 0);
-              break;
-            case '!': case '"': case '#': case '%':
-            case '&': case '\'': case '(': case ')': case '*':
-            case '+': case ',': case '-': case '.': case '/':
-            case ':': case ';': case '<': case '=': case '>':
-            case '?':
-            case '[': case '\\': case ']': case '^': case '_':
-            case '{': case '|': case '}': case '~':
-              /* These characters are usually expected to be punctuation or
-                 symbol characters.  */
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = ispunct_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case ' ':
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            /* c is an alphanumeric or space character.  */
+            ASSERT (is == 0);
+            break;
+          case '!': case '"': case '#': case '%':
+          case '&': case '\'': case '(': case ')': case '*':
+          case '+': case ',': case '-': case '.': case '/':
+          case ':': case ';': case '<': case '=': case '>':
+          case '?':
+          case '[': case '\\': case ']': case '^': case '_':
+          case '{': case '|': case '}': case '~':
+            /* These characters are usually expected to be punctuation or
+               symbol characters.  */
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 731640ab7a9c9359c02b51b7d6573042254cdb95..9604a2c3597644090795af51c7259235c0a5981f 100644 (file)
@@ -44,48 +44,44 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the white-space characters include only the ASCII <space>, <form-feed>,
          <newline>, <carriage-return>, <tab>, <vertical-tab> characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\f': case '\n': case '\r': case '\t': case '\v':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set" or one of the explicitly
-             mentioned white-space characters.  */
-          is = isspace_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\f': case '\n': case '\r': case '\t': case '\v':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set" or one of the explicitly
+           mentioned white-space characters.  */
+        is = isspace_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case ' ': case '\f': case '\n': case '\r': case '\t': case '\v':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 53ddda4f20db98c1549062fe103a470c7e23a352..7c4fdad126fbae232f42d3873b9ad328a1bccb90 100644 (file)
@@ -43,52 +43,48 @@ test_single_locale_common (locale_t locale)
        - in the "POSIX" locale (which is usually the same as the "C" locale),
          the uppercase characters include only the ASCII A ... Z characters.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isupper_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isupper_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index f80ffb639cde72d9c1e29913e9d8d4c37e129be3..ece54c216d115b1332d97d54a1ee4208cee38e9f 100644 (file)
@@ -62,49 +62,45 @@ main (int argc, char *argv[])
   /* Test single-byte characters.
      ISO C 99 sections 7.25.2.1.5 and 5.2.1 specify that the decimal digits
      include only the ASCII 0 ... 9 characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 0d42c427a75bc0bb96650a3920577bd37caff51a..bfc7c2769dfe53bf331f5472e30b2f6521bf5ce9 100644 (file)
@@ -63,74 +63,70 @@ main (int argc, char *argv[])
      POSIX specifies in
        <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
      no explicit list of punctuation or symbol characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case ' ':
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              /* c is an alphanumeric or space character.  */
-              ASSERT (is == 0);
-              break;
-            case '!': case '"': case '#': case '%':
-            case '&': case '\'': case '(': case ')': case '*':
-            case '+': case ',': case '-': case '.': case '/':
-            case ':': case ';': case '<': case '=': case '>':
-            case '?':
-            case '[': case '\\': case ']': case '^': case '_':
-            case '{': case '|': case '}': case '~':
-              /* These characters are usually expected to be punctuation or
-                 symbol characters.  */
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case ' ':
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            /* c is an alphanumeric or space character.  */
+            ASSERT (is == 0);
+            break;
+          case '!': case '"': case '#': case '%':
+          case '&': case '\'': case '(': case ')': case '*':
+          case '+': case ',': case '-': case '.': case '/':
+          case ':': case ';': case '<': case '=': case '>':
+          case '?':
+          case '[': case '\\': case ']': case '^': case '_':
+          case '{': case '|': case '}': case '~':
+            /* These characters are usually expected to be punctuation or
+               symbol characters.  */
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index 466e3ac9a8fe068a3222b93eae149afb6ff4b4fe..eb948143be64e4d2f33090013a2ff48da4e71914 100644 (file)
@@ -62,51 +62,47 @@ main (int argc, char *argv[])
   /* Test single-byte characters.
      ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal
      digits include only the ASCII 0 ... 9 A ... F a ... f characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          buf[0] = (unsigned char) c;
-          is = for_character (buf, 1);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-            case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        buf[0] = (unsigned char) c;
+        is = for_character (buf, 1);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+          case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 
   if (argc > 1)
     switch (argv[1][0])
index f4b47d7f901e45166772f663ff2e50f26c654280..7cee860e7637148e2986a4761ae51027ccf2628b 100644 (file)
@@ -37,50 +37,46 @@ test_single_locale_common (locale_t locale)
 
   /* ISO C 99 sections 7.25.2.1.12 and 6.4.4.1 specify that the hexadecimal
      digits include only the ASCII 0 ... 9 A ... F a ... f characters.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          is = isxdigit_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case '0': case '1': case '2': case '3': case '4':
-            case '5': case '6': case '7': case '8': case '9':
-            case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-            case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
-              ASSERT (is != 0);
-              break;
-            default:
-              ASSERT (is == 0);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        is = isxdigit_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case '0': case '1': case '2': case '3': case '4':
+          case '5': case '6': case '7': case '8': case '9':
+          case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+          case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+            ASSERT (is != 0);
+            break;
+          default:
+            ASSERT (is == 0);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 62f67df7435c28bdc0fb243039c9ae94e4799340..9f1412253f6ecea5c92f85e90fa5f81f9fcf04d7 100644 (file)
 static void
 test_function (void)
 {
-  int exp;
-
   /* [MX] shaded specification in POSIX.  */
 
   /* NaN.  */
-  for (exp = -100000; exp <= 100000; exp += 100000)
+  for (int exp = -100000; exp <= 100000; exp += 100000)
     ASSERT (ISNAN (LDEXP (NAN, exp)));
 
   /* Signed zero.  */
-  for (exp = -100000; exp <= 100000; exp += 100000)
+  for (int exp = -100000; exp <= 100000; exp += 100000)
     {
       DOUBLE z = LDEXP (L_(0.0), exp);
       ASSERT (z == L_(0.0));
       ASSERT (!signbit (z));
     }
-  for (exp = -100000; exp <= 100000; exp += 100000)
+  for (int exp = -100000; exp <= 100000; exp += 100000)
     {
       DOUBLE z = LDEXP (MINUS_ZERO, exp);
       ASSERT (z == L_(0.0));
@@ -40,8 +38,8 @@ test_function (void)
     }
 
   /* Infinity.  */
-  for (exp = -100000; exp <= 100000; exp += 100000)
+  for (int exp = -100000; exp <= 100000; exp += 100000)
     ASSERT (LDEXP (INFINITY, exp) == INFINITY);
-  for (exp = -100000; exp <= 100000; exp += 100000)
+  for (int exp = -100000; exp <= 100000; exp += 100000)
     ASSERT (LDEXP (- INFINITY, exp) == - INFINITY);
 }
index d76f7c8c77898bc0a258e74731508191d67a6f43..9179b363d182127191b6478dc585c1301ee09643 100644 (file)
@@ -21,7 +21,6 @@
 static void
 test_function (void)
 {
-  int i;
   volatile DOUBLE x;
   volatile DOUBLE y;
 
@@ -91,43 +90,45 @@ test_function (void)
     y = LDEXP (x, -5); ASSERT (y == x * L_(0.03125));
   }
 
-  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = LDEXP (x, 0); ASSERT (y == x);
+  {
+    int i;
+
+    for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
       {
-        volatile DOUBLE expected;
-        y = LDEXP (x, 5);
-        expected = x * L_(32.0);
-        ASSERT (y == expected);
-      }
-      y = LDEXP (x, -5); ASSERT (y == x * 0.03125L);
-      y = LDEXP (x, INT_MIN); ASSERT (y == 0);
-    }
-  for (i = 1, x = L_(1.73205); i >= MIN_EXP; i--, x *= L_(0.5))
-    {
-      y = LDEXP (x, 0); ASSERT (y == x);
-      y = LDEXP (x, 5); ASSERT (y == x * L_(32.0));
-      if (i - 5 >= MIN_EXP)
+        y = LDEXP (x, 0); ASSERT (y == x);
         {
-          y = LDEXP (x, -5); ASSERT (y == x * L_(0.03125));
+          volatile DOUBLE expected;
+          y = LDEXP (x, 5);
+          expected = x * L_(32.0);
+          ASSERT (y == expected);
         }
-    }
-  for (; i >= LDBL_MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = LDEXP (x, 0); ASSERT (y == x);
-      y = LDEXP (x, 5); ASSERT (y == x * L_(32.0));
-    }
+        y = LDEXP (x, -5); ASSERT (y == x * 0.03125L);
+        y = LDEXP (x, INT_MIN); ASSERT (y == 0);
+      }
+    for (i = 1, x = L_(1.73205); i >= MIN_EXP; i--, x *= L_(0.5))
+      {
+        y = LDEXP (x, 0); ASSERT (y == x);
+        y = LDEXP (x, 5); ASSERT (y == x * L_(32.0));
+        if (i - 5 >= MIN_EXP)
+          {
+            y = LDEXP (x, -5); ASSERT (y == x * L_(0.03125));
+          }
+      }
+    for (; i >= LDBL_MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = LDEXP (x, 0); ASSERT (y == x);
+        y = LDEXP (x, 5); ASSERT (y == x * L_(32.0));
+      }
+  }
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
-      int u, v;
-
       x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
       /* LDEXP only does rounding when it returns a denormalized number
          or there is underflow.  It doesn't happen here.  */
-      for (u = -10; u <= 10; u++)
-        for (v = -10; v <= 10; v++)
+      for (int u = -10; u <= 10; u++)
+        for (int v = -10; v <= 10; v++)
           ASSERT (LDEXP (x, u + v) == LDEXP (LDEXP (x, u), v));
     }
 }
index 6545a00223c201d5af77fb6bbb3e924fbf097604..b15908f1a7ad1a2bb9040ef3a2877324aa2eb255 100644 (file)
@@ -28,10 +28,9 @@ int
 main (int argc, char *argv[])
 {
   const char *program_name = argv[0];
-  int i;
 
   /* Parse the command-line arguments.  */
-  for (i = 1; i < argc; i++)
+  for (int i = 1; i < argc; i++)
     {
       const char *arg = argv[i];
       if (str_startswith (arg, "--color="))
index c115b70744a268a9aff11205eb6ee691b3e36c32..25e51a0df4ed473f86a35162a33b7b954cc1df68 100644 (file)
@@ -86,7 +86,6 @@ check_same_link (char const *name1, char const *name2)
 int
 main (void)
 {
-  int i;
   int dfd;
   char *cwd;
   int result;
@@ -167,7 +166,7 @@ main (void)
      last scenario (two relative paths given, neither one AT_FDCWD)
      has two paths, based on whether the two fds are equivalent, so we
      do the other variant after the loop.  */
-  for (i = 0; i < 32; i++)
+  for (int i = 0; i < 32; i++)
     {
       int fd1 = (i & 8) ? dfd : AT_FDCWD;
       char *file1 = mfile_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
index 43f5aca29111325116595d6dfdd3bc613c6dd49a..fb12dc89fd1a71d0f5c8fc33bc80951be26935fb 100644 (file)
@@ -35,11 +35,11 @@ static const char *objects[15] =
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -95,10 +95,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -108,7 +106,7 @@ main (int argc, char *argv[])
     /* Create list2.  */
     list2 = gl_list_nx_create_empty (GL_LINKED_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -121,7 +119,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -402,7 +400,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -428,7 +426,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index fe0d5b2f045e7b4a8ce3317cd3817eed9dad411c..35edf1f3cb6bfe7ef5eccd8d18954bab6ba38ae2 100644 (file)
@@ -62,11 +62,11 @@ string_hash (const void *x)
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -122,10 +122,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -137,7 +135,7 @@ main (int argc, char *argv[])
     list2 = gl_list_nx_create_empty (GL_LINKEDHASH_LIST,
                                      string_equals, string_hash, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -151,7 +149,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -432,7 +430,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -458,7 +456,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index 9a2de70f072139e35ca78e5b487aaad429619c8d..ffeea153b3170b4257eb83b0c1d05914da683904 100644 (file)
@@ -87,11 +87,10 @@ check_equals (gl_map_t map1, gl_map_t map2)
   const void *value1;
   const void *key2;
   const void *value2;
-  size_t i;
 
   iter1 = gl_map_iterator (map1);
   iter2 = gl_map_iterator (map2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_map_iterator_next (&iter1, &key1, &value1));
       ASSERT (gl_map_iterator_next (&iter2, &key2, &value2));
@@ -110,7 +109,7 @@ check_equals (gl_map_t map1, gl_map_t map2)
       qsort (pairs_of_map1, n, sizeof (struct pair), cmp_pairs_in_array);
       qsort (pairs_of_map2, n, sizeof (struct pair), cmp_pairs_in_array);
     }
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (pairs_of_map1[i].key == pairs_of_map2[i].key);
       ASSERT (pairs_of_map1[i].value == pairs_of_map2[i].value);
@@ -136,8 +135,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_map_nx_create_empty (GL_ARRAY_MAP,
@@ -152,7 +149,7 @@ main (int argc, char *argv[])
     check_all (map1, map2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -160,7 +157,7 @@ main (int argc, char *argv[])
         check_all (map1, map2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index 0aab9c3205203acd9e5f4765fba08b7d70f53d8d..def398cc1b540a34d9ec5c09d79d0101962b9438 100644 (file)
@@ -54,11 +54,10 @@ check_equals (gl_set_t set1, gl_set_t set2)
   gl_set_iterator_t iter2;
   const void *elt1;
   const void *elt2;
-  size_t i;
 
   iter1 = gl_set_iterator (set1);
   iter2 = gl_set_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_set_iterator_next (&iter1, &elt1));
       ASSERT (gl_set_iterator_next (&iter2, &elt2));
@@ -75,7 +74,7 @@ check_equals (gl_set_t set1, gl_set_t set2)
       qsort (elements_of_set1, n, sizeof (const void *), cmp_objects_in_array);
       qsort (elements_of_set2, n, sizeof (const void *), cmp_objects_in_array);
     }
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     ASSERT (elements_of_set1[i] == elements_of_set2[i]);
   free (elements_of_set2);
   free (elements_of_set1);
@@ -97,8 +96,7 @@ static size_t
 string_hashcode (const void *elt)
 {
   size_t hashcode = 0;
-  const char *s;
-  for (s = (const char *) elt; *s != '\0'; s++)
+  for (const char *s = (const char *) elt; *s != '\0'; s++)
     hashcode += (unsigned char) *s;
   return hashcode;
 }
@@ -114,8 +112,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_set_nx_create_empty (GL_ARRAY_SET, string_equals, string_hashcode, NULL);
@@ -128,14 +124,14 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_set_nx_add (set1, obj) == gl_set_nx_add (set2, obj));
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index 0bbc2c76d984acdab4e2fbbcacd6442e1b28facb..8b63f9a3f560981efcd60cf05c0806d2a3fa6bd2 100644 (file)
@@ -244,38 +244,32 @@ test_locale_name (void)
 
   /* Check that gl_locale_name distinguishes different categories of the
      thread locale, and that the name is the right one for each.  */
-  {
-    unsigned int i;
-
-    for (i = 0; i < SIZEOF (categories); i++)
-      {
-        int category_mask = categories[i].mask;
-        locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
-        if (loc != NULL)
-          {
-            locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
-            if (locale == NULL)
-              freelocale (loc);
-            else
-              {
-                unsigned int j;
-
-                uselocale (locale);
-                for (j = 0; j < SIZEOF (categories); j++)
-                  {
-                    const char *name_j =
-                      gl_locale_name (categories[j].cat, categories[j].string);
-                    if (j == i)
-                      ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
-                    else
-                      ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
-                  }
-                uselocale (LC_GLOBAL_LOCALE);
-                freelocale (locale);
-              }
-          }
-      }
-  }
+  for (unsigned int i = 0; i < SIZEOF (categories); i++)
+    {
+      int category_mask = categories[i].mask;
+      locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+      if (loc != NULL)
+        {
+          locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+          if (locale == NULL)
+            freelocale (loc);
+          else
+            {
+              uselocale (locale);
+              for (unsigned int j = 0; j < SIZEOF (categories); j++)
+                {
+                  const char *name_j =
+                    gl_locale_name (categories[j].cat, categories[j].string);
+                  if (j == i)
+                    ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
+                  else
+                    ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
+                }
+              uselocale (LC_GLOBAL_LOCALE);
+              freelocale (locale);
+            }
+        }
+    }
 #endif
 }
 
@@ -312,39 +306,33 @@ test_locale_name_thread (void)
 
   /* Check that gl_locale_name_thread distinguishes different categories of the
      thread locale, and that the name is the right one for each.  */
-  {
-    unsigned int i;
-
-    for (i = 0; i < SIZEOF (categories); i++)
-      {
-        int category_mask = categories[i].mask;
-        locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
-        if (loc != NULL)
-          {
-            locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
-            if (locale == NULL)
-              freelocale (loc);
-            else
-              {
-                unsigned int j;
-
-                uselocale (locale);
-                for (j = 0; j < SIZEOF (categories); j++)
-                  {
-                    const char *name_j =
-                      gl_locale_name_thread (categories[j].cat,
-                                             categories[j].string);
-                    if (j == i)
-                      ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
-                    else
-                      ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
-                  }
-                uselocale (LC_GLOBAL_LOCALE);
-                freelocale (locale);
-              }
-          }
-      }
-  }
+  for (unsigned int i = 0; i < SIZEOF (categories); i++)
+    {
+      int category_mask = categories[i].mask;
+      locale_t loc = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", NULL);
+      if (loc != NULL)
+        {
+          locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
+          if (locale == NULL)
+            freelocale (loc);
+          else
+            {
+              uselocale (locale);
+              for (unsigned int j = 0; j < SIZEOF (categories); j++)
+                {
+                  const char *name_j =
+                    gl_locale_name_thread (categories[j].cat,
+                                           categories[j].string);
+                  if (j == i)
+                    ASSERT (strcmp (name_j, "de_DE.UTF-8") == 0);
+                  else
+                    ASSERT (strcmp (name_j, "fr_FR.UTF-8") == 0);
+                }
+              uselocale (LC_GLOBAL_LOCALE);
+              freelocale (locale);
+            }
+        }
+    }
 
   /* Check that gl_locale_name_thread returns a string that is allocated with
      indefinite extent.  */
@@ -463,18 +451,15 @@ test_locale_name_thread (void)
     /* Array of remembered results of gl_locale_name_thread, stored in safe
        memory.  */
     char *saved_names[SIZEOF (choices)][SIZEOF (categories)];
-    unsigned int j;
 
-    for (j = 0; j < SIZEOF (choices); j++)
+    for (unsigned int j = 0; j < SIZEOF (choices); j++)
       {
         locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL);
         available[j] = (locale != NULL);
         if (locale != NULL)
           {
-            unsigned int i;
-
             uselocale (locale);
-            for (i = 0; i < SIZEOF (categories); i++)
+            for (unsigned int i = 0; i < SIZEOF (categories); i++)
               {
                 unsaved_names[j][i] = gl_locale_name_thread (categories[i].cat, categories[i].string);
                 saved_names[j][i] = strdup (unsaved_names[j][i]);
@@ -484,27 +469,24 @@ test_locale_name_thread (void)
           }
       }
     /* Verify the unsaved_names are still valid.  */
-    for (j = 0; j < SIZEOF (choices); j++)
+    for (unsigned int j = 0; j < SIZEOF (choices); j++)
       if (available[j])
         {
-          unsigned int i;
-
-          for (i = 0; i < SIZEOF (categories); i++)
+          for (unsigned int i = 0; i < SIZEOF (categories); i++)
             ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
         }
     /* Allocate many locales, without freeing them.  This is an attempt at
        overwriting as much of the previously allocated memory as possible.  */
-    for (j = SIZEOF (choices); j > 0; )
+    for (unsigned int j = SIZEOF (choices); j > 0; )
       {
         j--;
         if (available[j])
           {
             locale_t locale = newlocale (LC_ALL_MASK, choices[j], NULL);
-            unsigned int i;
 
             ASSERT (locale != NULL);
             uselocale (locale);
-            for (i = 0; i < SIZEOF (categories); i++)
+            for (unsigned int i = 0; i < SIZEOF (categories); i++)
               {
                 const char *name = gl_locale_name_thread (categories[i].cat, categories[i].string);
                 ASSERT (strcmp (unsaved_names[j][i], name) == 0);
@@ -514,12 +496,10 @@ test_locale_name_thread (void)
           }
       }
     /* Verify the unsaved_names are still valid.  */
-    for (j = 0; j < SIZEOF (choices); j++)
+    for (unsigned int j = 0; j < SIZEOF (choices); j++)
       if (available[j])
         {
-          unsigned int i;
-
-          for (i = 0; i < SIZEOF (categories); i++)
+          for (unsigned int i = 0; i < SIZEOF (categories); i++)
             {
               ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
               free (saved_names[j][i]);
index 35142031cbc9d2e0b89a7191dd2a3a5018425811..6badca9ca0c06e42fc43227d5fe6279a179e2383 100644 (file)
@@ -125,10 +125,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -146,9 +146,7 @@ gl_lock_define_initialized(static, my_lock)
 static void *
 lock_mutator_thread (_GL_UNUSED void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -202,23 +200,22 @@ lock_checker_thread (_GL_UNUSED void *arg)
 static void
 test_lock (void)
 {
-  int i;
   gl_thread_t checkerthread;
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
 
   /* Spawn the threads.  */
   checkerthread = gl_thread_create (lock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] = gl_thread_create (lock_mutator_thread, NULL);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
   set_atomic_int_value (&lock_checker_done, 1);
   gl_thread_join (checkerthread, NULL);
@@ -237,9 +234,7 @@ gl_rwlock_define_initialized(static, my_rwlock)
 static void *
 rwlock_mutator_thread (_GL_UNUSED void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -287,27 +282,26 @@ rwlock_checker_thread (_GL_UNUSED void *arg)
 static void
 test_rwlock (void)
 {
-  int i;
   gl_thread_t checkerthreads[THREAD_COUNT];
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&rwlock_checker_done);
   set_atomic_int_value (&rwlock_checker_done, 0);
 
   /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     checkerthreads[i] = gl_thread_create (rwlock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] = gl_thread_create (rwlock_mutator_thread, NULL);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
   set_atomic_int_value (&rwlock_checker_done, 1);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (checkerthreads[i], NULL);
   check_accounts ();
 }
@@ -348,9 +342,7 @@ recshuffle (void)
 static void *
 reclock_mutator_thread (_GL_UNUSED void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       recshuffle ();
 
@@ -390,23 +382,22 @@ reclock_checker_thread (_GL_UNUSED void *arg)
 static void
 test_recursive_lock (void)
 {
-  int i;
   gl_thread_t checkerthread;
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&reclock_checker_done);
   set_atomic_int_value (&reclock_checker_done, 0);
 
   /* Spawn the threads.  */
   checkerthread = gl_thread_create (reclock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] = gl_thread_create (reclock_mutator_thread, NULL);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
   set_atomic_int_value (&reclock_checker_done, 1);
   gl_thread_join (checkerthread, NULL);
@@ -443,9 +434,8 @@ static void *
 once_contender_thread (void *arg)
 {
   int id = (int) (intptr_t) arg;
-  int repeat;
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Tell the main thread that we're ready.  */
       gl_lock_lock (ready_lock[id]);
@@ -480,17 +470,16 @@ once_contender_thread (void *arg)
 static void
 test_once (void)
 {
-  int i, repeat;
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialize all variables.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     {
       ready[i] = 0;
       gl_lock_init (ready_lock[i]);
     }
 #if ENABLE_LOCKING
-  for (i = 0; i < REPEAT_COUNT; i++)
+  for (int i = 0; i < REPEAT_COUNT; i++)
     gl_rwlock_init (fire_signal[i]);
 #else
   fire_signal_state = 0;
@@ -498,23 +487,23 @@ test_once (void)
 
 #if ENABLE_LOCKING
   /* Block all fire_signals.  */
-  for (i = REPEAT_COUNT-1; i >= 0; i--)
+  for (int i = REPEAT_COUNT-1; i >= 0; i--)
     gl_rwlock_wrlock (fire_signal[i]);
 #endif
 
   /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] =
       gl_thread_create (once_contender_thread, (void *) (intptr_t) i);
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Wait until every thread is ready.  */
       dbgprintf ("Main thread before synchronizing for round %d\n", repeat);
       for (;;)
         {
           int ready_count = 0;
-          for (i = 0; i < THREAD_COUNT; i++)
+          for (int i = 0; i < THREAD_COUNT; i++)
             {
               gl_lock_lock (ready_lock[i]);
               ready_count += ready[i];
@@ -544,7 +533,7 @@ test_once (void)
       performed = 0;
 
       /* Preparation for the next round: Reset the ready flags.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         {
           gl_lock_lock (ready_lock[i]);
           ready[i] = 0;
@@ -561,7 +550,7 @@ test_once (void)
     }
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
 }
 
index e80887228a8c4e3d2ccd15db252f0246f68b970b..8f85f85c2a6604cb04e1b8be959cc6a088261dae 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -62,7 +60,7 @@ test_function (void)
 #endif
       );
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i] + L_(1.0); /* 1.0 <= x <= 17.0 */
         DOUBLE y = LOG (x);
@@ -91,8 +89,8 @@ test_function (void)
 #endif
        : L_(7.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(1.0);
           DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(1.0);
index a91c566d6de4fa2035c3524506fd928d859a9a9e..86a2128b5f622b20f96ebe1c80c26feba8dfd420 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -56,7 +54,7 @@ test_function (void)
 #endif
        : L_(3.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i] + L_(1.0); /* 1.0 <= x <= 17.0 */
         DOUBLE y = LOG10 (x);
@@ -85,8 +83,8 @@ test_function (void)
 #endif
        : L_(5.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(1.0);
           DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(1.0);
index 172cf57c2f605b136d19eab6e9b0f73897f84293..773543eaddffd158a2be9756096fad1bc6208d26 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -52,7 +50,7 @@ test_function (void)
 #endif
        : L_(13.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = LOG1P (x);
@@ -81,8 +79,8 @@ test_function (void)
 #endif
        : L_(61.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(2.0);
           DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(2.0);
index 7afcb90297f047b6ddbe26c061498f65b4550c79..f23ac81b0f9bea911d0177397d7d251a74b9bece 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -83,7 +81,7 @@ test_function (void)
 #endif
        : L_(5.0));
 
-    for (i = 0; i < SIZEOF (RANDOM); i++)
+    for (int i = 0; i < SIZEOF (RANDOM); i++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i] + L_(1.0); /* 1.0 <= x <= 17.0 */
         DOUBLE y = LOG2 (x);
@@ -112,8 +110,8 @@ test_function (void)
 #endif
        : L_(9.0));
 
-    for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
         {
           DOUBLE x = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[i]) - L_(1.0);
           DOUBLE y = L_(17.0) / (L_(16.0) - L_(15.0) * RANDOM[j]) - L_(1.0);
index 1fbafbaad06790e3093536700f9ffa5eb2da2d4d..edfe185f9351eba5c959adfea1f44839dbdfd5c6 100644 (file)
@@ -27,7 +27,6 @@ my_ldexp (DOUBLE x, int d)
 static void
 test_function (void)
 {
-  int i;
   VOLATILE DOUBLE x;
   DOUBLE y;
 
@@ -61,73 +60,76 @@ test_function (void)
   ASSERT (LOGB (MINUS_ZERO) == - HUGEVAL);
 
   /* From here on, this test assumes FLT_RADIX == 2.  */
-
-  for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-
-  for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-
-  for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-
-  for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1));
-    }
-  for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
-    {
-      y = LOGB (x);
-      ASSERT (y == (DOUBLE)(i - 1) || y == (DOUBLE)i);
-    }
+  {
+    int i;
+
+    for (i = 1, x = L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (i = 1, x = L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+
+    for (i = 1, x = - L_(1.0); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (i = 1, x = - L_(1.0); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (; i >= MIN_EXP - 100 && x < L_(0.0); i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+
+    for (i = 1, x = L_(1.01); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (i = 1, x = L_(1.01); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+
+    for (i = 1, x = L_(1.73205); i <= MAX_EXP; i++, x *= L_(2.0))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (i = 1, x = L_(1.73205); i >= MIN_NORMAL_EXP; i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1));
+      }
+    for (; i >= MIN_EXP - 100 && x > L_(0.0); i--, x *= L_(0.5))
+      {
+        y = LOGB (x);
+        ASSERT (y == (DOUBLE)(i - 1) || y == (DOUBLE)i);
+      }
+  }
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       x = L_(20.0) * RANDOM[i] - L_(10.0); /* -10.0 <= x <= 10.0 */
       if (x != L_(0.0))
index 883ee2625cba48394a342801f4afdda4cefd2fcb..7ba4d92ac7bf14ec50089ff782c1548bc6d9ea3b 100644 (file)
@@ -60,44 +60,41 @@ main ()
 
   /* Check that fd = 0, 1, 2 are now open to the controlling terminal for the
      current process and that it is a session of its own.  */
-  {
-    int fd;
-    for (fd = 0; fd < 3; fd++)
-      if (!(tcgetpgrp (fd) == getpid ()))
-        {
-          ignore_value (freopen ("err", "w+", stderr));
-          fprintf (stderr, "tcgetpgrp(%d) = %ld whereas getpid() = %ld\n",
-                   fd, (long) tcgetpgrp (fd), (long) getpid ());
-          fflush (stderr);
-          abort ();
-        }
-    for (fd = 0; fd < 3; fd++)
+  for (int fd = 0; fd < 3; fd++)
+    if (!(tcgetpgrp (fd) == getpid ()))
       {
-        pid_t sid = tcgetsid (fd);
-        if (sid == -1)
-          {
-            if (!(errno == ENOSYS))
-              {
-                ignore_value (freopen ("err", "w+", stderr));
-                fprintf (stderr, "tcgetsid(%d) = -1 and errno = %d\n",
-                         fd, errno);
-                fflush (stderr);
-                abort ();
-              }
-          }
-        else
-          {
-            if (!(sid == getpid ()))
-              {
-                ignore_value (freopen ("err", "w+", stderr));
-                fprintf (stderr, "tcgetsid(%d) = %ld whereas getpid() = %ld\n",
-                         fd, (long) tcgetsid (fd), (long) getpid ());
-                fflush (stderr);
-                abort ();
-              }
-          }
+        ignore_value (freopen ("err", "w+", stderr));
+        fprintf (stderr, "tcgetpgrp(%d) = %ld whereas getpid() = %ld\n",
+                 fd, (long) tcgetpgrp (fd), (long) getpid ());
+        fflush (stderr);
+        abort ();
       }
-  }
+  for (int fd = 0; fd < 3; fd++)
+    {
+      pid_t sid = tcgetsid (fd);
+      if (sid == -1)
+        {
+          if (!(errno == ENOSYS))
+            {
+              ignore_value (freopen ("err", "w+", stderr));
+              fprintf (stderr, "tcgetsid(%d) = -1 and errno = %d\n",
+                       fd, errno);
+              fflush (stderr);
+              abort ();
+            }
+        }
+      else
+        {
+          if (!(sid == getpid ()))
+            {
+              ignore_value (freopen ("err", "w+", stderr));
+              fprintf (stderr, "tcgetsid(%d) = %ld whereas getpid() = %ld\n",
+                       fd, (long) tcgetsid (fd), (long) getpid ());
+              fflush (stderr);
+              abort ();
+            }
+        }
+    }
 
   return 0;
 }
index 438106e1e0b8af69456db06ed460c6e39580744e..519d0286b6a6005fe176bc483acac9ecf71c6f75 100644 (file)
@@ -35,13 +35,11 @@ void (*func) (int) = do_allocation;
 int
 main ()
 {
-  int i;
-
   /* This slows down malloc a lot.  */
   unsetenv ("MALLOC_PERTURB_");
 
   /* Repeat a lot of times, to make sure there's no memory leak.  */
-  for (i = 0; i < 50000; i++)
+  for (int i = 0; i < 50000; i++)
     {
       /* Try various values.
          n = 0 gave a crash on Alpha with gcc-2.5.8.
index 1ba29f16df5f0e4465a4aec0ca6bbc3d777de282..efeba1eb7a64897b45e981408d90e58fb441afa3 100644 (file)
@@ -105,11 +105,10 @@ test_one_locale (const char *name, int codepage)
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -534,10 +533,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index c08dd562ea39347db8e01d4cbb388094a8e2eaea..a269826d44ded7fb3681200ae11aa02a6c9163b2 100644 (file)
@@ -58,11 +58,10 @@ main (int argc, char *argv[])
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -124,11 +123,10 @@ main (int argc, char *argv[])
       case '1':
         /* C or POSIX locale.  */
         {
-          int c;
           char buf[1];
 
           memset (&state, '\0', sizeof (mbstate_t));
-          for (c = 0; c < 0x100; c++)
+          for (int c = 0; c < 0x100; c++)
             if (c != 0)
               {
                 /* We are testing all nonnull bytes.  */
index 9aad232f7d6a174354194d2ebdbeb7e4d0f254bd..e04dd827ad4e9d0f6ff004787c81dc47a30817a1 100644 (file)
@@ -110,11 +110,10 @@ test_one_locale (const char *name, int codepage)
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -743,10 +742,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index ffa66b52804de0d21c2f0887af8f7272c0131941..e61d7197e8f2d0688bef90a6ea34d0f79eb26e6f 100644 (file)
@@ -67,11 +67,10 @@ main (int argc, char *argv[])
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -141,11 +140,10 @@ main (int argc, char *argv[])
       case '1':
         /* C or POSIX locale.  */
         {
-          int c;
           char buf[1];
 
           memset (&state, '\0', sizeof (mbstate_t));
-          for (c = 0; c < 0x100; c++)
+          for (int c = 0; c < 0x100; c++)
             if (c != 0)
               {
                 /* We are testing all nonnull bytes.  */
index 107497d066fe56e5aa7b0728f9bfa2f653ddbaea..fa892e700000e89f328e9c412b4e5bc30c870195 100644 (file)
@@ -110,11 +110,10 @@ test_one_locale (const char *name, int codepage)
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -719,10 +718,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index d1bf56bc2ae66f3cd7ac7f991b9928ff42363185..96e6a4f7213024de79acca265ec51a1cf7bcaf6f 100644 (file)
@@ -67,11 +67,10 @@ main (int argc, char *argv[])
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -141,11 +140,10 @@ main (int argc, char *argv[])
       case '1':
         /* C or POSIX locale.  */
         {
-          int c;
           char buf[1];
 
           memset (&state, '\0', sizeof (mbstate_t));
-          for (c = 0; c < 0x100; c++)
+          for (int c = 0; c < 0x100; c++)
             if (c != 0)
               {
                 /* We are testing all nonnull bytes.  */
index 4ec33f94d43bf9f40c79545ad8d4341825e60429..ea5cb213072e76e806ccd0aa2130bd6c7ea39082 100644 (file)
@@ -112,11 +112,10 @@ test_one_locale (const char *name, int codepage)
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -703,10 +702,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index 2c288a29eb92152ebba7871c44b5b8bd16f6ec9e..92d1721d1ff75f203f32daa20a2bdf5408694025 100644 (file)
@@ -66,11 +66,10 @@ main (int argc, char *argv[])
 
   /* Test single-byte input.  */
   {
-    int c;
     char buf[1];
 
     memset (&state, '\0', sizeof (mbstate_t));
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       switch (c)
         {
         case '\t': case '\v': case '\f':
@@ -140,11 +139,10 @@ main (int argc, char *argv[])
       case '1':
         /* C or POSIX locale.  */
         {
-          int c;
           char buf[1];
 
           memset (&state, '\0', sizeof (mbstate_t));
-          for (c = 0; c < 0x100; c++)
+          for (int c = 0; c < 0x100; c++)
             if (c != 0)
               {
                 /* We are testing all nonnull bytes.  */
index b1a437b451b913cbcfedb0085f9fff8ac6226d7d..70d5e68070f2f27cd86d28890de0fe17370e4f1f 100644 (file)
@@ -84,20 +84,15 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           char32_t buf[BUFSIZE];
           const char *src;
           mbstate_t temp_state;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (char32_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (char32_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -131,11 +126,10 @@ main (int argc, char *argv[])
                 ASSERT (mbsinit (&state));
               }
               {
-                int c;
                 char input[2];
 
                 memset (&state, '\0', sizeof (mbstate_t));
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 6e28b38e050ffe02e574e7048e5527b6ba364104..6bcca35b87329edfdf8eb3ec915e0370099d757b 100644 (file)
@@ -83,20 +83,15 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           wchar_t buf[BUFSIZE];
           const char *src;
           mbstate_t temp_state;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (wchar_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (wchar_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -130,11 +125,10 @@ main (int argc, char *argv[])
                 ASSERT (mbsinit (&state));
               }
               {
-                int c;
                 char input[2];
 
                 memset (&state, '\0', sizeof (mbstate_t));
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 8523c818027316504790a10a29629d4972245c19..7269da9180e0a25adf3323328b9576542ac8193a 100644 (file)
@@ -84,20 +84,15 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           char32_t buf[BUFSIZE];
           const char *src;
           mbstate_t temp_state;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (char32_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (char32_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -131,11 +126,10 @@ main (int argc, char *argv[])
                 ASSERT (mbsinit (&state));
               }
               {
-                int c;
                 char input[2];
 
                 memset (&state, '\0', sizeof (mbstate_t));
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 88a8058cdd06da23285dc4d20b07b46367e5f4ed..f60fe5445adaff10a8b166ce744e5f581c894149 100644 (file)
@@ -83,20 +83,15 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           wchar_t buf[BUFSIZE];
           const char *src;
           mbstate_t temp_state;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (wchar_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (wchar_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -130,11 +125,10 @@ main (int argc, char *argv[])
                 ASSERT (mbsinit (&state));
               }
               {
-                int c;
                 char input[2];
 
                 memset (&state, '\0', sizeof (mbstate_t));
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 0e8d9e14a11c8a7e4fa6cef2a4fe5c15357b39ee..d4d7517677992a25a36bbf53cb956077fae847dc 100644 (file)
@@ -75,19 +75,14 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           char32_t buf[BUFSIZE];
           const char *src;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (char32_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (char32_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -115,10 +110,9 @@ main (int argc, char *argv[])
                   ASSERT (buf[1] == (char32_t) 0xBADFACE);
               }
               {
-                int c;
                 char input[2];
 
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 4d265293d3a66f43694b6a4f7b8eb8c573db720d..e014dacef7d0c9db6a3e86887ee45654a99aad9c 100644 (file)
@@ -76,19 +76,14 @@ main (int argc, char *argv[])
 
   if (argc > 1)
     {
-      int unlimited;
-
-      for (unlimited = 0; unlimited < 2; unlimited++)
+      for (int unlimited = 0; unlimited < 2; unlimited++)
         {
           #define BUFSIZE 10
           wchar_t buf[BUFSIZE];
           const char *src;
 
-          {
-            size_t i;
-            for (i = 0; i < BUFSIZE; i++)
-              buf[i] = (wchar_t) 0xBADFACE;
-          }
+          for (size_t i = 0; i < BUFSIZE; i++)
+            buf[i] = (wchar_t) 0xBADFACE;
 
           switch (argv[1][0])
             {
@@ -116,10 +111,9 @@ main (int argc, char *argv[])
                   ASSERT (buf[1] == (wchar_t) 0xBADFACE);
               }
               {
-                int c;
                 char input[2];
 
-                for (c = 0; c < 0x100; c++)
+                for (int c = 0; c < 0x100; c++)
                   if (c != 0)
                     {
                       /* We are testing all nonnull bytes.  */
index 9767a9b01d6fa04df17613c75336bc49a0333b59..7ae7d786ff78c508554f76c36ada490d26b05544 100644 (file)
@@ -37,12 +37,11 @@ main (int argc, char *argv[])
   if (memcmp (md2_buffer (in1, strlen (in1), buf), out1, MD2_DIGEST_SIZE) !=
       0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD2_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD2_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -51,12 +50,11 @@ main (int argc, char *argv[])
   if (memcmp (md2_buffer (in2, strlen (in2), buf), out2, MD2_DIGEST_SIZE) !=
       0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD2_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
         printf ("%02x ", out2[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD2_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD2_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFF);
       printf ("\n");
       return 1;
index 5be63b3fc816800fa5f3cf3241174530b3f272f4..607be43ecf0b0d65029092508c19f08ce0900895 100644 (file)
@@ -38,12 +38,11 @@ main (int argc, char *argv[])
   if (memcmp (md4_buffer (in1, strlen (in1), buf), out1, MD4_DIGEST_SIZE) !=
       0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD4_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD4_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -52,12 +51,11 @@ main (int argc, char *argv[])
   if (memcmp (md4_buffer (in2, strlen (in2), buf), out2, MD4_DIGEST_SIZE) !=
       0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD4_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
         printf ("%02x ", out2[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD4_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD4_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFF);
       printf ("\n");
       return 1;
index 2d94c811f876ace7bd295ea5f0a85f83e5e8ab7a..2fdab57cbd1d3af9b4b4eb5fb53b93ae2b227945 100644 (file)
@@ -39,12 +39,11 @@ main (void)
 
   if (memcmp (md5_buffer (in1, strlen (in1), buf), out1, MD5_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
@@ -52,12 +51,11 @@ main (void)
 
   if (memcmp (md5_buffer (in2, strlen (in2), buf), out2, MD5_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
         printf ("%02x ", out2[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < MD5_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < MD5_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index a457937590968f3e74264f788d63790f9b8a47ad..59e34924b3684770b3794b2019828f6cca0ba310 100644 (file)
@@ -41,9 +41,8 @@ main (int argc, char *argv[])
   void *aligned16_blocks[SIZEOF (sizes)];
   void *aligned32_blocks[SIZEOF (sizes)];
   void *aligned64_blocks[SIZEOF (sizes)];
-  size_t i;
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       size_t size = sizes[i];
 
@@ -78,7 +77,7 @@ main (int argc, char *argv[])
       memset (aligned64_blocks[i], 'z', size);
     }
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       free (aligned2_blocks[i]);
       free (aligned4_blocks[i]);
index a8df12d1516604e243b74894247a10536881d474..544d1a1aec4641956358021b852c1f5f0e2468f0 100644 (file)
@@ -58,8 +58,7 @@ main (void)
   {
     char foo[21];
     char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
+    for (int i = 0; i < 4; i++)
       {
         char *a = foo + i;
         char *b = bar + i;
index 48f9b2eabdf74a491798fc2c744a9670714a1f13..02b882a975a5ffb43a7c8fa91bd50e2b21e81312 100644 (file)
@@ -41,61 +41,62 @@ static void *(*volatile volatile_memchr) (void const *, int, size_t)
 int
 main (void)
 {
-  size_t n = 0x100000;
-  char *input = malloc (n);
-  ASSERT (input);
-
-  input[0] = 'a';
-  input[1] = 'b';
-  memset (input + 2, 'c', 1024);
-  memset (input + 1026, 'd', n - 1028);
-  input[n - 2] = 'e';
-  input[n - 1] = 'a';
-
-  /* Basic behavior tests.  */
-  ASSERT (memchr (input, 'a', n) == input);
-
-  ASSERT (memchr (input, 'a', 0) == NULL);
-
   {
-    void *page_boundary = zerosize_ptr ();
-    if (page_boundary)
-      ASSERT (memchr (page_boundary, 'a', 0) == NULL);
-  }
-
-  ASSERT (memchr (input, 'b', n) == input + 1);
-  ASSERT (memchr (input, 'c', n) == input + 2);
-  ASSERT (memchr (input, 'd', n) == input + 1026);
-
-  ASSERT (memchr (input + 1, 'a', n - 1) == input + n - 1);
-  ASSERT (memchr (input + 1, 'e', n - 1) == input + n - 2);
-  ASSERT (memchr (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2);
-
-  ASSERT (memchr (input, 'f', n) == NULL);
-  ASSERT (memchr (input, '\0', n) == NULL);
-
-  /* Check that a very long haystack is handled quickly if the byte is
-     found near the beginning.  */
-  {
-    size_t repeat = 10000;
-    for (; repeat > 0; repeat--)
-      {
-        ASSERT (memchr (input, 'c', n) == input + 2);
-      }
-  }
-
-  /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
+    size_t n = 0x100000;
+    char *input = malloc (n);
+    ASSERT (input);
+
+    input[0] = 'a';
+    input[1] = 'b';
+    memset (input + 2, 'c', 1024);
+    memset (input + 1026, 'd', n - 1028);
+    input[n - 2] = 'e';
+    input[n - 1] = 'a';
+
+    /* Basic behavior tests.  */
+    ASSERT (memchr (input, 'a', n) == input);
+
+    ASSERT (memchr (input, 'a', 0) == NULL);
+
+    {
+      void *page_boundary = zerosize_ptr ();
+      if (page_boundary)
+        ASSERT (memchr (page_boundary, 'a', 0) == NULL);
+    }
+
+    ASSERT (memchr (input, 'b', n) == input + 1);
+    ASSERT (memchr (input, 'c', n) == input + 2);
+    ASSERT (memchr (input, 'd', n) == input + 1026);
+
+    ASSERT (memchr (input + 1, 'a', n - 1) == input + n - 1);
+    ASSERT (memchr (input + 1, 'e', n - 1) == input + n - 2);
+    ASSERT (memchr (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2);
+
+    ASSERT (memchr (input, 'f', n) == NULL);
+    ASSERT (memchr (input, '\0', n) == NULL);
+
+    /* Check that a very long haystack is handled quickly if the byte is
+       found near the beginning.  */
+    {
+      size_t repeat = 10000;
+      for (; repeat > 0; repeat--)
+        {
+          ASSERT (memchr (input, 'c', n) == input + 2);
+        }
+    }
+
+    /* Alignment tests.  */
+    for (int i = 0; i < 32; i++)
       {
-        for (j = 0; j < 256; j++)
+        for (int j = 0; j < 256; j++)
           input[i + j] = j;
-        for (j = 0; j < 256; j++)
+        for (int j = 0; j < 256; j++)
           {
             ASSERT (memchr (input + i, j, 256) == input + i + j);
           }
       }
+
+    free (input);
   }
 
   /* Check that memchr() does not read past the first occurrence of the
@@ -112,34 +113,27 @@ main (void)
 
     if (page_boundary != NULL)
       {
-        for (n = 1; n <= limit; n++)
+        for (int n = 1; n <= limit; n++)
           {
             char *mem = page_boundary - n;
             memset (mem, 'X', n);
             ASSERT (memchr (mem, 'U', n) == NULL);
             ASSERT (memchr (mem, 0, n) == NULL);
 
-            {
-              size_t i;
-              size_t k;
-
-              for (i = 0; i < n; i++)
-                {
-                  mem[i] = 'U';
-                  for (k = i + 1; k < n + limit; k++)
-                    ASSERT (memchr (mem, 'U', k) == mem + i);
-                  mem[i] = 0;
-                  for (k = i + 1; k < n + limit; k++)
-                    ASSERT (memchr (mem, 0, k) == mem + i);
-                  mem[i] = 'X';
-                }
-            }
+            for (size_t i = 0; i < n; i++)
+              {
+                mem[i] = 'U';
+                for (size_t k = i + 1; k < n + limit; k++)
+                  ASSERT (memchr (mem, 'U', k) == mem + i);
+                mem[i] = 0;
+                for (size_t k = i + 1; k < n + limit; k++)
+                  ASSERT (memchr (mem, 0, k) == mem + i);
+                mem[i] = 'X';
+              }
           }
       }
   }
 
-  free (input);
-
   /* Test zero-length operations on NULL pointers, allowed by
      <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>.  */
   ASSERT (memchr (NULL, '?', 0) == NULL);
index 1e11ae75bd142806e8f0339ae387e9f0d4a7793f..ada15a7ae579e2e72dff687a792fffb0939b83d3 100644 (file)
@@ -78,19 +78,16 @@ main (void)
   }
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 256; j++)
-          input[i + j] = j;
-        for (j = 0; j < 256; j++)
-          {
-            ASSERT (memchr2 (input + i, j, 0xff, 256) == input + i + j);
-            ASSERT (memchr2 (input + i, 0xff, j, 256) == input + i + j);
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 256; j++)
+        input[i + j] = j;
+      for (int j = 0; j < 256; j++)
+        {
+          ASSERT (memchr2 (input + i, j, 0xff, 256) == input + i + j);
+          ASSERT (memchr2 (input + i, 0xff, j, 256) == input + i + j);
+        }
+    }
 
   free (input);
 
index 9a62197c7a5c9866b6ba0a7172e5c9dd32d25f33..58f0316d210db1d4ac5d318c36913099fe88d202 100644 (file)
@@ -70,8 +70,7 @@ main (void)
   {
     char foo[21];
     char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
+    for (int i = 0; i < 4; i++)
       {
         char *a = foo + i;
         char *b = bar + i;
index 54e684765ce34be5104905fa6e0a0740dc95de6c..44dfd1cb6fd887a7e17f525e3153869b825146fc 100644 (file)
@@ -278,9 +278,8 @@ main (int argc, char *argv[])
       "with_multilib_list\n";
     size_t h_len = strlen (h);
     char *haystack = malloc (h_len + 1);
-    size_t i;
     ASSERT (haystack);
-    for (i = 0; i < h_len - strlen (needle); i++)
+    for (size_t i = 0; i < h_len - strlen (needle); i++)
       {
         const char *p;
         memcpy (haystack, h, h_len + 1);
index 2d9f907dd089981ee03d06d275c569cf8b9e1046..3cb143b642f114da47c0fe3624d9c24ad3bd7b2d 100644 (file)
@@ -75,18 +75,15 @@ main (void)
   }
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 256; j++)
-          input[i + j] = j;
-        for (j = 0; j < 256; j++)
-          {
-            ASSERT (memrchr (input + i, j, 256) == input + i + j);
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 256; j++)
+        input[i + j] = j;
+      for (int j = 0; j < 256; j++)
+        {
+          ASSERT (memrchr (input + i, j, 256) == input + i + j);
+        }
+    }
 
   free (input);
 
index ec165df9ac707da32c722fbfe0e81c9872035071..ead1c30178f323b2fe03d98fe8029667b21c73d8 100644 (file)
@@ -227,10 +227,9 @@ static void
 test_stack (void)
 {
   int count = 0;
-  int repeat;
   char *volatile last_stackbuf;
 
-  for (repeat = 2 * 1000; repeat > 0; repeat--)
+  for (int repeat = 2 * 1000; repeat > 0; repeat--)
     {
       /* This odd way of writing two consecutive statements
            do_secret_stuff (1, &last_stackbuf);
index 5a13b6fb81eb490eec48d51d2aad4d733ed3030f..ff40d56ed7110667f02053c13ddb7720ebdee0e3 100644 (file)
@@ -67,7 +67,6 @@ do_mknodat (char const *name, mode_t mode)
 int
 main (void)
 {
-  int i;
   test_func funcs[2] = { mkfifoat, test_mknodat };
   int result;
 
@@ -83,7 +82,7 @@ main (void)
   ASSERT (test_mkfifo (do_mknodat, false) == result);
 
   /* Test directory-relative handling of both functions.  */
-  for (i = 0; i < 2; i++)
+  for (int i = 0; i < 2; i++)
     {
       struct stat st;
       test_func func = funcs[i];
index 8f00716fb04839817fa22b3352e7687b2e1d5380..b7df662c3379ba961d27a36d6569bb6bdc019bf9 100644 (file)
@@ -17,7 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -29,7 +28,7 @@ test_function (void)
     * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       DOUBLE x = RANDOM[i]; /* 0.0 <= x < 1.0 */
       DOUBLE y;
index cf7d5dd03dd7773786e9a7381d1089aa4d2c0a9f..7dff8ffc3142d642120b39075ff4c3e119621415 100644 (file)
@@ -29,14 +29,13 @@ int
 main (void)
 {
   struct mount_entry *mounts;
-  struct mount_entry *p;
 
   mounts = read_file_system_list (false);
 
   /* Assume at least one mount point.  */
   ASSERT (mounts != NULL);
 
-  for (p = mounts; p != NULL;)
+  for (struct mount_entry *p = mounts; p != NULL;)
     {
       struct mount_entry *next = p->me_next;
       printf ("%s %s %s %s %s\n",
index 996a6f030031ccbb21645c6d322146297bcd6b5f..1cc9554d4bcce801545d1189b4cd42197b041666 100644 (file)
@@ -96,10 +96,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -117,9 +117,7 @@ static mtx_t my_lock;
 static int
 lock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -173,12 +171,11 @@ lock_checker_thread (void *arg)
 static void
 test_mtx_plain (void)
 {
-  int i;
   thrd_t checkerthread;
   thrd_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
@@ -186,12 +183,12 @@ test_mtx_plain (void)
   /* Spawn the threads.  */
   ASSERT (thrd_create (&checkerthread, lock_checker_thread, NULL)
           == thrd_success);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_create (&threads[i], lock_mutator_thread, NULL)
             == thrd_success);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_join (threads[i], NULL) == thrd_success);
   set_atomic_int_value (&lock_checker_done, 1);
   ASSERT (thrd_join (checkerthread, NULL) == thrd_success);
@@ -234,9 +231,7 @@ recshuffle (void)
 static int
 reclock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       recshuffle ();
 
@@ -276,12 +271,11 @@ reclock_checker_thread (void *arg)
 static void
 test_mtx_recursive (void)
 {
-  int i;
   thrd_t checkerthread;
   thrd_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&reclock_checker_done);
   set_atomic_int_value (&reclock_checker_done, 0);
@@ -289,12 +283,12 @@ test_mtx_recursive (void)
   /* Spawn the threads.  */
   ASSERT (thrd_create (&checkerthread, reclock_checker_thread, NULL)
           == thrd_success);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_create (&threads[i], reclock_mutator_thread, NULL)
             == thrd_success);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (thrd_join (threads[i], NULL) == thrd_success);
   set_atomic_int_value (&reclock_checker_done, 1);
   ASSERT (thrd_join (checkerthread, NULL) == thrd_success);
index 5fcdd8795871949e3eccd5bf7e2bae6f1edb6249..8fcb1a3ea01d069e60bc459be3fc06c2f527864f 100644 (file)
@@ -33,7 +33,6 @@ main (int argc, char *argv[])
 {
 #if HAVE_WORKING_USELOCALE
   /* Check that nl_langinfo() uses the per-thread locale.  */
-  int pass;
   bool skipped_all = true;
 
   /* Extract a few items from the C locale.  */
@@ -59,7 +58,7 @@ main (int argc, char *argv[])
   ASSERT (strlen (c_CRNCYSTR) <= 1); /* "-", "+", ".", or "" */
   ASSERT (c_strcasestr (c_YESEXPR, "y" /* from "yes" */) != NULL);
 
-  for (pass = 1; pass <= 2; pass++)
+  for (int pass = 1; pass <= 2; pass++)
     {
       /* pass    locale
           1        traditional French locale
index 08e550c136358813cf7e3fd4a54a9b5b7a472a9f..69b34c6a4c6bbab91aba9684143c4ea05bbf7cf9 100644 (file)
@@ -27,12 +27,11 @@ static unsigned char *
 init_data (size_t data_block_size)
 {
   unsigned char *data;
-  unsigned int i;
 
   data = (unsigned char *) malloc (2 * data_block_size);
   ASSERT (data != NULL);
 
-  for (i = 0; i < 2 * data_block_size; i++)
+  for (unsigned int i = 0; i < 2 * data_block_size; i++)
     data[i] = (unsigned char) (i * i + (7 * i) % 61 + 4);
 
   return data;
index 387a6c3b0f9b691e0133ec9b354f16ea3d18aa7d..5095fc6b31e8fbedde8336d28f39ac221f42a5c7 100644 (file)
@@ -60,9 +60,8 @@ static int
 posixtm_test (void)
 {
   int fail = 0;
-  unsigned int i;
 
-  for (i = 0; T[i].fmt; i++)
+  for (unsigned int i = 0; T[i].fmt; i++)
     {
       char buf[1000];
       time_t t = T[i].in;
@@ -195,9 +194,8 @@ static int
 tzalloc_test (void)
 {
   int fail = 0;
-  int i;
 
-  for (i = 0; LT[i].tza; i++)
+  for (int i = 0; LT[i].tza; i++)
     {
       struct tzalloc_test *tza = LT[i].tza;
       long lt = LT[i].t;
@@ -270,10 +268,9 @@ static int
 quarter_test (void)
 {
   int fail = 0;
-  size_t mon;
 
   /* Check %q.  */
-  for (mon = 1; mon <= 12; mon++)
+  for (size_t mon = 1; mon <= 12; mon++)
     {
       char out[2];
       char exp[2] = {0,};
index 2cae044fed833d2cef8b7949a5cd27db3b075bff..e0ba9bd70efb76a4470b30d53705cddb0e23df2e 100644 (file)
@@ -69,7 +69,6 @@ test_function (RETTYPE (*my_obstack_printf) (struct obstack *, const char *, ...
     char *base = obstack_base (&obs);
     char *new_base;
     RETTYPE result;
-    int i;
 
     ASSERT (obstack_chunk_size (&obs) < 10000);
     result = my_obstack_printf (&obs, "%010000d", 0);
@@ -77,7 +76,7 @@ test_function (RETTYPE (*my_obstack_printf) (struct obstack *, const char *, ...
     ASSERT (result == obstack_object_size (&obs));
     new_base = obstack_base (&obs);
     ASSERT (base != new_base);
-    for (i = 0; i < 10000; i++)
+    for (int i = 0; i < 10000; i++)
       ASSERT (new_base[i] == '0');
   }
 
index c5464c96974b37eff768e7ed853b1834e73211c4..a50d575e95cd1a9d5b9bb4decb9d1ec119058f04 100644 (file)
@@ -106,8 +106,7 @@ main ()
                   {
                     char *s = obstack_finish (&obs);
                     ASSERT (len == n1 + n2 + 3);
-                    size_t i;
-                    for (i = 0; i < len; i++)
+                    for (size_t i = 0; i < len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -144,8 +143,7 @@ main ()
               {
                 char *s = obstack_finish (&obs);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i < len; i++)
+                for (size_t i = 0; i < len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -180,8 +178,7 @@ main ()
                   {
                     char *s = obstack_finish (&obs);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i < len; i++)
+                    for (size_t i = 0; i < len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
index 8681c60b41f14be0d85d3bf19b509dbc84ef202b..f6faace7ed18ff9cf46f5d02d03006843c2c202e 100644 (file)
@@ -206,8 +206,7 @@ test_function (ptrdiff_t (*my_obstack_zprintf) (struct obstack *, const char *,
     ASSERT (len >= 0);
     char *result = obstack_finish (&obs);
     ASSERT (len == 4000 + 3);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (memcmp (result + 4000 - 7, "1234567 99", 7 + 3) == 0);
     obstack_free (&obs, result);
index f81799e57f1b865f9bad87f6ccff88f75ca926a6..92ad18ca5abf0134df91aa17f5f5e58aaf9d2715 100644 (file)
@@ -145,9 +145,7 @@ test_open (int (*func) (char const *, int, ...), bool print)
     {
       /* Since the O_CLOEXEC handling goes through a special code path at its
          first invocation, test it twice.  */
-      int i;
-
-      for (i = 0; i < 2; i++)
+      for (int i = 0; i < 2; i++)
         {
           int flags;
 
index ca11e260be8ab584af714016f3c0d1b66834145d..1f53774691dba1a2e0e5a2cf1e0faf7e265a4987 100644 (file)
@@ -40,8 +40,6 @@ static FILE *myerr;
 int
 main (void)
 {
-  int i;
-  int j;
   int dfd;
   int fd;
   char buf[2];
@@ -64,14 +62,14 @@ main (void)
 
   /* Four iterations, with progressively more standard descriptors
      closed.  */
-  for (i = -1; i <= STDERR_FILENO; i++)
+  for (int i = -1; i <= STDERR_FILENO; i++)
     {
       ASSERT (fchdir (dfd) == 0);
       if (0 <= i)
         ASSERT (close (i) == 0);
 
       /* Execute once in ".", once in "..".  */
-      for (j = 0; j <= 1; j++)
+      for (int j = 0; j <= 1; j++)
         {
           if (j)
             ASSERT (chdir ("..") == 0);
index d3e7ac3613219a9999aba456ecd0c9a05bbcd388..fec0cfd873a1eb8ea09cba095b2cf0c5544cf7b3 100644 (file)
@@ -84,8 +84,6 @@ options_loop (enum non_option_handling nonopt_handling,
 static void
 test_getopt_long (void)
 {
-  int start;
-
   /* Test disambiguation of options.  */
   {
     static const struct program_option options[] =
@@ -240,7 +238,7 @@ test_getopt_long (void)
       };
 
     /* Test processing of boolean short options.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -270,7 +268,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -301,7 +299,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 3);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -331,7 +329,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -364,7 +362,7 @@ test_getopt_long (void)
       }
 
     /* Test processing of boolean long options.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -394,7 +392,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -425,7 +423,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 3);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -488,7 +486,7 @@ test_getopt_long (void)
       };
 
     /* Test processing of short options with arguments.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -517,7 +515,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -547,7 +545,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 3);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -581,7 +579,7 @@ test_getopt_long (void)
       }
 
     /* Test processing of long options with arguments.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -610,7 +608,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -640,7 +638,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 3);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -694,7 +692,7 @@ test_getopt_long (void)
       };
 
     /* Test processing of short options with optional arguments.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -723,7 +721,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -753,7 +751,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -785,7 +783,7 @@ test_getopt_long (void)
       }
 
     /* Test processing of long options with optional arguments.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -814,7 +812,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -844,7 +842,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -874,7 +872,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 2);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -922,7 +920,7 @@ test_getopt_long (void)
       };
 
     /* Check that invalid options are recognized.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -954,7 +952,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 'x');
         ASSERT (optind == 5);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -988,7 +986,7 @@ test_getopt_long (void)
       }
 
     /* Check that unexpected arguments are recognized.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1019,7 +1017,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 'a');
         ASSERT (optind == 4);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1054,7 +1052,7 @@ test_getopt_long (void)
       }
 
     /* Check that by default, non-options arguments are moved to the end.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1097,7 +1095,7 @@ test_getopt_long (void)
       }
 
     /* Check that '--' ends the argument processing.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1151,7 +1149,7 @@ test_getopt_long (void)
 
     /* Check that the PROCESS_NON_OPTIONS flag causes non-options to be
        returned in order.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1197,7 +1195,7 @@ test_getopt_long (void)
       }
 
     /* Check that '--' ends the argument processing.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1271,7 +1269,7 @@ test_getopt_long (void)
 
     /* Check that the NON_OPTION_TERMINATES_OPTIONS flag causes the first
        non-option to terminate the loop.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1312,7 +1310,7 @@ test_getopt_long (void)
         ASSERT (unrecognized == 0);
         ASSERT (optind == 1);
       }
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1342,7 +1340,7 @@ test_getopt_long (void)
       }
 
     /* Check that '--' ends the argument processing.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1403,8 +1401,6 @@ test_getopt_long (void)
 static void
 test_getopt_long_posix (void)
 {
-  int start;
-
   {
     static const struct program_option options[] =
       {
@@ -1421,7 +1417,7 @@ test_getopt_long_posix (void)
       };
 
     /* Check that POSIXLY_CORRECT stops parsing the same as leading '+'.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1479,7 +1475,7 @@ test_getopt_long_posix (void)
       };
 
     /* Check that POSIXLY_CORRECT doesn't change optional arguments.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
@@ -1525,7 +1521,7 @@ test_getopt_long_posix (void)
       };
 
     /* Check that leading - still sees options after non-options.  */
-    for (start = 0; start <= 1; start++)
+    for (int start = 0; start <= 1; start++)
       {
         const char *p_value = NULL;
         const char *q_value = NULL;
index 0b1374a589bbf10786f79089f9361c7033af770f..d7e4a8dbbb35a67f03c12e775d42fdd197d36479 100644 (file)
@@ -67,16 +67,15 @@ main (int argc, char *argv[])
 
   size_t pagesize = getpagesize ();
 
-  int i;
-  for (i = 0; i < n; i++)
+  for (int i = 0; i < n; i++)
     pages[i] = pagealign_xalloc (pagesize);
 
   /* Free half of the pages in allocation order and the other half of the pages
      in reverse allocation order.  */
   int half = n / 2;
-  for (i = 0; i < half; i++)
+  for (int i = 0; i < half; i++)
     pagealign_free (pages[i]);
-  for (i = n - 1; i >= half; i--)
+  for (int i = n - 1; i >= half; i--)
     pagealign_free (pages[i]);
 
   return 0;
index 546b383c55a7d49df15b2bb3a71030fbd50cc000..23c8598a6f4bca679b04504c921dad8d690919c4 100644 (file)
@@ -129,7 +129,6 @@ main (_GL_UNUSED int argc, char **argv)
   struct timespec expected;
   struct timespec now;
   const char *p;
-  int i;
   long gmtoff;
   time_t ref_time = 1304250918;
 
@@ -428,7 +427,7 @@ main (_GL_UNUSED int argc, char **argv)
   /* Check that some "next Monday", "last Wednesday", etc. are correct.  */
   ASSERT (setenv ("TZ", "UTC0", 1) == 0);
   tzset ();
-  for (i = 0; day_table[i]; i++)
+  for (int i = 0; day_table[i]; i++)
     {
       unsigned int thur2 = SOME_TIMEPOINT + 7 * 24 * 3600; /* 2nd thursday */
       char tmp[32];
index a0c87b230ff149f30c7bdc51df45560fe56ddf59..5f904e50b29fdee06206e059bb70db5dccd462c4 100644 (file)
@@ -95,8 +95,7 @@ main (void)
   /* Test that perror uses the same message as strerror.  */
   {
     int errs[] = { EACCES, 0, -3, };
-    int i;
-    for (i = 0; i < SIZEOF (errs); i++)
+    for (int i = 0; i < SIZEOF (errs); i++)
       {
         char buf[256];
         const char *err = strerror (errs[i]);
index d900343e52455f2054f52d76b6106577099acd4d..642211ddcaf3bfc86918bec4c3cf4c4db0031225 100644 (file)
@@ -50,9 +50,8 @@ done_read (void *data_read, size_t num_bytes_read, void *private_data)
   struct locals *l = (struct locals *) private_data;
   const char *p = l->input + l->nread;
   const char *q = (const char *) data_read;
-  size_t i;
 
-  for (i = 0; i < num_bytes_read; i++, q++)
+  for (size_t i = 0; i < num_bytes_read; i++, q++)
     {
       /* Handle conversion NL -> CRLF possibly done by the child process.  */
       if (!(O_BINARY && *q == '\r'))
index 14f98cf15408b27132902fae9abe4257788aee9a..3660f75838debfea590d6ef3be3bf1fc68c7c084 100644 (file)
@@ -72,9 +72,8 @@ done_read (void *data_read, size_t num_bytes_read, void *private_data)
   struct locals *l = (struct locals *) private_data;
   const char *p = l->input + l->nread;
   const char *q = (const char *) data_read;
-  size_t i;
 
-  for (i = 0; i < num_bytes_read; i++, q++)
+  for (size_t i = 0; i < num_bytes_read; i++, q++)
     {
       /* Handle conversion NL -> CRLF possibly done by the child process.  */
       if (!(O_BINARY && *q == '\r'))
index 15d19c99bb1c574afa06e84bdd09241dcf298163..e485b32049fb7c4ce46fd36c40b866048bc6bbb6 100644 (file)
@@ -94,11 +94,8 @@ get_nonblocking_flag (int fd)
 int
 main ()
 {
-  int use_nonblocking;
-  int use_cloexec;
-
-  for (use_nonblocking = 0; use_nonblocking <= !!O_NONBLOCK; use_nonblocking++)
-    for (use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++)
+  for (int use_nonblocking = 0; use_nonblocking <= !!O_NONBLOCK; use_nonblocking++)
+    for (int use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++)
       {
         int o_flags;
         int fd[2];
index 0906143eba0504e5033a4de7919e76878edfe49e..f2935c32448b1f310544ea9d0d906db8919e5db7 100644 (file)
@@ -31,7 +31,6 @@ main (int argc, char **argv)
 {
   size_t len;
   char *cmd;
-  int i;
 
   /* Children - use the pipe.  */
   if (argc > 1)
@@ -53,7 +52,7 @@ main (int argc, char **argv)
   strcpy (cmd, argv[0]);
   cmd[len] = ' ';
   cmd[len + 2] = '\0';
-  for (i = 0; i < 2; i++)
+  for (int i = 0; i < 2; i++)
     {
       FILE *child;
       int status;
index 791667607eed3e39f11aa00f6c88600c27dee83f..619f3780f46cf9c799b0a4a94e8d151734394a06 100644 (file)
@@ -44,9 +44,8 @@ main (int argc, char *argv[])
   void *aligned16_blocks[SIZEOF (sizes)];
   void *aligned32_blocks[SIZEOF (sizes)];
   void *aligned64_blocks[SIZEOF (sizes)];
-  size_t i;
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       size_t size = sizes[i];
 
@@ -90,7 +89,7 @@ main (int argc, char *argv[])
       memset (aligned64_blocks[i], 'z', size);
     }
 
-  for (i = 0; i < SIZEOF (sizes); i++)
+  for (size_t i = 0; i < SIZEOF (sizes); i++)
     {
       if (sizeof (void *) <= 2)
         free (aligned2_blocks[i]);
index 2eaa38604516ad25040cd4d600c5ff41b5f2371e..7339d1c06c509d66b522ab5420d20b636c40ee72 100644 (file)
@@ -51,44 +51,40 @@ main ()
                                             O_RDWR | O_CREAT | O_TRUNC, 0600)
           == 0);
 
-  {
-    size_t i;
-
-    for (i = 0; i < 2; i++)
-      {
-        const char *prog_path =
-          (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
-        const char *prog_argv[2] = { prog_path, NULL };
-
-        int err = posix_spawn (&child, prog_path, &actions, NULL,
-                               (char **) prog_argv, environ);
-        if (err != ENOEXEC)
-          {
-            if (err != 0)
-              {
-                errno = err;
-                perror ("posix_spawn");
-                return 1;
-              }
-
-            /* Wait for child.  */
-            int status = 0;
-            while (waitpid (child, &status, 0) != child)
-              ;
-            if (!WIFEXITED (status))
-              {
-                fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
-                return 1;
-              }
-            int exitstatus = WEXITSTATUS (status);
-            if (exitstatus != 127)
-              {
-                fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
-                return 1;
-              }
-          }
-      }
-  }
+  for (size_t i = 0; i < 2; i++)
+    {
+      const char *prog_path =
+        (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
+      const char *prog_argv[2] = { prog_path, NULL };
+
+      int err = posix_spawn (&child, prog_path, &actions, NULL,
+                             (char **) prog_argv, environ);
+      if (err != ENOEXEC)
+        {
+          if (err != 0)
+            {
+              errno = err;
+              perror ("posix_spawn");
+              return 1;
+            }
+
+          /* Wait for child.  */
+          int status = 0;
+          while (waitpid (child, &status, 0) != child)
+            ;
+          if (!WIFEXITED (status))
+            {
+              fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
+              return 1;
+            }
+          int exitstatus = WEXITSTATUS (status);
+          if (exitstatus != 127)
+            {
+              fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
+              return 1;
+            }
+        }
+    }
 
 #if defined _WIN32 && !defined __CYGWIN__
   /* On native Windows, scripts - even with '#!' marker - are not executable.
index 52e7028487fdd17881f515fad7e9d2851063400a..8658142f3b6479a5b69ddf4362edd89f1a42a1d4 100644 (file)
@@ -51,44 +51,40 @@ main ()
                                             O_RDWR | O_CREAT | O_TRUNC, 0600)
           == 0);
 
-  {
-    size_t i;
-
-    for (i = 0; i < 2; i++)
-      {
-        const char *prog_path =
-          (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
-        const char *prog_argv[2] = { prog_path, NULL };
-
-        int err = posix_spawnp (&child, prog_path, &actions, NULL,
-                                (char **) prog_argv, environ);
-        if (err != ENOEXEC)
-          {
-            if (err != 0)
-              {
-                errno = err;
-                perror ("posix_spawn");
-                return 1;
-              }
-
-            /* Wait for child.  */
-            int status = 0;
-            while (waitpid (child, &status, 0) != child)
-              ;
-            if (!WIFEXITED (status))
-              {
-                fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
-                return 1;
-              }
-            int exitstatus = WEXITSTATUS (status);
-            if (exitstatus != 127)
-              {
-                fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
-                return 1;
-              }
-          }
-      }
-  }
+  for (size_t i = 0; i < 2; i++)
+    {
+      const char *prog_path =
+        (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
+      const char *prog_argv[2] = { prog_path, NULL };
+
+      int err = posix_spawnp (&child, prog_path, &actions, NULL,
+                              (char **) prog_argv, environ);
+      if (err != ENOEXEC)
+        {
+          if (err != 0)
+            {
+              errno = err;
+              perror ("posix_spawn");
+              return 1;
+            }
+
+          /* Wait for child.  */
+          int status = 0;
+          while (waitpid (child, &status, 0) != child)
+            ;
+          if (!WIFEXITED (status))
+            {
+              fprintf (stderr, "subprocess terminated with unexpected wait status %d\n", status);
+              return 1;
+            }
+          int exitstatus = WEXITSTATUS (status);
+          if (exitstatus != 127)
+            {
+              fprintf (stderr, "subprocess terminated with unexpected exit status %d\n", exitstatus);
+              return 1;
+            }
+        }
+    }
 
 #if defined _WIN32 && !defined __CYGWIN__
   /* On native Windows, scripts - even with '#!' marker - are not executable.
index f5f8ea1af101e45b5406a8e852256f23386d1d3a..458e4de12b5c2a83779aafe8068a27c114a07066 100644 (file)
@@ -118,7 +118,6 @@ static struct posixtm_test const T[] =
 int
 main (void)
 {
-  unsigned int i;
   char curr_year_str[30];
   struct tm *tm;
   time_t t_now;
@@ -136,7 +135,7 @@ main (void)
   n_bytes = strftime (curr_year_str, sizeof curr_year_str, "%Y", tm);
   ASSERT (0 < n_bytes);
 
-  for (i = 0; T[i].in; i++)
+  for (unsigned int i = 0; T[i].in; i++)
     {
       time_t t_out;
       time_t t_exp;
index 637dc2f568423b21f937f38f79a5733a3efae46b..bcadc2e9c244aa1448a4a65a60896946eeee60b1 100644 (file)
@@ -37,7 +37,6 @@ main (void)
   char const *file = "in";
   int fd;
   char buf[] = "0123456789";
-  off_t pos;
 
   ASSERT (file);
 
@@ -49,13 +48,12 @@ main (void)
   fd = open (file, O_RDONLY);
   ASSERT (0 <= fd);
 
-  for (pos = 0; pos < 3; pos++)
+  for (off_t pos = 0; pos < 3; pos++)
     {
-      size_t i;
       off_t init_pos = lseek (fd, pos, SEEK_SET);
       ASSERT (init_pos == pos);
 
-      for (i = 0; i < N; i++)
+      for (size_t i = 0; i < N; i++)
         {
           char byte_buf;
           ASSERT (pread (fd, &byte_buf, 1, i) == 1);
index 5671263eb86fe689eea5e62f183c87cd285e2597..6cfc5b845ce38af5c45bef9546cf0fe88e413ed1 100644 (file)
@@ -99,10 +99,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -120,9 +120,7 @@ static pthread_mutex_t my_lock;
 static void *
 lock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -176,12 +174,11 @@ lock_checker_thread (void *arg)
 static void
 test_pthread_mutex_normal (void)
 {
-  int i;
   pthread_t checkerthread;
   pthread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
@@ -189,11 +186,11 @@ test_pthread_mutex_normal (void)
   /* Spawn the threads.  */
   ASSERT (pthread_create (&checkerthread, NULL, lock_checker_thread, NULL)
           == 0);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&threads[i], NULL, lock_mutator_thread, NULL) == 0);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (threads[i], NULL) == 0);
   set_atomic_int_value (&lock_checker_done, 1);
   ASSERT (pthread_join (checkerthread, NULL) == 0);
@@ -236,9 +233,7 @@ recshuffle (void)
 static void *
 reclock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       recshuffle ();
 
@@ -278,12 +273,11 @@ reclock_checker_thread (void *arg)
 static void
 test_pthread_mutex_recursive (void)
 {
-  int i;
   pthread_t checkerthread;
   pthread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&reclock_checker_done);
   set_atomic_int_value (&reclock_checker_done, 0);
@@ -291,12 +285,12 @@ test_pthread_mutex_recursive (void)
   /* Spawn the threads.  */
   ASSERT (pthread_create (&checkerthread, NULL, reclock_checker_thread, NULL)
           == 0);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&threads[i], NULL, reclock_mutator_thread, NULL)
             == 0);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (threads[i], NULL) == 0);
   set_atomic_int_value (&reclock_checker_done, 1);
   ASSERT (pthread_join (checkerthread, NULL) == 0);
index 4df7b3501d52c31430b8d98eb269648feaa8d270..88bb12d89b26a59ceb9d36ba94f30eb098285e71 100644 (file)
@@ -109,9 +109,8 @@ static void *
 once_contender_thread (void *arg)
 {
   int id = (int) (intptr_t) arg;
-  int repeat;
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Tell the main thread that we're ready.  */
       ASSERT (pthread_mutex_lock (&ready_lock[id]) == 0);
@@ -146,11 +145,10 @@ once_contender_thread (void *arg)
 static void
 test_once (void)
 {
-  int i, repeat;
   pthread_t threads[THREAD_COUNT];
 
   /* Initialize all variables.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     {
       pthread_mutexattr_t attr;
 
@@ -161,7 +159,7 @@ test_once (void)
       ASSERT (pthread_mutexattr_destroy (&attr) == 0);
     }
 #if ENABLE_LOCKING
-  for (i = 0; i < REPEAT_COUNT; i++)
+  for (int i = 0; i < REPEAT_COUNT; i++)
     ASSERT (pthread_rwlock_init (&fire_signal[i], NULL) == 0);
 #else
   fire_signal_state = 0;
@@ -169,24 +167,24 @@ test_once (void)
 
 #if ENABLE_LOCKING
   /* Block all fire_signals.  */
-  for (i = REPEAT_COUNT-1; i >= 0; i--)
+  for (int i = REPEAT_COUNT-1; i >= 0; i--)
     ASSERT (pthread_rwlock_wrlock (&fire_signal[i]) == 0);
 #endif
 
   /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&threads[i], NULL,
                             once_contender_thread, (void *) (intptr_t) i)
             == 0);
 
-  for (repeat = 0; repeat <= REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat <= REPEAT_COUNT; repeat++)
     {
       /* Wait until every thread is ready.  */
       dbgprintf ("Main thread before synchronizing for round %d\n", repeat);
       for (;;)
         {
           int ready_count = 0;
-          for (i = 0; i < THREAD_COUNT; i++)
+          for (int i = 0; i < THREAD_COUNT; i++)
             {
               ASSERT (pthread_mutex_lock (&ready_lock[i]) == 0);
               ready_count += ready[i];
@@ -216,7 +214,7 @@ test_once (void)
       performed = 0;
 
       /* Preparation for the next round: Reset the ready flags.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         {
           ASSERT (pthread_mutex_lock (&ready_lock[i]) == 0);
           ready[i] = 0;
@@ -233,7 +231,7 @@ test_once (void)
     }
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (threads[i], NULL) == 0);
 }
 
index 8a4ab93b41fc746ddeca7112be6c23e5288a1553..222082d359e484bf149e7ea2cd514eecd0c91aa4 100644 (file)
@@ -102,10 +102,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -123,9 +123,7 @@ static pthread_rwlock_t my_rwlock = PTHREAD_RWLOCK_INITIALIZER;
 static void *
 rwlock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -173,30 +171,29 @@ rwlock_checker_thread (void *arg)
 static void
 test_rwlock (void)
 {
-  int i;
   pthread_t checkerthreads[THREAD_COUNT];
   pthread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&rwlock_checker_done);
   set_atomic_int_value (&rwlock_checker_done, 0);
 
   /* Spawn the threads.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&checkerthreads[i], NULL,
                             rwlock_checker_thread, NULL)
             == 0);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&threads[i], NULL, rwlock_mutator_thread, NULL)
             == 0);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (threads[i], NULL) == 0);
   set_atomic_int_value (&rwlock_checker_done, 1);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (checkerthreads[i], NULL) == 0);
   check_accounts ();
 }
index e79a473632562126cf03f5115b84a8ac4558b06a..3993ba352b385e2216e7f548047d153e688f33a6 100644 (file)
@@ -91,10 +91,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -112,9 +112,7 @@ static pthread_spinlock_t my_lock;
 static void *
 lock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -168,12 +166,11 @@ lock_checker_thread (void *arg)
 static void
 test_pthread_spin (void)
 {
-  int i;
   pthread_t checkerthread;
   pthread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
@@ -181,11 +178,11 @@ test_pthread_spin (void)
   /* Spawn the threads.  */
   ASSERT (pthread_create (&checkerthread, NULL, lock_checker_thread, NULL)
           == 0);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_create (&threads[i], NULL, lock_mutator_thread, NULL) == 0);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     ASSERT (pthread_join (threads[i], NULL) == 0);
   set_atomic_int_value (&lock_checker_done, 1);
   ASSERT (pthread_join (checkerthread, NULL) == 0);
index cfc416c74bb1c15d725b3a12682c0549a0e7f0d8..36daee952d49b6c5b3a54735008cfb2a06be5f3c 100644 (file)
@@ -92,13 +92,12 @@ static void *
 worker_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
-  int i, j, repeat;
   unsigned int values[KEYS_COUNT];
 
   dbgprintf ("Worker %p started\n", pthread_self_pointer ());
 
   /* Initialize the per-thread storage.  */
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       values[i] = (((unsigned long) random () >> 3) % 1000000) * THREAD_COUNT + id;
       /* Hopefully no arithmetic overflow.  */
@@ -109,7 +108,7 @@ worker_thread (void *arg)
 
   /* Verify that the initial value is NULL.  */
   dbgprintf ("Worker %p before initial verify\n", pthread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if (pthread_getspecific (mykeys[i]) != NULL)
       abort ();
   dbgprintf ("Worker %p after  initial verify\n", pthread_self_pointer ());
@@ -118,7 +117,7 @@ worker_thread (void *arg)
   /* Initialize the per-thread storage.  */
   dbgprintf ("Worker %p before first pthread_setspecific\n",
              pthread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       unsigned int *ptr = (unsigned int *) malloc (sizeof (unsigned int));
       *ptr = values[i];
@@ -129,11 +128,11 @@ worker_thread (void *arg)
   perhaps_yield ();
 
   /* Shuffle around the pointers.  */
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       dbgprintf ("Worker %p doing value swapping\n", pthread_self_pointer ());
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
-      j = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int j = ((unsigned long) random () >> 3) % KEYS_COUNT;
       if (i != j)
         {
           void *vi = pthread_getspecific (mykeys[i]);
@@ -147,7 +146,7 @@ worker_thread (void *arg)
 
   /* Verify that all the values are from this thread.  */
   dbgprintf ("Worker %p before final verify\n", pthread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if ((*(unsigned int *) pthread_getspecific (mykeys[i]) % THREAD_COUNT)
         != id)
       abort ();
@@ -161,30 +160,28 @@ worker_thread (void *arg)
 static void
 test_tss (void)
 {
-  int pass, i;
-
-  for (pass = 0; pass < 2; pass++)
+  for (int pass = 0; pass < 2; pass++)
     {
       pthread_t threads[THREAD_COUNT];
 
       if (pass == 0)
-        for (i = 0; i < KEYS_COUNT; i++)
+        for (int i = 0; i < KEYS_COUNT; i++)
           ASSERT (pthread_key_create (&mykeys[i], free) == 0);
       else
-        for (i = KEYS_COUNT - 1; i >= 0; i--)
+        for (int i = KEYS_COUNT - 1; i >= 0; i--)
           ASSERT (pthread_key_create (&mykeys[i], free) == 0);
 
       /* Spawn the threads.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (pthread_create (&threads[i], NULL,
                                 worker_thread, (void *) (uintptr_t) i)
                 == 0);
 
       /* Wait for the threads to terminate.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (pthread_join (threads[i], NULL) == 0);
 
-      for (i = 0; i < KEYS_COUNT; i++)
+      for (int i = 0; i < KEYS_COUNT; i++)
         ASSERT (pthread_key_delete (mykeys[i]) == 0);
     }
 }
@@ -320,12 +317,11 @@ dtorcheck1_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   pthread_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (pthread_key_create (&keys[i], destructor_table[i]) == 0);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (pthread_setspecific (keys[i],
                                  (void *) (uintptr_t) (10 * id + i + 1))
             == 0);
@@ -337,25 +333,23 @@ static void
 test_tss_dtorcheck1 (void)
 {
   pthread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_create (&threads[id], NULL,
                             dtorcheck1_thread, (void *) (uintptr_t) id)
             == 0);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_join (threads[id], NULL) == 0);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       ASSERT (pthread_key_delete (dtorcheck_keys[id][i]) == 0);
 
   /* Check that the destructor was invoked for each key.  */
@@ -373,12 +367,11 @@ dtorcheck2_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   pthread_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (pthread_key_create (&keys[i], destructor_table[id]) == 0);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (pthread_setspecific (keys[i],
                                  (void *) (uintptr_t) (10 * i + id + 1))
             == 0);
@@ -390,25 +383,23 @@ static void
 test_tss_dtorcheck2 (void)
 {
   pthread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_create (&threads[id], NULL,
                             dtorcheck2_thread, (void *) (uintptr_t) id)
             == 0);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_join (threads[id], NULL) == 0);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       ASSERT (pthread_key_delete (dtorcheck_keys[id][i]) == 0);
 
   /* Check that the destructor was invoked for each key.  */
@@ -447,12 +438,10 @@ racecheck_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   pthread_key_t *keys = racecheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int repeat;
-  int i;
 
   dbgprintf ("Worker %p started\n", pthread_self_pointer ());
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       ASSERT (pthread_key_create (&keys[i], destructor_table[i]) == 0);
       ASSERT (pthread_setspecific (keys[i],
@@ -460,9 +449,9 @@ racecheck_thread (void *arg)
               == 0);
     }
 
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
       dbgprintf ("Worker %p reallocating key %d\n", pthread_self_pointer (), i);
       ASSERT (pthread_key_delete (keys[i]) == 0);
       ASSERT (pthread_key_create (&keys[i], destructor_table[i]) == 0);
@@ -479,25 +468,23 @@ static void
 test_tss_racecheck (void)
 {
   pthread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_create (&threads[id], NULL,
                             racecheck_thread, (void *) (uintptr_t) id)
             == 0);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (pthread_join (threads[id], NULL) == 0);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       ASSERT (pthread_key_delete (racecheck_keys[id][i]) == 0);
 
   /* Check that the destructor was invoked for each key.  */
index 1d3e55ed2b9487fa65f97faa433188474d4a58da..fd382c8f8defd6baf2a20e8277f020226911ef34 100644 (file)
@@ -164,42 +164,57 @@ main (void)
 #elif defined __gnu_hurd__ /* Hurd */
 
   /* Try various master names of Hurd: /dev/pty[p-q][0-9a-v]  */
-  {
-    int char1;
-    int char2;
-
-    for (char1 = 'p'; char1 <= 'q'; char1++)
-      for (char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
-        {
-          char master_name[32];
-          int fd;
+  for (int char1 = 'p'; char1 <= 'q'; char1++)
+    for (int char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
+      {
+        char master_name[32];
+        int fd;
 
-          sprintf (master_name, "/dev/pty%c%c", char1, char2);
-          fd = open (master_name, O_RDONLY);
-          if (fd >= 0)
-            {
-              char *result;
-              char slave_name[32];
+        sprintf (master_name, "/dev/pty%c%c", char1, char2);
+        fd = open (master_name, O_RDONLY);
+        if (fd >= 0)
+          {
+            char *result;
+            char slave_name[32];
 
-              result = ptsname (fd);
-              ASSERT (result != NULL);
-              sprintf (slave_name, "/dev/tty%c%c", char1, char2);
-              ASSERT (same_slave (result, slave_name));
+            result = ptsname (fd);
+            ASSERT (result != NULL);
+            sprintf (slave_name, "/dev/tty%c%c", char1, char2);
+            ASSERT (same_slave (result, slave_name));
 
-              close (fd);
-            }
-        }
-  }
+            close (fd);
+          }
+      }
 
 #else
 
   /* Try various master names of Mac OS X: /dev/pty[p-w][0-9a-f]  */
-  {
-    int char1;
-    int char2;
+  for (int char1 = 'p'; char1 <= 'w'; char1++)
+    for (int char2 = '0'; char2 <= 'f'; (char2 == '9' ? char2 = 'a' : char2++))
+      {
+        char master_name[32];
+        int fd;
+
+        sprintf (master_name, "/dev/pty%c%c", char1, char2);
+        fd = open (master_name, O_RDONLY);
+        if (fd >= 0)
+          {
+            char *result;
+            char slave_name[32];
+
+            result = ptsname (fd);
+            ASSERT (result != NULL);
+            sprintf (slave_name, "/dev/tty%c%c", char1, char2);
+            ASSERT (same_slave (result, slave_name));
+
+            close (fd);
+          }
+      }
 
-    for (char1 = 'p'; char1 <= 'w'; char1++)
-      for (char2 = '0'; char2 <= 'f'; (char2 == '9' ? char2 = 'a' : char2++))
+  /* Try various master names of *BSD: /dev/pty[p-sP-S][0-9a-v]  */
+  for (int upper = 0; upper <= 1; upper++)
+    for (int char1 = (upper ? 'P' : 'p'); char1 <= (upper ? 'S' : 's'); char1++)
+      for (int char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
         {
           char master_name[32];
           int fd;
@@ -219,37 +234,6 @@ main (void)
               close (fd);
             }
         }
-  }
-
-  /* Try various master names of *BSD: /dev/pty[p-sP-S][0-9a-v]  */
-  {
-    int upper;
-    int char1;
-    int char2;
-
-    for (upper = 0; upper <= 1; upper++)
-      for (char1 = (upper ? 'P' : 'p'); char1 <= (upper ? 'S' : 's'); char1++)
-        for (char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
-          {
-            char master_name[32];
-            int fd;
-
-            sprintf (master_name, "/dev/pty%c%c", char1, char2);
-            fd = open (master_name, O_RDONLY);
-            if (fd >= 0)
-              {
-                char *result;
-                char slave_name[32];
-
-                result = ptsname (fd);
-                ASSERT (result != NULL);
-                sprintf (slave_name, "/dev/tty%c%c", char1, char2);
-                ASSERT (same_slave (result, slave_name));
-
-                close (fd);
-              }
-          }
-  }
 
 #endif
 
index b793805542f690ebaf460d8f687385dbdb55a602..da2b1c6cede276a1fd6c1c9544ba79afb4178896 100644 (file)
@@ -68,14 +68,13 @@ test_errors (int fd, const char *slave)
   char buffer[256];
   size_t len;
   size_t buflen_max;
-  size_t buflen;
   int result;
 
   len = strlen (slave);
   buflen_max = len + 5;
   if (buflen_max > sizeof buffer)
     buflen_max = sizeof buffer;
-  for (buflen = 0; buflen <= buflen_max; buflen++)
+  for (size_t buflen = 0; buflen <= buflen_max; buflen++)
     {
       memset (buffer, 'X', sizeof buffer);
       result = ptsname_r (fd, buffer, buflen);
@@ -219,45 +218,64 @@ main (void)
 #elif defined __gnu_hurd__ /* Hurd */
 
   /* Try various master names of Hurd: /dev/pty[p-q][0-9a-v]  */
-  {
-    int char1;
-    int char2;
-
-    for (char1 = 'p'; char1 <= 'q'; char1++)
-      for (char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
-        {
-          char master_name[32];
-          int fd;
+  for (int char1 = 'p'; char1 <= 'q'; char1++)
+    for (int char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
+      {
+        char master_name[32];
+        int fd;
 
-          sprintf (master_name, "/dev/pty%c%c", char1, char2);
-          fd = open (master_name, O_RDONLY);
-          if (fd >= 0)
-            {
-              char buffer[256];
-              int result;
-              char slave_name[32];
+        sprintf (master_name, "/dev/pty%c%c", char1, char2);
+        fd = open (master_name, O_RDONLY);
+        if (fd >= 0)
+          {
+            char buffer[256];
+            int result;
+            char slave_name[32];
 
-              result = ptsname_r (fd, buffer, sizeof buffer);
-              ASSERT (result == 0);
-              sprintf (slave_name, "/dev/tty%c%c", char1, char2);
-              ASSERT (same_slave (buffer, slave_name));
+            result = ptsname_r (fd, buffer, sizeof buffer);
+            ASSERT (result == 0);
+            sprintf (slave_name, "/dev/tty%c%c", char1, char2);
+            ASSERT (same_slave (buffer, slave_name));
 
-              test_errors (fd, buffer);
+            test_errors (fd, buffer);
 
-              close (fd);
-            }
-        }
-  }
+            close (fd);
+          }
+      }
 
 #else
 
   /* Try various master names of Mac OS X: /dev/pty[p-w][0-9a-f]  */
-  {
-    int char1;
-    int char2;
+  for (int char1 = 'p'; char1 <= 'w'; char1++)
+    for (int char2 = '0'; char2 <= 'f'; (char2 == '9' ? char2 = 'a' : char2++))
+      {
+        char master_name[32];
+        int fd;
 
-    for (char1 = 'p'; char1 <= 'w'; char1++)
-      for (char2 = '0'; char2 <= 'f'; (char2 == '9' ? char2 = 'a' : char2++))
+        sprintf (master_name, "/dev/pty%c%c", char1, char2);
+        fd = open (master_name, O_RDONLY);
+        if (fd >= 0)
+          {
+            char buffer[256];
+            int result;
+            char slave_name[32];
+
+            result = ptsname_r (fd, buffer, sizeof buffer);
+            ASSERT (result == 0);
+            sprintf (slave_name, "/dev/tty%c%c", char1, char2);
+            ASSERT (same_slave (buffer, slave_name));
+
+            test_errors (fd, buffer);
+
+            /* This call hangs on AIX.  */
+            close (fd);
+          }
+      }
+
+  /* Try various master names of *BSD: /dev/pty[p-sP-S][0-9a-v]  */
+  for (int upper = 0; upper <= 1; upper++)
+    for (int char1 = (upper ? 'P' : 'p'); char1 <= (upper ? 'S' : 's'); char1++)
+      for (int char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
         {
           char master_name[32];
           int fd;
@@ -277,44 +295,9 @@ main (void)
 
               test_errors (fd, buffer);
 
-              /* This call hangs on AIX.  */
               close (fd);
             }
         }
-  }
-
-  /* Try various master names of *BSD: /dev/pty[p-sP-S][0-9a-v]  */
-  {
-    int upper;
-    int char1;
-    int char2;
-
-    for (upper = 0; upper <= 1; upper++)
-      for (char1 = (upper ? 'P' : 'p'); char1 <= (upper ? 'S' : 's'); char1++)
-        for (char2 = '0'; char2 <= 'v'; (char2 == '9' ? char2 = 'a' : char2++))
-          {
-            char master_name[32];
-            int fd;
-
-            sprintf (master_name, "/dev/pty%c%c", char1, char2);
-            fd = open (master_name, O_RDONLY);
-            if (fd >= 0)
-              {
-                char buffer[256];
-                int result;
-                char slave_name[32];
-
-                result = ptsname_r (fd, buffer, sizeof buffer);
-                ASSERT (result == 0);
-                sprintf (slave_name, "/dev/tty%c%c", char1, char2);
-                ASSERT (same_slave (buffer, slave_name));
-
-                test_errors (fd, buffer);
-
-                close (fd);
-              }
-          }
-  }
 
 #endif
 
index 4f3f759dd3966ae61bfa1174a4be9fbaf89c8836..4a9902a9b45afbb4b4fad8baf1c66303b08b163f 100644 (file)
@@ -37,7 +37,6 @@ main (void)
   int fd;
   char buf[] = "0123456789";
   off_t pos = 2;
-  size_t i;
   off_t init_pos;
 
   ASSERT (file);
@@ -53,7 +52,7 @@ main (void)
   init_pos = lseek (fd, pos, SEEK_SET);
   ASSERT (init_pos == pos);
 
-  for (i = 0; i < N; i+=2)
+  for (size_t i = 0; i < N; i+=2)
     {
       const char byte = 'W';
       ASSERT (pwrite (fd, &byte, 1, i) == 1);
index 376e7658105b7264bd6722d90c4c0716f63ec960..3f5c3011143e299920d95df7a1a056854ca43d2c 100644 (file)
@@ -270,7 +270,6 @@ use_quote_double_quotes (const char *str, size_t *len)
 int
 main (_GL_UNUSED int argc, char *argv[])
 {
-  int i;
   bool ascii_only = MB_CUR_MAX == 1 && !isprint ((unsigned char) LQ[0]);
 
   /* This part of the program is hard-wired to the C locale since it
@@ -285,7 +284,7 @@ main (_GL_UNUSED int argc, char *argv[])
      testing for quoting of str7, use the ascii_only flag to decide
      what to expect for the 8-bit data being quoted.  */
   ASSERT (!isprint ('\033'));
-  for (i = literal_quoting_style; i <= clocale_quoting_style; i++)
+  for (int i = literal_quoting_style; i <= clocale_quoting_style; i++)
     {
       set_quoting_style (NULL, (enum quoting_style) i);
       if (!(i == locale_quoting_style || i == clocale_quoting_style)
@@ -329,7 +328,7 @@ main (_GL_UNUSED int argc, char *argv[])
 
   ASSERT (set_quoting_flags (NULL, 0) == QA_SPLIT_TRIGRAPHS);
 
-  for (i = 0; i < sizeof custom_quotes / sizeof *custom_quotes; ++i)
+  for (int i = 0; i < sizeof custom_quotes / sizeof *custom_quotes; ++i)
     {
       set_custom_quoting (NULL,
                           custom_quotes[i][0], custom_quotes[i][1]);
index c438c881089230fa484aea06730ba36e1776e7da..218ccf6aec690325eeaaf975b9d7f2de31a357a2 100644 (file)
@@ -62,9 +62,8 @@ static void *
 random_invocator_thread (void *arg)
 {
   long *storage = (long *) arg;
-  int repeat;
 
-  for (repeat = 0; repeat < REPEAT_COUNT; repeat++)
+  for (int repeat = 0; repeat < REPEAT_COUNT; repeat++)
     {
       storage[repeat] = random ();
       yield ();
@@ -81,46 +80,35 @@ main ()
   /* First, get the expected sequence of random() results.  */
   srandom (seed);
   long *expected = XNMALLOC (REPEAT_COUNT, long);
-  {
-    int repeat;
-    for (repeat = 0; repeat < REPEAT_COUNT; repeat++)
-      expected[repeat] = random ();
-  }
+  for (int repeat = 0; repeat < REPEAT_COUNT; repeat++)
+    expected[repeat] = random ();
 
   /* Then, run REPEAT_COUNT invocations of random() each, in THREAD_COUNT
      separate threads.  */
   gl_thread_t threads[THREAD_COUNT];
   long *thread_results[THREAD_COUNT];
   srandom (seed);
-  {
-    int i;
-    for (i = 0; i < THREAD_COUNT; i++)
-      thread_results[i] = XNMALLOC (REPEAT_COUNT, long);
-    for (i = 0; i < THREAD_COUNT; i++)
-      threads[i] =
-        gl_thread_create (random_invocator_thread, thread_results[i]);
-  }
+  for (int i = 0; i < THREAD_COUNT; i++)
+    thread_results[i] = XNMALLOC (REPEAT_COUNT, long);
+  for (int i = 0; i < THREAD_COUNT; i++)
+    threads[i] = gl_thread_create (random_invocator_thread, thread_results[i]);
 
   /* Wait for the threads to terminate.  */
-  {
-    int i;
-    for (i = 0; i < THREAD_COUNT; i++)
-      gl_thread_join (threads[i], NULL);
-  }
+  for (int i = 0; i < THREAD_COUNT; i++)
+    gl_thread_join (threads[i], NULL);
 
   /* Finally, determine whether the threads produced the same sequence of
      random() results.  */
   {
-    int expected_index;
     int result_index[THREAD_COUNT];
-    int i;
 
-    for (i = 0; i < THREAD_COUNT; i++)
+    for (int i = 0; i < THREAD_COUNT; i++)
       result_index[i] = 0;
 
-    for (expected_index = 0; expected_index < REPEAT_COUNT; expected_index++)
+    for (int expected_index = 0; expected_index < REPEAT_COUNT; expected_index++)
       {
         long expected_value = expected[expected_index];
+        int i;
 
         for (i = 0; i < THREAD_COUNT; i++)
           {
index 4a4e0af9501195c0335de5bc441d626da13c4ddf..64fd19eae6b19e574d6c1c84a9c090af2ce75ded 100644 (file)
@@ -32,11 +32,10 @@ int
 main ()
 {
   char buf[128];
-  unsigned int i;
   unsigned int n_big = 0;
 
   initstate (time (NULL), buf, sizeof buf);
-  for (i = 0; i < 1000; i++)
+  for (unsigned int i = 0; i < 1000; i++)
     {
       long r = random ();
       ASSERT (0 <= r);
index 83743810fcb5cf969715367e35825d333a04a140..a4d574d592d6d182c1603e34b9c3c5557420064a 100644 (file)
@@ -39,14 +39,13 @@ test_failed (int alignment)
 {
   struct random_data rand_state;
   char buf[128 + sizeof (int32_t)];
-  unsigned int i;
   unsigned int n_big = 0;
 
   rand_state.state = NULL;
   if (initstate_r (time (NULL), buf + alignment, sizeof buf - alignment,
                    &rand_state))
     return 1;
-  for (i = 0; i < 1000; i++)
+  for (unsigned int i = 0; i < 1000; i++)
     {
       int32_t r;
       ASSERT (random_r (&rand_state, &r) == 0);
@@ -62,8 +61,7 @@ test_failed (int alignment)
 int
 main ()
 {
-  int alignment;
-  for (alignment = 0; alignment < sizeof (int32_t); alignment++)
+  for (int alignment = 0; alignment < sizeof (int32_t); alignment++)
     if (test_failed (alignment))
       return 1;
   return test_exit_status;
index ef50367d368a4dfd17537e5b7e55c78602609669..88b160c6927fd6f269d61ce70b3bd754c4b67e85 100644 (file)
@@ -55,29 +55,25 @@ main (void)
   ASSERT (rawmemchr (input, '\0') == input + n);
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 256; j++)
-          input[i + j] = j;
-        for (j = 0; j < 256; j++)
-          {
-            ASSERT (rawmemchr (input + i, j) == input + i + j);
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 256; j++)
+        input[i + j] = j;
+      for (int j = 0; j < 256; j++)
+        {
+          ASSERT (rawmemchr (input + i, j) == input + i + j);
+        }
+    }
 
   /* Ensure that no unaligned oversized reads occur.  */
   {
     char *page_boundary = (char *) zerosize_ptr ();
-    size_t i;
 
     if (!page_boundary)
       page_boundary = input + 4096;
     memset (page_boundary - 512, '1', 511);
     page_boundary[-1] = '2';
-    for (i = 1; i <= 512; i++)
+    for (size_t i = 1; i <= 512; i++)
       ASSERT (rawmemchr (page_boundary - i, (i * 0x01010100) | '2')
               == page_boundary - 1);
   }
index d074515a15c6dda4abe811be1cdbb4f6ef484a8e..cbd0ef412c17ee5b78b7804571966c4c93d972a0 100644 (file)
@@ -37,11 +37,11 @@ static const char *objects[15] =
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -99,10 +99,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -112,7 +110,7 @@ main (int argc, char *argv[])
     /* Create list2.  */
     list2 = gl_list_nx_create_empty (GL_RBTREE_LIST, NULL, NULL, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -125,7 +123,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -406,7 +404,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -432,7 +430,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index c6f71fc7eaa5c95eafb4b036a40ade424496caf9..18d07be2bc391e44f9318bdf538d4706e90ba05d 100644 (file)
@@ -45,11 +45,10 @@ check_equals (gl_omap_t map1, gl_omap_t map2)
   const void *value1;
   const void *key2;
   const void *value2;
-  size_t i;
 
   iter1 = gl_omap_iterator (map1);
   iter2 = gl_omap_iterator (map2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_omap_iterator_next (&iter1, &key1, &value1));
       ASSERT (gl_omap_iterator_next (&iter2, &key2, &value2));
@@ -80,8 +79,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create map1.  */
     map1 = gl_omap_nx_create_empty (GL_ARRAY_OMAP, (gl_mapkey_compar_fn) strcmp, NULL, NULL);
@@ -94,7 +91,7 @@ main (int argc, char *argv[])
     check_all (map1, map2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *key = RANDOM_OBJECT ();
         const char *value = RANDOM_OBJECT ();
@@ -102,7 +99,7 @@ main (int argc, char *argv[])
         check_all (map1, map2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (3);
         switch (operation)
index cc472360ce04446beedc4a5e70ef20707f058c1a..f0f4da55e101236d293d6cd46a75e197f04ba54a 100644 (file)
@@ -45,11 +45,10 @@ check_equals (gl_oset_t set1, gl_oset_t set2)
   gl_oset_iterator_t iter1, iter2;
   const void *elt1;
   const void *elt2;
-  size_t i;
 
   iter1 = gl_oset_iterator (set1);
   iter2 = gl_oset_iterator (set2);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_oset_iterator_next (&iter1, &elt1));
       ASSERT (gl_oset_iterator_next (&iter2, &elt2));
@@ -85,8 +84,6 @@ main (int argc, char *argv[])
 
   {
     size_t initial_size = RANDOM (20);
-    size_t i;
-    unsigned int repeat;
 
     /* Create set1.  */
     set1 = gl_oset_nx_create_empty (GL_ARRAY_OSET, (gl_setelement_compar_fn) strcmp, NULL);
@@ -99,14 +96,14 @@ main (int argc, char *argv[])
     check_all (set1, set2);
 
     /* Initialize them.  */
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       {
         const char *obj = RANDOM_OBJECT ();
         ASSERT (gl_oset_nx_add (set1, obj) == gl_oset_nx_add (set2, obj));
         check_all (set1, set2);
       }
 
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (4);
         switch (operation)
index abe52a6635c16578699e495ccf08b980e72b36bb..ed4ad0cb7668d75aa212cd23626be4069af7b513 100644 (file)
@@ -64,11 +64,11 @@ string_hash (const void *x)
 static void
 check_equals (gl_list_t list1, gl_list_t list2)
 {
-  size_t n, i;
+  size_t n;
 
   n = gl_list_size (list1);
   ASSERT (n == gl_list_size (list2));
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       ASSERT (gl_list_get_at (list1, i) == gl_list_get_at (list2, i));
     }
@@ -126,10 +126,8 @@ main (int argc, char *argv[])
     size_t initial_size = RANDOM (50);
     const void **contents =
       (const void **) malloc (initial_size * sizeof (const void *));
-    size_t i;
-    unsigned int repeat;
 
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       contents[i] = RANDOM_OBJECT ();
 
     /* Create list1.  */
@@ -141,7 +139,7 @@ main (int argc, char *argv[])
     list2 = gl_list_nx_create_empty (GL_RBTREEHASH_LIST,
                                      string_equals, string_hash, NULL, true);
     ASSERT (list2 != NULL);
-    for (i = 0; i < initial_size; i++)
+    for (size_t i = 0; i < initial_size; i++)
       ASSERT (gl_list_nx_add_last (list2, contents[i]) != NULL);
 
     /* Create list3.  */
@@ -155,7 +153,7 @@ main (int argc, char *argv[])
     check_equals_by_forward_iteration (list1, list2);
     check_equals_by_backward_iteration (list1, list2);
 
-    for (repeat = 0; repeat < 10000; repeat++)
+    for (unsigned int repeat = 0; repeat < 10000; repeat++)
       {
         unsigned int operation = RANDOM (18);
         switch (operation)
@@ -436,7 +434,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator (list1);
               iter2 = gl_list_iterator (list2);
               iter3 = gl_list_iterator (list3);
-              for (i = 0; i < n; i++)
+              for (size_t i = 0; i < n; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
@@ -462,7 +460,7 @@ main (int argc, char *argv[])
               iter1 = gl_list_iterator_from_to (list1, start, end);
               iter2 = gl_list_iterator_from_to (list2, start, end);
               iter3 = gl_list_iterator_from_to (list3, start, end);
-              for (i = start; i < end; i++)
+              for (size_t i = start; i < end; i++)
                 {
                   ASSERT (gl_list_iterator_next (&iter1, &elt, NULL));
                   ASSERT (gl_list_get_at (list1, i) == elt);
index 26ca4b44ba965303c82972e531e1e02dddd151cb..f22aabfa31eaec541a4a920dee8b773aaa63bdd0 100644 (file)
@@ -78,13 +78,10 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
   ASSERT (errno == ENOTDIR || errno == EINVAL); /* AIX yields EINVAL */
   ASSERT (unlink (BASE "file") == 0);
   ASSERT (unlink (BASE "link2") == 0);
-  {
-    /* Up till now, no readlink has been successful, so buf should be
-       unchanged.  */
-    int i;
-    for (i = 0; i < sizeof buf; i++)
-      ASSERT (buf[i] == (char) 0xff);
-  }
+  /* Up till now, no readlink has been successful, so buf should be
+     unchanged.  */
+  for (int i = 0; i < sizeof buf; i++)
+    ASSERT (buf[i] == (char) 0xff);
   {
     size_t len = strlen (BASE "dir");
     /* When passing too small of a buffer, expect the truncated
index 9a2ef2e0232ff7c739736afc4c95bf48cb5a98e1..a691ad4ab08cdef94afede1c2491dfb72e9e6eac 100644 (file)
@@ -102,8 +102,7 @@ main (int argc, char *argv[])
                           XNMALLOC (num_entries, STRUCT_UTMP));
 
       idx_t boot_time_count = 0;
-      idx_t i;
-      for (i = 0; i < num_entries; i++)
+      for (idx_t i = 0; i < num_entries; i++)
         {
           const STRUCT_UTMP *entry = &entries[i];
 
index fcbd0b4ec2e45c5a5117c99b705c3c8efd52c8a3..b2e9c886860bc7f4dc938514e362b81430e4aab4 100644 (file)
@@ -127,16 +127,14 @@ bug_regex11 (void)
 {
   regex_t re;
   regmatch_t rm[5];
-  size_t i;
-  int n;
 
-  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+  for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
     {
-      n = regcomp (&re, tests[i].pattern, tests[i].flags);
-      if (n != 0)
+      int err = regcomp (&re, tests[i].pattern, tests[i].flags);
+      if (err != 0)
         {
           char buf[500];
-          regerror (n, &re, buf, sizeof (buf));
+          regerror (err, &re, buf, sizeof (buf));
           report_error ("%s: regcomp %zd failed: %s", tests[i].pattern, i, buf);
           continue;
         }
@@ -148,7 +146,7 @@ bug_regex11 (void)
           continue;
         }
 
-      for (n = 0; n < tests[i].nmatch; ++n)
+      for (int n = 0; n < tests[i].nmatch; ++n)
         if (rm[n].rm_so != tests[i].rm[n].rm_so
               || rm[n].rm_eo != tests[i].rm[n].rm_eo)
           {
@@ -169,7 +167,6 @@ main (void)
 {
   static struct re_pattern_buffer regex;
   unsigned char folded_chars[UCHAR_MAX + 1];
-  int i;
   const char *s;
   struct re_registers regs;
 
@@ -203,11 +200,11 @@ main (void)
         else
           {
             memset (&regs, 0, sizeof regs);
-            i = re_search (&regex, data, sizeof data - 1,
-                           0, sizeof data - 1, &regs);
-            if (i != -1)
+            int ret = re_search (&regex, data, sizeof data - 1,
+                                 0, sizeof data - 1, &regs);
+            if (ret != -1)
               report_error ("re_search '%s' on '%s' returned %d",
-                            pat, data, i);
+                            pat, data, ret);
             regfree (&regex);
             free (regs.start);
             free (regs.end);
@@ -240,11 +237,11 @@ main (void)
           else
             {
               memset (&regs, 0, sizeof regs);
-              i = re_search (&regex, data, sizeof data - 1,
-                             0, sizeof data - 1, NULL);
-              if (i != 0 && i != 21)
+              int ret = re_search (&regex, data, sizeof data - 1,
+                                   0, sizeof data - 1, NULL);
+              if (ret != 0 && ret != 21)
                 report_error ("re_search '%s' on '%s' returned %d",
-                              pat, data, i);
+                              pat, data, ret);
               regfree (&regex);
               free (regs.start);
               free (regs.end);
@@ -277,11 +274,12 @@ main (void)
               static char const data[] = "\xc4\xb0";
 
               memset (&regs, 0, sizeof regs);
-              i = re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1,
-                             &regs);
-              if (i != 0)
+              int ret =
+                re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1,
+                           &regs);
+              if (ret != 0)
                 report_error ("re_search '%s' on '%s' returned %d",
-                              pat, data, i);
+                              pat, data, ret);
               regfree (&regex);
               free (regs.start);
               free (regs.end);
@@ -307,10 +305,11 @@ main (void)
       /* This should fail, but succeeds for glibc-2.5.  */
       memset (&regs, 0, sizeof regs);
       static char const data[] = "a\nb";
-      i = re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1, &regs);
-      if (i != -1)
+      int ret =
+        re_search (&regex, data, sizeof data - 1, 0, sizeof data - 1, &regs);
+      if (ret != -1)
         report_error ("re_search '%s' on '%s' returned %d",
-                      pat_3957, data, i);
+                      pat_3957, data, ret);
       regfree (&regex);
       free (regs.start);
       free (regs.end);
@@ -320,7 +319,7 @@ main (void)
      in grep-2.3.  */
   re_set_syntax (RE_SYNTAX_POSIX_EGREP);
   memset (&regex, 0, sizeof regex);
-  for (i = 0; i <= UCHAR_MAX; i++)
+  for (int i = 0; i <= UCHAR_MAX; i++)
     folded_chars[i] = i;
   regex.translate = folded_chars;
   static char const pat75[] = "a[[:@:>@:]]b\n";
@@ -365,10 +364,10 @@ main (void)
     {
       memset (&regs, 0, sizeof regs);
       static char const data[] = "an";
-      i = re_match (&regex, data, sizeof data - 1, 0, &regs);
-      if (i != 2)
+      int ret = re_match (&regex, data, sizeof data - 1, 0, &regs);
+      if (ret != 2)
         report_error ("re_match '%s' on '%s' at 2 returned %d",
-                      pat_stolfi, data, i);
+                      pat_stolfi, data, ret);
       regfree (&regex);
       free (regs.start);
       free (regs.end);
@@ -384,9 +383,9 @@ main (void)
     {
       memset (&regs, 0, sizeof regs);
       static char const data[] = "wxy";
-      i = re_search (&regex, data, sizeof data - 1, 2, -2, &regs);
-      if (i != 1)
-        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i);
+      int ret = re_search (&regex, data, sizeof data - 1, 2, -2, &regs);
+      if (ret != 1)
+        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, ret);
       regfree (&regex);
       free (regs.start);
       free (regs.end);
@@ -403,9 +402,9 @@ main (void)
     {
       memset (&regs, 0, sizeof regs);
       static char const data[] = "WXY";
-      i = re_search (&regex, data, sizeof data - 1, 0, 3, &regs);
-      if (i < 0)
-        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, i);
+      int ret = re_search (&regex, data, sizeof data - 1, 0, 3, &regs);
+      if (ret < 0)
+        report_error ("re_search '%s' on '%s' returned %d", pat_x, data, ret);
       regfree (&regex);
       free (regs.start);
       free (regs.end);
@@ -423,9 +422,10 @@ main (void)
       memset (&regs, 0, sizeof regs);
       static char const data[] = "a";
       int datalen = sizeof data - 1;
-      i = re_search (&regex, data, datalen, 0, datalen, &regs);
-      if (i != 0)
-        report_error ("re_search '%s' on '%s' returned %d", pat_sub2, data, i);
+      int ret = re_search (&regex, data, datalen, 0, datalen, &regs);
+      if (ret != 0)
+        report_error ("re_search '%s' on '%s' returned %d",
+                      pat_sub2, data, ret);
       else if (regs.num_regs < 2)
         report_error ("re_search '%s' on '%s' returned only %d registers",
                       pat_sub2, data, (int) regs.num_regs);
index a4893047980da21b3ed757e51d8011f6d353ec17..19380a9f8a6ad5288db181467a012eb2a2053a3d 100644 (file)
@@ -27,8 +27,6 @@ my_ldexp (DOUBLE x, int d)
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -40,8 +38,8 @@ test_function (void)
     * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
@@ -63,8 +61,8 @@ test_function (void)
           }
       }
 
-  for (i = 0; i < SIZEOF (RANDOM) / 5; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 5; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 5; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 5; j++)
       {
         DOUBLE x = L_(1.0e9) * RANDOM[i]; /* 0.0 <= x <= 10^9 */
         DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
@@ -102,8 +100,8 @@ test_function (void)
   {
     int large_exp = (MAX_EXP - 1 < 1000 ? MAX_EXP - 1 : 1000);
     DOUBLE large = my_ldexp (L_(1.0), large_exp); /* = 2^large_exp */
-    for (i = 0; i < SIZEOF (RANDOM) / 10; i++)
-      for (j = 0; j < SIZEOF (RANDOM) / 10; j++)
+    for (int i = 0; i < SIZEOF (RANDOM) / 10; i++)
+      for (int j = 0; j < SIZEOF (RANDOM) / 10; j++)
         {
           DOUBLE x = large * RANDOM[i]; /* 0.0 <= x <= 2^large_exp */
           DOUBLE y = RANDOM[j]; /* 0.0 <= y < 1.0 */
index f2e1a6198e4d0cfd420fce155cff97fb9a49e58b..3e91d276f4205efde0f5cc9cd19ca0e28a5ace0d 100644 (file)
@@ -52,7 +52,6 @@ do_rename (char const *name1, char const *name2)
 int
 main (void)
 {
-  int i;
   int dfd;
   char *cwd;
   int result;
@@ -121,7 +120,7 @@ main (void)
      last scenario (two relative paths given, neither one AT_FDCWD)
      has two paths, based on whether the two fds are equivalent, so we
      do the other variant after the loop.  */
-  for (i = 0; i < 16; i++)
+  for (int i = 0; i < 16; i++)
     {
       int fd1 = (i & 8) ? dfd : AT_FDCWD;
       char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
index 6841e0875a5de4642e38b60a1b9e3df1396ab09c..eab56c54a88f04d906e55c4d23f75dd1b422e393 100644 (file)
@@ -55,7 +55,6 @@ do_rename (char const *name1, char const *name2)
 int
 main (void)
 {
-  int i;
   int dfd;
   char *cwd;
   int result;
@@ -125,7 +124,7 @@ main (void)
      last scenario (two relative paths given, neither one AT_FDCWD)
      has two paths, based on whether the two fds are equivalent, so we
      do the other variant after the loop.  */
-  for (i = 0; i < 16; i++)
+  for (int i = 0; i < 16; i++)
     {
       int fd1 = (i & 8) ? dfd : AT_FDCWD;
       char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
index be86df5022775e2c1054746f93f8813982ba03a6..20ae827807e4ab4fb8fd53014450ef792aa9e7dc 100644 (file)
@@ -34,7 +34,6 @@ main (int argc, char *argv[])
     "\x00\x00\x00\x00\x00\x00\x00\x00";
   char ct[] = "\xC3\x4C\x05\x2C\xC0\xDA\x8D\x73"
     "\x45\x1A\xFE\x5F\x03\xBE\x29\x7F";
-  size_t round;
 
   rc = rijndaelMakeKey (&key, RIJNDAEL_DIR_ENCRYPT,
                         128, "00000000000000000000000000000000");
@@ -47,7 +46,7 @@ main (int argc, char *argv[])
 
   memset (in, 0, RIJNDAEL_BITSPERBLOCK / 8);
 
-  for (round = 0; round < 10000; round++)
+  for (size_t round = 0; round < 10000; round++)
     {
       rc = rijndaelBlockEncrypt (&cipher, &key, in, 128, out);
       if (rc < 0)
@@ -58,12 +57,11 @@ main (int argc, char *argv[])
 
   if (memcmp (out, ct, RIJNDAEL_BITSPERBLOCK / 8) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
+      for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
         printf ("%02x ", ct[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
+      for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       return 1;
@@ -78,7 +76,7 @@ main (int argc, char *argv[])
   if (rc != 0)
     printf ("cipherInit failed %d\n", rc);
 
-  for (round = 0; round < 10000; round++)
+  for (size_t round = 0; round < 10000; round++)
     {
       memcpy (in, out, RIJNDAEL_BITSPERBLOCK / 8);
 
@@ -89,12 +87,11 @@ main (int argc, char *argv[])
 
   if (memcmp (out, pt, RIJNDAEL_BITSPERBLOCK / 8) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
+      for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
         printf ("%02x ", pt[i] & 0xFF);
       printf ("\ncomputed:\n");
-      for (i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
+      for (size_t i = 0; i < RIJNDAEL_BITSPERBLOCK / 8; i++)
         printf ("%02x ", out[i] & 0xFF);
       printf ("\n");
       return 1;
index e2a7eb816fe25059a4f416a69eeac0bf36228fb5..3d32611b5af6ffecd2d007439da6439aaddcfbd8 100644 (file)
@@ -24,32 +24,28 @@ test_function (void)
   ASSERT (ISNAN (RINT (NAN)));
 
   /* Randomized tests.  */
-  {
-    int i;
-
-    for (i = 0; i < SIZEOF (RANDOM); i++)
-      {
-        DOUBLE x;
-
-        x = L_(0.5) * RANDOM[i];
-        ASSERT (RINT (x) == L_(0.0));
-        x = - x;
-        ASSERT (RINT (x) == L_(0.0));
-
-        x = L_(1.0) - L_(0.5) * RANDOM[i];
-        ASSERT (RINT (x) == L_(1.0));
-        x = - x;
-        ASSERT (RINT (x) == - L_(1.0));
-
-        x = L_(1.0) + L_(0.5) * RANDOM[i];
-        ASSERT (RINT (x) == L_(1.0));
-        x = - x;
-        ASSERT (RINT (x) == - L_(1.0));
-
-        x = L_(2.0) - L_(0.5) * RANDOM[i];
-        ASSERT (RINT (x) == L_(2.0));
-        x = - x;
-        ASSERT (RINT (x) == - L_(2.0));
-      }
-  }
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
+    {
+      DOUBLE x;
+
+      x = L_(0.5) * RANDOM[i];
+      ASSERT (RINT (x) == L_(0.0));
+      x = - x;
+      ASSERT (RINT (x) == L_(0.0));
+
+      x = L_(1.0) - L_(0.5) * RANDOM[i];
+      ASSERT (RINT (x) == L_(1.0));
+      x = - x;
+      ASSERT (RINT (x) == - L_(1.0));
+
+      x = L_(1.0) + L_(0.5) * RANDOM[i];
+      ASSERT (RINT (x) == L_(1.0));
+      x = - x;
+      ASSERT (RINT (x) == - L_(1.0));
+
+      x = L_(2.0) - L_(0.5) * RANDOM[i];
+      ASSERT (RINT (x) == L_(2.0));
+      x = - x;
+      ASSERT (RINT (x) == - L_(2.0));
+    }
 }
index 5f45e44bf32713df4cc9061d015ad94f3caffd48..453393132db0fa4aff8b2e4c36f5a25dfdae9760 100644 (file)
@@ -89,10 +89,9 @@ check (DOUBLE x)
 int
 main (void)
 {
-  DOUBLE_UINT highbits, lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (DOUBLE_UINT highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (DOUBLE_UINT lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to DOUBLE_BITS-NUM_HIGHBITS bits.  */
index 9c487b4ccb03367c1c567aeb0c6510f3acad870f..00c9fba8781c2f117b5287f9f390226d80de87e3 100644 (file)
@@ -123,9 +123,8 @@ main (int argc, char *argv[])
         , ACL_TYPE_EXTENDED
 # endif
       };
-    int t;
 
-    for (t = 0; t < sizeof (types) / sizeof (types[0]); t++)
+    for (int t = 0; t < sizeof (types) / sizeof (types[0]); t++)
       {
         int type = types[t];
         acl_t acl1;
@@ -261,7 +260,6 @@ main (int argc, char *argv[])
     {
       aclent_t *entries1 = XNMALLOC (count1, aclent_t);
       aclent_t *entries2 = XNMALLOC (count2, aclent_t);
-      int i;
 
       if (count1 > 0 && acl (file1, GETACL, count1, entries1) < count1)
         {
@@ -275,7 +273,7 @@ main (int argc, char *argv[])
           fflush (stderr);
           abort ();
         }
-      for (i = 0; i < count1; i++)
+      for (int i = 0; i < count1; i++)
         {
           if (entries1[i].a_type != entries2[i].a_type)
             {
@@ -322,7 +320,6 @@ main (int argc, char *argv[])
     ace_t *entries1 = XNMALLOC (count1, ace_t);
     ace_t *entries2 = XNMALLOC (count2, ace_t);
     int ret;
-    int i;
 
     ret = acl (file1, ACE_GETACL, count1, entries1);
     if (ret < 0 && errno == EINVAL)
@@ -350,7 +347,7 @@ main (int argc, char *argv[])
         return 1;
       }
 
-    for (i = 0; i < count1; i++)
+    for (int i = 0; i < count1; i++)
       {
         if (entries1[i].a_type != entries2[i].a_type)
           {
@@ -416,7 +413,6 @@ main (int argc, char *argv[])
     {
       struct acl_entry *entries1 = XNMALLOC (count1, struct acl_entry);
       struct acl_entry *entries2 = XNMALLOC (count2, struct acl_entry);
-      int i;
 
       if (getacl (file1, count1, entries1) < count1)
         {
@@ -430,7 +426,7 @@ main (int argc, char *argv[])
           fflush (stderr);
           abort ();
         }
-      for (i = 0; i < count1; i++)
+      for (int i = 0; i < count1; i++)
         {
           if (entries1[i].uid != entries2[i].uid)
             {
@@ -491,7 +487,6 @@ main (int argc, char *argv[])
     {
       struct acl *entries1 = XNMALLOC (count1, struct acl);
       struct acl *entries2 = XNMALLOC (count2, struct acl);
-      int i;
 
       if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
         {
@@ -505,7 +500,7 @@ main (int argc, char *argv[])
           fflush (stderr);
           abort ();
         }
-      for (i = 0; i < count1; i++)
+      for (int i = 0; i < count1; i++)
         {
           if (entries1[i].a_type != entries2[i].a_type)
             {
@@ -669,7 +664,6 @@ main (int argc, char *argv[])
     {
       struct acl *entries1 = XNMALLOC (count1, struct acl);
       struct acl *entries2 = XNMALLOC (count2, struct acl);
-      int i;
 
       if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
         {
@@ -683,7 +677,7 @@ main (int argc, char *argv[])
           fflush (stderr);
           abort ();
         }
-      for (i = 0; i < count1; i++)
+      for (int i = 0; i < count1; i++)
         {
           if (entries1[i].a_type != entries2[i].a_type)
             {
index 9fb6f38555c0cb55fd302e8300edd9b01d31c481..d79649e7c8a5437713ae1a994a19d038ebe63e5f 100644 (file)
@@ -35,20 +35,18 @@ main ()
   /* Check scratch_buffer_set_array_size.  */
   {
     size_t sizes[] = { 100, 1000, 10000, 100000 };
-    size_t s;
-    for (s = 0; s < SIZEOF (sizes); s++)
+    for (size_t s = 0; s < SIZEOF (sizes); s++)
       {
         size_t size = sizes[s];
         struct scratch_buffer buf;
         bool ok;
-        size_t i;
 
         scratch_buffer_init (&buf);
 
         ok = scratch_buffer_set_array_size (&buf, size, 1);
         ASSERT (ok);
 
-        for (i = 0; i < size; i++)
+        for (size_t i = 0; i < size; i++)
           ((unsigned char *) buf.data)[i] = byte_at (i);
 
         memset (buf.data, 'x', buf.length);
@@ -61,13 +59,11 @@ main ()
   /* Check scratch_buffer_grow.  */
   {
     size_t sizes[] = { 100, 1000, 10000, 100000 };
-    size_t s;
-    for (s = 0; s < SIZEOF (sizes); s++)
+    for (size_t s = 0; s < SIZEOF (sizes); s++)
       {
         size_t size = sizes[s];
         struct scratch_buffer buf;
         bool ok;
-        size_t i;
 
         scratch_buffer_init (&buf);
 
@@ -77,7 +73,7 @@ main ()
             ASSERT (ok);
           }
 
-        for (i = 0; i < size; i++)
+        for (size_t i = 0; i < size; i++)
           ((unsigned char *) buf.data)[i] = byte_at (i);
 
         memset (buf.data, 'x', buf.length);
@@ -94,7 +90,6 @@ main ()
     size_t s;
     size_t size;
     bool ok;
-    size_t i;
 
     scratch_buffer_init (&buf);
 
@@ -103,7 +98,7 @@ main ()
     ok = scratch_buffer_set_array_size (&buf, size, 1);
     ASSERT (ok);
 
-    for (i = 0; i < size; i++)
+    for (size_t i = 0; i < size; i++)
       ((unsigned char *) buf.data)[i] = byte_at (i);
 
     for (; s < SIZEOF (sizes); s++)
@@ -117,9 +112,9 @@ main ()
             ASSERT (ok);
           }
 
-        for (i = 0; i < oldsize; i++)
+        for (size_t i = 0; i < oldsize; i++)
           ASSERT(((unsigned char *) buf.data)[i] == byte_at (i));
-        for (i = oldsize; i < size; i++)
+        for (size_t i = oldsize; i < size; i++)
           ((unsigned char *) buf.data)[i] = byte_at (i);
       }
 
index 01a4053bfaa1fa41a85791c107e53800d84f7a17..3165404c3a4054ad9a8a7b012bc8ad54659b7755 100644 (file)
@@ -45,7 +45,7 @@ main (int argc, _GL_UNUSED char *argv[])
 {
   char origname[HOST_NAME_MAX];
   char newname[HOST_NAME_MAX];
-  int rcs, i;
+  int rcs;
 
   /* skip the tests if we don't have root privilege.  this does not
      consider things like CAP_SYS_ADMIN (linux) or PRIV_SYS_ADMIN
@@ -113,6 +113,7 @@ main (int argc, _GL_UNUSED char *argv[])
 #if !(defined __CYGWIN__ || defined __HAIKU__)
   {
     char longname[HOST_NAME_MAX + 2];
+    int i;
 
     /* glibc does allow setting a zero length name, so the lower bound
        needs no test. validate that we are constrained by
index 49d4b1fe0b4cdf795acaae471154eb1bf3da6ff9..2e88371f98856207e7140ec38bc1f04e9e413464 100644 (file)
@@ -57,8 +57,6 @@ main (void)
 {
   /* Check the shell_quote_length, shell_quote_copy, shell_quote functions.  */
   {
-    int c;
-
     /* Empty argument.  */
     check_one ("", "''");
 
@@ -156,7 +154,7 @@ main (void)
     check_one ("foo'bar\"baz", "'foo'\\''bar\"baz'"); /* or "\"foo'bar\\\"baz\"" */
 
     /* All other characters don't need quoting.  */
-    for (c = 1; c <= UCHAR_MAX; c++)
+    for (int c = 1; c <= UCHAR_MAX; c++)
       if (strchr ("\t\n\r !\"#$&'()*;<=>?^[\\]`{|}~", c) == NULL)
         {
           char s[5];
index 43dd88c444e5e7fadde66d404c21c3b67223de1e..44a6bb481d07498e0922f5c61934148c5c109214 100644 (file)
@@ -33,12 +33,11 @@ main (void)
   if (memcmp (sha1_buffer (in1, strlen (in1), buf),
               out1, SHA1_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA1_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA1_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA1_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA1_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 97e888e80c4f421cc2b0bd6b3c51c57df10f4298..6b0323911e054043aadca6dbb6863926816b6e0a 100644 (file)
@@ -36,12 +36,11 @@ main (void)
   if (memcmp (sha224_buffer (in1, strlen (in1), buf),
               out1, SHA224_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA224_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA224_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA224_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA224_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 08fb841c6a22ce571e3bd435c03653723af70cde..42c60d930750d13a7cb703a142360fbc5977ea86 100644 (file)
@@ -36,12 +36,11 @@ main (void)
   if (memcmp (sha256_buffer (in1, strlen (in1), buf),
               out1, SHA256_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA256_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA256_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA256_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA256_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 50512a7e52ce06bbfccdb62c5ed50ea230cb5aef..9d99d6d20aad102eaf5194ab08bb338312842992 100644 (file)
@@ -51,12 +51,11 @@ check (char const *message, size_t len, char const *expect)
   if (memcmp (sha3_224_buffer (message, len, buf),
               expect, SHA3_224_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA3_224_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_224_DIGEST_SIZE; i++)
         printf ("%02x ", expect[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA3_224_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_224_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 58775718136db57eba9a1571bc7c1098950ccaae..9215b6de391ab2148294ff74aa4dbbbdd790dc3f 100644 (file)
@@ -52,12 +52,11 @@ check (char const *message, size_t len, char const *expect)
   if (memcmp (sha3_256_buffer (message, len, buf),
               expect, SHA3_256_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA3_256_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_256_DIGEST_SIZE; i++)
         printf ("%02x ", expect[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA3_256_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_256_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 8f6ff7ef5206736d93829285cf1ca6ab7dee5015..12bdad462c430e0cb681f8b6063faf9bb08926f8 100644 (file)
@@ -56,12 +56,11 @@ check (char const *message, size_t len, char const *expect)
   if (memcmp (sha3_384_buffer (message, len, buf),
               expect, SHA3_384_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA3_384_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_384_DIGEST_SIZE; i++)
         printf ("%02x ", expect[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA3_384_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_384_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 3be928507e7e988b9b4b6ccaa8e3e8ea8ccef39c..4d5e1d8076f780cb3692992fc9b9093bb463418b 100644 (file)
@@ -60,12 +60,11 @@ check (char const *message, size_t len, char const *expect)
   if (memcmp (sha3_512_buffer (message, len, buf),
               expect, SHA3_512_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA3_512_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_512_DIGEST_SIZE; i++)
         printf ("%02x ", expect[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA3_512_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA3_512_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index 91de0739f09e8bb84ab07bd807610e4a23f562e1..dbc46fea162424dcd0c3e375de690cf8712dbad0 100644 (file)
@@ -37,12 +37,11 @@ main (void)
   if (memcmp (sha384_buffer (in1, strlen (in1), buf),
               out1, SHA384_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA384_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA384_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA384_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA384_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index a11efbecec2aa7374e351987b73eb14e79beeea1..f1f2293253a3fd5807b320615a6a1f04ad2c8759 100644 (file)
@@ -38,12 +38,11 @@ main (void)
   if (memcmp (sha512_buffer (in1, strlen (in1), buf),
               out1, SHA512_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SHA512_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA512_DIGEST_SIZE; i++)
         printf ("%02x ", out1[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SHA512_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SHA512_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
index dead4d2ac46765c7a9f540e6cdc742ec6a49fbce..6cd1f0b6b0a2805d7186fac4a05d362f0b75fc68 100644 (file)
@@ -55,9 +55,8 @@ static void *
 int_mutator_thread (void *arg)
 {
   int *pcounter = (int *) arg;
-  int repeat;
 
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       if (atomic_compare_and_swap (&int_variable, 0, 10) == 0)
         pcounter[0]++;
@@ -90,9 +89,8 @@ static void *
 ptr_mutator_thread (void *arg)
 {
   int *pcounter = (int *) arg;
-  int repeat;
 
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       if (atomic_compare_and_swap_ptr (&ptr_variable, 0, 10) == 0)
         pcounter[0]++;
@@ -161,32 +159,30 @@ main ()
   /* Check atomicity of atomic_compare_and_swap.  */
   {
     void * (*funcs[2]) (void *) = { int_mutator_thread, ptr_mutator_thread };
-    int f;
-    for (f = 0; f < 2; f++)
+    for (int f = 0; f < 2; f++)
       {
         void * (*func) (void *) = funcs[f];
-        int i, j;
         gl_thread_t threads[THREAD_COUNT];
 
         /* Initialization.  */
-        for (i = 0; i < THREAD_COUNT; i++)
-          for (j = 0; j < 5; j++)
+        for (int i = 0; i < THREAD_COUNT; i++)
+          for (int j = 0; j < 5; j++)
             counter[i][j] = 0;
 
         /* Spawn the threads.  */
-        for (i = 0; i < THREAD_COUNT; i++)
+        for (int i = 0; i < THREAD_COUNT; i++)
           threads[i] = gl_thread_create (func, &counter[i][0]);
 
         /* Wait for the threads to terminate.  */
-        for (i = 0; i < THREAD_COUNT; i++)
+        for (int i = 0; i < THREAD_COUNT; i++)
           gl_thread_join (threads[i], NULL);
 
         /* Sum up the work that the threads have done.  */
         unsigned int sum[5];
-        for (j = 0; j < 5; j++)
+        for (int j = 0; j < 5; j++)
           {
             sum[j] = 0;
-            for (i = 0; i < THREAD_COUNT; i++)
+            for (int i = 0; i < THREAD_COUNT; i++)
               sum[j] += counter[i][j];
           }
 
index 806849d4743f99a4ef19e5eedfab6c33020cf426..01d0111c05b29f065d265dbeb086208f40d263e7 100644 (file)
@@ -30,12 +30,11 @@ test (const char *in, const char *out)
   if (memcmp (sm3_buffer (in, strlen (in), buf),
               out, SM3_DIGEST_SIZE) != 0)
     {
-      size_t i;
       printf ("expected:\n");
-      for (i = 0; i < SM3_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SM3_DIGEST_SIZE; i++)
         printf ("%02x ", out[i] & 0xFFu);
       printf ("\ncomputed:\n");
-      for (i = 0; i < SM3_DIGEST_SIZE; i++)
+      for (size_t i = 0; i < SM3_DIGEST_SIZE; i++)
         printf ("%02x ", buf[i] & 0xFFu);
       printf ("\n");
       return 1;
@@ -60,9 +59,8 @@ main (void)
       "\xde\xbe\x9f\xf9\x22\x75\xb8\xa1\x38\x60\x48\x89\xc1\x8e\x5a\x4d"
       "\x6f\xdb\x70\xe5\x38\x7e\x57\x65\x29\x3d\xcb\xa3\x9c\x0c\x57\x32",
     };
-  size_t i;
 
-  for (i = 0; i < sizeof (in) / sizeof (in[0]); i++)
+  for (size_t i = 0; i < sizeof (in) / sizeof (in[0]); i++)
     {
       if (test (in[i], out[i]))
         return 1;
index 918b992f5aa648eeabca380add78b1ab51b9bb75..88c41db10a74373a73e3ab6aa837a5752a4afce8 100644 (file)
@@ -79,12 +79,11 @@ static void
 test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
 {
   char buf[8];
-  int size;
   char result[5000];
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       int retval;
 
@@ -838,8 +837,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35, "123432123432123*********************.000000" },
         { 1.234321234321234e36, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%f", data[k].value);
@@ -1098,8 +1096,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35L, "123432123432123*********************.000000" },
         { 1.234321234321234e36L, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%Lf", data[k].value);
@@ -1642,8 +1639,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35, "1.234321e+35" },
         { 1.234321234321234e36, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%e", data[k].value);
@@ -1935,8 +1931,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35L, "1.234321e+35" },
         { 1.234321234321234e36L, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%Le", data[k].value);
@@ -2293,8 +2288,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35, "1.23432e+35" },
         { 1.234321234321234e36, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%g", data[k].value);
@@ -2572,8 +2566,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
         { 1.234321234321234e35L, "1.23432e+35" },
         { 1.234321234321234e36L, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_snprintf (result, sizeof (result), "%Lg", data[k].value);
@@ -2881,8 +2874,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000d %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2891,8 +2883,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.*d %d", 4000, 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2901,9 +2892,8 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000d %d", -1234567, 99);
-    size_t i;
     ASSERT (result[0] == '-');
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[1 + i] == '0');
     ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2912,8 +2902,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000u %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2922,8 +2911,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000o %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2932,8 +2920,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000x %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2942,10 +2929,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%#.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result[0] == '0');
     ASSERT (result[1] == 'x');
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2954,10 +2940,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.4000f %d", 1.0, 99);
-    size_t i;
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 4000; i++)
+    for (size_t i = 0; i < 4000; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2966,10 +2951,9 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   {
     int retval =
       my_snprintf (result, sizeof (result), "%.511f %d", 1.0, 99);
-    size_t i;
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 511; i++)
+    for (size_t i = 0; i < 511; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 511, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3052,42 +3036,33 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...))
   /* To verify that these tests succeed, it is necessary to run them under
      a tool that checks against invalid memory accesses, such as ElectricFence
      or "valgrind --tool=memcheck".  */
-  {
-    size_t i;
+  for (size_t i = 1; i <= 8; i++)
+    {
+      char *block;
+      int retval;
 
-    for (i = 1; i <= 8; i++)
-      {
-        char *block;
-        int retval;
-
-        block = (char *) malloc (i);
-        memcpy (block, "abcdefgh", i);
-        retval = my_snprintf (result, sizeof (result), "%.*s", (int) i, block);
-        ASSERT (memcmp (result, block, i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (block);
-      }
-  }
-  {
-    size_t i;
+      block = (char *) malloc (i);
+      memcpy (block, "abcdefgh", i);
+      retval = my_snprintf (result, sizeof (result), "%.*s", (int) i, block);
+      ASSERT (memcmp (result, block, i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (block);
+    }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      wchar_t *block;
+      int retval;
 
-    for (i = 1; i <= 8; i++)
-      {
-        wchar_t *block;
-        size_t j;
-        int retval;
-
-        block = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          block[j] = "abcdefgh"[j];
-        retval = my_snprintf (result, sizeof (result), "%.*ls", (int) i, block);
-        ASSERT (memcmp (result, "abcdefgh", i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (block);
-      }
-  }
+      block = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        block[j] = "abcdefgh"[j];
+      retval = my_snprintf (result, sizeof (result), "%.*ls", (int) i, block);
+      ASSERT (memcmp (result, "abcdefgh", i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (block);
+    }
 
   /* Test the support of the %c format directive.  */
 
index c6f6b223582e230df4189470f1e43d381d381f65..30b248960593921c71c4a5a56b0b0154dcdfe5d0 100644 (file)
@@ -31,13 +31,12 @@ int
 main ()
 {
   char buf[8];
-  int size;
   int retval;
 
   retval = snprintf (NULL, 0, "%d", 12345);
   ASSERT (retval == 5);
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       memcpy (buf, "DEADBEEF", 8);
       retval = snprintf (buf, size, "%d", 12345);
index 122f4c3db7c5ea4d60ae34379b53fc34865dab79..0fdc0c27b0f6eb992869925622dc1011b432b29c 100644 (file)
@@ -163,8 +163,7 @@ test_function (ptrdiff_t (*my_snzprintf) (char *, size_t, const char *, ...))
   { /* This test would fail on AIX 7.1.  */
     ptrdiff_t retval =
       my_snzprintf (result, sizeof (result), "%.4000d %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
index 8daeb70b9dbe58f17ef733be276d8e2cb1246883..76b2432a167ae6cc101af4e75f1d9a8b5d8b6a44 100644 (file)
@@ -140,8 +140,7 @@ main (int argc, char *argv[])
       ASSERT (0);
     }
 
-  int fd;
-  for (fd = 3; fd < 7; fd++)
+  for (int fd = 3; fd < 7; fd++)
     if (!(is_qemu && fd == 3))
       {
         errno = 0;
index 06c200e7319edd31dd486203cd8eac57cc7a987d..ec16a95954b0ff3c0f10c04d4cc0db5aea94095e 100644 (file)
@@ -76,7 +76,6 @@ int
 main (int argc, char *argv[])
 {
   int test;
-  int fd;
 
   if (argc != 3)
     {
@@ -128,7 +127,7 @@ main (int argc, char *argv[])
   /* Plug any file descriptor leaks inherited from outside world before
      starting, so that child has a clean slate (at least for the fds that we
      might be manipulating).  */
-  for (fd = 3; fd < 7; fd++)
+  for (int fd = 3; fd < 7; fd++)
     close (fd);
 
   test_pipe (argv[1], test >= 4);
index fbeee01fa3c57336f9df60975dd83b4144a032af..08b7a5d243eb3e01ed6d75ca2f5b0d59043e0ea9 100644 (file)
@@ -39,33 +39,29 @@ main ()
   int fd[1];
   pid_t pid;
 
-  {
-    size_t i;
-
-    for (i = 0; i < 2; i++)
-      {
-        const char *progname =
-          (i == 0 ? "executable-script" : "executable-script.sh");
-        const char *prog_path =
-          (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
-        const char *prog_argv[2] = { prog_path, NULL };
-
-        pid = create_pipe_in (progname, prog_argv[0], prog_argv, NULL, NULL,
-                              NULL, false, true, false, fd);
-        if (pid >= 0)
-          {
-            /* Wait for child.  */
-            ASSERT (wait_subprocess (pid, progname, true, true, true, false,
-                                     NULL)
-                    == 127);
-          }
-        else
-          {
-            ASSERT (pid == -1);
-            ASSERT (errno == ENOEXEC);
-          }
-      }
-  }
+  for (size_t i = 0; i < 2; i++)
+    {
+      const char *progname =
+        (i == 0 ? "executable-script" : "executable-script.sh");
+      const char *prog_path =
+        (i == 0 ? SRCDIR "executable-script" : SRCDIR "executable-script.sh");
+      const char *prog_argv[2] = { prog_path, NULL };
+
+      pid = create_pipe_in (progname, prog_argv[0], prog_argv, NULL, NULL,
+                            NULL, false, true, false, fd);
+      if (pid >= 0)
+        {
+          /* Wait for child.  */
+          ASSERT (wait_subprocess (pid, progname, true, true, true, false,
+                                   NULL)
+                  == 127);
+        }
+      else
+        {
+          ASSERT (pid == -1);
+          ASSERT (errno == ENOEXEC);
+        }
+    }
 
 #if defined _WIN32 && !defined __CYGWIN__
   /* On native Windows, scripts - even with '#!' marker - are not executable.
index 5b82925905b39a9d5785ca2c36ab6a6c246b0299..1fe6f6066ec451ed59df059e2558e7dcbe4af5ac 100644 (file)
@@ -35,11 +35,10 @@ main (void)
   /* Check a spin-lock initialized through gl_spinlock_init.  */
   {
     gl_spinlock_define (, local_spin_lock)
-    int i;
 
     gl_spinlock_init (local_spin_lock);
 
-    for (i = 0; i < 10; i++)
+    for (int i = 0; i < 10; i++)
       {
         gl_spinlock_lock (local_spin_lock);
         gl_spinlock_unlock (local_spin_lock);
index b3baf3c32591821a988bf87de99d00a66ac86ab9..3d648c67714fc5293042bfb6fdabada2942e60c6 100644 (file)
@@ -101,10 +101,10 @@ random_account (void)
 static void
 check_accounts (void)
 {
-  int i, sum;
+  int sum;
 
   sum = 0;
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     sum += account[i];
   if (sum != ACCOUNT_COUNT * 1000)
     abort ();
@@ -122,9 +122,7 @@ gl_spinlock_define (static, my_lock)
 static void *
 lock_mutator_thread (void *arg)
 {
-  int repeat;
-
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       int i1, i2, value;
 
@@ -178,23 +176,22 @@ lock_checker_thread (void *arg)
 static void
 test_asyncsafe_spin (void)
 {
-  int i;
   gl_thread_t checkerthread;
   gl_thread_t threads[THREAD_COUNT];
 
   /* Initialization.  */
-  for (i = 0; i < ACCOUNT_COUNT; i++)
+  for (int i = 0; i < ACCOUNT_COUNT; i++)
     account[i] = 1000;
   init_atomic_int (&lock_checker_done);
   set_atomic_int_value (&lock_checker_done, 0);
 
   /* Spawn the threads.  */
   checkerthread = gl_thread_create (lock_checker_thread, NULL);
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     threads[i] = gl_thread_create (lock_mutator_thread, NULL);
 
   /* Wait for the threads to terminate.  */
-  for (i = 0; i < THREAD_COUNT; i++)
+  for (int i = 0; i < THREAD_COUNT; i++)
     gl_thread_join (threads[i], NULL);
   set_atomic_int_value (&lock_checker_done, 1);
   gl_thread_join (checkerthread, NULL);
index 0b5110519d3468ac54bcc2c4f42d67307028c419..881c317abc1eb0e7f05e35c0de605e7892eb36f1 100644 (file)
@@ -824,8 +824,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35, "123432123432123*********************.000000" },
         { 1.234321234321234e36, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%f", data[k].value);
@@ -1084,8 +1083,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35L, "123432123432123*********************.000000" },
         { 1.234321234321234e36L, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%Lf", data[k].value);
@@ -1628,8 +1626,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35, "1.234321e+35" },
         { 1.234321234321234e36, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%e", data[k].value);
@@ -1921,8 +1918,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35L, "1.234321e+35" },
         { 1.234321234321234e36L, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%Le", data[k].value);
@@ -2279,8 +2275,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35, "1.23432e+35" },
         { 1.234321234321234e36, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%g", data[k].value);
@@ -2558,8 +2553,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
         { 1.234321234321234e35L, "1.23432e+35" },
         { 1.234321234321234e36L, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         int retval =
           my_sprintf (result, "%Lg", data[k].value);
@@ -2867,8 +2861,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000d %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2877,8 +2870,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.*d %d", 4000, 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2887,9 +2879,8 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000d %d", -1234567, 99);
-    size_t i;
     ASSERT (result[0] == '-');
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[1 + i] == '0');
     ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2898,8 +2889,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000u %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2908,8 +2898,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000o %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2918,8 +2907,7 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000x %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2928,10 +2916,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%#.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result[0] == '0');
     ASSERT (result[1] == 'x');
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2940,10 +2927,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.4000f %d", 1.0, 99);
-    size_t i;
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 4000; i++)
+    for (size_t i = 0; i < 4000; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -2952,10 +2938,9 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   {
     int retval =
       my_sprintf (result, "%.511f %d", 1.0, 99);
-    size_t i;
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 511; i++)
+    for (size_t i = 0; i < 511; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 511, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3038,42 +3023,33 @@ test_function (int (*my_sprintf) (char *, const char *, ...))
   /* To verify that these tests succeed, it is necessary to run them under
      a tool that checks against invalid memory accesses, such as ElectricFence
      or "valgrind --tool=memcheck".  */
-  {
-    size_t i;
-
-    for (i = 1; i <= 8; i++)
-      {
-        char *block;
-        int retval;
-
-        block = (char *) malloc (i);
-        memcpy (block, "abcdefgh", i);
-        retval = my_sprintf (result, "%.*s", (int) i, block);
-        ASSERT (memcmp (result, block, i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (block);
-      }
-  }
-  {
-    size_t i;
-
-    for (i = 1; i <= 8; i++)
-      {
-        wchar_t *block;
-        size_t j;
-        int retval;
-
-        block = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          block[j] = "abcdefgh"[j];
-        retval = my_sprintf (result, "%.*ls", (int) i, block);
-        ASSERT (memcmp (result, "abcdefgh", i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (block);
-      }
-  }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      char *block;
+      int retval;
+
+      block = (char *) malloc (i);
+      memcpy (block, "abcdefgh", i);
+      retval = my_sprintf (result, "%.*s", (int) i, block);
+      ASSERT (memcmp (result, block, i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (block);
+    }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      wchar_t *block;
+      int retval;
+
+      block = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        block[j] = "abcdefgh"[j];
+      retval = my_sprintf (result, "%.*ls", (int) i, block);
+      ASSERT (memcmp (result, "abcdefgh", i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (block);
+    }
 
   /* Test the support of the %c format directive.  */
 
index a6354734101aa297cc5e0f087acc3731d9668e97..9bae12ef5ca229eff876066644733d7ec2fb56a6 100644 (file)
@@ -17,8 +17,6 @@
 static void
 test_function (void)
 {
-  int i;
-  int j;
   const DOUBLE TWO_MANT_DIG =
     /* Assume MANT_DIG <= 5 * 31.
        Use the identity
@@ -30,7 +28,7 @@ test_function (void)
     * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
 
   /* Randomized tests.  */
-  for (i = 0; i < SIZEOF (RANDOM); i++)
+  for (int i = 0; i < SIZEOF (RANDOM); i++)
     {
       DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
       DOUBLE y = SQRT (x);
@@ -40,8 +38,8 @@ test_function (void)
               && err < L_(16.0) / TWO_MANT_DIG);
     }
 
-  for (i = 0; i < SIZEOF (RANDOM) / 4; i++)
-    for (j = 0; j < SIZEOF (RANDOM) / 4; j++)
+  for (int i = 0; i < SIZEOF (RANDOM) / 4; i++)
+    for (int j = 0; j < SIZEOF (RANDOM) / 4; j++)
       {
         DOUBLE x = L_(16.0) * RANDOM[i]; /* 0.0 <= x <= 16.0 */
         DOUBLE y = L_(16.0) * RANDOM[j]; /* 0.0 <= y <= 16.0 */
index 2c597eab0e6bd3a26f7612848329af55d442dd0e..528359ec4ce5a3c4490acb7ceacda6e87238fb4a 100644 (file)
@@ -284,17 +284,12 @@ main (int argc, char *argv[])
      Also verify that there are no unexpected modifications to the contents of
      these blocks.  */
   {
-    unsigned int repeat;
     char *blocks[SIZEOF (block_sizes)];
 
-    {
-      size_t i;
+    for (size_t i = 0; i < SIZEOF (block_sizes); i++)
+      blocks[i] = NULL;
 
-      for (i = 0; i < SIZEOF (block_sizes); i++)
-        blocks[i] = NULL;
-    }
-
-    for (repeat = 0; repeat < 100000; repeat++)
+    for (unsigned int repeat = 0; repeat < 100000; repeat++)
       {
         unsigned int operation = RANDOM (2);
 
@@ -331,18 +326,14 @@ main (int argc, char *argv[])
       }
 
     /* Free the remaining blocks.  */
-    {
-      size_t i;
-
-      for (i = 0; i < SIZEOF (block_sizes); i++)
-        if (blocks[i] != NULL)
-          {
-            uintptr_t block = (uintptr_t) blocks[i];
-            size_t size = block_sizes[i];
-            verify_block (block, size);
-            free_block (block);
-          }
-    }
+    for (size_t i = 0; i < SIZEOF (block_sizes); i++)
+      if (blocks[i] != NULL)
+        {
+          uintptr_t block = (uintptr_t) blocks[i];
+          size_t size = block_sizes[i];
+          verify_block (block, size);
+          free_block (block);
+        }
   }
 
   return test_exit_status;
index 19ecc8385bb45cb533d8b4fdba4c87007c864244..4fa8bf5168c89c7bf5a02abdfee3d46017bbbdc1 100644 (file)
@@ -107,8 +107,6 @@ do_stat (const char *filename, struct stat *p)
 static void
 prepare_test (struct stat *statinfo, struct timespec *modtimes)
 {
-  int i;
-
   create_file (filename_stamp1);
   nap ();
   create_file (filename_testfile);
@@ -125,7 +123,7 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes)
   do_stat (filename_stamp3,   &statinfo[3]);
 
   /* Now use our access functions. */
-  for (i = 0; i < NFILES; ++i)
+  for (int i = 0; i < NFILES; ++i)
     {
       modtimes[i] = get_stat_mtime (&statinfo[i]);
     }
@@ -134,8 +132,6 @@ prepare_test (struct stat *statinfo, struct timespec *modtimes)
 static void
 test_mtime (const struct stat *statinfo, struct timespec *modtimes)
 {
-  int i;
-
   /* Use the struct stat fields directly. */
   /* mtime(stamp1) < mtime(stamp2) */
   ASSERT (statinfo[0].st_mtime < statinfo[2].st_mtime
@@ -159,7 +155,7 @@ test_mtime (const struct stat *statinfo, struct timespec *modtimes)
               && modtimes[2].tv_nsec < modtimes[3].tv_nsec));
 
   /* verify equivalence */
-  for (i = 0; i < NFILES; ++i)
+  for (int i = 0; i < NFILES; ++i)
     {
       struct timespec ts;
       ts = get_stat_mtime (&statinfo[i]);
@@ -195,10 +191,8 @@ test_birthtime (const struct stat *statinfo,
                 const struct timespec *modtimes,
                 struct timespec *birthtimes)
 {
-  int i;
-
   /* Collect the birth times.  */
-  for (i = 0; i < NFILES; ++i)
+  for (int i = 0; i < NFILES; ++i)
     {
       birthtimes[i] = get_stat_birthtime (&statinfo[i]);
       if (birthtimes[i].tv_nsec < 0)
index 315e72caa4c794753610692ccb8347c7a8abe2ba..6606b5311682222bcee3b8f0f4effeb382ec7de3 100644 (file)
@@ -28,12 +28,11 @@ main ()
 {
   char from[10];
   char to[10];
-  int i, j, k, h;
   char *ret;
 
-  for (i = 0; i < 10; i++)
-    for (j = 0; j < 10; j++)
-      for (k = 0; k < 10; k++)
+  for (int i = 0; i < 10; i++)
+    for (int j = 0; j < 10; j++)
+      for (int k = 0; k < 10; k++)
         {
           memset (from, 'X', sizeof from);
           memcpy (from, "SourceString", i);
@@ -43,13 +42,13 @@ main ()
           if (k < 10) to[k] = '\0';
           ret = stpncpy (to, from, j);
           printf ("i = %2d, j = %2d, k = %2d:  from = ", i, j, k);
-          for (h = 0; h < 10; h++)
+          for (int h = 0; h < 10; h++)
             if (from[h] >= 0x20 && from[h] < 0x7f)
               putchar (from[h]);
             else
               printf ("\\x%02x", from[h]);
           printf ("  to = ");
-          for (h = 0; h < 10; h++)
+          for (int h = 0; h < 10; h++)
             if (to[h] >= 0x20 && to[h] < 0x7f)
               putchar (to[h]);
             else
index a37ba8673dcbd062a1bd0c1dcaa3cf6ef1c0d0d2..2eb052500dc2b46171b72a2de26e26edab545521 100644 (file)
@@ -238,9 +238,8 @@ main ()
       "with_multilib_list\n";
     size_t h_len = strlen (h);
     char *haystack = malloc (h_len + 1);
-    size_t i;
     ASSERT (haystack);
-    for (i = 0; i < h_len - strlen (needle); i++)
+    for (size_t i = 0; i < h_len - strlen (needle); i++)
       {
         const char *p;
         memcpy (haystack, h, h_len + 1);
index ff093e7fecc36959f218c65099263633d0ed9919..9d53c64c6171d858f2bf8cd529b79b017fc590fc 100644 (file)
@@ -64,21 +64,18 @@ main (void)
   }
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 256; j++)
-          input[i + j] = (j + 1) & 0xff;
-        for (j = 1; j < 256; j++)
-          {
-            ASSERT (strchrnul (input + i, j) == input + i + j - 1);
-            input[i + j - 1] = (j == 1 ? 2 : 1);
-            ASSERT (strchrnul (input + i, j) == input + i + 255);
-            input[i + j - 1] = j;
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 256; j++)
+        input[i + j] = (j + 1) & 0xff;
+      for (int j = 1; j < 256; j++)
+        {
+          ASSERT (strchrnul (input + i, j) == input + i + j - 1);
+          input[i + j - 1] = (j == 1 ? 2 : 1);
+          ASSERT (strchrnul (input + i, j) == input + i + 255);
+          input[i + j - 1] = j;
+        }
+    }
 
   free (input);
 
index ec5a71a8366393a885aa3b49653e0fc83597faaf..91e752043884b7b40f74c0d9af96d20adc5c2aec 100644 (file)
@@ -88,21 +88,19 @@ main (void)
      that no out-of-bounds writes occur.  */
   {
     int errs[] = { EACCES, 0, -3, };
-    int j;
 
     buf[sizeof buf - 1] = '\0';
-    for (j = 0; j < SIZEOF (errs); j++)
+    for (int j = 0; j < SIZEOF (errs); j++)
       {
         int err = errs[j];
         char buf2[sizeof buf] = "";
         size_t len;
-        size_t i;
 
         strerror_r (err, buf2, sizeof buf2);
         len = strlen (buf2);
         ASSERT (len < sizeof buf);
 
-        for (i = 0; i <= len; i++)
+        for (size_t i = 0; i <= len; i++)
           {
             memset (buf, '^', sizeof buf - 1);
             errno = 0;
index fac294575dd4598dc495fd1bf5e341dd28184ee4..9d6eb30c7c36d3218bb218b5b030fc05c54cf524 100644 (file)
@@ -52,10 +52,6 @@ main ()
       iconveh_replacement_character,
       iconveh_escape_sequence
     };
-  size_t indirect;
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, UTF-8, and with libiconv or glibc also GB18030.  */
@@ -147,14 +143,14 @@ main ()
   /* ------------------------ Test mem_cd_iconveh() ------------------------ */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
           static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -171,7 +167,7 @@ main ()
               ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 37; i++)
+                  for (size_t i = 0; i < 37; i++)
                     ASSERT (offsets[i] == i);
                   ASSERT (offsets[37] == MAGIC);
                   free (offsets);
@@ -182,13 +178,13 @@ main ()
     }
 
   /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ).  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -218,7 +214,7 @@ main ()
                     ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                     if (o)
                       {
-                        for (i = 0; i < 16; i++)
+                        for (size_t i = 0; i < 16; i++)
                           ASSERT (offsets[i] == i);
                         ASSERT (offsets[16] == MAGIC);
                         free (offsets);
@@ -232,13 +228,13 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -267,7 +263,7 @@ main ()
                     ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                     if (o)
                       {
-                        for (i = 0; i < 16; i++)
+                        for (size_t i = 0; i < 16; i++)
                           ASSERT (offsets[i] == i);
                         ASSERT (offsets[16] == MAGIC);
                         free (offsets);
@@ -283,7 +279,7 @@ main ()
                     ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                     if (o)
                       {
-                        for (i = 0; i < 16; i++)
+                        for (size_t i = 0; i < 16; i++)
                           ASSERT (offsets[i] == (i < 5 ? i :
                                                  i + 5));
                         ASSERT (offsets[16] == MAGIC);
@@ -298,12 +294,12 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -318,7 +314,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 1 :
                                        i < 18 ? i + 2 :
@@ -332,12 +328,12 @@ main ()
 
 # if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
   /* Test conversion from ISO-8859-1 to GB18030 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\2010\2072rger mit b\2010\2132sen B\250\271bchen ohne Augenma\2010\2118";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -352,7 +348,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 3 :
                                        i < 18 ? i + 6 :
@@ -366,12 +362,12 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -386,7 +382,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 41; i++)
+              for (size_t i = 0; i < 41; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i == 1 ? (size_t)(-1) :
                                        i < 13 ? i - 1 :
@@ -403,11 +399,11 @@ main ()
     }
 
   /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ).  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -434,7 +430,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -450,7 +446,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i : i + 2));
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -466,11 +462,11 @@ main ()
   /* Test conversion from ASCII to GB18030 with invalid input (EILSEQ).
      Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
      Andreas Schwab on 2012-02-06.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -497,7 +493,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -513,7 +509,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i : i + 3));
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -527,11 +523,11 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -558,7 +554,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i - 1));
@@ -576,7 +572,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i + 4));
@@ -591,11 +587,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -623,7 +619,7 @@ main ()
          -1 / EILSEQ when converting the 7th byte of the input "+VDLYP9hA".  */
 # if !(defined __sun && !defined _LIBICONV_VERSION)
       /* Test conversion from UTF-7 to UTF-8 with EINVAL.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40.  It would
@@ -650,7 +646,7 @@ main ()
 
 #  if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
       /* Test conversion from UTF-7 to GB18030 with EINVAL.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           /* This is base64 encoded 0x54 0x32 0xD8 0x3F 0xD8 0x40.  It would
@@ -680,7 +676,7 @@ main ()
          the input "+2D/YQNhB" to U+1FED8 U+3FD8 U+40D8.  */
 #  if !(defined __NetBSD__ && !defined _LIBICONV_VERSION)
       /* Test conversion from UTF-7 to UTF-8 with EILSEQ.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41.  It would
@@ -752,7 +748,7 @@ main ()
       /* Test conversion from UTF-7 to GB18030 with EILSEQ.
          Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
          Andreas Schwab on 2012-02-06.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           /* This is base64 encoded 0xD8 0x3F 0xD8 0x40 0xD8 0x41.  It would
@@ -825,9 +821,9 @@ main ()
   /* ------------------------ Test str_cd_iconveh() ------------------------ */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -844,9 +840,9 @@ main ()
     }
 
   /* Test conversion from ASCII to ISO-8859-1 with invalid input (EILSEQ).  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -875,9 +871,9 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (indirect = 0; indirect <= 1; indirect++)
+  for (size_t indirect = 0; indirect <= 1; indirect++)
     {
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -913,7 +909,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -928,7 +924,7 @@ main ()
 
 # if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
   /* Test conversion from ISO-8859-1 to GB18030 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -943,7 +939,7 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -957,7 +953,7 @@ main ()
     }
 
   /* Test conversion from ASCII to UTF-8 with invalid input (EILSEQ).  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -993,7 +989,7 @@ main ()
   /* Test conversion from ASCII to GB18030 with invalid input (EILSEQ).
      Note: glibc's GB18030 converter was buggy in glibc-2.15; fixed by
      Andreas Schwab on 2012-02-06.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafa? Maszkowski */
@@ -1027,7 +1023,7 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
@@ -1060,7 +1056,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
@@ -1084,12 +1080,12 @@ main ()
   /* ------------------------- Test mem_iconveh() ------------------------- */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1104,7 +1100,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -1114,11 +1110,11 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1145,7 +1141,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -1161,7 +1157,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i + 5));
                     ASSERT (offsets[16] == MAGIC);
@@ -1175,12 +1171,12 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1195,7 +1191,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 1 :
                                        i < 18 ? i + 2 :
@@ -1209,12 +1205,12 @@ main ()
 
 # if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
   /* Test conversion from ISO-8859-1 to GB18030 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\2010\2072rger mit b\2010\2132sen B\250\271bchen ohne Augenma\2010\2118";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1229,7 +1225,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 3 :
                                        i < 18 ? i + 6 :
@@ -1243,12 +1239,12 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1263,7 +1259,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 41; i++)
+              for (size_t i = 0; i < 41; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i == 1 ? (size_t)(-1) :
                                        i < 13 ? i - 1 :
@@ -1280,11 +1276,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1311,7 +1307,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i - 1));
@@ -1329,7 +1325,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i + 4));
@@ -1344,11 +1340,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -1373,7 +1369,7 @@ main ()
   /* ------------------------- Test str_iconveh() ------------------------- */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1385,7 +1381,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -1416,7 +1412,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1429,7 +1425,7 @@ main ()
 
 # if (defined _LIBICONV_VERSION && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__)) || (defined __GLIBC__ && !defined __UCLIBC__)
   /* Test conversion from ISO-8859-1 to GB18030 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -1442,7 +1438,7 @@ main ()
 # endif
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -1454,7 +1450,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
@@ -1485,7 +1481,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
index 803a312d960ce8070bcfbce1f9c92cf06b6fcec6..928750b906c045667a9ca43c2bd438ddcc654cbf 100644 (file)
@@ -48,9 +48,6 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
@@ -58,12 +55,12 @@ main ()
   /* ------------------------- Test mem_iconveha() ------------------------- */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -78,7 +75,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -88,11 +85,11 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -118,7 +115,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -134,7 +131,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i + 5));
                     ASSERT (offsets[16] == MAGIC);
@@ -148,12 +145,12 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const char expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -168,7 +165,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 1 :
                                        i < 18 ? i + 2 :
@@ -181,12 +178,12 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -201,7 +198,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 41; i++)
+              for (size_t i = 0; i < 41; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i == 1 ? (size_t)(-1) :
                                        i < 13 ? i - 1 :
@@ -218,11 +215,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -248,7 +245,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i - 1));
@@ -266,7 +263,7 @@ main ()
                 ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i + 4));
@@ -281,11 +278,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -313,12 +310,12 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-8.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
           static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -333,7 +330,7 @@ main ()
               ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -341,12 +338,12 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
           static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -361,7 +358,7 @@ main ()
               ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -369,12 +366,12 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
           static const char expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               char *result = NULL;
@@ -389,7 +386,7 @@ main ()
               ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 16; i++)
+                  for (size_t i = 0; i < 16; i++)
                     ASSERT (offsets[i] == (i == 0 ? 0 :
                                            i == 5 ? 3 :
                                            i == 7 ? 6 :
@@ -408,12 +405,12 @@ main ()
 
 # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) && !defined __UCLIBC__) || (_LIBICONV_VERSION >= 0x0105 && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__))
   /* Test conversion from UTF-8 to ISO-8859-1 with transliteration.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
       static const char expected[] = "Costs: 27 EUR";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           char *result = NULL;
@@ -428,7 +425,7 @@ main ()
           ASSERT (result != NULL && memcmp (result, expected, strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 13; i++)
+              for (size_t i = 0; i < 13; i++)
                 ASSERT (offsets[i] == (i < 11 ? i : (size_t)(-1)));
               ASSERT (offsets[13] == MAGIC);
               free (offsets);
@@ -441,7 +438,7 @@ main ()
   /* ------------------------- Test str_iconveha() ------------------------- */
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -453,7 +450,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -483,7 +480,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -495,7 +492,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -507,7 +504,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
@@ -537,7 +534,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\342";
@@ -553,7 +550,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-8.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -563,7 +560,7 @@ main ()
           ASSERT (strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -573,7 +570,7 @@ main ()
           ASSERT (strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
@@ -588,7 +585,7 @@ main ()
 
 # if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) && !defined __UCLIBC__) || (_LIBICONV_VERSION >= 0x0105 && !(_LIBICONV_VERSION == 0x10b && defined __APPLE__))
   /* Test conversion from UTF-8 to ISO-8859-1 with transliteration.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Costs: 27 \342\202\254"; /* EURO SIGN */
index 04cb7f43a6f7a66b9035648913acef6262436e55..d2fcaccd8a039562e22eac879756e3ef0c06f94a 100644 (file)
@@ -30,7 +30,6 @@ SIGNATURE_CHECK (strnlen, size_t, (char const *, size_t));
 int
 main (void)
 {
-  size_t i;
   char *page_boundary = (char *) zerosize_ptr ();
   if (!page_boundary)
     {
@@ -46,7 +45,7 @@ main (void)
   ASSERT (strnlen ("", 0x100000) == 0);
 
   /* Memory fence and alignment testing.  */
-  for (i = 0; i < 512; i++)
+  for (size_t i = 0; i < 512; i++)
     {
       char *start = page_boundary - i;
       size_t j = i;
index db29076c1dc32ea1dc95ad6028e034160454f49c..7617a53e8dde04890d69d2d050011ce196b5d4e1 100644 (file)
@@ -261,9 +261,8 @@ main (int argc, char *argv[])
       "with_multilib_list\n";
     size_t h_len = strlen (h);
     char *haystack = malloc (h_len + 1);
-    size_t i;
     ASSERT (haystack);
-    for (i = 0; i < h_len - strlen (needle); i++)
+    for (size_t i = 0; i < h_len - strlen (needle); i++)
       {
         const char *p;
         memcpy (haystack, h, h_len + 1);
index b159cbffa0dbf53e61b995c9f55e50dfadd83a68..76ce9fb4ae58e399172c6f1671fdd0ca7c7235ff 100644 (file)
@@ -177,8 +177,6 @@ check_all (enum system_command_interpreter interpreter,
   /* Check the system_quote_length, system_quote_copy, system_quote
      functions.  */
   {
-    int c;
-
     /* Empty argument.  */
     check_one (interpreter, prog, "");
 
@@ -294,7 +292,7 @@ check_all (enum system_command_interpreter interpreter,
     check_one (interpreter, prog, "%PATH%");
 
     /* All other characters don't need quoting.  */
-    for (c = 1; c <= UCHAR_MAX; c++)
+    for (int c = 1; c <= UCHAR_MAX; c++)
       if (strchr ("\t\n\r !\"#$&'()*;<=>?^[\\]`{|}~", c) == NULL)
         {
           char s[5];
@@ -324,12 +322,9 @@ main (int argc, char *argv[])
 #ifdef WINDOWS_NATIVE
   /* Make PROG suitable for native Windows system calls and cmd.exe:
      Replace '/' with '\\'.  */
-  {
-    char *p;
-    for (p = prog; *p != '\0'; p++)
-      if (*p == '/')
-        *p = '\\';
-  }
+  for (char *p = prog; *p != '\0'; p++)
+    if (*p == '/')
+      *p = '\\';
 #endif
 
 #ifdef WINDOWS_NATIVE
index c813261b1458d01503c1e7fb2feee26a99ae180e..34293d9d72e6820222d6c4d5271411237e9ff489 100644 (file)
@@ -163,8 +163,7 @@ test_function (ptrdiff_t (*my_szprintf) (char *, const char *, ...))
   { /* This test would fail on AIX 7.1.  */
     ptrdiff_t retval =
       my_szprintf (result, "%.4000d %d", 1234567, 99);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
index 4880f6e24d4633a7dc62d122a088642f842fcf29..ece4cd6b21430a9931e271d3d3a8aa9c9d1ad83a 100644 (file)
@@ -93,14 +93,13 @@ static int
 worker_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
-  int i, j, repeat;
   unsigned int *values[KEYS_COUNT] = { &value0, &value1, &value2, &value3 };
 
   dbgprintf ("Worker %p started\n", thrd_current_pointer ());
 
   /* Initialize the per-thread storage.  */
   dbgprintf ("Worker %p before first assignment\n", thrd_current_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       *values[i] = (((unsigned long) random () >> 3) % 1000000) * THREAD_COUNT + id;
       /* Hopefully no arithmetic overflow.  */
@@ -111,11 +110,11 @@ worker_thread (void *arg)
   perhaps_yield ();
 
   /* Shuffle around the pointers.  */
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       dbgprintf ("Worker %p doing value swapping\n", thrd_current_pointer ());
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
-      j = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int j = ((unsigned long) random () >> 3) % KEYS_COUNT;
       if (i != j)
         {
           unsigned int vi = *values[i];
@@ -129,7 +128,7 @@ worker_thread (void *arg)
 
   /* Verify that all the values are from this thread.  */
   dbgprintf ("Worker %p before final verify\n", thrd_current_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if ((*values[i] % THREAD_COUNT) != id)
       abort ();
   dbgprintf ("Worker %p after  final verify\n", thrd_current_pointer ());
@@ -142,19 +141,17 @@ worker_thread (void *arg)
 static void
 test_thread_local (void)
 {
-  int pass, i;
-
-  for (pass = 0; pass < 2; pass++)
+  for (int pass = 0; pass < 2; pass++)
     {
       thrd_t threads[THREAD_COUNT];
 
       /* Spawn the threads.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (thrd_create (&threads[i], worker_thread, (void *) (uintptr_t) i)
                 == thrd_success);
 
       /* Wait for the threads to terminate.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (thrd_join (threads[i], NULL) == thrd_success);
     }
 }
index e79ef718a681e6b929bf585a0d68afe5f9dba69a..bb57570e0dda0998290a04fc6081f47887be5230 100644 (file)
@@ -71,11 +71,10 @@ main (int argc, char *argv[])
     {
       size_t size = atoi (argv[1]);
       double *base;
-      size_t i;
 
       base = malloc (size * sizeof (double));
 
-      for (i = 0; i < size; i++)
+      for (size_t i = 0; i < size; i++)
         base[i] = i * i;
 
       qsort (base, size, sizeof (double), doublecmp);
index 05ddcbd607803459fc79094bc016515af859b3ac..4ca6ce83ebec38adeddcb487b64ae901c0cb54b2 100644 (file)
@@ -90,7 +90,6 @@ extremal (struct timespec a)
 int
 main (void)
 {
-  int i, j, k;
   struct timespec test[nprototypes + 1];
   int ntests;
   int computed_hz = 1;
@@ -98,7 +97,7 @@ main (void)
 
   test[0] = make_timespec (TYPE_MINIMUM (time_t), -1);
   ntests = 1;
-  for (i = 0; i < nprototypes; i++)
+  for (int i = 0; i < nprototypes; i++)
     {
       int s = prototype[i].s;
       if (TYPE_SIGNED (time_t) || 0 <= s)
@@ -110,11 +109,11 @@ main (void)
         }
     }
 
-  for (i = 0; i < LOG10_TIMESPEC_HZ; i++)
+  for (int i = 0; i < LOG10_TIMESPEC_HZ; i++)
     computed_hz *= 10;
   ASSERT (computed_hz == TIMESPEC_HZ);
 
-  for (i = 0; i < ntests; i++)
+  for (int i = 0; i < ntests; i++)
     {
       struct timespec a = test[i];
 
@@ -126,7 +125,7 @@ main (void)
       ASSERT (sign (timespec_sign (a)) == cmp (a, make_timespec (0, 0)));
 
       if (valid (a))
-        for (j = 0; j < ntests; j++)
+        for (int j = 0; j < ntests; j++)
           {
             struct timespec b = test[j];
             if (valid (b))
@@ -141,7 +140,7 @@ main (void)
                     ASSERT (eq (a, timespec_sub (sum, b)));
                     ASSERT (eq (b, timespec_sub (sum, a)));
 
-                    for (k = 0; k < ntests; k++)
+                    for (int k = 0; k < ntests; k++)
                       {
                         struct timespec c = test[k];
                         if (valid (c))
index c10166dcfda6f861320b41ec9b7178adbf8019f6..968e7321f5ef2220353d95972286d97cf71e110f 100644 (file)
@@ -89,13 +89,12 @@ static void *
 worker_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
-  int i, j, repeat;
   unsigned int values[KEYS_COUNT];
 
   dbgprintf ("Worker %p started\n", gl_thread_self_pointer ());
 
   /* Initialize the per-thread storage.  */
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       values[i] = (((unsigned long) random () >> 3) % 1000000) * THREAD_COUNT + id;
       /* Hopefully no arithmetic overflow.  */
@@ -106,7 +105,7 @@ worker_thread (void *arg)
 
   /* Verify that the initial value is NULL.  */
   dbgprintf ("Worker %p before initial verify\n", gl_thread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if (gl_tls_get (mykeys[i]) != NULL)
       abort ();
   dbgprintf ("Worker %p after  initial verify\n", gl_thread_self_pointer ());
@@ -114,7 +113,7 @@ worker_thread (void *arg)
 
   /* Initialize the per-thread storage.  */
   dbgprintf ("Worker %p before first tls_set\n", gl_thread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       unsigned int *ptr = (unsigned int *) malloc (sizeof (unsigned int));
       *ptr = values[i];
@@ -124,11 +123,11 @@ worker_thread (void *arg)
   perhaps_yield ();
 
   /* Shuffle around the pointers.  */
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       dbgprintf ("Worker %p doing value swapping\n", gl_thread_self_pointer ());
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
-      j = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int j = ((unsigned long) random () >> 3) % KEYS_COUNT;
       if (i != j)
         {
           void *vi = gl_tls_get (mykeys[i]);
@@ -142,7 +141,7 @@ worker_thread (void *arg)
 
   /* Verify that all the values are from this thread.  */
   dbgprintf ("Worker %p before final verify\n", gl_thread_self_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if ((*(unsigned int *) gl_tls_get (mykeys[i]) % THREAD_COUNT) != id)
       abort ();
   dbgprintf ("Worker %p after  final verify\n", gl_thread_self_pointer ());
@@ -155,28 +154,26 @@ worker_thread (void *arg)
 static void
 test_tls (void)
 {
-  int pass, i;
-
-  for (pass = 0; pass < 2; pass++)
+  for (int pass = 0; pass < 2; pass++)
     {
       gl_thread_t threads[THREAD_COUNT];
 
       if (pass == 0)
-        for (i = 0; i < KEYS_COUNT; i++)
+        for (int i = 0; i < KEYS_COUNT; i++)
           gl_tls_key_init (mykeys[i], free);
       else
-        for (i = KEYS_COUNT - 1; i >= 0; i--)
+        for (int i = KEYS_COUNT - 1; i >= 0; i--)
           gl_tls_key_init (mykeys[i], free);
 
       /* Spawn the threads.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         threads[i] = gl_thread_create (worker_thread, (void *) (uintptr_t) i);
 
       /* Wait for the threads to terminate.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         gl_thread_join (threads[i], NULL);
 
-      for (i = 0; i < KEYS_COUNT; i++)
+      for (int i = 0; i < KEYS_COUNT; i++)
         gl_tls_key_destroy (mykeys[i]);
     }
 }
@@ -308,12 +305,11 @@ dtorcheck1_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   gl_tls_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     gl_tls_key_init (keys[i], destructor_table[i]);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     gl_tls_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1));
 
   return NULL;
@@ -323,23 +319,21 @@ static void
 test_tls_dtorcheck1 (void)
 {
   gl_thread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     threads[id] = gl_thread_create (dtorcheck1_thread, (void *) (uintptr_t) id);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     gl_thread_join (threads[id], NULL);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       gl_tls_key_destroy (dtorcheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
@@ -357,12 +351,11 @@ dtorcheck2_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   gl_tls_key_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     gl_tls_key_init (keys[i], destructor_table[id]);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     gl_tls_set (keys[i], (void *) (uintptr_t) (10 * i + id + 1));
 
   return NULL;
@@ -372,23 +365,21 @@ static void
 test_tls_dtorcheck2 (void)
 {
   gl_thread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     threads[id] = gl_thread_create (dtorcheck2_thread, (void *) (uintptr_t) id);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     gl_thread_join (threads[id], NULL);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       gl_tls_key_destroy (dtorcheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
@@ -423,20 +414,18 @@ racecheck_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   gl_tls_key_t *keys = racecheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int repeat;
-  int i;
 
   dbgprintf ("Worker %p started\n", gl_thread_self_pointer ());
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       gl_tls_key_init (keys[i], destructor_table[i]);
       gl_tls_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1));
     }
 
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
       dbgprintf ("Worker %p reallocating key %d\n", gl_thread_self_pointer (), i);
       gl_tls_key_destroy (keys[i]);
       gl_tls_key_init (keys[i], destructor_table[i]);
@@ -451,23 +440,21 @@ static void
 test_tls_racecheck (void)
 {
   gl_thread_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     threads[id] = gl_thread_create (racecheck_thread, (void *) (uintptr_t) id);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     gl_thread_join (threads[id], NULL);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       gl_tls_key_destroy (racecheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
index 501d62bcef2ff7e114a54dd68e251e6cfd60cefa..e71d2f6585ba7363b0aa98db335fe523f244c78b 100644 (file)
@@ -45,52 +45,48 @@ test_single_locale_common (locale_t locale)
          the uppercase characters include only the ASCII A ... Z characters,
          and the corresponding characters a ... z are lowercase.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          tc = tolower_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case 'A': case 'B': case 'C': case 'D': case 'E':
-            case 'F': case 'G': case 'H': case 'I': case 'J':
-            case 'K': case 'L': case 'M': case 'N': case 'O':
-            case 'P': case 'Q': case 'R': case 'S': case 'T':
-            case 'U': case 'V': case 'W': case 'X': case 'Y':
-            case 'Z':
-              ASSERT (tc == (unsigned char) c - 'A' + 'a');
-              break;
-            default:
-              ASSERT (tc == c);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        tc = tolower_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case 'A': case 'B': case 'C': case 'D': case 'E':
+          case 'F': case 'G': case 'H': case 'I': case 'J':
+          case 'K': case 'L': case 'M': case 'N': case 'O':
+          case 'P': case 'Q': case 'R': case 'S': case 'T':
+          case 'U': case 'V': case 'W': case 'X': case 'Y':
+          case 'Z':
+            ASSERT (tc == (unsigned char) c - 'A' + 'a');
+            break;
+          default:
+            ASSERT (tc == c);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 69f769f646c38b2c77445d68629f9aeae3d1532c..16165d594df62b8df043265e791dc4a5cc1f200b 100644 (file)
@@ -45,52 +45,48 @@ test_single_locale_common (locale_t locale)
          the lowercase characters include only the ASCII a ... z characters,
          and the corresponding characters A ... Z are uppercase.
    */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          tc = toupper_l ((unsigned char) c, locale);
-          switch (c)
-            {
-            case 'a': case 'b': case 'c': case 'd': case 'e':
-            case 'f': case 'g': case 'h': case 'i': case 'j':
-            case 'k': case 'l': case 'm': case 'n': case 'o':
-            case 'p': case 'q': case 'r': case 's': case 't':
-            case 'u': case 'v': case 'w': case 'x': case 'y':
-            case 'z':
-              ASSERT (tc == (unsigned char) c - 'a' + 'A');
-              break;
-            default:
-              ASSERT (tc == c);
-              break;
-            }
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        tc = toupper_l ((unsigned char) c, locale);
+        switch (c)
+          {
+          case 'a': case 'b': case 'c': case 'd': case 'e':
+          case 'f': case 'g': case 'h': case 'i': case 'j':
+          case 'k': case 'l': case 'm': case 'n': case 'o':
+          case 'p': case 'q': case 'r': case 's': case 't':
+          case 'u': case 'v': case 'w': case 'x': case 'y':
+          case 'z':
+            ASSERT (tc == (unsigned char) c - 'a' + 'A');
+            break;
+          default:
+            ASSERT (tc == c);
+            break;
+          }
+        break;
+      }
 }
 
 int
index 9005e3fe87a0cad2b53ea9af4e9996129fe1754f..dc04984da13da2fe282ef73bb001aaccf06df8d5 100644 (file)
@@ -158,11 +158,9 @@ check (double x)
 int
 main ()
 {
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 32-NUM_HIGHBITS bits.  */
index 3a6bf435ef064633b5d9213576088d62241edded..baee03a5ec81eca9b078e77340eff78bdb5f6159 100644 (file)
@@ -158,11 +158,9 @@ check (float x)
 int
 main ()
 {
-  unsigned int highbits;
-  unsigned int lowbits;
   int error = 0;
-  for (highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
-    for (lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
+  for (unsigned int highbits = 0; highbits < (1 << NUM_HIGHBITS); highbits++)
+    for (unsigned int lowbits = 0; lowbits < (1 << NUM_LOWBITS); lowbits++)
       {
         /* Combine highbits and lowbits into a floating-point number,
            sign-extending the lowbits to 32-NUM_HIGHBITS bits.  */
index ea41505dd62b6bffdd998e51b10bcd6d60167911..fc1ed8ca9f2a503b03b561b657b0e79a0d674623 100644 (file)
@@ -104,9 +104,7 @@ cmp_fn (const void *a, const void *b)
 static void
 memfry (int *string)
 {
-  int i;
-
-  for (i = 0; i < SIZE; ++i)
+  for (int i = 0; i < SIZE; ++i)
     {
       int32_t j;
       int c;
@@ -144,13 +142,11 @@ walk_action (const void *nodep, const VISIT which, const int depth)
 static void
 walk_tree (void *root, int expected_count)
 {
-  int i;
-
   memset (z, 0, sizeof z);
   max_depth = 0;
 
   twalk (root, walk_action);
-  for (i = 0; i < expected_count; ++i)
+  for (int i = 0; i < expected_count; ++i)
     if (z[i] != 1)
       {
         fputs ("Node was not visited.\n", stdout);
@@ -172,16 +168,14 @@ walk_tree (void *root, int expected_count)
 static void
 mangle_tree (enum order how, enum action what, void **root, int lag)
 {
-  int i;
-
   if (how == randomorder)
     {
-      for (i = 0; i < SIZE; ++i)
+      for (int i = 0; i < SIZE; ++i)
         y[i] = i;
       memfry (y);
     }
 
-  for (i = 0; i < SIZE + lag; ++i)
+  for (int i = 0; i < SIZE + lag; ++i)
     {
       void *elem;
       int j, k;
@@ -267,7 +261,6 @@ main (int argc, char **argv)
 {
   int total_error = 0;
   void *root = NULL;
-  int i, j;
 
 #if HAVE_INITSTATE
   static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -275,13 +268,13 @@ main (int argc, char **argv)
   initstate (SEED, state, 8);
 #endif
 
-  for (i = 0; i < SIZE; ++i)
+  for (int i = 0; i < SIZE; ++i)
     x[i] = i;
 
   /* Do this loop several times to get different permutations for the
      random case.  */
   fputs ("Series I\n", stdout);
-  for (i = 0; i < PASSES; ++i)
+  for (int i = 0; i < PASSES; ++i)
     {
       fprintf (stdout, "Pass %d... ", i + 1);
       fflush (stdout);
@@ -324,7 +317,7 @@ main (int argc, char **argv)
       walk_tree (root, SIZE);
       mangle_tree (randomorder, delete, &root, 0);
 
-      for (j = 1; j < SIZE; j *= 2)
+      for (int j = 1; j < SIZE; j *= 2)
         {
           mangle_tree (randomorder, build_and_del, &root, j);
         }
@@ -334,7 +327,7 @@ main (int argc, char **argv)
     }
 
   fputs ("Series II\n", stdout);
-  for (i = 1; i < SIZE; i *= 2)
+  for (int i = 1; i < SIZE; i *= 2)
     {
       fprintf (stdout, "For size %d... ", i);
       fflush (stdout);
index c2741a0689455f8ec519da2890114a46dde57074..fe0c835235499c822151b06cf1166c0bae6bcb87 100644 (file)
@@ -89,13 +89,12 @@ static int
 worker_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
-  int i, j, repeat;
   unsigned int values[KEYS_COUNT];
 
   dbgprintf ("Worker %p started\n", thrd_current_pointer ());
 
   /* Initialize the per-thread storage.  */
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       values[i] = (((unsigned long) random () >> 3) % 1000000) * THREAD_COUNT + id;
       /* Hopefully no arithmetic overflow.  */
@@ -106,7 +105,7 @@ worker_thread (void *arg)
 
   /* Verify that the initial value is NULL.  */
   dbgprintf ("Worker %p before initial verify\n", thrd_current_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if (tss_get (mykeys[i]) != NULL)
       abort ();
   dbgprintf ("Worker %p after  initial verify\n", thrd_current_pointer ());
@@ -114,7 +113,7 @@ worker_thread (void *arg)
 
   /* Initialize the per-thread storage.  */
   dbgprintf ("Worker %p before first tss_set\n", thrd_current_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       unsigned int *ptr = (unsigned int *) malloc (sizeof (unsigned int));
       *ptr = values[i];
@@ -124,11 +123,11 @@ worker_thread (void *arg)
   perhaps_yield ();
 
   /* Shuffle around the pointers.  */
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
       dbgprintf ("Worker %p doing value swapping\n", thrd_current_pointer ());
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
-      j = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int j = ((unsigned long) random () >> 3) % KEYS_COUNT;
       if (i != j)
         {
           void *vi = tss_get (mykeys[i]);
@@ -142,7 +141,7 @@ worker_thread (void *arg)
 
   /* Verify that all the values are from this thread.  */
   dbgprintf ("Worker %p before final verify\n", thrd_current_pointer ());
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     if ((*(unsigned int *) tss_get (mykeys[i]) % THREAD_COUNT) != id)
       abort ();
   dbgprintf ("Worker %p after  final verify\n", thrd_current_pointer ());
@@ -155,29 +154,27 @@ worker_thread (void *arg)
 static void
 test_tss (void)
 {
-  int pass, i;
-
-  for (pass = 0; pass < 2; pass++)
+  for (int pass = 0; pass < 2; pass++)
     {
       thrd_t threads[THREAD_COUNT];
 
       if (pass == 0)
-        for (i = 0; i < KEYS_COUNT; i++)
+        for (int i = 0; i < KEYS_COUNT; i++)
           ASSERT (tss_create (&mykeys[i], free) == thrd_success);
       else
-        for (i = KEYS_COUNT - 1; i >= 0; i--)
+        for (int i = KEYS_COUNT - 1; i >= 0; i--)
           ASSERT (tss_create (&mykeys[i], free) == thrd_success);
 
       /* Spawn the threads.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (thrd_create (&threads[i], worker_thread, (void *) (uintptr_t) i)
                 == thrd_success);
 
       /* Wait for the threads to terminate.  */
-      for (i = 0; i < THREAD_COUNT; i++)
+      for (int i = 0; i < THREAD_COUNT; i++)
         ASSERT (thrd_join (threads[i], NULL) == thrd_success);
 
-      for (i = 0; i < KEYS_COUNT; i++)
+      for (int i = 0; i < KEYS_COUNT; i++)
         tss_delete (mykeys[i]);
     }
 }
@@ -309,12 +306,11 @@ dtorcheck1_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   tss_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (tss_create (&keys[i], destructor_table[i]) == thrd_success);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (tss_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1))
             == thrd_success);
 
@@ -325,24 +321,22 @@ static void
 test_tss_dtorcheck1 (void)
 {
   thrd_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_create (&threads[id], dtorcheck1_thread, (void *) (uintptr_t) id)
             == thrd_success);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_join (threads[id], NULL) == thrd_success);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       tss_delete (dtorcheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
@@ -360,12 +354,11 @@ dtorcheck2_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   tss_t *keys = dtorcheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int i;
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (tss_create (&keys[i], destructor_table[id]) == thrd_success);
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     ASSERT (tss_set (keys[i], (void *) (uintptr_t) (10 * i + id + 1))
             == thrd_success);
 
@@ -376,24 +369,22 @@ static void
 test_tss_dtorcheck2 (void)
 {
   thrd_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_create (&threads[id], dtorcheck2_thread, (void *) (uintptr_t) id)
             == thrd_success);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_join (threads[id], NULL) == thrd_success);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       tss_delete (dtorcheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
@@ -428,21 +419,19 @@ racecheck_thread (void *arg)
 {
   unsigned int id = (unsigned int) (uintptr_t) arg;
   tss_t *keys = racecheck_keys[id]; /* an array of KEYS_COUNT keys */
-  int repeat;
-  int i;
 
   dbgprintf ("Worker %p started\n", thrd_current_pointer ());
 
-  for (i = 0; i < KEYS_COUNT; i++)
+  for (int i = 0; i < KEYS_COUNT; i++)
     {
       ASSERT (tss_create (&keys[i], destructor_table[i]) == thrd_success);
       ASSERT (tss_set (keys[i], (void *) (uintptr_t) (10 * id + i + 1))
               == thrd_success);
     }
 
-  for (repeat = REPEAT_COUNT; repeat > 0; repeat--)
+  for (int repeat = REPEAT_COUNT; repeat > 0; repeat--)
     {
-      i = ((unsigned long) random () >> 3) % KEYS_COUNT;
+      int i = ((unsigned long) random () >> 3) % KEYS_COUNT;
       dbgprintf ("Worker %p reallocating key %d\n", thrd_current_pointer (), i);
       tss_delete (keys[i]);
       ASSERT (tss_create (&keys[i], destructor_table[i]) == thrd_success);
@@ -458,24 +447,22 @@ static void
 test_tss_racecheck (void)
 {
   thrd_t threads[THREAD_COUNT];
-  unsigned int id;
-  int i;
   uintptr_t expected_sum;
 
   sum = 0;
 
   /* Spawn the threads.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_create (&threads[id], racecheck_thread, (void *) (uintptr_t) id)
             == thrd_success);
 
   /* Wait for the threads to terminate.  */
-  for (id = 0; id < THREAD_COUNT; id++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
     ASSERT (thrd_join (threads[id], NULL) == thrd_success);
 
   /* Clean up the keys.  */
-  for (id = 0; id < THREAD_COUNT; id++)
-    for (i = 0; i < KEYS_COUNT; i++)
+  for (unsigned int id = 0; id < THREAD_COUNT; id++)
+    for (int i = 0; i < KEYS_COUNT; i++)
       tss_delete (racecheck_keys[id][i]);
 
   /* Check that the destructor was invoked for each key.  */
index 63cb530cb7899f9ed7f81e5e69c73e04e2510bab..a057ee2bf13eece6522bd46b3e4989d7d4c85edc 100644 (file)
@@ -97,43 +97,39 @@ same_diag (char const *s, char const *t)
 int
 main (void)
 {
-  unsigned int i;
   int fail = 0;
 
   /* Find a UID that has both a user name and login group name,
      but skip UID 0.  */
-  {
-    uid_t uid;
-    for (uid = 1200; 0 < uid; uid--)
-      {
-        struct group *gr;
-        struct passwd *pw = getpwuid (uid);
-        unsigned int j;
-        size_t len;
-        if (!pw || !pw->pw_name || !(gr = getgrgid (pw->pw_gid)) || !gr->gr_name)
-          continue;
-        j = ARRAY_CARDINALITY (T) - 1;
-        len = strlen (pw->pw_name);
-        if (sizeof T[j].in - 2 < len)
-          continue;
+  for (uid_t uid = 1200; 0 < uid; uid--)
+    {
+      struct group *gr;
+      struct passwd *pw = getpwuid (uid);
+      unsigned int j;
+      size_t len;
+      if (!pw || !pw->pw_name || !(gr = getgrgid (pw->pw_gid)) || !gr->gr_name)
+        continue;
+      j = ARRAY_CARDINALITY (T) - 1;
+      len = strlen (pw->pw_name);
+      if (sizeof T[j].in - 2 < len)
+        continue;
 
-        /* Store "username:" in T[j].in.  */
-        memcpy(T[j].in, pw->pw_name, len);
-        strcpy(T[j].in + len, ":");
+      /* Store "username:" in T[j].in.  */
+      memcpy(T[j].in, pw->pw_name, len);
+      strcpy(T[j].in + len, ":");
 
-        T[j].uid = uid;
-        T[j].gid = gr->gr_gid;
-        T[j].user_name = xstrdup (pw->pw_name);
-        T[j].group_name = xstrdup (gr->gr_name);
-        T[j].result = NULL;
-        break;
-      }
-  }
+      T[j].uid = uid;
+      T[j].gid = gr->gr_gid;
+      T[j].user_name = xstrdup (pw->pw_name);
+      T[j].group_name = xstrdup (gr->gr_name);
+      T[j].result = NULL;
+      break;
+    }
 
   char *user_name = NULL;
   char *group_name = NULL;
 
-  for (i = 0; i < ARRAY_CARDINALITY (T); i++)
+  for (unsigned int i = 0; i < ARRAY_CARDINALITY (T); i++)
     {
       uid_t uid = (uid_t) -1;
       gid_t gid = (gid_t) -1;
index 263d2c68546c7db6d4dcfb99c9560a602f927ef5..885f6374afd375f4fe24b6ea32e51674361f61a5 100644 (file)
@@ -104,8 +104,7 @@ main ()
                   {
                     ASSERT (strlen (s) == len);
                     ASSERT (len == n1 + n2 + 3);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -143,8 +142,7 @@ main ()
               {
                 ASSERT (strlen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -180,8 +178,7 @@ main ()
                   {
                     ASSERT (strlen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -216,8 +213,7 @@ main ()
               {
                 ASSERT (strlen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -253,8 +249,7 @@ main ()
                   {
                     ASSERT (strlen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
index fe91cb45151222728a100792672371d28ae1718b..a62a24639b712e92762b5f0758b5d150e5930acf 100644 (file)
@@ -93,11 +93,10 @@ static void
 test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
 {
   char buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       char *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -107,7 +106,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       char *result;
@@ -1065,8 +1064,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35, "123432123432123*********************.000000" },
         { 1.234321234321234e36, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -1397,8 +1395,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35L, "123432123432123*********************.000000" },
         { 1.234321234321234e36L, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -2118,8 +2115,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35, "1.234321e+35" },
         { 1.234321234321234e36, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -2486,8 +2482,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35L, "1.234321e+35" },
         { 1.234321234321234e36L, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -2936,8 +2931,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35, "1.23432e+35" },
         { 1.234321234321234e36, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -3290,8 +3284,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
         { 1.234321234321234e35L, "1.23432e+35" },
         { 1.234321234321234e36L, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         char *result =
@@ -3708,9 +3701,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000d %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (length == strlen (result));
@@ -3721,9 +3713,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.*d %d", 4000, 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (length == strlen (result));
@@ -3734,10 +3725,9 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000d %d", -1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '-');
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[1 + i] == '0');
     ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0);
     ASSERT (length == strlen (result));
@@ -3748,9 +3738,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000u %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (length == strlen (result));
@@ -3761,9 +3750,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000o %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0);
     ASSERT (length == strlen (result));
@@ -3774,9 +3762,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0);
     ASSERT (length == strlen (result));
@@ -3787,11 +3774,10 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%#.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '0');
     ASSERT (result[1] == 'x');
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0);
     ASSERT (length == strlen (result));
@@ -3802,11 +3788,10 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.4000f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 4000; i++)
+    for (size_t i = 0; i < 4000; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000, " 99") == 0);
     ASSERT (length == strlen (result));
@@ -3817,11 +3802,10 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     size_t length;
     char *result =
       my_asnprintf (NULL, &length, "%.511f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 511; i++)
+    for (size_t i = 0; i < 511; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 511, " 99") == 0);
     ASSERT (length == strlen (result));
@@ -3932,48 +3916,39 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
   /* To verify that these tests succeed, it is necessary to run them under
      a tool that checks against invalid memory accesses, such as ElectricFence
      or "valgrind --tool=memcheck".  */
-  {
-    size_t i;
-
-    for (i = 1; i <= 8; i++)
-      {
-        char *block;
-        size_t length;
-        char *result;
-
-        block = (char *) malloc (i);
-        memcpy (block, "abcdefgh", i);
-        result = my_asnprintf (NULL, &length, "%.*s", (int) i, block);
-        ASSERT (result != NULL);
-        ASSERT (memcmp (result, block, i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (length == strlen (result));
-        free (result);
-        free (block);
-      }
-  }
-  {
-    size_t i;
+  for (size_t i = 1; i <= 8; i++)
+    {
+      char *block;
+      size_t length;
+      char *result;
 
-    for (i = 1; i <= 8; i++)
-      {
-        wchar_t *block;
-        size_t j;
-        size_t length;
-        char *result;
+      block = (char *) malloc (i);
+      memcpy (block, "abcdefgh", i);
+      result = my_asnprintf (NULL, &length, "%.*s", (int) i, block);
+      ASSERT (result != NULL);
+      ASSERT (memcmp (result, block, i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (length == strlen (result));
+      free (result);
+      free (block);
+    }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      wchar_t *block;
+      size_t length;
+      char *result;
 
-        block = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          block[j] = "abcdefgh"[j];
-        result = my_asnprintf (NULL, &length, "%.*ls", (int) i, block);
-        ASSERT (result != NULL);
-        ASSERT (memcmp (result, "abcdefgh", i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (length == strlen (result));
-        free (result);
-        free (block);
-      }
-  }
+      block = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        block[j] = "abcdefgh"[j];
+      result = my_asnprintf (NULL, &length, "%.*ls", (int) i, block);
+      ASSERT (result != NULL);
+      ASSERT (memcmp (result, "abcdefgh", i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (length == strlen (result));
+      free (result);
+      free (block);
+    }
 
   /* Test that converting an invalid wchar_t[] to char[] fails with EILSEQ.  */
   {
index 1e5c2b6e7d165333fc42497d8a456bd61dc9e26b..9770d2527176f87f2cd328b792be55de0270e1ed 100644 (file)
@@ -31,9 +31,8 @@ static void
 test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
 {
   char buf[8];
-  int size;
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       char *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -43,7 +42,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       char *result;
@@ -62,7 +61,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     }
 
   /* Note: This test assumes IEEE 754 representation of 'double' floats.  */
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       char *result;
index ab59f6de3a57a329976b9c5a611c0e4dcbeed52c..09f5e79ddf2caa978bc9eb79de768deba6ba8326 100644 (file)
@@ -104,8 +104,7 @@ main ()
                   {
                     ASSERT (wcslen (s) == len);
                     ASSERT (len == n1 + n2 + 3);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -143,8 +142,7 @@ main ()
               {
                 ASSERT (wcslen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -180,8 +178,7 @@ main ()
                   {
                     ASSERT (wcslen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -216,8 +213,7 @@ main ()
               {
                 ASSERT (wcslen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -253,8 +249,7 @@ main ()
                   {
                     ASSERT (wcslen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
index aad15df7aa7288f4aa4a7f20d486037df909a8bc..61ff8c5a0c7ede81f22c2a27d2c776c8e02a3b72 100644 (file)
@@ -93,11 +93,10 @@ static void
 test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *, ...))
 {
   wchar_t buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       wchar_t *result = my_asnwprintf (NULL, &length, L"%d", 12345);
@@ -107,7 +106,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       wchar_t *result;
@@ -1065,8 +1064,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35, L"123432123432123*********************.000000" },
         { 1.234321234321234e36, L"123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -1397,8 +1395,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35L, L"123432123432123*********************.000000" },
         { 1.234321234321234e36L, L"123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -2118,8 +2115,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35, L"1.234321e+35" },
         { 1.234321234321234e36, L"1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -2486,8 +2482,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35L, L"1.234321e+35" },
         { 1.234321234321234e36L, L"1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -2936,8 +2931,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35, L"1.23432e+35" },
         { 1.234321234321234e36, L"1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -3290,8 +3284,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
         { 1.234321234321234e35L, L"1.23432e+35" },
         { 1.234321234321234e36L, L"1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         size_t length;
         wchar_t *result =
@@ -3708,9 +3701,8 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000d %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (wcscmp (result + 4000 - 7, L"1234567 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3721,9 +3713,8 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.*d %d", 4000, 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (wcscmp (result + 4000 - 7, L"1234567 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3734,10 +3725,9 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000d %d", -1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '-');
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[1 + i] == '0');
     ASSERT (wcscmp (result + 1 + 4000 - 7, L"1234567 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3748,9 +3738,8 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000u %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (wcscmp (result + 4000 - 7, L"1234567 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3761,9 +3750,8 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000o %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (wcscmp (result + 4000 - 7, L"4553207 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3774,9 +3762,8 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[i] == '0');
     ASSERT (wcscmp (result + 4000 - 6, L"12d687 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3787,11 +3774,10 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%#.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '0');
     ASSERT (result[1] == 'x');
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (wcscmp (result + 2 + 4000 - 6, L"12d687 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3802,11 +3788,10 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.4000f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 4000; i++)
+    for (size_t i = 0; i < 4000; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (wcscmp (result + 2 + 4000, L" 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3817,11 +3802,10 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result =
       my_asnwprintf (NULL, &length, L"%.511f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 511; i++)
+    for (size_t i = 0; i < 511; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (wcscmp (result + 2 + 511, L" 99") == 0);
     ASSERT (length == wcslen (result));
@@ -3833,14 +3817,16 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     size_t length;
     wchar_t *result;
     wchar_t winput[5000];
-    size_t i;
 
-    for (i = 0; i < sizeof (input) - 1; i++)
-      input[i] = 'a' + ((1000000 / (i + 1)) % 26);
-    input[i] = '\0';
+    {
+      size_t i;
+      for (i = 0; i < sizeof (input) - 1; i++)
+        input[i] = 'a' + ((1000000 / (i + 1)) % 26);
+      input[i] = '\0';
+    }
     result = my_asnwprintf (NULL, &length, L"%.4000s %d", input, 99);
     ASSERT (result != NULL);
-    for (i = 0; i < sizeof (input); i++)
+    for (size_t i = 0; i < sizeof (input); i++)
       winput[i] = (wchar_t) input[i];
     ASSERT (wmemcmp (result, winput, 4000) == 0);
     ASSERT (wcscmp (result + 4000, L" 99") == 0);
@@ -3899,9 +3885,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
        invocations of mbrtowc(), and in the "C" and "POSIX" locales, "an
        [EILSEQ] error cannot occur since all byte values are valid characters",
        says POSIX:2018.  */
-    int c;
-
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       {
         char s[2] = { c, '\0' };
         size_t length;
@@ -3957,53 +3941,43 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
   /* To verify that these tests succeed, it is necessary to run them under
      a tool that checks against invalid memory accesses, such as ElectricFence
      or "valgrind --tool=memcheck".  */
-  {
-    size_t i;
-
-    for (i = 1; i <= 8; i++)
-      {
-        char *block;
-        size_t length;
-        wchar_t *result;
-        wchar_t *wblock;
-        size_t j;
-
-        block = (char *) malloc (i);
-        memcpy (block, "abcdefgh", i);
-        result = my_asnwprintf (NULL, &length, L"%.*s", (int) i, block);
-        ASSERT (result != NULL);
-        wblock = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          wblock[j] = (wchar_t) block[j];
-        ASSERT (wmemcmp (result, wblock, i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (length == wcslen (result));
-        free (result);
-        free (block);
-      }
-  }
-  {
-    size_t i;
+  for (size_t i = 1; i <= 8; i++)
+    {
+      char *block;
+      size_t length;
+      wchar_t *result;
+      wchar_t *wblock;
 
-    for (i = 1; i <= 8; i++)
-      {
-        wchar_t *block;
-        size_t j;
-        size_t length;
-        wchar_t *result;
+      block = (char *) malloc (i);
+      memcpy (block, "abcdefgh", i);
+      result = my_asnwprintf (NULL, &length, L"%.*s", (int) i, block);
+      ASSERT (result != NULL);
+      wblock = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        wblock[j] = (wchar_t) block[j];
+      ASSERT (wmemcmp (result, wblock, i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (length == wcslen (result));
+      free (result);
+      free (block);
+    }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      wchar_t *block;
+      size_t length;
+      wchar_t *result;
 
-        block = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          block[j] = "abcdefgh"[j];
-        result = my_asnwprintf (NULL, &length, L"%.*ls", (int) i, block);
-        ASSERT (result != NULL);
-        ASSERT (wmemcmp (result, L"abcdefgh", i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (length == wcslen (result));
-        free (result);
-        free (block);
-      }
-  }
+      block = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        block[j] = "abcdefgh"[j];
+      result = my_asnwprintf (NULL, &length, L"%.*ls", (int) i, block);
+      ASSERT (result != NULL);
+      ASSERT (wmemcmp (result, L"abcdefgh", i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (length == wcslen (result));
+      free (result);
+      free (block);
+    }
 
   /* Test that converting an invalid wchar_t[] to char[] fails with EILSEQ.  */
   {
@@ -4117,9 +4091,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
   { /* The conversion of %c to wide character is done as if through btowc(),
        and in the "C" and "POSIX" locales, "btowc() shall not return WEOF if
        c has a value in the range 0 to 255 inclusive", says POSIX:2018.  */
-    int c;
-
-    for (c = 0; c < 0x100; c++)
+    for (int c = 0; c < 0x100; c++)
       {
         size_t length;
         wchar_t *result = my_asnwprintf (NULL, &length, L"%c", c);
index 70a7ce15876ca472feaca9590c91cf2776abe8ce..2ee7814002803b57c4e7b351a2d9b6391f30326d 100644 (file)
@@ -32,9 +32,8 @@ static void
 test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *, ...))
 {
   wchar_t buf[8];
-  int size;
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       wchar_t *result = my_asnwprintf (NULL, &length, L"%d", 12345);
@@ -44,7 +43,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       wchar_t *result;
@@ -63,7 +62,7 @@ test_function (wchar_t * (*my_asnwprintf) (wchar_t *, size_t *, const wchar_t *,
     }
 
   /* Note: This test assumes IEEE 754 representation of 'double' floats.  */
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       wchar_t *result;
index df88c48f5ba2e642972f401ffa846b5bde6b8c58..5d47e7b28f8c6ff73700d3e8891a9952e728a775 100644 (file)
@@ -91,11 +91,9 @@ strisnan (const char *string, size_t start_index, size_t end_index, int uppercas
 static void
 test_function (int (*my_asprintf) (char **, const char *, ...))
 {
-  int repeat;
-
   /* Test return value convention.  */
 
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       char *result;
       int retval = asprintf (&result, "%d", 12345);
@@ -1046,8 +1044,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35, "123432123432123*********************.000000" },
         { 1.234321234321234e36, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -1378,8 +1375,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35L, "123432123432123*********************.000000" },
         { 1.234321234321234e36L, "123432123432123**********************.000000" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -2099,8 +2095,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35, "1.234321e+35" },
         { 1.234321234321234e36, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -2467,8 +2462,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35L, "1.234321e+35" },
         { 1.234321234321234e36L, "1.234321e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -2921,8 +2915,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35, "1.23432e+35" },
         { 1.234321234321234e36, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -3275,8 +3268,7 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
         { 1.234321234321234e35L, "1.23432e+35" },
         { 1.234321234321234e36L, "1.23432e+36" }
       };
-    size_t k;
-    for (k = 0; k < SIZEOF (data); k++)
+    for (size_t k = 0; k < SIZEOF (data); k++)
       {
         char *result;
         int retval =
@@ -3693,9 +3685,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000d %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3706,9 +3697,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.*d %d", 4000, 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3719,10 +3709,9 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000d %d", -1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '-');
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[1 + i] == '0');
     ASSERT (strcmp (result + 1 + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3733,9 +3722,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000u %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3746,9 +3734,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000o %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "4553207 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3759,9 +3746,8 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3772,11 +3758,10 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%#.4000x %d", 1234567, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '0');
     ASSERT (result[1] == 'x');
-    for (i = 0; i < 4000 - 6; i++)
+    for (size_t i = 0; i < 4000 - 6; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000 - 6, "12d687 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3787,11 +3772,10 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.4000f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 4000; i++)
+    for (size_t i = 0; i < 4000; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 4000, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3802,11 +3786,10 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
     char *result;
     int retval =
       my_asprintf (&result, "%.511f %d", 1.0, 99);
-    size_t i;
     ASSERT (result != NULL);
     ASSERT (result[0] == '1');
     ASSERT (result[1] == '.');
-    for (i = 0; i < 511; i++)
+    for (size_t i = 0; i < 511; i++)
       ASSERT (result[2 + i] == '0');
     ASSERT (strcmp (result + 2 + 511, " 99") == 0);
     ASSERT (retval == strlen (result));
@@ -3917,48 +3900,39 @@ test_function (int (*my_asprintf) (char **, const char *, ...))
   /* To verify that these tests succeed, it is necessary to run them under
      a tool that checks against invalid memory accesses, such as ElectricFence
      or "valgrind --tool=memcheck".  */
-  {
-    size_t i;
-
-    for (i = 1; i <= 8; i++)
-      {
-        char *block;
-        char *result;
-        int retval;
-
-        block = (char *) malloc (i);
-        memcpy (block, "abcdefgh", i);
-        retval = my_asprintf (&result, "%.*s", (int) i, block);
-        ASSERT (result != NULL);
-        ASSERT (memcmp (result, block, i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (result);
-        free (block);
-      }
-  }
-  {
-    size_t i;
+  for (size_t i = 1; i <= 8; i++)
+    {
+      char *block;
+      char *result;
+      int retval;
 
-    for (i = 1; i <= 8; i++)
-      {
-        wchar_t *block;
-        size_t j;
-        char *result;
-        int retval;
+      block = (char *) malloc (i);
+      memcpy (block, "abcdefgh", i);
+      retval = my_asprintf (&result, "%.*s", (int) i, block);
+      ASSERT (result != NULL);
+      ASSERT (memcmp (result, block, i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (result);
+      free (block);
+    }
+  for (size_t i = 1; i <= 8; i++)
+    {
+      wchar_t *block;
+      char *result;
+      int retval;
 
-        block = (wchar_t *) malloc (i * sizeof (wchar_t));
-        for (j = 0; j < i; j++)
-          block[j] = "abcdefgh"[j];
-        retval = my_asprintf (&result, "%.*ls", (int) i, block);
-        ASSERT (result != NULL);
-        ASSERT (memcmp (result, "abcdefgh", i) == 0);
-        ASSERT (result[i] == '\0');
-        ASSERT (retval == strlen (result));
-        free (result);
-        free (block);
-      }
-  }
+      block = (wchar_t *) malloc (i * sizeof (wchar_t));
+      for (size_t j = 0; j < i; j++)
+        block[j] = "abcdefgh"[j];
+      retval = my_asprintf (&result, "%.*ls", (int) i, block);
+      ASSERT (result != NULL);
+      ASSERT (memcmp (result, "abcdefgh", i) == 0);
+      ASSERT (result[i] == '\0');
+      ASSERT (retval == strlen (result));
+      free (result);
+      free (block);
+    }
 
   /* Test the support of the %c format directive.  */
 
index da9fbf8fe1a46d11273602ed89c2515ba77fe8a3..371240bbb214f6da78fce7f98f0a2142e498a5fc 100644 (file)
@@ -45,9 +45,7 @@ my_asprintf (char **result, const char *format, ...)
 static void
 test_vasprintf ()
 {
-  int repeat;
-
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       char *result;
       int retval = my_asprintf (&result, "%d", 12345);
@@ -57,7 +55,7 @@ test_vasprintf ()
       free (result);
     }
 
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       char *result;
       int retval = my_asprintf (&result, "%08lx", 12345UL);
@@ -71,9 +69,7 @@ test_vasprintf ()
 static void
 test_asprintf ()
 {
-  int repeat;
-
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       char *result;
       int retval = asprintf (&result, "%d", 12345);
@@ -83,7 +79,7 @@ test_asprintf ()
       free (result);
     }
 
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       char *result;
       int retval = asprintf (&result, "%08lx", 12345UL);
index 73a0847058b0127ea75397156e4a87c58ad7a3b4..fdfdd4f3802624e84693f7280769d34339984fe7 100644 (file)
@@ -206,8 +206,7 @@ test_function (ptrdiff_t (*my_aszprintf) (char **, const char *, ...))
     ptrdiff_t retval =
       my_aszprintf (&result, "%.4000d %d", 1234567, 99);
     ASSERT (result != NULL);
-    size_t i;
-    for (i = 0; i < 4000 - 7; i++)
+    for (size_t i = 0; i < 4000 - 7; i++)
       ASSERT (result[i] == '0');
     ASSERT (strcmp (result + 4000 - 7, "1234567 99") == 0);
     ASSERT (retval == strlen (result));
index fd57e861b974b27695f759ceba3695e5fdf2a391..2ccbc1ea0a3cf7801f79c8b8efa2835cd4cfdfa7 100644 (file)
@@ -44,13 +44,12 @@ int
 main (int argc, char *argv[])
 {
   char buf[8];
-  int size;
   int retval;
 
   retval = my_snprintf (NULL, 0, "%d", 12345);
   ASSERT (retval == 5);
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       memcpy (buf, "DEADBEEF", 8);
       retval = my_snprintf (buf, size, "%d", 12345);
index 843e495252855d6fe85180bf5829f510f1c82016..6c85df9f8d342df96fa7b80f709c9203a4496ec4 100644 (file)
@@ -97,40 +97,36 @@ test_one_locale (const char *name, int codepage)
   }
 
   /* Test single bytes.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          ret = wcrtomb (buf, btowc (c), NULL);
-          ASSERT (ret == 1);
-          ASSERT (buf[0] == (char) c);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        ret = wcrtomb (buf, btowc (c), NULL);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == (char) c);
+        break;
+      }
 
   /* Test special calling convention, passing a NULL pointer.  */
   {
@@ -306,10 +302,9 @@ main (int argc, char *argv[])
 {
   int codepage = atoi (argv[argc - 1]);
   int result;
-  int i;
 
   result = 77;
-  for (i = 1; i < argc - 1; i++)
+  for (int i = 1; i < argc - 1; i++)
     {
       int ret = test_one_locale (argv[i], codepage);
 
index 2632041943e16f8a7825b57b04034b9f25f76279..c7d9fdc18bb9709e04fd0db7e42d45b3901b8400 100644 (file)
@@ -70,40 +70,36 @@ main (int argc, char *argv[])
   }
 
   /* Test single bytes.  */
-  {
-    int c;
-
-    for (c = 0; c < 0x100; c++)
-      switch (c)
-        {
-        case '\t': case '\v': case '\f':
-        case ' ': case '!': case '"': case '#': case '%':
-        case '&': case '\'': case '(': case ')': case '*':
-        case '+': case ',': case '-': case '.': case '/':
-        case '0': case '1': case '2': case '3': case '4':
-        case '5': case '6': case '7': case '8': case '9':
-        case ':': case ';': case '<': case '=': case '>':
-        case '?':
-        case 'A': case 'B': case 'C': case 'D': case 'E':
-        case 'F': case 'G': case 'H': case 'I': case 'J':
-        case 'K': case 'L': case 'M': case 'N': case 'O':
-        case 'P': case 'Q': case 'R': case 'S': case 'T':
-        case 'U': case 'V': case 'W': case 'X': case 'Y':
-        case 'Z':
-        case '[': case '\\': case ']': case '^': case '_':
-        case 'a': case 'b': case 'c': case 'd': case 'e':
-        case 'f': case 'g': case 'h': case 'i': case 'j':
-        case 'k': case 'l': case 'm': case 'n': case 'o':
-        case 'p': case 'q': case 'r': case 's': case 't':
-        case 'u': case 'v': case 'w': case 'x': case 'y':
-        case 'z': case '{': case '|': case '}': case '~':
-          /* c is in the ISO C "basic character set".  */
-          ret = wcrtomb (buf, btowc (c), NULL);
-          ASSERT (ret == 1);
-          ASSERT (buf[0] == (char) c);
-          break;
-        }
-  }
+  for (int c = 0; c < 0x100; c++)
+    switch (c)
+      {
+      case '\t': case '\v': case '\f':
+      case ' ': case '!': case '"': case '#': case '%':
+      case '&': case '\'': case '(': case ')': case '*':
+      case '+': case ',': case '-': case '.': case '/':
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+      case ':': case ';': case '<': case '=': case '>':
+      case '?':
+      case 'A': case 'B': case 'C': case 'D': case 'E':
+      case 'F': case 'G': case 'H': case 'I': case 'J':
+      case 'K': case 'L': case 'M': case 'N': case 'O':
+      case 'P': case 'Q': case 'R': case 'S': case 'T':
+      case 'U': case 'V': case 'W': case 'X': case 'Y':
+      case 'Z':
+      case '[': case '\\': case ']': case '^': case '_':
+      case 'a': case 'b': case 'c': case 'd': case 'e':
+      case 'f': case 'g': case 'h': case 'i': case 'j':
+      case 'k': case 'l': case 'm': case 'n': case 'o':
+      case 'p': case 'q': case 'r': case 's': case 't':
+      case 'u': case 'v': case 'w': case 'x': case 'y':
+      case 'z': case '{': case '|': case '}': case '~':
+        /* c is in the ISO C "basic character set".  */
+        ret = wcrtomb (buf, btowc (c), NULL);
+        ASSERT (ret == 1);
+        ASSERT (buf[0] == (char) c);
+        break;
+      }
 
   /* Test special calling convention, passing a NULL pointer.  */
   {
index 39e4158bc5c891ab74c67971a1ec3e3eb6ae61a4..da4dc7b580b47fef244d4b962876f4589c3a5166 100644 (file)
@@ -40,17 +40,13 @@ main (int argc, char *argv[])
   if (argc > 1)
     {
       wchar_t input[10];
-      size_t n;
       const wchar_t *src;
       #define BUFSIZE 20
       char buf[BUFSIZE];
       size_t ret;
 
-      {
-        size_t i;
-        for (i = 0; i < BUFSIZE; i++)
-          buf[i] = '_';
-      }
+      for (size_t i = 0; i < BUFSIZE; i++)
+        buf[i] = '_';
 
       switch (argv[1][0])
         {
@@ -62,7 +58,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsnrtombs (NULL, &src, 6, n, NULL);
@@ -91,7 +87,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsnrtombs (NULL, &src, 6, n, NULL);
@@ -126,7 +122,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsnrtombs (NULL, &src, 6, n, NULL);
@@ -164,7 +160,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsnrtombs (NULL, &src, 6, n, NULL);
index 58d4657d17e0c4eb05c49623ef5983f4d2105088..0237c766f3f2f44a79ecdf84871e96bafe599c3b 100644 (file)
@@ -40,17 +40,13 @@ main (int argc, char *argv[])
   if (argc > 1)
     {
       wchar_t input[10];
-      size_t n;
       const wchar_t *src;
       #define BUFSIZE 20
       char buf[BUFSIZE];
       size_t ret;
 
-      {
-        size_t i;
-        for (i = 0; i < BUFSIZE; i++)
-          buf[i] = '_';
-      }
+      for (size_t i = 0; i < BUFSIZE; i++)
+        buf[i] = '_';
 
       switch (argv[1][0])
         {
@@ -62,7 +58,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsrtombs (NULL, &src, n, NULL);
@@ -91,7 +87,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsrtombs (NULL, &src, n, NULL);
@@ -126,7 +122,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsrtombs (NULL, &src, n, NULL);
@@ -164,7 +160,7 @@ main (int argc, char *argv[])
             ret = mbstowcs (input, original, 10);
             ASSERT (ret == 5);
 
-            for (n = 0; n < 10; n++)
+            for (size_t n = 0; n < 10; n++)
               {
                 src = input;
                 ret = wcsrtombs (NULL, &src, n, NULL);
index 82888f599356feff8c13d372e6a4f0c532de3c1d..7b4a3c5135cb075817bfb77decf7cb4d07e1722a 100644 (file)
@@ -33,12 +33,10 @@ SIGNATURE_CHECK (wcwidth, int, (wchar_t));
 int
 main ()
 {
-  wchar_t wc;
-
 #if !GNULIB_WCHAR_SINGLE_LOCALE
 # ifdef C_CTYPE_ASCII
   /* Test width of ASCII characters.  */
-  for (wc = 0x20; wc < 0x7F; wc++)
+  for (wchar_t wc = 0x20; wc < 0x7F; wc++)
     ASSERT (wcwidth (wc) == 1);
 # endif
 #endif
@@ -53,7 +51,7 @@ main ()
       && strcmp (locale_charset (), "UTF-8") == 0)
     {
       /* Test width of ASCII characters.  */
-      for (wc = 0x20; wc < 0x7F; wc++)
+      for (wchar_t wc = 0x20; wc < 0x7F; wc++)
         ASSERT (wcwidth (wc) == 1);
 
       /* Test width of some non-spacing characters.  */
index fe68dc00e61bbb40217661022084804542291d6c..5b074cd4cc5f661cc2ab2a695d6ae675bce88c24 100644 (file)
@@ -43,11 +43,9 @@ main (int argc, char **argv)
   if (argc > 1)
     {
       /* Test cases given on the command line.  */
-      int i;
-
       error_print_progname = print_no_progname;
 
-      for (i = 1; i < argc; i++)
+      for (int i = 1; i < argc; i++)
         {
           char *p;
           __strtol_t val;
index 61ab4be8e418262bfd9398af4b11253ad4d825ad..c6011dc375024e2593a7ef0323e1fdc421e53893 100644 (file)
@@ -48,10 +48,9 @@ my_xasprintf (const char *format, ...)
 static void
 test_xvasprintf (void)
 {
-  int repeat;
   char *result;
 
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       result = my_xasprintf ("%d", 12345);
       ASSERT (result != NULL);
@@ -87,10 +86,9 @@ test_xvasprintf (void)
 static void
 test_xasprintf (void)
 {
-  int repeat;
   char *result;
 
-  for (repeat = 0; repeat <= 8; repeat++)
+  for (int repeat = 0; repeat <= 8; repeat++)
     {
       result = xasprintf ("%d", 12345);
       ASSERT (result != NULL);
index aa143845304befde68081686363347e5fea72c6a..4c11ad96481455a7cce0f12bde09bbb3e800e728 100644 (file)
@@ -20,10 +20,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (MAP (c) == c);
index 7ad81db26718dd18ead1e1b19a7e9a10e68cb50c..125602f2cfe14d033185320a2b44ceaefba30473 100644 (file)
@@ -20,10 +20,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (set); i++)
+  for (size_t i = 0; i < SIZEOF (set); i++)
     {
       for (; c < set[i].start; c++)
         ASSERT (!PREDICATE (c));
index 6dffc71e8dc74f9c21c964c6fb2dd79e48653a24..7b953c9de3d7b27f2fd77ca9061e507d3242e715 100644 (file)
@@ -44,15 +44,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -62,7 +59,7 @@ main ()
           'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
           'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -75,7 +72,7 @@ main ()
           ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -85,7 +82,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -94,7 +91,7 @@ main ()
           'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
           's', 'k', 'i'
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -107,7 +104,7 @@ main ()
           ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 16; i++)
+              for (size_t i = 0; i < 16; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[16] == MAGIC);
               free (offsets);
@@ -122,7 +119,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-16.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -130,7 +127,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -143,7 +140,7 @@ main ()
               ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -151,7 +148,7 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -159,7 +156,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -172,7 +169,7 @@ main ()
               ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -180,7 +177,7 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
@@ -188,7 +185,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -201,7 +198,7 @@ main ()
               ASSERT (u16_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 16; i++)
+                  for (size_t i = 0; i < 16; i++)
                     ASSERT (offsets[i] == (i == 0 ? 0 :
                                            i == 5 ? 1 :
                                            i == 7 ? 2 :
index 2d12c1d1e89cfa23f7675cd5933a202271713ec1..ec4a0ab43855196d700ff107aebf9c150194692b 100644 (file)
@@ -43,15 +43,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-16 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -61,7 +58,7 @@ main ()
           'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
         };
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
           size_t length;
@@ -74,7 +71,7 @@ main ()
           ASSERT (memcmp (result, expected, length) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -84,7 +81,7 @@ main ()
     }
 
   /* Test conversion from UTF-16 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = /* Rafał Maszkowski */
@@ -92,7 +89,7 @@ main ()
           'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
           's', 'k', 'i'
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
           size_t length = 0xdead;
@@ -119,7 +116,7 @@ main ()
                         || memcmp (result, expected_translit, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -135,7 +132,7 @@ main ()
                 ASSERT (memcmp (result, expected, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i : i + 5));
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -148,11 +145,11 @@ main ()
     }
 
   /* Test conversion from UTF-16 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = { 0xD845 };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
           size_t length;
index 93ebead6b0c64d18b38e9f316d57584fc7ae9b13..695dc597839bbc908253db4c5ae74727596a0f47 100644 (file)
@@ -32,13 +32,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -55,7 +54,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -76,7 +75,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-16.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -89,7 +88,7 @@ main ()
           ASSERT (u16_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -102,7 +101,7 @@ main ()
           ASSERT (u16_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
index 9378c64788fd422fb115b08d51158d35ace2bd10..153a8c4bc7785ac8f7ccd98a13c0c93a2508eb6f 100644 (file)
@@ -32,13 +32,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-16 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -55,7 +54,7 @@ main ()
     }
 
   /* Test conversion from UTF-16 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = /* Rafał Maszkowski */
@@ -92,7 +91,7 @@ main ()
 
 # if 0
   /* Test conversion from UTF-16 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint16_t input[] = { 0xD845, 0 };
index 677c11fcb0971fd2a142635895c26613a48e9c24..ef857e39bd8b7be94b85a23a7b03e981f0f77d5a 100644 (file)
@@ -44,15 +44,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -62,7 +59,7 @@ main ()
           'e', 'n', ' ', 'B', 0xFC, 'b', 'c', 'h', 'e', 'n', ' ', 'o', 'h',
           'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -75,7 +72,7 @@ main ()
           ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -85,7 +82,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -94,7 +91,7 @@ main ()
           'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
           's', 'k', 'i'
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -107,7 +104,7 @@ main ()
           ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 16; i++)
+              for (size_t i = 0; i < 16; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[16] == MAGIC);
               free (offsets);
@@ -122,7 +119,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-16.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -130,7 +127,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -143,7 +140,7 @@ main ()
               ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -151,7 +148,7 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -159,7 +156,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -172,7 +169,7 @@ main ()
               ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? i / 2 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -180,7 +177,7 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
@@ -188,7 +185,7 @@ main ()
             {
               0x3053, 0x3093, 0x306B, 0x3061, 0x306F
             };
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -201,7 +198,7 @@ main ()
               ASSERT (u32_cmp (result, expected, SIZEOF (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 16; i++)
+                  for (size_t i = 0; i < 16; i++)
                     ASSERT (offsets[i] == (i == 0 ? 0 :
                                            i == 5 ? 1 :
                                            i == 7 ? 2 :
index cdb9c363786e4251e2327bc807023ea3e0640d1d..47fe4199584978c2524625655520938ee991bc7c 100644 (file)
@@ -43,15 +43,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-32 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -61,7 +58,7 @@ main ()
           'n', 'e', ' ', 'A', 'u', 'g', 'e', 'n', 'm', 'a', 0xDF
         };
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
           size_t length;
@@ -74,7 +71,7 @@ main ()
           ASSERT (memcmp (result, expected, length) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == i);
               ASSERT (offsets[37] == MAGIC);
               free (offsets);
@@ -84,7 +81,7 @@ main ()
     }
 
   /* Test conversion from UTF-32 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint32_t input[] = /* Rafał Maszkowski */
@@ -92,7 +89,7 @@ main ()
           'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w',
           's', 'k', 'i'
         };
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (SIZEOF (input)) : NULL);
           size_t length = 0xdead;
@@ -119,7 +116,7 @@ main ()
                         || memcmp (result, expected_translit, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == i);
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
@@ -135,7 +132,7 @@ main ()
                 ASSERT (memcmp (result, expected, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 16; i++)
+                    for (size_t i = 0; i < 16; i++)
                       ASSERT (offsets[i] == (i < 5 ? i : i + 5));
                     ASSERT (offsets[16] == MAGIC);
                     free (offsets);
index 9d7d7349aa62c4792a3886b300787d4943d79a72..0c057b30d7e9235589839d3f10885dca8192cf5e 100644 (file)
@@ -32,13 +32,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -55,7 +54,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-16 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -76,7 +75,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-16.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -89,7 +88,7 @@ main ()
           ASSERT (u32_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -102,7 +101,7 @@ main ()
           ASSERT (u32_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
index 8ff053e536141d547886d5cc505fdc0d2d391f3e..8af50db274dd8c768b30c0f38793edb637ffc2bc 100644 (file)
@@ -31,13 +31,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-32 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint32_t input[] = /* Ärger mit bösen Bübchen ohne Augenmaß */
@@ -54,7 +53,7 @@ main ()
     }
 
   /* Test conversion from UTF-32 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint32_t input[] = /* Rafał Maszkowski */
index f0bc956ecb696306b9e73b5f1cf46773f21a86a4..015652787786722457975b7eb726f88b3ca8e64d 100644 (file)
@@ -44,20 +44,17 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
       static const uint8_t expected[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -70,7 +67,7 @@ main ()
           ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 37; i++)
+              for (size_t i = 0; i < 37; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i < 12 ? i + 1 :
                                        i < 18 ? i + 2 :
@@ -83,12 +80,12 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
       static const uint8_t expected[] = "Rafa\305\202 Maszkowski";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
           size_t length;
@@ -101,7 +98,7 @@ main ()
           ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
           if (o)
             {
-              for (i = 0; i < 16; i++)
+              for (size_t i = 0; i < 16; i++)
                 ASSERT (offsets[i] == (i < 5 ? i :
                                        i + 1));
               ASSERT (offsets[16] == MAGIC);
@@ -117,12 +114,12 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-8.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
           static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -135,7 +132,7 @@ main ()
               ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -143,12 +140,12 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
           static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -161,7 +158,7 @@ main ()
               ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 10; i++)
+                  for (size_t i = 0; i < 10; i++)
                     ASSERT (offsets[i] == ((i % 2) == 0 ? (i / 2) * 3 : (size_t)(-1)));
                   ASSERT (offsets[10] == MAGIC);
                   free (offsets);
@@ -169,12 +166,12 @@ main ()
               free (result);
             }
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
           static const uint8_t expected[] = "\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257"; /* こんにちは */
-          for (o = 0; o < 2; o++)
+          for (size_t o = 0; o < 2; o++)
             {
               size_t *offsets = (o ? new_offsets (strlen (input)) : NULL);
               size_t length;
@@ -187,7 +184,7 @@ main ()
               ASSERT (u8_cmp (result, expected, u8_strlen (expected)) == 0);
               if (o)
                 {
-                  for (i = 0; i < 16; i++)
+                  for (size_t i = 0; i < 16; i++)
                     ASSERT (offsets[i] == (i == 0 ? 0 :
                                            i == 5 ? 3 :
                                            i == 7 ? 6 :
index 1f1b5c7bdd8b526712128fc11da36d6bab3b2353..1075c31f2d790c6b6fabbf3001800b82c4aa9747 100644 (file)
@@ -44,20 +44,17 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
-  size_t o;
-  size_t i;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
       static const char expected[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL);
           size_t length;
@@ -70,7 +67,7 @@ main ()
           ASSERT (memcmp (result, expected, length) == 0);
           if (o)
             {
-              for (i = 0; i < 41; i++)
+              for (size_t i = 0; i < 41; i++)
                 ASSERT (offsets[i] == (i < 1 ? i :
                                        i == 1 ? (size_t)(-1) :
                                        i < 13 ? i - 1 :
@@ -88,11 +85,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL);
           size_t length = 0xdead;
@@ -119,7 +116,7 @@ main ()
                         || memcmp (result, expected_translit, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i - 1));
@@ -137,7 +134,7 @@ main ()
                 ASSERT (memcmp (result, expected, length) == 0);
                 if (o)
                   {
-                    for (i = 0; i < 17; i++)
+                    for (size_t i = 0; i < 17; i++)
                       ASSERT (offsets[i] == (i < 5 ? i :
                                              i == 5 ? (size_t)(-1) :
                                              i + 4));
@@ -152,11 +149,11 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "\342";
-      for (o = 0; o < 2; o++)
+      for (size_t o = 0; o < 2; o++)
         {
           size_t *offsets = (o ? new_offsets (u8_strlen (input)) : NULL);
           size_t length;
index 0211aa343a941973334c0ec5c4132fa5f2f5ee20..c5b62ced4d3bc36eaa23dc21332d25e6a62d8505 100644 (file)
@@ -32,13 +32,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from ISO-8859-1 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
@@ -50,7 +49,7 @@ main ()
     }
 
   /* Test conversion from ISO-8859-2 to UTF-8 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const char input[] = "Rafa\263 Maszkowski"; /* Rafał Maszkowski */
@@ -67,7 +66,7 @@ main ()
   if (iconv_supports_encoding ("ISO-2022-JP-2"))
     {
       /* Test conversions from autodetect_jp to UTF-8.  */
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\244\263\244\363\244\313\244\301\244\317"; /* こんにちは in EUC-JP */
@@ -77,7 +76,7 @@ main ()
           ASSERT (u8_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\202\261\202\361\202\311\202\277\202\315"; /* こんにちは in Shift_JIS */
@@ -87,7 +86,7 @@ main ()
           ASSERT (u8_strcmp (result, expected) == 0);
           free (result);
         }
-      for (h = 0; h < SIZEOF (handlers); h++)
+      for (size_t h = 0; h < SIZEOF (handlers); h++)
         {
           enum iconv_ilseq_handler handler = handlers[h];
           static const char input[] = "\033$B$3$s$K$A$O\033(B"; /* こんにちは in ISO-2022-JP-2 */
index 48e5d07526f6f5572d473864b4e80dbc38656629..5c81699cec54ee3c170c041518f0bd65f717a3cb 100644 (file)
@@ -32,13 +32,12 @@ main ()
 #if HAVE_ICONV
   static enum iconv_ilseq_handler handlers[] =
     { iconveh_error, iconveh_question_mark, iconveh_escape_sequence };
-  size_t h;
 
   /* Assume that iconv() supports at least the encodings ASCII, ISO-8859-1,
      ISO-8859-2, and UTF-8.  */
 
   /* Test conversion from UTF-8 to ISO-8859-1 with no errors.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "\303\204rger mit b\303\266sen B\303\274bchen ohne Augenma\303\237";
@@ -50,7 +49,7 @@ main ()
     }
 
   /* Test conversion from UTF-8 to ISO-8859-1 with EILSEQ.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */
@@ -83,7 +82,7 @@ main ()
 
 # if 0
   /* Test conversion from UTF-8 to ISO-8859-1 with EINVAL.  */
-  for (h = 0; h < SIZEOF (handlers); h++)
+  for (size_t h = 0; h < SIZEOF (handlers); h++)
     {
       enum iconv_ilseq_handler handler = handlers[h];
       static const uint8_t input[] = "\342";
index 2cdb4dc293a8258ba85bf2258d02fecbac27a2f2..477c485096b9d50a205aa7d4f488b08d30c0213a 100644 (file)
@@ -37,12 +37,8 @@ main ()
   ASSERT (!uc_is_bidi_class ('7', UC_BIDI_L));
   ASSERT (!uc_is_bidi_class ('7', UC_BIDI_R));
 
-  {
-    unsigned int c;
-
-    for (c = 0; c < 0x110000; c++)
-      ASSERT (uc_is_bidi_class (c, uc_bidi_class (c)));
-  }
+  for (unsigned int c = 0; c < 0x110000; c++)
+    ASSERT (uc_is_bidi_class (c, uc_bidi_class (c)));
 
   return test_exit_status;
 }
index a026c4b66331aed6ddd58d4717c40c7cd23c05d0..052984487709baca38681d2ca2e134d752427dbb 100644 (file)
@@ -33,9 +33,8 @@ main ()
   {
     const uc_block_t *latin_block = NULL;
     const uc_block_t *hebrew_block = NULL;
-    size_t i;
 
-    for (i = 0; i < nblocks; i++)
+    for (size_t i = 0; i < nblocks; i++)
       {
         if (strcmp (blocks[i].name, "Latin") == 0)
           latin_block = &blocks[i];
index 28ca1b27ff8b46bf16c87e9a585b1b4127bdc46a..bbc0dbbd44d3bf606f3db3d68e570011a7da0ffa 100644 (file)
@@ -28,24 +28,19 @@ main ()
   ASSERT (strcmp (uc_block ('x')->name, "Basic Latin") == 0);
   ASSERT (strcmp (uc_block (0x20AC)->name, "Currency Symbols") == 0);
 
-  {
-    unsigned int c;
-
-    for (c = 0; c < 0x110000; c++)
-      {
-        const uc_block_t *block = uc_block (c);
-        ASSERT (block == NULL || uc_is_block (c, block));
-      }
-  }
+  for (unsigned int c = 0; c < 0x110000; c++)
+    {
+      const uc_block_t *block = uc_block (c);
+      ASSERT (block == NULL || uc_is_block (c, block));
+    }
 
   {
     const uc_block_t *blocks;
     size_t nblocks;
-    size_t i;
 
     uc_all_blocks (&blocks, &nblocks);
 
-    for (i = 0; i < nblocks; i++)
+    for (size_t i = 0; i < nblocks; i++)
       {
         if (strcmp (blocks[i].name, "Hebrew") == 0)
           {
@@ -54,11 +49,9 @@ main ()
           }
       }
 
-    for (i = 0; i < nblocks; i++)
+    for (size_t i = 0; i < nblocks; i++)
       {
-        unsigned int c;
-
-        for (c = blocks[i].start; c <= blocks[i].end; c++)
+        for (unsigned int c = blocks[i].start; c <= blocks[i].end; c++)
           ASSERT (uc_block (c) == &blocks[i]);
       }
   }
index d7f4924df9fad0b330fb6150061bd1251d6f04d4..a248e845fb3425716174704ca98756239b6968d0 100644 (file)
@@ -208,19 +208,17 @@ main ()
 
   {
     uc_general_category_t ct = uc_general_category_byname ("Nd");
-    unsigned int c;
 
-    for (c = 0x30; c <= 0x39; c++)
+    for (unsigned int c = 0x30; c <= 0x39; c++)
       ASSERT (uc_is_general_category (c, ct));
-    for (c = 0x40; c < 0x80; c++)
+    for (unsigned int c = 0x40; c < 0x80; c++)
       ASSERT (!uc_is_general_category (c, ct));
   }
 
   {
     uc_general_category_t ct = uc_general_category_byname ("Nl");
-    unsigned int c;
 
-    for (c = 0x2160; c < 0x2180; c++)
+    for (unsigned int c = 0x2160; c < 0x2180; c++)
       ASSERT (uc_is_general_category (c, ct));
     ASSERT (!uc_is_general_category (0x0BF1, ct));
     ASSERT (!uc_is_general_category (0x0D71, ct));
@@ -228,9 +226,8 @@ main ()
 
   {
     uc_general_category_t ct = uc_general_category_byname ("Foo");
-    unsigned int c;
 
-    for (c = 0; c < 0x110000; c++)
+    for (unsigned int c = 0; c < 0x110000; c++)
       ASSERT (!uc_is_general_category (c, ct));
   }
 
index 9cd80044f26677ed14964c8d8cd136caed333ca0..6d8ec7eb0482f79e8956ea48c14bbb7fa7339a11 100644 (file)
@@ -31,9 +31,8 @@ main ()
 #if !defined _MSC_VER
 
   uc_general_category_t ct = _UC_CATEGORY_NONE;
-  unsigned int c;
 
-  for (c = 0; c < 0x110000; c++)
+  for (unsigned int c = 0; c < 0x110000; c++)
     ASSERT (!uc_is_general_category (c, ct));
 
 #endif
index 007e0c409589cf7b932222cdad92974a86283771..1a290ad86ea8f345fcf3aef53ddd55aad2602a28 100644 (file)
 int
 main ()
 {
-  {
-    unsigned int c;
-    for (c = 0; c < 0x110000; c++)
-      ASSERT (uc_is_general_category (c, uc_general_category (c)));
-  }
+  for (unsigned int c = 0; c < 0x110000; c++)
+    ASSERT (uc_is_general_category (c, uc_general_category (c)));
 
   {
     uc_general_category_t decimal_digits = uc_general_category ('7');
-    unsigned int c;
 
-    for (c = 0x30; c <= 0x39; c++)
+    for (unsigned int c = 0x30; c <= 0x39; c++)
       ASSERT (uc_is_general_category (c, decimal_digits));
-    for (c = 0x40; c < 0x80; c++)
+    for (unsigned int c = 0x40; c < 0x80; c++)
       ASSERT (!uc_is_general_category (c, decimal_digits));
   }
 
   {
     uc_general_category_t lowercase_letters = uc_general_category ('x');
-    unsigned int c;
 
-    for (c = 0x41; c <= 0x5A; c++)
+    for (unsigned int c = 0x41; c <= 0x5A; c++)
       ASSERT (!uc_is_general_category (c, lowercase_letters));
-    for (c = 0x61; c <= 0x7A; c++)
+    for (unsigned int c = 0x61; c <= 0x7A; c++)
       ASSERT (uc_is_general_category (c, lowercase_letters));
   }
 
index 1e860f056f62ab1aca5c6f03a323af05f5b9a3d4..a59ee1f8a5671ba34fe58d6974c7ae902483f434 100644 (file)
@@ -31,10 +31,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (uc_decimal_value (c) == -1);
index a9cd6518f3e40604967dd062bb42c48742d48303..9ad688f6fb87a5d4ebb738f5e8a43c93a6c9d24f 100644 (file)
@@ -31,10 +31,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (uc_digit_value (c) == -1);
index c4d8cd71ba3bef0aeace9a0664d22ace8613fd80..69763424f06669faf323f3a74bfb0d87fdb98bbf 100644 (file)
@@ -35,10 +35,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (uc_indic_conjunct_break (c) == UC_INDIC_CONJUNCT_BREAK_NONE);
index 8ff37325c71ed819199cdf376916633557e323c1..476113cbd74fb271d0a650b3aaf950266ec9288d 100644 (file)
@@ -35,10 +35,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (uc_joining_group (c) == UC_JOINING_GROUP_NONE);
index f04695a9fd2a7ea2be95d4025bfd6ebc1ab68334..313e0fb5f1195cad1d21135a5d4450abf63ffa6c 100644 (file)
@@ -35,10 +35,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         ASSERT (uc_joining_type (c) == UC_JOINING_TYPE_U
index 824db1a2b404f442eeac77bad6c21665dca7f0a0..a4968ccf34b2de44c5a0532a3d26d45b7d016a9a 100644 (file)
@@ -33,10 +33,9 @@ main ()
 {
   unsigned int c;
   uc_fraction_t value;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (mapping); i++)
+  for (size_t i = 0; i < SIZEOF (mapping); i++)
     {
       for (; c < mapping[i].ch; c++)
         {
index fc0908c7d875aebcdabc59dbaba78e02227fb5e1..c22a4699d2d001f4e21c52ef5471831f399545a1 100644 (file)
@@ -27,9 +27,8 @@ main ()
 {
   {
     uc_property_t pr = uc_property_byname ("composite");
-    unsigned int c;
 
-    for (c = 0; c < 0x110000; c++)
+    for (unsigned int c = 0; c < 0x110000; c++)
       ASSERT (uc_is_property (c, pr) == uc_is_property_composite (c));
   }
 
index c8b52328e93e69fe72205191c4338c2e5d63958e..75847c74bdab6f07c0145fb7392026bb913bd431 100644 (file)
@@ -26,9 +26,8 @@ int
 main ()
 {
   uc_property_t pr = UC_PROPERTY_COMPOSITE;
-  unsigned int c;
 
-  for (c = 0; c < 0x110000; c++)
+  for (unsigned int c = 0; c < 0x110000; c++)
     ASSERT (uc_is_property (c, pr) == uc_is_property_composite (c));
 
   return test_exit_status;
index b4eef82e9bd0478174ef97c7f0223409bfe5ea08..abaabb3774991d7ac53229825b735a345768b7e3 100644 (file)
@@ -20,10 +20,9 @@ int
 main ()
 {
   unsigned int c;
-  size_t i;
 
   c = 0;
-  for (i = 0; i < SIZEOF (set); i++)
+  for (size_t i = 0; i < SIZEOF (set); i++)
     {
       for (; c < set[i].start; c++)
         ASSERT (!PREDICATE (c));
index 54699b31598d42963c9578e67a28f7ff3dc25a6a..542879dfeeda59d83f69093d0db612bae6fec645 100644 (file)
@@ -40,28 +40,23 @@ main ()
   ASSERT (!uc_is_script (0x05DA, uc_script_byname ("Latin")));
   ASSERT (uc_is_script (0x05DA, uc_script_byname ("Hebrew")));
 
-  {
-    unsigned int c;
-
-    for (c = 0; c < 0x110000; c++)
-      {
-        const uc_script_t *script = uc_script (c);
-        if (script != NULL)
-          ASSERT (uc_is_script (c, script));
-      }
-  }
+  for (unsigned int c = 0; c < 0x110000; c++)
+    {
+      const uc_script_t *script = uc_script (c);
+      if (script != NULL)
+        ASSERT (uc_is_script (c, script));
+    }
 
   /* Test the uc_all_scripts function.  */
   {
     const uc_script_t *scripts;
     size_t nscripts;
-    size_t i;
     bool found;
 
     uc_all_scripts (&scripts, &nscripts);
 
     found = false;
-    for (i = 0; i < nscripts; i++)
+    for (size_t i = 0; i < nscripts; i++)
       {
         ASSERT (scripts[i].name != NULL);
         if (strcmp (scripts[i].name, "Hebrew") == 0)
index f4af9984cda658a92e2471b7082b94704bfe580c..05ead7603f1ecea88f83fdab1c42dac45803b2fd 100644 (file)
@@ -35,14 +35,13 @@ test_u16_grapheme_breaks (const char *expected, ...)
   uint16_t s[16];
   va_list args;
   char breaks[16];
-  size_t i;
 
   ASSERT (n <= 16);
 
   memset (breaks, 0xcc, n);
 
   va_start (args, expected);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       int unit = va_arg (args, int);
       ASSERT (unit >= 0);
@@ -52,25 +51,23 @@ test_u16_grapheme_breaks (const char *expected, ...)
   va_end (args);
 
   u16_grapheme_breaks (s, n, breaks);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     if (breaks[i] != (expected[i] == '#'))
       {
-        size_t j;
-
         fprintf (stderr, "wrong grapheme breaks:\n");
 
         fprintf (stderr, "   input:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, " %04X", s[j]);
         putc ('\n', stderr);
 
         fprintf (stderr, "expected:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", expected[j] == '#');
         putc ('\n', stderr);
 
         fprintf (stderr, "  actual:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", breaks[j]);
         putc ('\n', stderr);
 
index eb68b7bdb2e1df3a406d80b4889980fb8edb388c..713941e5af30ae2f53fe140ff519ba8954050e60 100644 (file)
@@ -52,14 +52,12 @@ test_u16_grapheme_next (size_t len, ...)
   next = u16_grapheme_next (s, s + n);
   if (next != s + len)
     {
-      size_t i;
-
       if (next == NULL)
         fputs ("u16_grapheme_next returned NULL", stderr);
       else
         fprintf (stderr, "u16_grapheme_next skipped %tu units", next - s);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %04x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index 8c17bdacf0f4ebbdb98d47e13e89e248132b9da9..55972ba8cafba0bc4fb6da2850b22f5b1ac3f7c7 100644 (file)
@@ -54,14 +54,12 @@ test_u16_grapheme_prev (size_t len, ...)
   prev = u16_grapheme_prev (end, s);
   if (prev != end - len)
     {
-      size_t i;
-
       if (prev == NULL)
         fputs ("u16_grapheme_prev returned NULL", stderr);
       else
         fprintf (stderr, "u16_grapheme_prev skipped %tu units", end - prev);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %04x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index 9f4267eb928cb4cfa6d11c98fc3d98e18ebe4deb..aaae5c59130623984df989926f8c41b4104911b5 100644 (file)
@@ -35,14 +35,13 @@ test_u32_grapheme_breaks (const char *expected, ...)
   uint32_t s[16];
   va_list args;
   char breaks[16];
-  size_t i;
 
   ASSERT (n <= 16);
 
   memset (breaks, 0xcc, n);
 
   va_start (args, expected);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     {
       int unit = va_arg (args, int);
       ASSERT (unit >= 0);
@@ -52,25 +51,23 @@ test_u32_grapheme_breaks (const char *expected, ...)
   va_end (args);
 
   u32_grapheme_breaks (s, n, breaks);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     if (breaks[i] != (expected[i] == '#'))
       {
-        size_t j;
-
         fprintf (stderr, "wrong grapheme breaks:\n");
 
         fprintf (stderr, "   input:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, " %04X", s[j]);
         putc ('\n', stderr);
 
         fprintf (stderr, "expected:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", expected[j] == '#');
         putc ('\n', stderr);
 
         fprintf (stderr, "  actual:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", breaks[j]);
         putc ('\n', stderr);
 
index eee9bafd0dd955da64ce866bbbdb6d0dda57d797..5a5528e491f6a95edbb83fec20d57fedf0c14d39 100644 (file)
@@ -52,14 +52,12 @@ test_u32_grapheme_next (size_t len, ...)
   next = u32_grapheme_next (s, s + n);
   if (next != s + len)
     {
-      size_t i;
-
       if (next == NULL)
         fputs ("u32_grapheme_next returned NULL", stderr);
       else
         fprintf (stderr, "u32_grapheme_next skipped %tu units", next - s);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %04x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index ab50a63058be2a42a59aab2399889d71db832b7b..ae0cd4d1fc5a78160b71940d854d79eceb141d8f 100644 (file)
@@ -54,14 +54,12 @@ test_u32_grapheme_prev (size_t len, ...)
   prev = u32_grapheme_prev (end, s);
   if (prev != end - len)
     {
-      size_t i;
-
       if (prev == NULL)
         fputs ("u32_grapheme_prev returned NULL", stderr);
       else
         fprintf (stderr, "u32_grapheme_prev skipped %tu units", end - prev);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %04x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index 3549186c59c2da1d77337965cbd4911eaf037d75..d76b9072bbe8a5e75f0741249506092efecc552b 100644 (file)
@@ -33,7 +33,6 @@ test_u8_grapheme_breaks (const char *input, const char *expected)
   const uint8_t *s = (const uint8_t *) input;
   size_t n = strlen (expected);
   char *breaks;
-  size_t i;
 
   breaks = malloc (n);
   if (!breaks)
@@ -41,25 +40,23 @@ test_u8_grapheme_breaks (const char *input, const char *expected)
   memset (breaks, 0xcc, n);
 
   u8_grapheme_breaks (s, n, breaks);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     if (breaks[i] != (expected[i] == '#'))
       {
-        size_t j;
-
         fprintf (stderr, "wrong grapheme breaks:\n");
 
         fprintf (stderr, "   input:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, " %02X", s[j]);
         putc ('\n', stderr);
 
         fprintf (stderr, "expected:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "  %d", expected[j] == '#');
         putc ('\n', stderr);
 
         fprintf (stderr, "  actual:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "  %d", breaks[j]);
         putc ('\n', stderr);
 
index 8929814f2b100ed4d7d4f79b3ba209de56d19ccb..1271c0bfb7f7366f44ce034d827a57d25158320b 100644 (file)
@@ -33,14 +33,12 @@ test_u8_grapheme_next (const char *input, size_t n, size_t len)
   const uint8_t *next = u8_grapheme_next (s, s + n);
   if (next != s + len)
     {
-      size_t i;
-
       if (next == NULL)
         fputs ("u8_grapheme_next returned NULL", stderr);
       else
         fprintf (stderr, "u8_grapheme_next skipped %tu bytes", next - s);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %02x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index 9d635100f8cf9d82d999ff724ac7ac9833af4fc3..144e485675b714881b594929a5d8bd4dac211b48 100644 (file)
@@ -34,14 +34,12 @@ test_u8_grapheme_prev (const char *input, size_t n, size_t len)
   const uint8_t *prev = u8_grapheme_prev (end, s);
   if (prev != end - len)
     {
-      size_t i;
-
       if (prev == NULL)
         fputs ("u8_grapheme_prev returned NULL", stderr);
       else
         fprintf (stderr, "u8_grapheme_prev skipped %tu bytes", end - prev);
       fprintf (stderr, ", expected %zu:\n", len);
-      for (i = 0; i < n; i++)
+      for (size_t i = 0; i < n; i++)
         fprintf (stderr, " %02x", s[i]);
       putc ('\n', stderr);
       fflush (stderr);
index 23dc7c894b6b860c616905ffa561f9a2a02b941a..310ebe01df9c7d44e3b23ecbbf0863a8c555a0e1 100644 (file)
@@ -63,11 +63,10 @@ graphemebreakproperty_to_string (int gbp)
 int
 main (void)
 {
-  const struct uc_gbrk_prop_range *r;
   ucs4_t uc;
 
   uc = 0;
-  for (r = set; r < set + SIZEOF (set); r++)
+  for (const struct uc_gbrk_prop_range *r = set; r < set + SIZEOF (set); r++)
     {
       for (; uc < r->end; uc++)
         {
index 860751c4bccd4af52b7cb9335d06215b85e04081..e5fceab6b8049d3a11ae1947ede40b16c9e2cda5 100644 (file)
@@ -61,30 +61,27 @@ test_uc_grapheme_breaks (const char *expected, ucs4_t *s, size_t n,
                           const char *filename, int lineno)
 {
   char breaks[16];
-  size_t i;
 
   ASSERT (n <= 16);
 
   uc_grapheme_breaks (s, n, breaks);
-  for (i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     if (breaks[i] != (expected[i] == '#'))
       {
-        size_t j;
-
         fprintf (stderr, "wrong grapheme breaks:\n");
 
         fprintf (stderr, "   input:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, " %04X", s[j]);
         putc ('\n', stderr);
 
         fprintf (stderr, "expected:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", expected[j] == '#');
         putc ('\n', stderr);
 
         fprintf (stderr, "  actual:");
-        for (j = 0; j < n; j++)
+        for (size_t j = 0; j < n; j++)
           fprintf (stderr, "    %d", breaks[j]);
         putc ('\n', stderr);
 
index b66222e8f2b4db3e24c6287116186151b8d321e5..bb279089ceec0485ae7d765e1ccb8820f269c221 100644 (file)
@@ -52,28 +52,25 @@ main ()
     static const char s[] = "ZYX\352\353W\360\361V\362";
     enum { LENGTH = sizeof s - 1 };
     char p[LENGTH];
-    size_t i;
 
     ulc_grapheme_breaks (s, LENGTH, p);
-    for (i = 0; i < LENGTH; i++)
+    for (size_t i = 0; i < LENGTH; i++)
       if (p[i] != is_8859_6_break (s[i]))
         {
-          size_t j;
-
           fprintf (stderr, "wrong grapheme breaks:\n");
 
           fprintf (stderr, "   input:");
-          for (j = 0; j < LENGTH; j++)
+          for (size_t j = 0; j < LENGTH; j++)
             fprintf (stderr, " %02X", (unsigned char) s[j]);
           putc ('\n', stderr);
 
           fprintf (stderr, "expected:");
-          for (j = 0; j < LENGTH; j++)
+          for (size_t j = 0; j < LENGTH; j++)
             fprintf (stderr, "  %d", is_8859_6_break (s[j]));
           putc ('\n', stderr);
 
           fprintf (stderr, "  actual:");
-          for (j = 0; j < LENGTH; j++)
+          for (size_t j = 0; j < LENGTH; j++)
             fprintf (stderr, "  %d", p[j]);
           putc ('\n', stderr);
 
index c66a7331f00b10604fd2d6633515e355b7500d82..0972e5bc3f1e0d5847ec62bdef158ebdc62df810 100644 (file)
@@ -44,10 +44,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u16_possible_linebreaks (input, SIZEOF (input), "GB18030", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 5
@@ -63,10 +62,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u16_possible_linebreaks (input, SIZEOF (input), "GB2312", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 5
@@ -86,10 +84,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
     static const uint16_t input[8] =
       { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 3 || i == 6 ? UC_BREAK_MANDATORY :
                          i == 5 ? (version < 2 ? UC_BREAK_MANDATORY : UC_BREAK_CR_BEFORE_LF) :
@@ -103,10 +100,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
   {
     static const uint16_t input[4] = { 'x', 0x200B, ' ', 'y' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 4; i++)
+    for (size_t i = 0; i < 4; i++)
       {
         ASSERT (p[i] == (i == 3 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -121,10 +117,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
         'e', 'n', 'c', 'e', '.', '<', '/', 'P', '>'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 21; i++)
+    for (size_t i = 0; i < 21; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 17 || i == 19 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -141,10 +136,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
         0x0300
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 16; i++)
+    for (size_t i = 0; i < 16; i++)
       {
         ASSERT (p[i] == (i == 14 ? UC_BREAK_MANDATORY :
                          i == 6 || i == 9 || i == 11 ? UC_BREAK_POSSIBLE :
@@ -165,10 +159,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
         0x261D, 0x200D, 0xD83C, 0xDFFF, '\n',
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 39; i++)
+    for (size_t i = 0; i < 39; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 20
                          || i == 24 || i == 29
@@ -187,10 +180,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
     static const uint16_t input[8] =
       { 0xD83C, 0xDDE9, 0xD83C, 0xDDEA, 0xD83C, 0xDDEB, 0xD83C, 0xDDF7 };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 4 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -203,10 +195,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
     static const uint16_t input[10] = /* "ab-אב-αβ-ω" */
       { 'a', 'b', '-', 0x05D0, 0x05D1, '-', 0x03B1, 0x03B2, '-', 0x03C9 };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 10; i++)
+    for (size_t i = 0; i < 10; i++)
       {
         ASSERT (p[i] == (i == 3 || i == 9 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -222,10 +213,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
         'G', 0x300C, 0x30E6, 0x30CB, 0x30B3, 0x30FC, 0x30C9, 0x300D
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 17; i++)
+    for (size_t i = 0; i < 17; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5
                          || i == 6 || i == 7 || i == 8 || i == 9
@@ -240,10 +230,9 @@ test_function (void (*my_u16_possible_linebreaks) (const uint16_t *, size_t, con
   {
     static const uint16_t input[4] = { 0xD83F, 0xDFFC, 0xD83C, 0xDFFF };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u16_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 4; i++)
+    for (size_t i = 0; i < 4; i++)
       {
         ASSERT (p[i] == UC_BREAK_PROHIBITED);
       }
index e2a9b6bca13b234a5ae61b26ab64418efef596ee..bd86cd5d364fe9ab8ef8a24b71b432f3b308332e 100644 (file)
@@ -44,10 +44,9 @@ test_function (int (*my_u16_width_linebreaks) (const uint16_t *, size_t, int, in
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 25 || i == 45 ? UC_BREAK_POSSIBLE :
@@ -58,10 +57,9 @@ test_function (int (*my_u16_width_linebreaks) (const uint16_t *, size_t, int, in
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u16_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE :
index f70d07f92a383f97a78e9b27309923d7bbd8eb75..533139d919c60112dcaf474906dd4f8600bcafce 100644 (file)
@@ -44,10 +44,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u32_possible_linebreaks (input, SIZEOF (input), "GB18030", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 5
@@ -63,10 +62,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u32_possible_linebreaks (input, SIZEOF (input), "GB2312", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 5
@@ -86,10 +84,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
     static const uint32_t input[8] =
       { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 3 || i == 6 ? UC_BREAK_MANDATORY :
                          i == 5 ? (version < 2 ? UC_BREAK_MANDATORY : UC_BREAK_CR_BEFORE_LF) :
@@ -103,10 +100,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
   {
     static const uint32_t input[4] = { 'x', 0x200B, ' ', 'y' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 4; i++)
+    for (size_t i = 0; i < 4; i++)
       {
         ASSERT (p[i] == (i == 3 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -121,10 +117,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
         'e', 'n', 'c', 'e', '.', '<', '/', 'P', '>'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 21; i++)
+    for (size_t i = 0; i < 21; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 17 || i == 19 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -141,10 +136,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
         0x0300
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 16; i++)
+    for (size_t i = 0; i < 16; i++)
       {
         ASSERT (p[i] == (i == 14 ? UC_BREAK_MANDATORY :
                          i == 6 || i == 9 || i == 11 ? UC_BREAK_POSSIBLE :
@@ -165,10 +159,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
         0x261D, 0x200D, 0x1F3FF, '\n',
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 37; i++)
+    for (size_t i = 0; i < 37; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 20
                          || i == 24 || i == 29
@@ -187,10 +180,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
     static const uint32_t input[4] =
       { 0x1F1E9, 0x1F1EA, 0x1F1EB, 0x1F1F7 };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 4; i++)
+    for (size_t i = 0; i < 4; i++)
       {
         ASSERT (p[i] == (i == 2 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -203,10 +195,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
     static const uint32_t input[10] = /* "ab-אב-αβ-ω" */
       { 'a', 'b', '-', 0x05D0, 0x05D1, '-', 0x03B1, 0x03B2, '-', 0x03C9 };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 10; i++)
+    for (size_t i = 0; i < 10; i++)
       {
         ASSERT (p[i] == (i == 3 || i == 9 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -222,10 +213,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
         'G', 0x300C, 0x30E6, 0x30CB, 0x30B3, 0x30FC, 0x30C9, 0x300D
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 17; i++)
+    for (size_t i = 0; i < 17; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5
                          || i == 6 || i == 7 || i == 8 || i == 9
@@ -240,10 +230,9 @@ test_function (void (*my_u32_possible_linebreaks) (const uint32_t *, size_t, con
   {
     static const uint32_t input[2] = { 0x1FFFC, 0x1F3FF };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u32_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 2; i++)
+    for (size_t i = 0; i < 2; i++)
       {
         ASSERT (p[i] == UC_BREAK_PROHIBITED);
       }
index 68ffbb2fefa5edabe1efbc76705e4a91a1e5200a..40bed3bfb053f903d25a41012fc6c393c4492c75 100644 (file)
@@ -44,10 +44,9 @@ test_function (int (*my_u32_width_linebreaks) (const uint32_t *, size_t, int, in
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 25 || i == 45 ? UC_BREAK_POSSIBLE :
@@ -58,10 +57,9 @@ test_function (int (*my_u32_width_linebreaks) (const uint32_t *, size_t, int, in
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u32_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p);
-      for (i = 0; i < 61; i++)
+      for (size_t i = 0; i < 61; i++)
         {
           ASSERT (p[i] == (i == 60 ? UC_BREAK_MANDATORY :
                            i == 11 || i == 25 || i == 45 ? UC_BREAK_POSSIBLE :
index 88a0d30ce36d3355a535b625971d012780e1f671..2f43aca3c68809a299df2097931e79d90359f4fd 100644 (file)
@@ -38,10 +38,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u8_possible_linebreaks (input, SIZEOF (input), "GB18030", p);
-      for (i = 0; i < 91; i++)
+      for (size_t i = 0; i < 91; i++)
         {
           ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY :
                            i == 7
@@ -57,10 +56,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u8_possible_linebreaks (input, SIZEOF (input), "GB2312", p);
-      for (i = 0; i < 91; i++)
+      for (size_t i = 0; i < 91; i++)
         {
           ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY :
                            i == 7
@@ -79,10 +77,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   {
     static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING = "a\nb\rc\r\nd";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 3 || i == 6 ? UC_BREAK_MANDATORY :
                          i == 5 ? (version < 2 ? UC_BREAK_MANDATORY : UC_BREAK_CR_BEFORE_LF) :
@@ -96,10 +93,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   {
     static const uint8_t input[6] _GL_ATTRIBUTE_NONSTRING = "x\342\200\213 y";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 6; i++)
+    for (size_t i = 0; i < 6; i++)
       {
         ASSERT (p[i] == (i == 5 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -110,10 +106,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
   {
     static const uint8_t input[21] _GL_ATTRIBUTE_NONSTRING = "<P>Some sentence.</P>";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 21; i++)
+    for (size_t i = 0; i < 21; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 17 || i == 19 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -127,10 +122,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
       "a\314\200\314\201e\314\200 \314\201o \314\200 o\302\240\314\200\n"
       "\314\200";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 24; i++)
+    for (size_t i = 0; i < 24; i++)
       {
         ASSERT (p[i] == (i == 21 ? UC_BREAK_MANDATORY :
                          i == 9 || i == 13 || i == 16 ? UC_BREAK_POSSIBLE :
@@ -149,10 +143,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
       "\342\230\235\360\237\217\277\n" /* "☝🏿" */
       "\342\230\235\342\200\215\360\237\217\277\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 101; i++)
+    for (size_t i = 0; i < 101; i++)
       {
         ASSERT (p[i] == (i == 24 || i == 58
                          || i == 68 || i == 81
@@ -171,10 +164,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
     static const uint8_t input[16] _GL_ATTRIBUTE_NONSTRING =
       "\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 16; i++)
+    for (size_t i = 0; i < 16; i++)
       {
         ASSERT (p[i] == (i == 8 ? UC_BREAK_POSSIBLE : UC_BREAK_PROHIBITED));
       }
@@ -187,10 +179,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
     static const uint8_t input[15] _GL_ATTRIBUTE_NONSTRING = /* "ab-אב-αβ-ω" */
       "ab-\327\220\327\221-\316\261\316\262-\317\211";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 15; i++)
+    for (size_t i = 0; i < 15; i++)
       {
         ASSERT (p[i] == (i == 3 || i == 13 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
@@ -206,10 +197,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
       "\345\255\227\346\213\241\345\274\265G\343\200\214\343\203\246"
       "\343\203\213\343\202\263\343\203\274\343\203\211\343\200\215";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 49; i++)
+    for (size_t i = 0; i < 49; i++)
       {
         ASSERT (p[i] == (i == 3 || i == 6 || i == 9 || i == 12 || i == 15
                          || i == 18 || i == 21 || i == 24 || i == 27
@@ -225,10 +215,9 @@ test_function (void (*my_u8_possible_linebreaks) (const uint8_t *, size_t, const
     static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING =
       "\360\237\277\274\360\237\217\277";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_u8_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == UC_BREAK_PROHIBITED);
       }
index a9c9378b06d0c5e04d86b38c30f69725f78addfa..07b9433b359f1363a42443d327397f2efc8c4ba6 100644 (file)
@@ -38,10 +38,9 @@ test_function (int (*my_u8_width_linebreaks) (const uint8_t *, size_t, int, int,
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB18030", p);
-      for (i = 0; i < 91; i++)
+      for (size_t i = 0; i < 91; i++)
         {
           ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY :
                            i == 39 || i == 61 ? UC_BREAK_POSSIBLE :
@@ -52,10 +51,9 @@ test_function (int (*my_u8_width_linebreaks) (const uint8_t *, size_t, int, int,
 
     {
       char *p = (char *) malloc (SIZEOF (input));
-      size_t i;
 
       my_u8_width_linebreaks (input, SIZEOF (input), 25, 0, 0, NULL, "GB2312", p);
-      for (i = 0; i < 91; i++)
+      for (size_t i = 0; i < 91; i++)
         {
           ASSERT (p[i] == (i == 90 ? UC_BREAK_MANDATORY :
                            i == 13 || i == 39 || i == 61 ? UC_BREAK_POSSIBLE :
index a54699b6d0ed61fdc6d2b0d0695d47a5f57bb74e..b9474d3f27a1b4dc648eaef496e84a9bf1f6c5fe 100644 (file)
@@ -118,71 +118,66 @@ main (int argc, char *argv[])
       u32_possible_linebreaks (input, i - 1, "UTF-8", breaks);
 
       int matches = 1;
-      {
-        int j;
-        for (j = 0; j < i - 1; j++)
-          {
-            /* The character U+FFFC has line break property CB, which according
-               to rule (LB1) is resolved "into other line breaking classes
-               depending on criteria outside the scope of this algorithm".
-               Thus it makes no sense to check the breaks[] entry before or
-               after such a character.  */
-            if (!(input[j] == 0xFFFC
-                  || (j > 0 && input[j - 1] == 0xFFFC)
-                  /* Also consider intervening characters with property LBP_CM
-                     or LBP_ZWJ, per (LB9).  */
-                  || (j > 1 && (input[j - 1] == 0x0308 || input[j - 1] == 0x200D)
-                      && input[j - 2] == 0xFFFC)))
-              /* A regional indicator with a combining character is nonsense,
-                 because regional indicators are supposed to come in pairs.  */
-              if (!(j >= 2 && (input[0] >= 0x1F1E6 && input[0] <= 0x1F1FF)
-                    && input[1] == 0x0308))
-                /* It is nonsense to treat U+1F8FF differently than U+1F02C.
-                   Both are unassigned Extended_Pictographic characters and
-                   should therefore be treated like LBP_EB (or LBP_ID, if you
-                   want), not like LBP_AL.  See rule (LB30b).  */
-                if (!(input[j] == 0x1F8FF
-                      || (j > 0 && input[j - 1] == 0x1F8FF)
-                      /* Also consider intervening characters with property LBP_CM
-                         or LBP_ZWJ, per (LB9).  */
-                      || (j > 1 && (input[j - 1] == 0x0308 || input[j - 1] == 0x200D)
-                          && input[j - 2] == 0x1F8FF)))
-                  /* There is a disagreement regarding whether to allow a line break
-                     after a U+0020 SPACE character at the start of the text.
-                     We consider that the start of the text is equivalent to the
-                     state after a newline was seen; hence the loop starts with
-                     property LBP_BK.  By the rules (LB4,LB5,LB6) an extra line
-                     break after a mandatory line break is undesired, even with
-                     intervening spaces (because these rules come before (LB18)).
-                     Whereas the LineBreakTest.txt file allows a line break after
-                     the space.
-                     Similarly when the first two characters at the start of the
-                     text have property LBP_CM and LBP_ZWJ, respectively. (LB9).  */
-                  if (!(((j == 1 || (j > 1 && ((input[j - 2] >= 0x000A && input[j - 2] <= 0x000D) || input[j - 2] == 0x0085)))
-                         && input[j - 1] == 0x0020)
-                        || ((j == 2 || (j > 2 && ((input[j - 3] >= 0x000A && input[j - 3] <= 0x000D) || input[j - 3] == 0x0085)))
-                            && ((input[j - 2] == 0x0020 && input[j - 1] == 0x0020)
-                                || (input[j - 2] == 0x0308 && input[j - 1] == 0x200D)
-                                || (input[j - 2] == 0x200D && input[j - 1] == 0x0308)))))
-                    matches &= (!(breaks[j] == UC_BREAK_PROHIBITED
-                                  || breaks[j] == UC_BREAK_MANDATORY
-                                  || breaks[j] == UC_BREAK_CR_BEFORE_LF)
-                                || (j > 0 && breaks[j - 1] == UC_BREAK_MANDATORY))
-                               == breaks_expected[j];
-          }
-      }
+      for (int j = 0; j < i - 1; j++)
+        {
+          /* The character U+FFFC has line break property CB, which according
+             to rule (LB1) is resolved "into other line breaking classes
+             depending on criteria outside the scope of this algorithm".
+             Thus it makes no sense to check the breaks[] entry before or
+             after such a character.  */
+          if (!(input[j] == 0xFFFC
+                || (j > 0 && input[j - 1] == 0xFFFC)
+                /* Also consider intervening characters with property LBP_CM
+                   or LBP_ZWJ, per (LB9).  */
+                || (j > 1 && (input[j - 1] == 0x0308 || input[j - 1] == 0x200D)
+                    && input[j - 2] == 0xFFFC)))
+            /* A regional indicator with a combining character is nonsense,
+               because regional indicators are supposed to come in pairs.  */
+            if (!(j >= 2 && (input[0] >= 0x1F1E6 && input[0] <= 0x1F1FF)
+                  && input[1] == 0x0308))
+              /* It is nonsense to treat U+1F8FF differently than U+1F02C.
+                 Both are unassigned Extended_Pictographic characters and
+                 should therefore be treated like LBP_EB (or LBP_ID, if you
+                 want), not like LBP_AL.  See rule (LB30b).  */
+              if (!(input[j] == 0x1F8FF
+                    || (j > 0 && input[j - 1] == 0x1F8FF)
+                    /* Also consider intervening characters with property LBP_CM
+                       or LBP_ZWJ, per (LB9).  */
+                    || (j > 1 && (input[j - 1] == 0x0308 || input[j - 1] == 0x200D)
+                        && input[j - 2] == 0x1F8FF)))
+                /* There is a disagreement regarding whether to allow a line break
+                   after a U+0020 SPACE character at the start of the text.
+                   We consider that the start of the text is equivalent to the
+                   state after a newline was seen; hence the loop starts with
+                   property LBP_BK.  By the rules (LB4,LB5,LB6) an extra line
+                   break after a mandatory line break is undesired, even with
+                   intervening spaces (because these rules come before (LB18)).
+                   Whereas the LineBreakTest.txt file allows a line break after
+                   the space.
+                   Similarly when the first two characters at the start of the
+                   text have property LBP_CM and LBP_ZWJ, respectively. (LB9).  */
+                if (!(((j == 1 || (j > 1 && ((input[j - 2] >= 0x000A && input[j - 2] <= 0x000D) || input[j - 2] == 0x0085)))
+                       && input[j - 1] == 0x0020)
+                      || ((j == 2 || (j > 2 && ((input[j - 3] >= 0x000A && input[j - 3] <= 0x000D) || input[j - 3] == 0x0085)))
+                          && ((input[j - 2] == 0x0020 && input[j - 1] == 0x0020)
+                              || (input[j - 2] == 0x0308 && input[j - 1] == 0x200D)
+                              || (input[j - 2] == 0x200D && input[j - 1] == 0x0308)))))
+                  matches &= (!(breaks[j] == UC_BREAK_PROHIBITED
+                                || breaks[j] == UC_BREAK_MANDATORY
+                                || breaks[j] == UC_BREAK_CR_BEFORE_LF)
+                              || (j > 0 && breaks[j - 1] == UC_BREAK_MANDATORY))
+                             == breaks_expected[j];
+        }
       if (!matches)
         {
-          int j;
-
           fprintf (stderr, "%s:%d: expected: ", filename, lineno);
-          for (j = 0; j < i - 1; j++)
+          for (int j = 0; j < i - 1; j++)
             fprintf (stderr, "%s U+%04X ",
                      breaks_expected[j] == 1 ? "\303\267" : "\303\227",
                      input[j]);
           fprintf (stderr, "\n");
           fprintf (stderr, "%s:%d: actual:   ", filename, lineno);
-          for (j = 0; j < i - 1; j++)
+          for (int j = 0; j < i - 1; j++)
             fprintf (stderr, "%s U+%04X ",
                      (!(breaks[j] == UC_BREAK_PROHIBITED
                         || breaks[j] == UC_BREAK_MANDATORY
index 70c572cad62771bc3f32ad5fffc24820f8f28a35..e1ec5080d388906a048b468b6b46231e2b78f35e 100644 (file)
@@ -37,10 +37,9 @@ test_function (void (*my_ulc_possible_linebreaks) (const char *, size_t, const c
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_ulc_possible_linebreaks (input, SIZEOF (input), "ISO-8859-1", p);
-    for (i = 0; i < 36; i++)
+    for (size_t i = 0; i < 36; i++)
       {
         ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY :
                          i == 5 || i == 11 || i == 15
@@ -55,10 +54,9 @@ test_function (void (*my_ulc_possible_linebreaks) (const char *, size_t, const c
     static const char input[21] _GL_ATTRIBUTE_NONSTRING =
       "<P>Some sentence.</P>";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_ulc_possible_linebreaks (input, SIZEOF (input), "UTF-8", p);
-    for (i = 0; i < 21; i++)
+    for (size_t i = 0; i < 21; i++)
       {
         ASSERT (p[i] == (i == 8 || i == 17 || i == 19 ? UC_BREAK_POSSIBLE :
                          UC_BREAK_PROHIBITED));
index b9c74b23a4fd3b6635f272fae47de1b5f5b59543..ac3d2b0c68dda164cc9b2a36ea847a6972ff0a30 100644 (file)
@@ -37,10 +37,9 @@ test_function (int (*my_ulc_width_linebreaks) (const char *, size_t, int, int, i
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     my_ulc_width_linebreaks (input, SIZEOF (input), 12, 0, 0, NULL, "ISO-8859-1", p);
-    for (i = 0; i < 36; i++)
+    for (size_t i = 0; i < 36; i++)
       {
         ASSERT (p[i] == (i == 35 ? UC_BREAK_MANDATORY :
                          i == 11 || i == 15 || i == 31 ? UC_BREAK_POSSIBLE :
index 0804abf2c268f72b13403729e7163d4994f3da68..ccbc7a0c17ead58e6a32a0ebed0b30d414bd1874 100644 (file)
@@ -187,8 +187,7 @@ fill_aliases (const char *namealiases_filename)
 static int
 name_has_alias (unsigned int uc)
 {
-  int i;
-  for (i = 0; i < ALIASLEN; i++)
+  for (int i = 0; i < ALIASLEN; i++)
     if (unicode_aliases[i].uc == uc)
       return 1;
   return 0;
@@ -199,10 +198,9 @@ static int
 test_name_lookup ()
 {
   int error = 0;
-  unsigned int i;
   char buf[UNINAME_MAX];
 
-  for (i = 0; i < 0x11000; i++)
+  for (unsigned int i = 0; i < 0x11000; i++)
     {
       char *result = unicode_character_name (i, buf);
 
@@ -231,7 +229,7 @@ test_name_lookup ()
         }
     }
 
-  for (i = 0x110000; i < 0x1000000; i++)
+  for (unsigned int i = 0x110000; i < 0x1000000; i++)
     {
       char *result = unicode_character_name (i, buf);
 
@@ -251,10 +249,9 @@ static int
 test_inverse_lookup ()
 {
   int error = 0;
-  unsigned int i;
 
   /* First, verify all valid character names are recognized.  */
-  for (i = 0; i < 0x110000; i++)
+  for (unsigned int i = 0; i < 0x110000; i++)
     if (unicode_names[i] != NULL)
       {
         unsigned int result = unicode_name_character (unicode_names[i]);
@@ -273,12 +270,12 @@ test_inverse_lookup ()
 
   /* Second, generate random but likely names and verify they are not
      recognized unless really valid.  */
-  for (i = 0; i < 10000; i++)
+  for (unsigned int i = 0; i < 10000; i++)
     {
       unsigned int i1, i2;
       const char *s1;
       const char *s2;
-      unsigned int l1, l2, j1, j2;
+      unsigned int l1, l2;
       char buf[2*UNINAME_MAX];
       unsigned int result;
 
@@ -298,9 +295,9 @@ test_inverse_lookup ()
       l2 = strlen (s2);
 
       /* Concatenate a starting piece of s1 with an ending piece of s2.  */
-      for (j1 = 1; j1 <= l1; j1++)
+      for (unsigned int j1 = 1; j1 <= l1; j1++)
         if (j1 == l1 || s1[j1] == ' ')
-          for (j2 = 0; j2 < l2; j2++)
+          for (unsigned int j2 = 0; j2 < l2; j2++)
             if (j2 == 0 || s2[j2-1] == ' ')
               {
                 memcpy (buf, s1, j1);
@@ -333,11 +330,10 @@ static int
 test_alias_lookup ()
 {
   int error = 0;
-  unsigned int i;
   char buf[UNINAME_MAX];
 
   /* Verify all valid character names are recognized.  */
-  for (i = 0; i < ALIASLEN; i++)
+  for (unsigned int i = 0; i < ALIASLEN; i++)
     if (unicode_aliases[i].uc != UNINAME_INVALID
         /* Skip if the character has no canonical name (e.g. control
            characters).  */
@@ -371,8 +367,7 @@ main (int argc, char *argv[])
 
   if (i < argc)
     {
-      int j;
-      for (j = 0; j < ALIASLEN; j++)
+      for (int j = 0; j < ALIASLEN; j++)
         unicode_aliases[j].uc = UNINAME_INVALID;
 
       i++;
index de65b30811e8b32134fbb361a20e994bfa3ad11a..ce3bf53355ade5a725fc140b21308abba96bcb92 100644 (file)
@@ -256,71 +256,67 @@ test_u16_nfc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
-        if (input != NULL)
-          {
-            uint16_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint16_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
+      if (input != NULL)
+        {
+          uint16_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint16_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x00C0;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2 - 1; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, m,        expected, m - 1) == 0);
-                ASSERT (check (expected, m - 1, expected, m - 1) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x00C0;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2 - 1; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, m,        expected, m - 1) == 0);
+              ASSERT (check (expected, m - 1, expected, m - 1) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index f83fc8e2f17d4b32d9a4012fdb42c63f1c9b801f..61cb9fa03dc92b4f9e83746bc6323f6555e28274 100644 (file)
@@ -243,68 +243,64 @@ test_u16_nfd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
-        if (input != NULL)
-          {
-            uint16_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint16_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
+      if (input != NULL)
+        {
+          uint16_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint16_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x0041;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, m, expected, m) == 0);
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x0041;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, m, expected, m) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index 63215ce0773c0486511bbfbe5ad8793fe4f9d78d..6ac4d188ee48aa69adb6d5dd702639eb6cb4002c 100644 (file)
@@ -304,71 +304,67 @@ test_u16_nfkc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
-        if (input != NULL)
-          {
-            uint16_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint16_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
+      if (input != NULL)
+        {
+          uint16_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint16_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x00C0;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2 - 1; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, m,        expected, m - 1) == 0);
-                ASSERT (check (expected, m - 1, expected, m - 1) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x00C0;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2 - 1; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, m,        expected, m - 1) == 0);
+              ASSERT (check (expected, m - 1, expected, m - 1) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index d560bb1b0bdfc1430daffa34a79f3751134e8547..b0c41fddd3f72e5dec2780651537ba1afbc3de44 100644 (file)
@@ -263,68 +263,64 @@ test_u16_nfkd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
-        if (input != NULL)
-          {
-            uint16_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint16_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint16_t *input = (uint16_t *) malloc (2 * m * sizeof (uint16_t));
+      if (input != NULL)
+        {
+          uint16_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint16_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x0041;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, m, expected, m) == 0);
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x0041;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, m, expected, m) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index 119af6b2952bf91303f74a3c6b49e1ee7c20d644..4db1d4a3cb74158290cd025ae9f39a51dfd77069 100644 (file)
@@ -256,71 +256,67 @@ test_u32_nfc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
-        if (input != NULL)
-          {
-            uint32_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint32_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
+      if (input != NULL)
+        {
+          uint32_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint32_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x00C0;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2 - 1; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, m,        expected, m - 1) == 0);
-                ASSERT (check (expected, m - 1, expected, m - 1) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x00C0;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2 - 1; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, m,        expected, m - 1) == 0);
+              ASSERT (check (expected, m - 1, expected, m - 1) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index 248e0eca1d9f7198883732e0a2e2c9dfe734a553..71492f6318125624f58326d9ffea14f67f9736f1 100644 (file)
@@ -243,68 +243,64 @@ test_u32_nfd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
-        if (input != NULL)
-          {
-            uint32_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint32_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
+      if (input != NULL)
+        {
+          uint32_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint32_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x0041;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, m, expected, m) == 0);
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x0041;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, m, expected, m) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index 454b7afd64039616f73207dd891e980178190756..5f4cfa4e55febadd0ba3ac7a15c2a13e7c78deca 100644 (file)
@@ -304,71 +304,67 @@ test_u32_nfkc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
-        if (input != NULL)
-          {
-            uint32_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint32_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
+      if (input != NULL)
+        {
+          uint32_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint32_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x00C0;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2 - 1; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, m,        expected, m - 1) == 0);
-                ASSERT (check (expected, m - 1, expected, m - 1) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x00C0;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2 - 1; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, m,        expected, m - 1) == 0);
+              ASSERT (check (expected, m - 1, expected, m - 1) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index 4120d7bcccbdb5b0d74355b68710629f06e4df5a..f77a92e523b5c6ad75ea46bcd8a9ab965cdd2d45 100644 (file)
@@ -263,68 +263,64 @@ test_u32_nfkd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
-        if (input != NULL)
-          {
-            uint32_t *expected = input + m;
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint32_t *p;
-            size_t i;
-
-            input[0] = 0x0041;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint32_t *input = (uint32_t *) malloc (2 * m * sizeof (uint32_t));
+      if (input != NULL)
+        {
+          uint32_t *expected = input + m;
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint32_t *p;
+
+          input[0] = 0x0041;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                *p++ = 0x0300;
+              for (size_t i = 0; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
                   *p++ = 0x0319;
-                for (i = 0; i < m2; i++)
-                  *p++ = 0x0300;
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
                   *p++ = 0x0300;
-                for (i = 0; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0x0319;
-                    *p++ = 0x0300;
-                  }
-                for (; i < m1; i++)
-                  *p++ = 0x0319;
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x0041;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              *p++ = 0x0319;
-            for (i = 0; i < m2; i++)
-              *p++ = 0x0300;
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, m, expected, m) == 0);
-
-            free (input);
-          }
-      }
-  }
+                }
+              for (size_t i = m2; i < m1; i++)
+                *p++ = 0x0319;
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x0041;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            *p++ = 0x0319;
+          for (size_t i = 0; i < m2; i++)
+            *p++ = 0x0300;
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, m, expected, m) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index ae197991b9f209146f380a414cf20672fd6b998a..de9497561825587f97cc52c3e3bb3e7def5d4386 100644 (file)
@@ -58,7 +58,6 @@ read_normalization_test_file (const char *filename,
 {
   FILE *stream;
   unsigned int lineno;
-  int part_index;
   struct normalization_test_line *lines;
   size_t lines_length;
   size_t lines_allocated;
@@ -70,7 +69,7 @@ read_normalization_test_file (const char *filename,
       exit (1);
     }
 
-  for (part_index = 0; part_index < 6; part_index++)
+  for (int part_index = 0; part_index < 6; part_index++)
     {
       file->parts[part_index].lines = NULL;
       file->parts[part_index].lines_length = 0;
@@ -78,7 +77,7 @@ read_normalization_test_file (const char *filename,
 
   lineno = 0;
 
-  part_index = -1;
+  int part_index = -1;
   lines = NULL;
   lines_length = 0;
   lines_allocated = 0;
@@ -89,7 +88,6 @@ read_normalization_test_file (const char *filename,
       char *ptr;
       int c;
       struct normalization_test_line line;
-      size_t sequence_index;
 
       lineno++;
 
@@ -139,9 +137,9 @@ read_normalization_test_file (const char *filename,
         }
       ptr = buf;
       line.lineno = lineno;
-      for (sequence_index = 0; sequence_index < 5; sequence_index++)
+      for (size_t sequence_index = 0; sequence_index < 5; sequence_index++)
         line.sequences[sequence_index] = NULL;
-      for (sequence_index = 0; sequence_index < 5; sequence_index++)
+      for (size_t sequence_index = 0; sequence_index < 5; sequence_index++)
         {
           uint32_t *sequence = XNMALLOC (1, uint32_t);
           size_t sequence_length = 0;
@@ -210,9 +208,8 @@ read_normalization_test_file (const char *filename,
     /* Collect all c1 values from the part 1 in an array.  */
     const struct normalization_test_part *p = &file->parts[1];
     ucs4_t *c1_array = XNMALLOC (p->lines_length + 1, ucs4_t);
-    size_t line_index;
 
-    for (line_index = 0; line_index < p->lines_length; line_index++)
+    for (size_t line_index = 0; line_index < p->lines_length; line_index++)
       {
         const uint32_t *sequence = p->lines[line_index].sequences[0];
         /* In part 1, every sequences[0] consists of a single character.  */
@@ -247,14 +244,11 @@ test_specific (const struct normalization_test_file *file,
                              const uint32_t *c4, size_t c4_length,
                              const uint32_t *c5, size_t c5_length))
 {
-  size_t part_index;
-
-  for (part_index = 0; part_index < 6; part_index++)
+  for (size_t part_index = 0; part_index < 6; part_index++)
     {
       const struct normalization_test_part *p = &file->parts[part_index];
-      size_t line_index;
 
-      for (line_index = 0; line_index < p->lines_length; line_index++)
+      for (size_t line_index = 0; line_index < p->lines_length; line_index++)
         {
           const struct normalization_test_line *l = &p->lines[line_index];
 
@@ -276,9 +270,8 @@ test_other (const struct normalization_test_file *file, uninorm_t nf)
      NormalizationTest.txt file, the character maps to itself in each
      of the four normalization forms.  */
   const ucs4_t *p = file->part1_c1_sorted;
-  ucs4_t uc;
 
-  for (uc = 0; uc < 0x110000; uc++)
+  for (ucs4_t uc = 0; uc < 0x110000; uc++)
     {
       if (uc >= 0xD800 && uc < 0xE000)
         {
@@ -307,19 +300,15 @@ test_other (const struct normalization_test_file *file, uninorm_t nf)
 void
 free_normalization_test_file (struct normalization_test_file *file)
 {
-  size_t part_index;
-
-  for (part_index = 0; part_index < 6; part_index++)
+  for (size_t part_index = 0; part_index < 6; part_index++)
     {
       const struct normalization_test_part *p = &file->parts[part_index];
-      size_t line_index;
 
-      for (line_index = 0; line_index < p->lines_length; line_index++)
+      for (size_t line_index = 0; line_index < p->lines_length; line_index++)
         {
           const struct normalization_test_line *l = &p->lines[line_index];
-          size_t sequence_index;
 
-          for (sequence_index = 0; sequence_index < 5; sequence_index++)
+          for (size_t sequence_index = 0; sequence_index < 5; sequence_index++)
             free (l->sequences[sequence_index]);
         }
       free (p->lines);
index 6d98721c4292306fe12d8486cdbeff7a926b9478..d350083f0b254346da257991f8e8e1fcff5d4890 100644 (file)
@@ -262,95 +262,91 @@ test_u8_nfc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
-        if (input != NULL)
-          {
-            uint8_t *expected = input + (2 * m - 1);
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint8_t *p;
-            size_t i;
-
-            input[0] = 0x41;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0xC3;
-            expected[1] = 0x80;
-            p = expected + 2;
-            for (i = 0; i < m1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x99;
-              }
-            for (i = 0; i < m2 - 1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x80;
-              }
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, 2 * m - 1,    expected, 2 * m - 2) == 0);
-                ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
+      if (input != NULL)
+        {
+          uint8_t *expected = input + (2 * m - 1);
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint8_t *p;
+
+          input[0] = 0x41;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = m2; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0xC3;
+          expected[1] = 0x80;
+          p = expected + 2;
+          for (size_t i = 0; i < m1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x99;
+            }
+          for (size_t i = 0; i < m2 - 1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x80;
+            }
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, 2 * m - 1,    expected, 2 * m - 2) == 0);
+              ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index 78b9fa770ace4a59f43d984b6fde5422440e852b..63b0fdd90f001144ddaa441193224b8aafe1a1f3 100644 (file)
@@ -249,91 +249,87 @@ test_u8_nfd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
-        if (input != NULL)
-          {
-            uint8_t *expected = input + (2 * m - 1);
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint8_t *p;
-            size_t i;
-
-            input[0] = 0x41;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x41;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x99;
-              }
-            for (i = 0; i < m2; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x80;
-              }
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0);
-
-            free (input);
-          }
-      }
-  }
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
+      if (input != NULL)
+        {
+          uint8_t *expected = input + (2 * m - 1);
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint8_t *p;
+
+          input[0] = 0x41;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = m2; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x41;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x99;
+            }
+          for (size_t i = 0; i < m2; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x80;
+            }
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index a83799083b3c54ba9de359aad86d78e00bfe523c..2559f02c60f739f44a895d32fafffcfe35221391 100644 (file)
@@ -314,95 +314,91 @@ test_u8_nfkc (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
-        if (input != NULL)
-          {
-            uint8_t *expected = input + (2 * m - 1);
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint8_t *p;
-            size_t i;
-
-            input[0] = 0x41;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0xC3;
-            expected[1] = 0x80;
-            p = expected + 2;
-            for (i = 0; i < m1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x99;
-              }
-            for (i = 0; i < m2 - 1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x80;
-              }
-
-            for (; repeat > 0; repeat--)
-              {
-                ASSERT (check (input, 2 * m - 1,    expected, 2 * m - 2) == 0);
-                ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0);
-              }
-
-            free (input);
-          }
-      }
-  }
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
+      if (input != NULL)
+        {
+          uint8_t *expected = input + (2 * m - 1);
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint8_t *p;
+
+          input[0] = 0x41;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = m2; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0xC3;
+          expected[1] = 0x80;
+          p = expected + 2;
+          for (size_t i = 0; i < m1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x99;
+            }
+          for (size_t i = 0; i < m2 - 1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x80;
+            }
+
+          for (; repeat > 0; repeat--)
+            {
+              ASSERT (check (input, 2 * m - 1,    expected, 2 * m - 2) == 0);
+              ASSERT (check (expected, 2 * m - 2, expected, 2 * m - 2) == 0);
+            }
+
+          free (input);
+        }
+    }
 }
 
 #else
index ddc1ddde1344c3963fdc9a095652370416d7d126..ff4b117e971d1edbf98745730173fb1d67539fbb 100644 (file)
@@ -270,91 +270,87 @@ test_u8_nfkd (void)
 #endif
 
   /* Check that the sorting is not O(n²) but O(n log n).  */
-  {
-    int pass;
-    for (pass = 0; pass < 3; pass++)
-      {
-        size_t repeat = 1;
-        size_t m = 100000;
-        uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
-        if (input != NULL)
-          {
-            uint8_t *expected = input + (2 * m - 1);
-            size_t m1 = m / 2;
-            size_t m2 = (m - 1) / 2;
-            /* NB: m1 + m2 == m - 1.  */
-            uint8_t *p;
-            size_t i;
-
-            input[0] = 0x41;
-            p = input + 1;
-            switch (pass)
-              {
-              case 0:
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                break;
-
-              case 1:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (i = 0; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              case 2:
-                for (i = 0; i < m2; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                    *p++ = 0xCC;
-                    *p++ = 0x80;
-                  }
-                for (; i < m1; i++)
-                  {
-                    *p++ = 0xCC;
-                    *p++ = 0x99;
-                  }
-                break;
-
-              default:
-                abort ();
-              }
-
-            expected[0] = 0x41;
-            p = expected + 1;
-            for (i = 0; i < m1; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x99;
-              }
-            for (i = 0; i < m2; i++)
-              {
-                *p++ = 0xCC;
-                *p++ = 0x80;
-              }
-
-            for (; repeat > 0; repeat--)
-              ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0);
-
-            free (input);
-          }
-      }
-  }
+  for (int pass = 0; pass < 3; pass++)
+    {
+      size_t repeat = 1;
+      size_t m = 100000;
+      uint8_t *input = (uint8_t *) malloc (2 * (2 * m - 1) * sizeof (uint8_t));
+      if (input != NULL)
+        {
+          uint8_t *expected = input + (2 * m - 1);
+          size_t m1 = m / 2;
+          size_t m2 = (m - 1) / 2;
+          /* NB: m1 + m2 == m - 1.  */
+          uint8_t *p;
+
+          input[0] = 0x41;
+          p = input + 1;
+          switch (pass)
+            {
+            case 0:
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              break;
+
+            case 1:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = 0; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            case 2:
+              for (size_t i = 0; i < m2; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                  *p++ = 0xCC;
+                  *p++ = 0x80;
+                }
+              for (size_t i = m2; i < m1; i++)
+                {
+                  *p++ = 0xCC;
+                  *p++ = 0x99;
+                }
+              break;
+
+            default:
+              abort ();
+            }
+
+          expected[0] = 0x41;
+          p = expected + 1;
+          for (size_t i = 0; i < m1; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x99;
+            }
+          for (size_t i = 0; i < m2; i++)
+            {
+              *p++ = 0xCC;
+              *p++ = 0x80;
+            }
+
+          for (; repeat > 0; repeat--)
+            ASSERT (check (input, 2 * m - 1, expected, 2 * m - 1) == 0);
+
+          free (input);
+        }
+    }
 }
 
 #else
index 98904182f44e215b93e17f454c4322f9af1a7c04..754a67bcbb5547b7906f9ce4e91206e126840df0 100644 (file)
@@ -55,7 +55,6 @@ check (const uint32_t *input, size_t input_length,
 {
   struct accumulator accu;
   struct uninorm_filter *filter;
-  size_t i;
 
   accu.result = NULL;
   accu.length = 0;
@@ -64,7 +63,7 @@ check (const uint32_t *input, size_t input_length,
   filter = uninorm_filter_create (UNINORM_NFC, write_to_accumulator, &accu);
   ASSERT (filter != NULL);
 
-  for (i = 0; i < input_length; i++)
+  for (size_t i = 0; i < input_length; i++)
     ASSERT (uninorm_filter_write (filter, input[i]) == 0);
 
   ASSERT (uninorm_filter_free (filter) == 0);
index 6d1be2908115b48b744221840abc25d9627caf12..a0c2a6feffa847f2ed0ac67ba56f33c6e172b4b3 100644 (file)
@@ -20,11 +20,10 @@ static void
 test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...))
 {
   uint16_t buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       uint16_t *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -36,7 +35,7 @@ test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, .
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       static const uint16_t initializer[] =
         { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 };
index 2046d4f657b9c614331f984173c65ef0372f165d..eced57f815c57b8280397e00971678cc5589a23a 100644 (file)
@@ -20,11 +20,10 @@ static void
 test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...))
 {
   uint32_t buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       uint32_t *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -36,7 +35,7 @@ test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, .
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       static const uint32_t initializer[] =
         { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F', 0 };
index 628b79fb0e0c934e96d164a0fb59a72574b11494..b725acdfba551585b16c2566b3d04a8b050539aa 100644 (file)
@@ -105,8 +105,7 @@ main ()
                   {
                     ASSERT (u8_strlen (s) == len);
                     ASSERT (len == n1 + n2 + 3);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -144,8 +143,7 @@ main ()
               {
                 ASSERT (u8_strlen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -181,8 +179,7 @@ main ()
                   {
                     ASSERT (u8_strlen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -217,8 +214,7 @@ main ()
               {
                 ASSERT (u8_strlen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -254,8 +250,7 @@ main ()
                   {
                     ASSERT (u8_strlen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
index 90238c8e2df131bb57ff9d4b06e4f29d9a400902..817e8e1fc6afdf4fba345883f467933e573b36a5 100644 (file)
@@ -20,11 +20,10 @@ static void
 test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...))
 {
   uint8_t buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       uint8_t *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -35,7 +34,7 @@ test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       static const uint8_t initializer[] = "DEADBEEF";
       static const uint8_t expected[] = "12345";
index 964d6df34c1857c87d6b4890a063a8e031a3b93e..464af3b549ecd1b61219928b311da28e4ebefd4b 100644 (file)
@@ -105,8 +105,7 @@ main ()
                   {
                     ASSERT (strlen (s) == len);
                     ASSERT (len == n1 + n2 + 3);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
@@ -146,8 +145,7 @@ main ()
                 {
                   ASSERT (strlen (s) == len);
                   ASSERT (len == n1 + 2);
-                  size_t i;
-                  for (i = 0; i <= len; i++)
+                  for (size_t i = 0; i <= len; i++)
                     s[i] = (i == 0 ? 'x' :
                             i <= n1 ? 'a' :
                             i == n1 + 1 ? 'y' :
@@ -169,8 +167,7 @@ main ()
                 {
                   ASSERT (strlen (s) == len);
                   ASSERT (len == n1 + 2);
-                  size_t i;
-                  for (i = 0; i <= len; i++)
+                  for (size_t i = 0; i <= len; i++)
                     s[i] = (i == 0 ? 'x' :
                             i <= n1 ? 'a' :
                             i == n1 + 1 ? 'y' :
@@ -210,8 +207,7 @@ main ()
                     {
                       ASSERT (strlen (s) == len);
                       ASSERT (len == n1 + 2);
-                      size_t i;
-                      for (i = 0; i <= len; i++)
+                      for (size_t i = 0; i <= len; i++)
                         s[i] = (i == 0 ? 'x' :
                                 i <= n1 ? 'a' :
                                 i == n1 + 1 ? 'y' :
@@ -233,8 +229,7 @@ main ()
                     {
                       ASSERT (strlen (s) == len);
                       ASSERT (len == n1 + 2);
-                      size_t i;
-                      for (i = 0; i <= len; i++)
+                      for (size_t i = 0; i <= len; i++)
                         s[i] = (i == 0 ? 'x' :
                                 i <= n1 ? 'a' :
                                 i == n1 + 1 ? 'y' :
@@ -271,8 +266,7 @@ main ()
               {
                 ASSERT (strlen (s) == len);
                 ASSERT (len == n1 + 2);
-                size_t i;
-                for (i = 0; i <= len; i++)
+                for (size_t i = 0; i <= len; i++)
                   s[i] = (i == 0 ? 'x' :
                           i <= n1 ? 'a' :
                           i == n1 + 1 ? 'y' :
@@ -308,8 +302,7 @@ main ()
                   {
                     ASSERT (strlen (s) == len);
                     ASSERT (len == n1 + 2);
-                    size_t i;
-                    for (i = 0; i <= len; i++)
+                    for (size_t i = 0; i <= len; i++)
                       s[i] = (i == 0 ? 'x' :
                               i <= n1 ? 'a' :
                               i == n1 + 1 ? 'y' :
index 0e7e9cff72c2b88ac839a41f40c419fa2c8adad8..31220d13c463658585f2d79c508fe713ece67280 100644 (file)
@@ -20,11 +20,10 @@ static void
 test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
 {
   char buf[8];
-  int size;
 
   /* Test return value convention.  */
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length = size;
       char *result = my_asnprintf (NULL, &length, "%d", 12345);
@@ -34,7 +33,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
       free (result);
     }
 
-  for (size = 0; size <= 8; size++)
+  for (int size = 0; size <= 8; size++)
     {
       size_t length;
       char *result;
index 7e95af1b429a27bbab920d6047c27c0b586249af..532035dc5d6a0ebe092bde0365cdd79b81ac29b7 100644 (file)
@@ -93,43 +93,35 @@ main (void)
   }
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 128; j++)
-          input[i + j] = j;
-        for (j = 0; j < 128; j++)
-          {
-            ASSERT (U_CHR (input + i, 128, j) == input + i + j);
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 128; j++)
+        input[i + j] = j;
+      for (int j = 0; j < 128; j++)
+        {
+          ASSERT (U_CHR (input + i, 128, j) == input + i + j);
+        }
+    }
 
   /* Check that uN_chr() does not read past the first occurrence of the
      byte being searched.  */
   {
     UNIT *page_boundary = zerosize_ptr ();
-    size_t n;
 
     if (page_boundary != NULL)
       {
-        for (n = 1; n <= 500 / sizeof (UNIT); n++)
+        for (size_t n = 1; n <= 500 / sizeof (UNIT); n++)
           {
             UNIT *mem = page_boundary - n;
             U_SET (mem, 'X', n);
             ASSERT (U_CHR (mem, n, 'U') == NULL);
 
-            {
-              size_t i;
-
-              for (i = 0; i < n; i++)
-                {
-                  mem[i] = 'U';
-                  ASSERT (U_CHR (mem, 4000, 'U') == mem + i);
-                  mem[i] = 'X';
-                }
-            }
+            for (size_t i = 0; i < n; i++)
+              {
+                mem[i] = 'U';
+                ASSERT (U_CHR (mem, 4000, 'U') == mem + i);
+                mem[i] = 'X';
+              }
           }
       }
   }
index 94e3d3f519f78e020891b5e58e70b3b0ea08ba0b..62b1a4a23f1c183a1f55c8eed0acd6624225b63c 100644 (file)
@@ -78,21 +78,19 @@ test_cmp (void)
   {
     UNIT foo[21];
     UNIT bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
+    for (int i = 0; i < 4; i++)
       {
         UNIT *a = foo + i;
         UNIT *b = bar + i;
-        int j;
-        for (j = 0; j < 8; j++)
+        for (int j = 0; j < 8; j++)
           a[j] = '-';
         a[8] = '0';
-        for (j = 9; j < 16; j++)
+        for (int j = 9; j < 16; j++)
           a[j] = '1';
-        for (j = 0; j < 8; j++)
+        for (int j = 0; j < 8; j++)
           b[j] = '-';
         b[8] = '1';
-        for (j = 9; j < 16; j++)
+        for (int j = 9; j < 16; j++)
           b[j] = '0';
         ASSERT (U_CMP (a, b, 16) < 0);
       }
index 4a2bfa055d3e37abe00777dca6b76d4d94a636a8..4709cedab544724fb8d21e7ab092558e58d4e0d5 100644 (file)
@@ -22,15 +22,13 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (src); n++)
+    for (size_t n = 0; n <= SIZEOF (src); n++)
       {
         UNIT *result = U_CPY_ALLOC (src, n);
-        size_t i;
 
         ASSERT (result != NULL);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (result[i] == src[i]);
 
         free (result);
index e1a167bb95bef7c73f1d47947d80b4bcc062393c..9cec31344b069385c61b16e41e922218573e1664 100644 (file)
@@ -22,19 +22,17 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (src); n++)
+    for (size_t n = 0; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1] =
           { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
         UNIT *ret;
-        size_t i;
 
         ret = U_CPY (dest + 1, src, n);
         ASSERT (ret == dest + 1);
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
index 765dcb5f74a1535d9662a35428e46b31acea1bcb..afc4435cb2b06fba476fde46384106be90e8dffb 100644 (file)
@@ -22,19 +22,17 @@ main ()
   /* Test copying operations with disjoint source and destination.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (src); n++)
+    for (size_t n = 0; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1] =
           { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
         UNIT *ret;
-        size_t i;
 
         ret = U_MOVE (dest + 1, src, n);
         ASSERT (ret == dest + 1);
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
@@ -43,23 +41,21 @@ main ()
   /* Test copying operations with overlap, in-place.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (src); n++)
+    for (size_t n = 0; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1];
         UNIT *ret;
-        size_t i;
 
         dest[0] = MAGIC;
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           dest[1 + i] = src[i];
         dest[1 + n] = MAGIC;
 
         ret = U_MOVE (dest + 1, dest + 1, n);
         ASSERT (ret == dest + 1);
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
@@ -69,23 +65,19 @@ main ()
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
     static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
-    size_t d;
 
     ASSERT (SIZEOF (src) == SIZEOF (src2));
-    for (d = 0; d <= SIZEOF (src); d++)
+    for (size_t d = 0; d <= SIZEOF (src); d++)
       {
-        size_t n;
-
-        for (n = 0; n <= SIZEOF (src); n++)
+        for (size_t n = 0; n <= SIZEOF (src); n++)
           {
             UNIT dest[1 + 2 * SIZEOF (src) + 1];
             UNIT *ret;
-            size_t i;
 
             dest[0] = MAGIC;
-            for (i = 0; i < SIZEOF (src2); i++)
+            for (size_t i = 0; i < SIZEOF (src2); i++)
               dest[1 + i] = src2[i];
-            for (i = 0; i < SIZEOF (src); i++)
+            for (size_t i = 0; i < SIZEOF (src); i++)
               dest[1 + SIZEOF (src) + i] = src[i];
             dest[1 + 2 * SIZEOF (src)] = MAGIC;
 
@@ -93,13 +85,13 @@ main ()
               U_MOVE (dest + 1 + SIZEOF (src) - d, dest + 1 + SIZEOF (src), n);
             ASSERT (ret == dest + 1 + SIZEOF (src) - d);
             ASSERT (dest[0] == MAGIC);
-            for (i = 0; i < SIZEOF (src) - d; i++)
+            for (size_t i = 0; i < SIZEOF (src) - d; i++)
               ASSERT (dest[1 + i] == src2[i]);
-            for (i = 0; i < n; i++)
+            for (size_t i = 0; i < n; i++)
               ASSERT (dest[1 + SIZEOF (src) - d + i] == src[i]);
-            for (i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++)
+            for (size_t i = SIZEOF (src) - d + n; i < SIZEOF (src2); i++)
               ASSERT (dest[1 + i] == src2[i]);
-            for (i = (n >= d ? n - d : 0); i < SIZEOF (src); i++)
+            for (size_t i = (n >= d ? n - d : 0); i < SIZEOF (src); i++)
               ASSERT (dest[1 + SIZEOF (src) + i] == src[i]);
             ASSERT (dest[1 + 2 * SIZEOF (src)] == MAGIC);
           }
@@ -110,36 +102,32 @@ main ()
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
     static const UNIT src2[] = { 'C', 'L', 'I', 'M', 'A', 'T', 'E' };
-    size_t d;
 
     ASSERT (SIZEOF (src) == SIZEOF (src2));
-    for (d = 0; d <= SIZEOF (src); d++)
+    for (size_t d = 0; d <= SIZEOF (src); d++)
       {
-        size_t n;
-
-        for (n = 0; n <= SIZEOF (src); n++)
+        for (size_t n = 0; n <= SIZEOF (src); n++)
           {
             UNIT dest[1 + 2 * SIZEOF (src) + 1];
             UNIT *ret;
-            size_t i;
 
             dest[0] = MAGIC;
-            for (i = 0; i < SIZEOF (src); i++)
+            for (size_t i = 0; i < SIZEOF (src); i++)
               dest[1 + i] = src[i];
-            for (i = 0; i < SIZEOF (src2); i++)
+            for (size_t i = 0; i < SIZEOF (src2); i++)
               dest[1 + SIZEOF (src) + i] = src2[i];
             dest[1 + 2 * SIZEOF (src)] = MAGIC;
 
             ret = U_MOVE (dest + 1 + d, dest + 1, n);
             ASSERT (ret == dest + 1 + d);
             ASSERT (dest[0] == MAGIC);
-            for (i = 0; i < d; i++)
+            for (size_t i = 0; i < d; i++)
               ASSERT (dest[1 + i] == src[i]);
-            for (i = 0; i < n; i++)
+            for (size_t i = 0; i < n; i++)
               ASSERT (dest[1 + d + i] == src[i]);
-            for (i = d + n; i < SIZEOF (src); i++)
+            for (size_t i = d + n; i < SIZEOF (src); i++)
               ASSERT (dest[1 + i] == src[i]);
-            for (i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0);
+            for (size_t i = (d + n >= SIZEOF (src) ? d + n - SIZEOF (src) : 0);
                  i < SIZEOF (src2);
                  i++)
               ASSERT (dest[1 + SIZEOF (src) + i] == src2[i]);
index c7298dca005e82349ebb77018ff2548911d32891..882b959aec7c1a00f0133b923787457d2c3fea9b 100644 (file)
@@ -22,19 +22,17 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e' };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (src); n++)
+    for (size_t n = 0; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1] =
           { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
         UNIT *ret;
-        size_t i;
 
         ret = U_PCPY (dest + 1, src, n);
         ASSERT (ret == dest + 1 + n);
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
index 133ea63883afaf25dce6603136f696ad9b1fa548..8f00c5565115a1b773401c04f764af087c1fa441 100644 (file)
 int
 main ()
 {
-  {
 #define NMAX 7
-    size_t n;
-
-    for (n = 0; n <= NMAX; n++)
-      {
-        UNIT dest[1 + NMAX + 1] =
-          { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
-        UNIT *ret;
-        size_t i;
-
-        ret = U_SET (dest + 1, VALUE, n);
-        ASSERT (ret == dest + 1);
-        ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
-          ASSERT (dest[1 + i] == VALUE);
-        ASSERT (dest[1 + n] == MAGIC);
-      }
+  for (size_t n = 0; n <= NMAX; n++)
+    {
+      UNIT dest[1 + NMAX + 1] =
+        { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+      UNIT *ret;
+
+      ret = U_SET (dest + 1, VALUE, n);
+      ASSERT (ret == dest + 1);
+      ASSERT (dest[0] == MAGIC);
+      for (size_t i = 0; i < n; i++)
+        ASSERT (dest[1 + i] == VALUE);
+      ASSERT (dest[1 + n] == MAGIC);
+    }
 #undef NMAX
-  }
 
   return test_exit_status;
 }
index d8b433d53aee92ff9dd3fb325d525917969c03d6..aae6421ac82c440ff5199fb2ff87cd2d28bb56c0 100644 (file)
@@ -22,22 +22,20 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
-    size_t n;
 
-    for (n = 1; n <= SIZEOF (src); n++)
+    for (size_t n = 1; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1] =
           { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
             MAGIC
           };
         UNIT *result;
-        size_t i;
 
         result = U_STPCPY (dest + 1, src + SIZEOF (src) - n);
         ASSERT (result == dest + n);
 
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
index c651a83ed1dc3950dcc30c0a5a730b1c443dc489..7ee87333539584507896af9f86aac6e991499fe3 100644 (file)
@@ -21,22 +21,24 @@ check_single (const UNIT *input, size_t length, size_t n)
 {
   UNIT *dest;
   UNIT *result;
-  size_t i;
 
   dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT));
   ASSERT (dest != NULL);
 
-  for (i = 0; i < 1 + n + 1; i++)
+  for (size_t i = 0; i < 1 + n + 1; i++)
     dest[i] = MAGIC;
 
   result = U_STPNCPY (dest + 1, input, n);
   ASSERT (result == dest + 1 + (n <= length ? n : length));
 
   ASSERT (dest[0] == MAGIC);
-  for (i = 0; i < (n <= length ? n : length + 1); i++)
-    ASSERT (dest[1 + i] == input[i]);
-  for (; i < n; i++)
-    ASSERT (dest[1 + i] == 0);
+  {
+    size_t i;
+    for (i = 0; i < (n <= length ? n : length + 1); i++)
+      ASSERT (dest[1 + i] == input[i]);
+    for (; i < n; i++)
+      ASSERT (dest[1 + i] == 0);
+  }
   ASSERT (dest[1 + n] == MAGIC);
 
   free (dest);
@@ -46,13 +48,12 @@ static void
 check (const UNIT *input, size_t input_length)
 {
   size_t length;
-  size_t n;
 
   ASSERT (input_length > 0);
   ASSERT (input[input_length - 1] == 0);
   length = input_length - 1; /* = U_STRLEN (input) */
 
-  for (n = 0; n <= 2 * length + 2; n++)
+  for (size_t n = 0; n <= 2 * length + 2; n++)
     check_single (input, length, n);
 
   /* Check that U_STPNCPY (D, S, N) does not look at more than
@@ -62,14 +63,13 @@ check (const UNIT *input, size_t input_length)
 
     if (page_boundary != NULL)
       {
-        for (n = 0; n <= 2 * length + 2; n++)
+        for (size_t n = 0; n <= 2 * length + 2; n++)
           {
             size_t n_to_copy = (n <= length ? n : length + 1);
             UNIT *copy;
-            size_t i;
 
             copy = (UNIT *) page_boundary - n_to_copy;
-            for (i = 0; i < n_to_copy; i++)
+            for (size_t i = 0; i < n_to_copy; i++)
               copy[i] = input[i];
 
             check_single (copy, length, n);
index cd0fb9f0a53ee30b54a9523b9354105eb2d0dc00..d038b5846745ef83b597ad95915041c753da48df 100644 (file)
@@ -23,20 +23,17 @@ main ()
   {
     static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 };
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
-    size_t m;
-    size_t n;
 
-    for (m = 0; m < SIZEOF (base); m++)
-      for (n = 1; n <= SIZEOF (src); n++)
+    for (size_t m = 0; m < SIZEOF (base); m++)
+      for (size_t n = 1; n <= SIZEOF (src); n++)
         {
           UNIT dest[1 + (SIZEOF (base) - 1) + SIZEOF (src) + 1] =
             { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
               MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC
             };
           UNIT *result;
-          size_t i;
 
-          for (i = 0; i < m; i++)
+          for (size_t i = 0; i < m; i++)
             dest[1 + i] = base[i];
           dest[1 + m] = 0;
 
@@ -44,9 +41,9 @@ main ()
           ASSERT (result == dest + 1);
 
           ASSERT (dest[0] == MAGIC);
-          for (i = 0; i < m; i++)
+          for (size_t i = 0; i < m; i++)
             ASSERT (dest[1 + i] == base[i]);
-          for (i = 0; i < n; i++)
+          for (size_t i = 0; i < n; i++)
             ASSERT (dest[1 + m + i] == src[SIZEOF (src) - n + i]);
           ASSERT (dest[1 + m + n] == MAGIC);
         }
index c5740a5da74bad192676808577fa2674af3625b5..bd4302137b752f25426bd69bf46785e4077221cf 100644 (file)
@@ -86,28 +86,24 @@ test_strchr (void)
   }
 
   /* Alignment tests.  */
-  {
-    int i, j;
-    for (i = 0; i < 32; i++)
-      {
-        for (j = 0; j < 127; j++)
-          input[i + j] = j + 1;
-        input[i + 128] = 0;
-        for (j = 0; j < 127; j++)
-          {
-            ASSERT (U_STRCHR (input + i, j + 1) == input + i + j);
-          }
-      }
-  }
+  for (int i = 0; i < 32; i++)
+    {
+      for (int j = 0; j < 127; j++)
+        input[i + j] = j + 1;
+      input[i + 128] = 0;
+      for (int j = 0; j < 127; j++)
+        {
+          ASSERT (U_STRCHR (input + i, j + 1) == input + i + j);
+        }
+    }
 
   /* Check that uN_strchr() does not read past the end of the string.  */
   {
     char *page_boundary = (char *) zerosize_ptr ();
-    size_t n;
 
     if (page_boundary != NULL)
       {
-        for (n = 2; n <= 500 / sizeof (UNIT); n++)
+        for (size_t n = 2; n <= 500 / sizeof (UNIT); n++)
           {
             UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT));
             U_SET (mem, 'X', n - 2);
@@ -130,27 +126,22 @@ test_strchr (void)
      byte being searched.  */
   {
     char *page_boundary = (char *) zerosize_ptr ();
-    size_t n;
 
     if (page_boundary != NULL)
       {
-        for (n = 2; n <= 500 / sizeof (UNIT); n++)
+        for (size_t n = 2; n <= 500 / sizeof (UNIT); n++)
           {
             UNIT *mem = (UNIT *) (page_boundary - n * sizeof (UNIT));
             U_SET (mem, 'X', n - 1);
             mem[n - 1] = 0;
             ASSERT (U_STRCHR (mem, 'U') == NULL);
 
-            {
-              size_t i;
-
-              for (i = 0; i < n; i++)
-                {
-                  mem[i] = 'U';
-                  ASSERT (U_STRCHR (mem, 'U') == mem + i);
-                  mem[i] = 'X';
-                }
-            }
+            for (size_t i = 0; i < n; i++)
+              {
+                mem[i] = 'U';
+                ASSERT (U_STRCHR (mem, 'U') == mem + i);
+                mem[i] = 'X';
+              }
           }
       }
   }
index 6a1d81e891efdaeb507f4db5465dbc7a10fa1339..9bb8cfe5b611af2f9f702044cba526a6e092463c 100644 (file)
@@ -22,22 +22,20 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
-    size_t n;
 
-    for (n = 1; n <= SIZEOF (src); n++)
+    for (size_t n = 1; n <= SIZEOF (src); n++)
       {
         UNIT dest[1 + SIZEOF (src) + 1] =
           { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC, MAGIC,
             MAGIC
           };
         UNIT *result;
-        size_t i;
 
         result = U_STRCPY (dest + 1, src + SIZEOF (src) - n);
         ASSERT (result == dest + 1);
 
         ASSERT (dest[0] == MAGIC);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (dest[1 + i] == src[SIZEOF (src) - n + i]);
         ASSERT (dest[1 + n] == MAGIC);
       }
index 4f59bc06ee0d60b20a5315f74601277fe9b72ed0..a0eec716aa19c6726038c618781a06bdd6282a98 100644 (file)
@@ -22,15 +22,13 @@ main ()
   /* Test small copying operations.  */
   {
     static const UNIT src[] = { 'c', 'l', 'i', 'm', 'a', 't', 'e', 0 };
-    size_t n;
 
-    for (n = 1; n <= SIZEOF (src); n++)
+    for (size_t n = 1; n <= SIZEOF (src); n++)
       {
         UNIT *result = U_STRDUP (src + SIZEOF (src) - n);
-        size_t i;
 
         ASSERT (result != NULL);
-        for (i = 0; i < n; i++)
+        for (size_t i = 0; i < n; i++)
           ASSERT (result[i] == src[SIZEOF (src) - n + i]);
 
         free (result);
index 0ba63afe22e1da0481c56cc640ca0adcdf0c12ec..d992798b72e32cd483f17f741e1baadd182dd862 100644 (file)
@@ -20,34 +20,35 @@ static void
 check_single (const UNIT *input, size_t length, size_t n)
 {
   static const UNIT base[] = { 'C', 'h', 'a', 'n', 'g', 'i', 'n', 'g', 0 };
-  size_t m;
 
-  for (m = 0; m < SIZEOF (base); m++)
+  for (size_t m = 0; m < SIZEOF (base); m++)
     {
       UNIT *dest;
       UNIT *result;
-      size_t i;
 
       dest = (UNIT *) malloc ((1 + m + n + 2) * sizeof (UNIT));
       ASSERT (dest != NULL);
 
       dest[0] = MAGIC;
-      for (i = 0; i < m; i++)
+      for (size_t i = 0; i < m; i++)
         dest[1 + i] = base[i];
       dest[1 + m] = 0;
-      for (i = 1; i < n + 2; i++)
+      for (size_t i = 1; i < n + 2; i++)
         dest[1 + m + i] = MAGIC;
 
       result = U_STRNCAT (dest + 1, input, n);
       ASSERT (result == dest + 1);
 
       ASSERT (dest[0] == MAGIC);
-      for (i = 0; i < m; i++)
+      for (size_t i = 0; i < m; i++)
         ASSERT (dest[1 + i] == base[i]);
-      for (i = 0; i < (n <= length ? n : length); i++)
-        ASSERT (dest[1 + m + i] == input[i]);
-      ASSERT (dest[1 + m + i] == 0);
-      ASSERT (dest[1 + m + i + 1] == MAGIC);
+      {
+        size_t i;
+        for (i = 0; i < (n <= length ? n : length); i++)
+          ASSERT (dest[1 + m + i] == input[i]);
+        ASSERT (dest[1 + m + i] == 0);
+        ASSERT (dest[1 + m + i + 1] == MAGIC);
+      }
 
       free (dest);
     }
@@ -57,13 +58,12 @@ static void
 check (const UNIT *input, size_t input_length)
 {
   size_t length;
-  size_t n;
 
   ASSERT (input_length > 0);
   ASSERT (input[input_length - 1] == 0);
   length = input_length - 1; /* = U_STRLEN (input) */
 
-  for (n = 0; n <= 2 * length + 2; n++)
+  for (size_t n = 0; n <= 2 * length + 2; n++)
     check_single (input, length, n);
 
   /* Check that U_STRNCAT (D, S, N) does not look at more than
@@ -73,14 +73,13 @@ check (const UNIT *input, size_t input_length)
 
     if (page_boundary != NULL)
       {
-        for (n = 0; n <= 2 * length + 2; n++)
+        for (size_t n = 0; n <= 2 * length + 2; n++)
           {
             size_t n_to_copy = (n <= length ? n : length + 1);
             UNIT *copy;
-            size_t i;
 
             copy = (UNIT *) page_boundary - n_to_copy;
-            for (i = 0; i < n_to_copy; i++)
+            for (size_t i = 0; i < n_to_copy; i++)
               copy[i] = input[i];
 
             check_single (copy, length, n);
index e24fa507fbd686d603d97be738b848bb12855fb4..60e3c7c74679ee67106a760ded2b447eef0cc451 100644 (file)
@@ -21,22 +21,24 @@ check_single (const UNIT *input, size_t length, size_t n)
 {
   UNIT *dest;
   UNIT *result;
-  size_t i;
 
   dest = (UNIT *) malloc ((1 + n + 1) * sizeof (UNIT));
   ASSERT (dest != NULL);
 
-  for (i = 0; i < 1 + n + 1; i++)
+  for (size_t i = 0; i < 1 + n + 1; i++)
     dest[i] = MAGIC;
 
   result = U_STRNCPY (dest + 1, input, n);
   ASSERT (result == dest + 1);
 
   ASSERT (dest[0] == MAGIC);
-  for (i = 0; i < (n <= length ? n : length + 1); i++)
-    ASSERT (dest[1 + i] == input[i]);
-  for (; i < n; i++)
-    ASSERT (dest[1 + i] == 0);
+  {
+    size_t i;
+    for (i = 0; i < (n <= length ? n : length + 1); i++)
+      ASSERT (dest[1 + i] == input[i]);
+    for (; i < n; i++)
+      ASSERT (dest[1 + i] == 0);
+  }
   ASSERT (dest[1 + n] == MAGIC);
 
   free (dest);
@@ -46,13 +48,12 @@ static void
 check (const UNIT *input, size_t input_length)
 {
   size_t length;
-  size_t n;
 
   ASSERT (input_length > 0);
   ASSERT (input[input_length - 1] == 0);
   length = input_length - 1; /* = U_STRLEN (input) */
 
-  for (n = 0; n <= 2 * length + 2; n++)
+  for (size_t n = 0; n <= 2 * length + 2; n++)
     check_single (input, length, n);
 
   /* Check that U_STRNCPY (D, S, N) does not look at more than
@@ -62,14 +63,13 @@ check (const UNIT *input, size_t input_length)
 
     if (page_boundary != NULL)
       {
-        for (n = 0; n <= 2 * length + 2; n++)
+        for (size_t n = 0; n <= 2 * length + 2; n++)
           {
             size_t n_to_copy = (n <= length ? n : length + 1);
             UNIT *copy;
-            size_t i;
 
             copy = (UNIT *) page_boundary - n_to_copy;
-            for (i = 0; i < n_to_copy; i++)
+            for (size_t i = 0; i < n_to_copy; i++)
               copy[i] = input[i];
 
             check_single (copy, length, n);
index fd0c25cc4266321f2677d3d1febfba2a4092e975..33a6838fa7ea2529bedb584de349cf1d7539c253 100644 (file)
@@ -27,13 +27,12 @@ static void
 check (const UNIT *input, size_t input_length)
 {
   size_t length;
-  size_t n;
 
   ASSERT (input_length > 0);
   ASSERT (input[input_length - 1] == 0);
   length = input_length - 1; /* = U_STRLEN (input) */
 
-  for (n = 0; n <= 2 * length + 2; n++)
+  for (size_t n = 0; n <= 2 * length + 2; n++)
     check_single (input, length, n);
 
   /* Check that U_STRNLEN (S, N) does not look at more than
@@ -43,14 +42,13 @@ check (const UNIT *input, size_t input_length)
 
     if (page_boundary != NULL)
       {
-        for (n = 0; n <= 2 * length + 2; n++)
+        for (size_t n = 0; n <= 2 * length + 2; n++)
           {
             size_t n_to_copy = (n <= length ? n : length + 1);
             UNIT *copy;
-            size_t i;
 
             copy = (UNIT *) page_boundary - n_to_copy;
-            for (i = 0; i < n_to_copy; i++)
+            for (size_t i = 0; i < n_to_copy; i++)
               copy[i] = input[i];
 
             check_single (copy, length, n);
index 826089d96402b02131a18f3c530667cd00fbf0a8..9bf6b329e7bfe42399c113d287aca3e4694f64c1 100644 (file)
@@ -130,10 +130,8 @@ test_u_strstr (void)
     UNIT *haystack = (UNIT *) malloc ((m + 1) * sizeof (UNIT));
     if (haystack != NULL)
       {
-        size_t i;
-
         haystack[0] = 'B';
-        for (i = 1; i < m; i++)
+        for (size_t i = 1; i < m; i++)
           haystack[i] = 'A';
         haystack[m] = '\0';
 
@@ -166,9 +164,7 @@ test_u_strstr (void)
     UNIT *needle = (UNIT *) malloc ((m + 1) * sizeof (UNIT));
     if (needle != NULL)
       {
-        size_t i;
-
-        for (i = 0; i < m; i++)
+        for (size_t i = 0; i < m; i++)
           needle[i] = 'A';
         needle[m] = '\0';
 
@@ -188,15 +184,14 @@ test_u_strstr (void)
     UNIT *needle = (UNIT *) malloc ((m + 2) * sizeof (UNIT));
     if (haystack != NULL && needle != NULL)
       {
-        size_t i;
         const UNIT *result;
 
-        for (i = 0; i < 2 * m; i++)
+        for (size_t i = 0; i < 2 * m; i++)
           haystack[i] = 'A';
         haystack[2 * m] = 'B';
         haystack[2 * m + 1] = 0;
 
-        for (i = 0; i < m; i++)
+        for (size_t i = 0; i < m; i++)
           needle[i] = 'A';
         needle[m] = 'B';
         needle[m + 1] = 0;
index 6d0c476518a27e2b79c5625f34a00d2e19de278d..c4d49d1bf0dbb90ed66287068259cf4f244a2030 100644 (file)
@@ -43,10 +43,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[1];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         ret = u16_mblen (buf, 1);
index c354ddfb2ee874efa29b884a6bdbf3eab903e02c..eb6a32a3a108de0680587d53dfa108fd5c7de5bc 100644 (file)
@@ -35,9 +35,8 @@ main ()
         '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
         0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
       };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (input); n++)
+    for (size_t n = 0; n <= SIZEOF (input); n++)
       {
         size_t len = u16_mbsnlen (input, n);
         ASSERT (len == n);
@@ -55,9 +54,8 @@ main ()
         1, 2, 3, 3, 4, 5, 5, 6, 7,
         8, 8, 9, 10, 10
       };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (input); n++)
+    for (size_t n = 0; n <= SIZEOF (input); n++)
       {
         size_t len = u16_mbsnlen (input, n);
         ASSERT (len == expected[n]);
index 07931f71f8c3bdb939c5d7070cf1c2e867a11f4c..0104f64f8f9605c40118fb5b61ba5d282ea93fd5 100644 (file)
@@ -33,10 +33,9 @@ test_function (int (*my_u16_mbtouc) (ucs4_t *, const uint16_t *, size_t))
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 67226cc16e2b638bd6074c3aaa9c242271c2955c..ff4b283df0af74796f85c82c161b40295bfe1ca0 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index afb4da3e7315ad4a1e7aa82c29303f47e5deb51f..5f991b4757afc7c332e070442706a484c7b8e502 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index 911b2c890c9de59de77cc639a56c8123b69b93ac..01479eb0b2364e245ba50046c7f20ee91806dab7 100644 (file)
@@ -35,12 +35,11 @@ check (const uint16_t *input, size_t input_length, ucs4_t *puc)
   {
     uint16_t buf[100];
     uint16_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 0x2102;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u16_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -53,13 +52,12 @@ check (const uint16_t *input, size_t input_length, ucs4_t *puc)
   {
     uint16_t buf[100];
     uint16_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 0xD835;
     *ptr++ = 0xDD1E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u16_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -88,11 +86,10 @@ check_invalid (const uint16_t *input, size_t input_length)
   {
     uint16_t buf[100];
     uint16_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0x2102;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -106,12 +103,11 @@ check_invalid (const uint16_t *input, size_t input_length)
   {
     uint16_t buf[100];
     uint16_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0xD835;
     *ptr++ = 0xDD1E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -131,10 +127,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 42cf3e6f8add153b0e711cb8be1c2a52ac7ba6a4..2195e27ba91643b1e4effc46a9e7bc3fa4a5653c 100644 (file)
@@ -36,10 +36,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index 8f2e37ec58e526e6165fca8800be750b18ec8065..a9bff30673f33b1285c1be633fda23db74934574 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint16_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index 93149219850d0e2bf88574e2e21142c178bebdab..1c3a5abfd0987ee6ccd0e727007f4ca0bb688e20 100644 (file)
@@ -28,24 +28,20 @@ int
 main ()
 {
   /* Test ISO 646 character, in particular the NUL character.  */
-  {
-    ucs4_t uc;
-
-    for (uc = 0; uc < 0x80; uc++)
-      {
-        uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
-        int ret;
+  for (ucs4_t uc = 0; uc < 0x80; uc++)
+    {
+      uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
+      int ret;
 
-        ret = u16_uctomb (buf, uc, 0);
-        ASSERT (ret == -2);
-        ASSERT (buf[0] == MAGIC);
+      ret = u16_uctomb (buf, uc, 0);
+      ASSERT (ret == -2);
+      ASSERT (buf[0] == MAGIC);
 
-        ret = u16_uctomb (buf, uc, 1);
-        ASSERT (ret == 1);
-        ASSERT (buf[0] == uc);
-        ASSERT (buf[1] == MAGIC);
-      }
-  }
+      ret = u16_uctomb (buf, uc, 1);
+      ASSERT (ret == 1);
+      ASSERT (buf[0] == uc);
+      ASSERT (buf[1] == MAGIC);
+    }
 
   /* Test BMP character.  */
   {
@@ -88,14 +84,12 @@ main ()
   {
     ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
     uint16_t buf[3] = { MAGIC, MAGIC, MAGIC };
-    size_t i;
 
-    for (i = 0; i < SIZEOF (invalid); i++)
+    for (size_t i = 0; i < SIZEOF (invalid); i++)
       {
         ucs4_t uc = invalid[i];
-        int n;
 
-        for (n = 0; n <= 2; n++)
+        for (int n = 0; n <= 2; n++)
           {
             int ret = u16_uctomb (buf, uc, n);
             ASSERT (ret == -1);
index 8ce134261a6b0f4aa43975fd3508858e19911281..ba02f2723dc372475ed33e0cdf6fbd6bd2040d8f 100644 (file)
@@ -43,10 +43,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[1];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         ret = u32_mblen (buf, 1);
index 113b0c5f5adf027814b69dfb7b7acb4606746d86..c7124800cc37ea415e668a07629666b116624949 100644 (file)
@@ -35,9 +35,8 @@ main ()
         '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
         0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
       };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (input); n++)
+    for (size_t n = 0; n <= SIZEOF (input); n++)
       {
         size_t len = u32_mbsnlen (input, n);
         ASSERT (len == n);
@@ -50,9 +49,8 @@ main ()
       { '-', '(', 0x1D51E, 0x00D7, 0x1D51F, ')', '=',
         0x1D51F, 0x00D7, 0x1D51E
       };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (input); n++)
+    for (size_t n = 0; n <= SIZEOF (input); n++)
       {
         size_t len = u32_mbsnlen (input, n);
         ASSERT (len == n);
index 3a44c096017dfc4dcce62c0f8db314003485da18..ce9996d0f6b6337a9d7a0d0ba8a6a73b6eff1520 100644 (file)
@@ -33,10 +33,9 @@ test_function (int (*my_u32_mbtouc) (ucs4_t *, const uint32_t *, size_t))
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 11137449f80988e1122b05b9adff01d7ea5c93bd..85e9fece174626272a2ab0c05d686f89f5279bb7 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index dc17eca43f2da60865998b9a028c62556e9129ac..563b3d35b5344a21ad2005de4550f9cbca5f5dac 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index b9a339a1eca8c9103eaa864ac5f9e71e997c2335..c00babcb093aee52451ac0b9ded7a1bbf2c87060 100644 (file)
@@ -35,12 +35,11 @@ check (const uint32_t *input, size_t input_length, ucs4_t *puc)
   {
     uint32_t buf[100];
     uint32_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 0x1D51E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u32_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -69,11 +68,10 @@ check_invalid (const uint32_t *input, size_t input_length)
   {
     uint32_t buf[100];
     uint32_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0x1D51E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -93,10 +91,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index dc60b17b32da9f086031e105a40d2e7fb5f57fde..95606614aece5d61a9bc5674284ec84c8a3a015e 100644 (file)
@@ -36,10 +36,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index 54a2b4a6a97e74f752fb4d05ec091dfdbc2d1f96..1998ec81d350d75ed796ab0a9bc80e5ad1bb5f0b 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint32_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index f05b8646134549aa5a6b5653f759d4ee82d3a2d6..d792297e212e0a78288708e97e4984813c17aa1e 100644 (file)
@@ -28,24 +28,20 @@ int
 main ()
 {
   /* Test ISO 646 character, in particular the NUL character.  */
-  {
-    ucs4_t uc;
-
-    for (uc = 0; uc < 0x80; uc++)
-      {
-        uint32_t buf[2] = { MAGIC, MAGIC };
-        int ret;
+  for (ucs4_t uc = 0; uc < 0x80; uc++)
+    {
+      uint32_t buf[2] = { MAGIC, MAGIC };
+      int ret;
 
-        ret = u32_uctomb (buf, uc, 0);
-        ASSERT (ret == -2);
-        ASSERT (buf[0] == MAGIC);
+      ret = u32_uctomb (buf, uc, 0);
+      ASSERT (ret == -2);
+      ASSERT (buf[0] == MAGIC);
 
-        ret = u32_uctomb (buf, uc, 1);
-        ASSERT (ret == 1);
-        ASSERT (buf[0] == uc);
-        ASSERT (buf[1] == MAGIC);
-      }
-  }
+      ret = u32_uctomb (buf, uc, 1);
+      ASSERT (ret == 1);
+      ASSERT (buf[0] == uc);
+      ASSERT (buf[1] == MAGIC);
+    }
 
   /* Test BMP character.  */
   {
@@ -83,14 +79,12 @@ main ()
   {
     ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
     uint32_t buf[2] = { MAGIC, MAGIC };
-    size_t i;
 
-    for (i = 0; i < SIZEOF (invalid); i++)
+    for (size_t i = 0; i < SIZEOF (invalid); i++)
       {
         ucs4_t uc = invalid[i];
-        int n;
 
-        for (n = 0; n <= 2; n++)
+        for (int n = 0; n <= 2; n++)
           {
             int ret = u32_uctomb (buf, uc, n);
             ASSERT (ret == -1);
index a6d56242da8147e4af4bc2ee8d9863f55d455718..5e731a2556f9882df9ab05ff698c4f50d774071c 100644 (file)
@@ -43,10 +43,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[1];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         ret = u8_mblen (buf, 1);
index 2123184804616d11b0bb01c4c0118379138e0237..9c0cd94ae8e7f5c0924895643356e05fa4c0ae8c 100644 (file)
@@ -48,9 +48,8 @@ main ()
         56, 56, 56, 57, 57, 57, 58,
         59, 59, 59, 60, 60, 60, 61
       };
-    size_t n;
 
-    for (n = 0; n <= SIZEOF (input); n++)
+    for (size_t n = 0; n <= SIZEOF (input); n++)
       {
         size_t len = u8_mbsnlen (input, n);
         ASSERT (len == expected[n]);
@@ -82,10 +81,9 @@ main ()
   }
   /* 3.2. Lonely start characters.  */
   {
-    ucs4_t c;
     uint8_t input[2];
 
-    for (c = 0xC0; c <= 0xFF; c++)
+    for (ucs4_t c = 0xC0; c <= 0xFF; c++)
       {
         input[0] = c;
         input[1] = ' ';
index 62a2258eabbd51ce6f1aa1206a6262958419febc..7547a45fe3037139f3beaaf410cf408cc2338364 100644 (file)
@@ -78,10 +78,9 @@ test_safe_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t))
   }
   /* 3.2. Lonely start characters.  */
   {
-    ucs4_t c;
     uint8_t input[2];
 
-    for (c = 0xC0; c <= 0xFF; c++)
+    for (ucs4_t c = 0xC0; c <= 0xFF; c++)
       {
         input[0] = c;
         input[1] = ' ';
index 9764088f2959ff6ed50223103b448a619d6bcf0e..3da5dd8241f38728a1511037d98e4a0f2da45e0c 100644 (file)
@@ -33,10 +33,9 @@ test_function (int (*my_u8_mbtouc) (ucs4_t *, const uint8_t *, size_t))
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 9d016ce6aac18139958562a91d974a582d78c944..0fa2379b77eeaabac4b95b631c83c6b399ad6d35 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 247236b3740c09bbab326540f017959b82c921dd..d7e4b22b1c33280e5fc5f71ad4b5f43d5bb5efab 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index f93b39142f9864bfe44a7b1bbd85d6be1a057803..8ef5ce6e25e99c19ab0dfebe9e86048a050742be 100644 (file)
@@ -35,12 +35,11 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 'x';
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -53,13 +52,12 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 0xC3;
     *ptr++ = 0x97;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -72,14 +70,13 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
     *ptr++ = 0xE2;
     *ptr++ = 0x84;
     *ptr++ = 0x82;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -92,7 +89,6 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
     ucs4_t uc1;
 
     ptr = buf;
@@ -100,7 +96,7 @@ check (const uint8_t *input, size_t input_length, ucs4_t *puc)
     *ptr++ = 0x9D;
     *ptr++ = 0x94;
     *ptr++ = 0x9E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     if (u8_prev (&uc1, ptr + input_length, buf) != ptr)
@@ -129,11 +125,10 @@ check_invalid (const uint8_t *input, size_t input_length)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 'x';
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -147,12 +142,11 @@ check_invalid (const uint8_t *input, size_t input_length)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0xC3;
     *ptr++ = 0x97;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -166,13 +160,12 @@ check_invalid (const uint8_t *input, size_t input_length)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0xE2;
     *ptr++ = 0x84;
     *ptr++ = 0x82;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -186,14 +179,13 @@ check_invalid (const uint8_t *input, size_t input_length)
   {
     uint8_t buf[100];
     uint8_t *ptr;
-    size_t i;
 
     ptr = buf;
     *ptr++ = 0xF0;
     *ptr++ = 0x9D;
     *ptr++ = 0x94;
     *ptr++ = 0x9E;
-    for (i = 0; i < input_length; i++)
+    for (size_t i = 0; i < input_length; i++)
       ptr[i] = input[i];
 
     uc = 0xBADFACE;
@@ -213,10 +205,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[1];
 
-    for (c = 0; c < 0x80; c++)
+    for (ucs4_t c = 0; c < 0x80; c++)
       {
         buf[0] = c;
         uc = 0xBADFACE;
index 3294445ba47f7e1295c7111980b3bff11a8f1b7e..ad212bb36565491ca11729c5186c0bb6b0afbdcd 100644 (file)
@@ -36,10 +36,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index a0ccb661294d2d08ba7d65d9f5631cc4f6199ed0..cfb1d58879f3e4288666e1291492a0c601c8129d 100644 (file)
@@ -39,10 +39,9 @@ main ()
 
   /* Test ISO 646 unit input.  */
   {
-    ucs4_t c;
     uint8_t buf[2];
 
-    for (c = 1; c < 0x80; c++)
+    for (ucs4_t c = 1; c < 0x80; c++)
       {
         buf[0] = c;
         buf[1] = 0;
index 31ae2e56e22e153f25a00f8d2f6587732e2d878f..bdb0706f51a41a102e994fcea2f09ffd2eae8108 100644 (file)
@@ -28,24 +28,20 @@ int
 main ()
 {
   /* Test ISO 646 character, in particular the NUL character.  */
-  {
-    ucs4_t uc;
-
-    for (uc = 0; uc < 0x80; uc++)
-      {
-        uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
-        int ret;
+  for (ucs4_t uc = 0; uc < 0x80; uc++)
+    {
+      uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
+      int ret;
 
-        ret = u8_uctomb (buf, uc, 0);
-        ASSERT (ret == -2);
-        ASSERT (buf[0] == MAGIC);
+      ret = u8_uctomb (buf, uc, 0);
+      ASSERT (ret == -2);
+      ASSERT (buf[0] == MAGIC);
 
-        ret = u8_uctomb (buf, uc, 1);
-        ASSERT (ret == 1);
-        ASSERT (buf[0] == uc);
-        ASSERT (buf[1] == MAGIC);
-      }
-  }
+      ret = u8_uctomb (buf, uc, 1);
+      ASSERT (ret == 1);
+      ASSERT (buf[0] == uc);
+      ASSERT (buf[1] == MAGIC);
+    }
 
   /* Test 2-byte character.  */
   {
@@ -133,14 +129,12 @@ main ()
   {
     ucs4_t invalid[] = { 0x110000, 0xD800, 0xDBFF, 0xDC00, 0xDFFF };
     uint8_t buf[5] = { MAGIC, MAGIC, MAGIC, MAGIC, MAGIC };
-    size_t i;
 
-    for (i = 0; i < SIZEOF (invalid); i++)
+    for (size_t i = 0; i < SIZEOF (invalid); i++)
       {
         ucs4_t uc = invalid[i];
-        int n;
 
-        for (n = 0; n <= 4; n++)
+        for (int n = 0; n <= 4; n++)
           {
             int ret = u8_uctomb (buf, uc, n);
             ASSERT (ret == -1);
index 408eb809cdc5c74101f3488d5d59eedecd6c3ff3..cb46e4d935958e69ef7bdfe735df17038f3bb7b0 100644 (file)
@@ -41,11 +41,10 @@ main ()
         0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u16_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 61; i++)
+    for (size_t i = 0; i < 61; i++)
       {
         ASSERT (p[i] == ((i >= 4 && i <= 5)
                          || (i >= 9 && i <= 11)
@@ -73,11 +72,10 @@ main ()
         0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u16_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 67; i++)
+    for (size_t i = 0; i < 67; i++)
       {
         ASSERT (p[i] == ((i >= 5 && i <= 6)
                          || (i >= 10 && i <= 12)
@@ -97,10 +95,9 @@ main ()
     static const uint16_t input[8] =
       { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u16_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5
                          || i == 7 ? 1 :
@@ -114,10 +111,9 @@ main ()
     static const uint16_t input[10] =
       { '.', 0xD83C, 0xDDE9, 0xD83C, 0xDDEA, 0xD83C, 0xDDEB, 0xD83C, 0xDDF7, '.' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u16_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 10; i++)
+    for (size_t i = 0; i < 10; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 5 || i == 9 ? 1 : 0));
       }
index 58fa9cd44aada927d9aa2cf24749670796947ed9..13337b34b044e4c24f9e2557b0f77fb5b5852bbd 100644 (file)
@@ -41,11 +41,10 @@ main ()
         0x65E5, 0x672C, 0x8A9E, ',', 0x4E2D, 0x6587, ',', 0xD55C, 0xAE00, '\n'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u32_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 61; i++)
+    for (size_t i = 0; i < 61; i++)
       {
         ASSERT (p[i] == ((i >= 4 && i <= 5)
                          || (i >= 9 && i <= 11)
@@ -73,11 +72,10 @@ main ()
         0x1112, 0x1161, 0x11AB, 0x1100, 0x1173, 0x11AF, '\n'
       };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u32_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 67; i++)
+    for (size_t i = 0; i < 67; i++)
       {
         ASSERT (p[i] == ((i >= 5 && i <= 6)
                          || (i >= 10 && i <= 12)
@@ -97,10 +95,9 @@ main ()
     static const uint32_t input[8] =
       { 'a', '\n', 'b', '\r', 'c', '\r', '\n', 'd' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u32_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5
                          || i == 7 ? 1 :
@@ -114,10 +111,9 @@ main ()
     static const uint32_t input[6] =
       { '.', 0x1F1E9, 0x1F1EA, 0x1F1EB, 0x1F1F7, '.' };
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u32_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 6; i++)
+    for (size_t i = 0; i < 6; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 3 || i == 5 ? 1 : 0));
       }
index b8d035a9815e3ef588f3c393fd0e7ac8803c7774..b5c390521b88f3ff845637b6a294aa9945fd2a74 100644 (file)
@@ -35,11 +35,10 @@ main ()
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gr\303\274\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\355\225\234\352\270\200\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u8_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 91; i++)
+    for (size_t i = 0; i < 91; i++)
       {
         ASSERT (p[i] == ((i >= 6 && i <= 7)
                          || (i >= 11 && i <= 13)
@@ -62,11 +61,10 @@ main ()
       /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a)  日本語,中文,한글" */
       "Gru\314\210\303\237 Gott. \320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\270\314\206\321\202\320\265! x=(-b\302\261sqrt(b\302\262-4ac))/(2a)  \346\227\245\346\234\254\350\252\236,\344\270\255\346\226\207,\341\204\222\341\205\241\341\206\253\341\204\200\341\205\263\341\206\257\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u8_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 106; i++)
+    for (size_t i = 0; i < 106; i++)
       {
         ASSERT (p[i] == ((i >= 7 && i <= 8)
                          || (i >= 12 && i <= 14)
@@ -87,10 +85,9 @@ main ()
   {
     static const uint8_t input[8] _GL_ATTRIBUTE_NONSTRING = "a\nb\rc\r\nd";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u8_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 8; i++)
+    for (size_t i = 0; i < 8; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 2 || i == 3 || i == 4 || i == 5
                          || i == 7 ? 1 :
@@ -104,10 +101,9 @@ main ()
     static const uint8_t input[18] _GL_ATTRIBUTE_NONSTRING =
       ".\360\237\207\251\360\237\207\252\360\237\207\253\360\237\207\267.";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     u8_wordbreaks (input, SIZEOF (input), p);
-    for (i = 0; i < 18; i++)
+    for (size_t i = 0; i < 18; i++)
       {
         ASSERT (p[i] == (i == 1 || i == 9 || i == 17 ? 1 : 0));
       }
index 11f4f201a548c7e8d43ecc9ecb7429a8676c4556..b5628c9ad2cbbca2b4f553bc726b7afe4af3f8fe 100644 (file)
@@ -157,10 +157,8 @@ main (int argc, char *argv[])
       breaks[0] = breaks_expected[0] = 1;
       if (memcmp (breaks, breaks_expected, i - 1) != 0)
         {
-          int j;
-
           fprintf (stderr, "%s:%d: expected: ", filename, lineno);
-          for (j = 0; j < i - 1; j++)
+          for (int j = 0; j < i - 1; j++)
             {
               int input_wbp = uc_wordbreak_property (input[j]);
               fprintf (stderr, "%s U+%04X (%s) ",
@@ -169,7 +167,7 @@ main (int argc, char *argv[])
             }
           fprintf (stderr, "\n");
           fprintf (stderr, "%s:%d: actual:   ", filename, lineno);
-          for (j = 0; j < i - 1; j++)
+          for (int j = 0; j < i - 1; j++)
             {
               int input_wbp = uc_wordbreak_property (input[j]);
               fprintf (stderr, "%s U+%04X (%s) ",
index 0d95fc383e6ce7820ae299bee6c935fccb482c09..8b743918bc59d6c0ace4e7b5fee96459f199df79 100644 (file)
@@ -41,11 +41,10 @@ main ()
       /* "Grüß Gott. x=(-b±sqrt(b²-4ac))/(2a)" */
       "Gr\374\337 Gott. x=(-b\261sqrt(b\262-4ac))/(2a)\n";
     char *p = (char *) malloc (SIZEOF (input));
-    size_t i;
 
     ulc_wordbreaks (input, SIZEOF (input), p);
 
-    for (i = 0; i < 36; i++)
+    for (size_t i = 0; i < 36; i++)
       {
         ASSERT (p[i] == ((i >= 4 && i <= 5)
                          || (i >= 9 && i <= 17)
index 276672459e7b9ace3ab3f3c04a47b05714f9dbdf..3a1ef2563d49fa573d229e374ff6b60ac8d7b342 100644 (file)
 int
 main ()
 {
-  ucs4_t uc;
-
   /* Test width of ASCII characters.  */
-  for (uc = 0x0020; uc < 0x007F; uc++)
+  for (ucs4_t uc = 0x0020; uc < 0x007F; uc++)
     ASSERT (uc_width (uc, "ISO-8859-2") == 1);
 
   /* Test width of some non-spacing characters.  */
index b651847d48ec74fa1403ca7e6b099dc9941594ec..a5df6afe48b26f26e2e3589fdb7fb48aa251e064 100644 (file)
@@ -60,9 +60,7 @@ add_to_interval (ucs4_t uc, char width)
 int
 main ()
 {
-  ucs4_t uc;
-
-  for (uc = 0; uc < 0x110000; uc++)
+  for (ucs4_t uc = 0; uc < 0x110000; uc++)
     {
       int w1 = uc_width (uc, "UTF-8");
       int w2 = uc_width (uc, "GBK");
index e3531893f19780da5b471c4a157fbba21881f609..18382bc887f8c6ca57b1f043b69c3c8259cf8eb3 100644 (file)
@@ -78,8 +78,7 @@ is_running_under_virtualbox_kvm (void)
             {
               buf[n] = '\0';
               char *saveptr;
-              char *word;
-              for (word = strtok_r (buf, " \n", &saveptr);
+              for (char *word = strtok_r (buf, " \n", &saveptr);
                    word != NULL;
                    word = strtok_r (NULL, " \n", &saveptr))
                 {
@@ -116,8 +115,7 @@ num_cpus (void)
           int n = read (fd, buf, sizeof (buf));
           if (n <= 0)
             break;
-          int i;
-          for (i = 0; i < n; i++)
+          for (int i = 0; i < n; i++)
             {
               if (last_char_was_newline && buf[i] == '\n')
                 blank_lines++;