diff options
Diffstat (limited to 'tests')
731 files changed, 4714 insertions, 5013 deletions
diff --git a/tests/Makefile.gnulib b/tests/Makefile.gnulib index 9188f3f7..11bd8755 100644 --- a/tests/Makefile.gnulib +++ b/tests/Makefile.gnulib @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2025 Free Software Foundation, Inc. +# Copyright (C) 2002-2026 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -2093,14 +2093,14 @@ EXTRA_DIST += test-signal-h.c ## end gnulib module signal-h-tests -## begin gnulib module signbit-tests +## begin gnulib module signbit-no-c++-tests TESTS += test-signbit check_PROGRAMS += test-signbit EXTRA_DIST += test-signbit.c minus-zero.h infinity.h macros.h -## end gnulib module signbit-tests +## end gnulib module signbit-no-c++-tests ## begin gnulib module signed-nan @@ -2442,9 +2442,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(AM_V_at)mv $@-t3 $@ MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 -if GL_COND_OBJ_STDIO_CONSOLESAFE -libtests_a_SOURCES += stdio-consolesafe.c -endif if GL_COND_OBJ_STDIO_READ libtests_a_SOURCES += stdio-read.c endif @@ -2464,6 +2461,14 @@ EXTRA_DIST += test-stdio-h.c macros.h ## end gnulib module stdio-h-tests +## begin gnulib module stdio-windows + +if GL_COND_OBJ_STDIO_CONSOLESAFE +libtests_a_SOURCES += stdio-consolesafe.c +endif + +## end gnulib module stdio-windows + ## begin gnulib module stdlib-h-tests TESTS += test-stdlib-h @@ -2588,6 +2593,14 @@ EXTRA_DIST += test-strncat.c unistr/test-strncat.h zerosize-ptr.h signature.h ma ## end gnulib module strncat-tests +## begin gnulib module strncpy-tests + +TESTS += test-strncpy +check_PROGRAMS += test-strncpy +EXTRA_DIST += test-strncpy.c zerosize-ptr.h macros.h + +## end gnulib module strncpy-tests + ## begin gnulib module strstr-tests TESTS += test-strstr diff --git a/tests/Makefile.in b/tests/Makefile.in index e9f728f1..ba6bbddc 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2025 Free Software Foundation, Inc. +# Copyright (C) 2002-2026 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -198,13 +198,13 @@ TESTS = test-accept$(EXEEXT) test-alignasof$(EXEEXT) \ test-strerror$(EXEEXT) test-strerror_r$(EXEEXT) \ test-striconveh$(EXEEXT) test-striconveha$(EXEEXT) \ test-string-h$(EXEEXT) test-strncat$(EXEEXT) \ - test-strstr$(EXEEXT) test-symlink$(EXEEXT) \ - test-sys_ioctl-h$(EXEEXT) test-sys_select-h$(EXEEXT) \ - test-sys_socket-h$(EXEEXT) test-sys_stat-h$(EXEEXT) \ - test-sys_time-h$(EXEEXT) test-sys_types-h$(EXEEXT) \ - test-sys_uio-h$(EXEEXT) test-init.sh test-thread_self$(EXEEXT) \ - test-thread_create$(EXEEXT) test-time-h$(EXEEXT) \ - test-time$(EXEEXT) test-uchar-h$(EXEEXT) \ + test-strncpy$(EXEEXT) test-strstr$(EXEEXT) \ + test-symlink$(EXEEXT) test-sys_ioctl-h$(EXEEXT) \ + test-sys_select-h$(EXEEXT) test-sys_socket-h$(EXEEXT) \ + test-sys_stat-h$(EXEEXT) test-sys_time-h$(EXEEXT) \ + test-sys_types-h$(EXEEXT) test-sys_uio-h$(EXEEXT) test-init.sh \ + test-thread_self$(EXEEXT) test-thread_create$(EXEEXT) \ + test-time-h$(EXEEXT) test-time$(EXEEXT) test-uchar-h$(EXEEXT) \ test-unicase-h$(EXEEXT) test-cased$(EXEEXT) \ test-ignorable$(EXEEXT) unicase/test-locale-language.sh \ test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ @@ -561,13 +561,13 @@ check_PROGRAMS = test-accept$(EXEEXT) test-alignasof$(EXEEXT) \ test-strerror$(EXEEXT) test-strerror_r$(EXEEXT) \ test-striconveh$(EXEEXT) test-striconveha$(EXEEXT) \ test-string-h$(EXEEXT) test-strncat$(EXEEXT) \ - test-strstr$(EXEEXT) test-symlink$(EXEEXT) \ - test-sys_ioctl-h$(EXEEXT) test-sys_select-h$(EXEEXT) \ - test-sys_socket-h$(EXEEXT) test-sys_stat-h$(EXEEXT) \ - test-sys_time-h$(EXEEXT) test-sys_types-h$(EXEEXT) \ - test-sys_uio-h$(EXEEXT) test-thread_self$(EXEEXT) \ - test-thread_create$(EXEEXT) test-time-h$(EXEEXT) \ - test-time$(EXEEXT) test-uchar-h$(EXEEXT) \ + test-strncpy$(EXEEXT) test-strstr$(EXEEXT) \ + test-symlink$(EXEEXT) test-sys_ioctl-h$(EXEEXT) \ + test-sys_select-h$(EXEEXT) test-sys_socket-h$(EXEEXT) \ + test-sys_stat-h$(EXEEXT) test-sys_time-h$(EXEEXT) \ + test-sys_types-h$(EXEEXT) test-sys_uio-h$(EXEEXT) \ + test-thread_self$(EXEEXT) test-thread_create$(EXEEXT) \ + test-time-h$(EXEEXT) test-time$(EXEEXT) test-uchar-h$(EXEEXT) \ test-unicase-h$(EXEEXT) test-cased$(EXEEXT) \ test-ignorable$(EXEEXT) test-locale-language$(EXEEXT) \ test-uc_tolower$(EXEEXT) test-uc_totitle$(EXEEXT) \ @@ -912,9 +912,9 @@ EXTRA_PROGRAMS = test-verify-try$(EXEEXT) @GL_COND_OBJ_SLEEP_TRUE@am__append_58 = sleep.c @GL_COND_OBJ_SOCKET_TRUE@am__append_59 = socket.c @GL_COND_OBJ_STAT_TRUE@am__append_60 = stat.c -@GL_COND_OBJ_STDIO_CONSOLESAFE_TRUE@am__append_61 = stdio-consolesafe.c -@GL_COND_OBJ_STDIO_READ_TRUE@am__append_62 = stdio-read.c -@GL_COND_OBJ_STDIO_WRITE_TRUE@am__append_63 = stdio-write.c +@GL_COND_OBJ_STDIO_READ_TRUE@am__append_61 = stdio-read.c +@GL_COND_OBJ_STDIO_WRITE_TRUE@am__append_62 = stdio-write.c +@GL_COND_OBJ_STDIO_CONSOLESAFE_TRUE@am__append_63 = stdio-consolesafe.c @GL_COND_OBJ_STPCPY_TRUE@am__append_64 = stpcpy.c @GL_COND_OBJ_STRERROR_TRUE@am__append_65 = strerror.c @GL_COND_OBJ_STRERROR_OVERRIDE_TRUE@am__append_66 = strerror-override.c @@ -1018,6 +1018,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/lib-ld.m4 \ $(top_srcdir)/gnulib-m4/lib-link.m4 \ $(top_srcdir)/gnulib-m4/lib-prefix.m4 \ + $(top_srcdir)/gnulib-m4/libdl.m4 \ $(top_srcdir)/gnulib-m4/libunistring-base.m4 \ $(top_srcdir)/gnulib-m4/limits-h.m4 \ $(top_srcdir)/gnulib-m4/localcharset.m4 \ @@ -1118,6 +1119,7 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ $(top_srcdir)/gnulib-m4/string_h.m4 \ $(top_srcdir)/gnulib-m4/stringeq.m4 \ $(top_srcdir)/gnulib-m4/strncat.m4 \ + $(top_srcdir)/gnulib-m4/strncpy.m4 \ $(top_srcdir)/gnulib-m4/strstr.m4 \ $(top_srcdir)/gnulib-m4/symlink.m4 \ $(top_srcdir)/gnulib-m4/sys_cdefs_h.m4 \ @@ -1198,8 +1200,8 @@ am__libtests_a_SOURCES_DIST = accept.c arpa_inet.c basename-lgpl.c \ same-inode.h same-inode.c sched_yield.c select.c setenv.c \ setlocale.c setsockopt.c signed-nan.h signed-snan.h \ sigprocmask.c sleep.c snan.h socket.c sockets.h sockets.c \ - stat.c stat-time.c stdio-consolesafe.c stdio-read.c \ - stdio-write.c stpcpy.c str_endswith.c str_startswith.c \ + stat.c stat-time.c stdio-read.c stdio-write.c \ + stdio-consolesafe.c stpcpy.c str_endswith.c str_startswith.c \ strerror.c strerror-override.c symlink.c sys_socket.c \ glthread/thread.h glthread/thread.c time.c unsetenv.c usleep.c \ wcrtomb.c wctob.c wctomb.c windows-cond.c windows-thread.c \ @@ -1266,9 +1268,9 @@ am__libtests_a_SOURCES_DIST = accept.c arpa_inet.c basename-lgpl.c \ @GL_COND_OBJ_SLEEP_TRUE@am__objects_49 = sleep.$(OBJEXT) @GL_COND_OBJ_SOCKET_TRUE@am__objects_50 = socket.$(OBJEXT) @GL_COND_OBJ_STAT_TRUE@am__objects_51 = stat.$(OBJEXT) -@GL_COND_OBJ_STDIO_CONSOLESAFE_TRUE@am__objects_52 = stdio-consolesafe.$(OBJEXT) -@GL_COND_OBJ_STDIO_READ_TRUE@am__objects_53 = stdio-read.$(OBJEXT) -@GL_COND_OBJ_STDIO_WRITE_TRUE@am__objects_54 = stdio-write.$(OBJEXT) +@GL_COND_OBJ_STDIO_READ_TRUE@am__objects_52 = stdio-read.$(OBJEXT) +@GL_COND_OBJ_STDIO_WRITE_TRUE@am__objects_53 = stdio-write.$(OBJEXT) +@GL_COND_OBJ_STDIO_CONSOLESAFE_TRUE@am__objects_54 = stdio-consolesafe.$(OBJEXT) @GL_COND_OBJ_STPCPY_TRUE@am__objects_55 = stpcpy.$(OBJEXT) @GL_COND_OBJ_STRERROR_TRUE@am__objects_56 = strerror.$(OBJEXT) @GL_COND_OBJ_STRERROR_OVERRIDE_TRUE@am__objects_57 = strerror-override.$(OBJEXT) @@ -2889,6 +2891,12 @@ test_strncat_LDADD = $(LDADD) test_strncat_DEPENDENCIES = libtests.a ../lib/libunistring.la \ libtests.a ../lib/libunistring.la libtests.a \ $(am__DEPENDENCIES_1) +test_strncpy_SOURCES = test-strncpy.c +test_strncpy_OBJECTS = test-strncpy.$(OBJEXT) +test_strncpy_LDADD = $(LDADD) +test_strncpy_DEPENDENCIES = libtests.a ../lib/libunistring.la \ + libtests.a ../lib/libunistring.la libtests.a \ + $(am__DEPENDENCIES_1) test_strstr_SOURCES = test-strstr.c test_strstr_OBJECTS = test-strstr.$(OBJEXT) test_strstr_LDADD = $(LDADD) @@ -4078,8 +4086,8 @@ am__depfiles_remade = ./$(DEPDIR)/accept.Po ./$(DEPDIR)/alloca.Po \ ./$(DEPDIR)/test-strerror.Po ./$(DEPDIR)/test-strerror_r.Po \ ./$(DEPDIR)/test-striconveh.Po ./$(DEPDIR)/test-striconveha.Po \ ./$(DEPDIR)/test-string-h.Po ./$(DEPDIR)/test-strncat.Po \ - ./$(DEPDIR)/test-strstr.Po ./$(DEPDIR)/test-symlink.Po \ - ./$(DEPDIR)/test-sys_ioctl-h.Po \ + ./$(DEPDIR)/test-strncpy.Po ./$(DEPDIR)/test-strstr.Po \ + ./$(DEPDIR)/test-symlink.Po ./$(DEPDIR)/test-sys_ioctl-h.Po \ ./$(DEPDIR)/test-sys_select-h.Po \ ./$(DEPDIR)/test-sys_socket-h.Po \ ./$(DEPDIR)/test-sys_stat-h.Po ./$(DEPDIR)/test-sys_time-h.Po \ @@ -4775,7 +4783,7 @@ SOURCES = $(libtests_a_SOURCES) $(EXTRA_libtests_a_SOURCES) \ test-str_endswith.c test-str_startswith.c test-strerror.c \ test-strerror_r.c test-striconveh.c \ $(test_striconveha_SOURCES) test-string-h.c test-strncat.c \ - test-strstr.c $(test_sy_c_ident_SOURCES) \ + test-strncpy.c test-strstr.c $(test_sy_c_ident_SOURCES) \ $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) test-symlink.c \ test-sys_ioctl-h.c test-sys_select-h.c test-sys_socket-h.c \ @@ -5121,7 +5129,7 @@ DIST_SOURCES = $(am__libtests_a_SOURCES_DIST) \ test-str_endswith.c test-str_startswith.c test-strerror.c \ test-strerror_r.c test-striconveh.c \ $(test_striconveha_SOURCES) test-string-h.c test-strncat.c \ - test-strstr.c $(test_sy_c_ident_SOURCES) \ + test-strncpy.c test-strstr.c $(test_sy_c_ident_SOURCES) \ $(test_sy_c_whitespace_SOURCES) $(test_sy_java_ident_SOURCES) \ $(test_sy_java_whitespace_SOURCES) test-symlink.c \ test-sys_ioctl-h.c test-sys_select-h.c test-sys_socket-h.c \ @@ -5804,13 +5812,16 @@ GL_GNULIB_ISBLANK_L = @GL_GNULIB_ISBLANK_L@ GL_GNULIB_ISCNTRL_L = @GL_GNULIB_ISCNTRL_L@ GL_GNULIB_ISDIGIT_L = @GL_GNULIB_ISDIGIT_L@ GL_GNULIB_ISFINITE = @GL_GNULIB_ISFINITE@ +GL_GNULIB_ISFINITE_NO_CXX = @GL_GNULIB_ISFINITE_NO_CXX@ GL_GNULIB_ISGRAPH_L = @GL_GNULIB_ISGRAPH_L@ GL_GNULIB_ISINF = @GL_GNULIB_ISINF@ +GL_GNULIB_ISINF_NO_CXX = @GL_GNULIB_ISINF_NO_CXX@ GL_GNULIB_ISLOWER_L = @GL_GNULIB_ISLOWER_L@ GL_GNULIB_ISNAN = @GL_GNULIB_ISNAN@ GL_GNULIB_ISNAND = @GL_GNULIB_ISNAND@ GL_GNULIB_ISNANF = @GL_GNULIB_ISNANF@ GL_GNULIB_ISNANL = @GL_GNULIB_ISNANL@ +GL_GNULIB_ISNAN_NO_CXX = @GL_GNULIB_ISNAN_NO_CXX@ GL_GNULIB_ISPRINT_L = @GL_GNULIB_ISPRINT_L@ GL_GNULIB_ISPUNCT_L = @GL_GNULIB_ISPUNCT_L@ GL_GNULIB_ISSPACE_L = @GL_GNULIB_ISSPACE_L@ @@ -5958,6 +5969,7 @@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OBSTACK_ZPRINTF = @GL_GNULIB_OBSTACK_ZPRINTF@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ +GL_GNULIB_OPENAT2 = @GL_GNULIB_OPENAT2@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ @@ -6039,6 +6051,7 @@ GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ GL_GNULIB_SIGNBIT = @GL_GNULIB_SIGNBIT@ +GL_GNULIB_SIGNBIT_NO_CXX = @GL_GNULIB_SIGNBIT_NO_CXX@ GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ GL_GNULIB_SINF = @GL_GNULIB_SINF@ GL_GNULIB_SINHF = @GL_GNULIB_SINHF@ @@ -6066,8 +6079,10 @@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ GL_GNULIB_STRINGEQ = @GL_GNULIB_STRINGEQ@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ +GL_GNULIB_STRNCPY = @GL_GNULIB_STRNCPY@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ +GL_GNULIB_STRNUL = @GL_GNULIB_STRNUL@ GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ @@ -6582,6 +6597,7 @@ HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@ HAVE_NEWLOCALE = @HAVE_NEWLOCALE@ HAVE_OFF64_T = @HAVE_OFF64_T@ HAVE_OPENAT = @HAVE_OPENAT@ +HAVE_OPENAT2 = @HAVE_OPENAT2@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ HAVE_PIPE = @HAVE_PIPE@ @@ -6739,6 +6755,7 @@ HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_IOCTL_H = @HAVE_SYS_IOCTL_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_PROCESS_H = @HAVE_SYS_PROCESS_H@ HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@ HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ @@ -6839,6 +6856,7 @@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBDL = @LIBDL@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ @@ -7284,6 +7302,7 @@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@ REPLACE_SIGNBIT_USING_BUILTINS = @REPLACE_SIGNBIT_USING_BUILTINS@ REPLACE_SINF = @REPLACE_SINF@ REPLACE_SINHF = @REPLACE_SINHF@ +REPLACE_SINL = @REPLACE_SINL@ REPLACE_SLEEP = @REPLACE_SLEEP@ REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ REPLACE_SPRINTF = @REPLACE_SPRINTF@ @@ -7303,6 +7322,7 @@ REPLACE_STRERROR_L = @REPLACE_STRERROR_L@ REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ REPLACE_STRFTIME = @REPLACE_STRFTIME@ REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNCPY = @REPLACE_STRNCPY@ REPLACE_STRNDUP = @REPLACE_STRNDUP@ REPLACE_STRNLEN = @REPLACE_STRNLEN@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ @@ -7709,30 +7729,31 @@ EXTRA_DIST = w32sock.h test-accept.c signature.h macros.h \ test-strerror_r.c signature.h macros.h test-striconveh.c \ macros.h test-striconveha.c iconvsupport.c macros.h \ test-string-h.c test-strncat.c unistr/test-strncat.h \ - zerosize-ptr.h signature.h macros.h test-strstr.c \ - zerosize-ptr.h signature.h macros.h test-symlink.h \ - test-symlink.c signature.h macros.h sys_ioctl.in.h \ - test-sys_ioctl-h.c sys_select.in.h test-sys_select-h.c \ - signature.h sys_socket.in.h test-sys_socket-h.c macros.h \ - sys_stat.in.h test-sys_stat-h.c sys_time.in.h \ - test-sys_time-h.c test-sys_types-h.c sys_uio.in.h \ - test-sys_uio-h.c init.sh test-init.sh test-thread_self.c \ - test-thread_create.c macros.h test-time-h.c test-time.c \ - signature.h macros.h test-uchar-h.c unicase/test-unicase-h.c \ - unicase/test-cased.c unicase/test-predicate-part1.h \ - unicase/test-predicate-part2.h macros.h \ - unicase/test-ignorable.c unicase/test-predicate-part1.h \ - unicase/test-predicate-part2.h macros.h \ - unicase/test-locale-language.sh unicase/test-locale-language.c \ - macros.h unicase/test-uc_tolower.c \ - unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - macros.h unicase/test-uc_totitle.c \ - unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - macros.h unicase/test-uc_toupper.c \ - unicase/test-mapping-part1.h unicase/test-mapping-part2.h \ - macros.h unicase/test-u16-casecmp.c unicase/test-casecmp.h \ - macros.h unicase/test-u16-casecoll.c unicase/test-casecmp.h \ - macros.h unicase/test-u16-casefold.c macros.h \ + zerosize-ptr.h signature.h macros.h test-strncpy.c \ + zerosize-ptr.h macros.h test-strstr.c zerosize-ptr.h \ + signature.h macros.h test-symlink.h test-symlink.c signature.h \ + macros.h sys_ioctl.in.h test-sys_ioctl-h.c sys_select.in.h \ + test-sys_select-h.c signature.h sys_socket.in.h \ + test-sys_socket-h.c macros.h sys_stat.in.h test-sys_stat-h.c \ + sys_time.in.h test-sys_time-h.c test-sys_types-h.c \ + sys_uio.in.h test-sys_uio-h.c init.sh test-init.sh \ + test-thread_self.c test-thread_create.c macros.h test-time-h.c \ + test-time.c signature.h macros.h test-uchar-h.c \ + unicase/test-unicase-h.c unicase/test-cased.c \ + unicase/test-predicate-part1.h unicase/test-predicate-part2.h \ + macros.h unicase/test-ignorable.c \ + unicase/test-predicate-part1.h unicase/test-predicate-part2.h \ + macros.h unicase/test-locale-language.sh \ + unicase/test-locale-language.c macros.h \ + unicase/test-uc_tolower.c unicase/test-mapping-part1.h \ + unicase/test-mapping-part2.h macros.h \ + unicase/test-uc_totitle.c unicase/test-mapping-part1.h \ + unicase/test-mapping-part2.h macros.h \ + unicase/test-uc_toupper.c unicase/test-mapping-part1.h \ + unicase/test-mapping-part2.h macros.h \ + unicase/test-u16-casecmp.c unicase/test-casecmp.h macros.h \ + unicase/test-u16-casecoll.c unicase/test-casecmp.h macros.h \ + unicase/test-u16-casefold.c macros.h \ unicase/test-u16-is-cased.c unicase/test-is-cased.h macros.h \ unicase/test-u16-is-casefolded.c unicase/test-is-casefolded.h \ macros.h unicase/test-u16-is-lowercase.c \ @@ -11508,6 +11529,10 @@ test-strncat$(EXEEXT): $(test_strncat_OBJECTS) $(test_strncat_DEPENDENCIES) $(EX @rm -f test-strncat$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strncat_OBJECTS) $(test_strncat_LDADD) $(LIBS) +test-strncpy$(EXEEXT): $(test_strncpy_OBJECTS) $(test_strncpy_DEPENDENCIES) $(EXTRA_test_strncpy_DEPENDENCIES) + @rm -f test-strncpy$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_strncpy_OBJECTS) $(test_strncpy_LDADD) $(LIBS) + test-strstr$(EXEEXT): $(test_strstr_OBJECTS) $(test_strstr_DEPENDENCIES) $(EXTRA_test_strstr_DEPENDENCIES) @rm -f test-strstr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strstr_OBJECTS) $(test_strstr_LDADD) $(LIBS) @@ -13443,6 +13468,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-striconveha.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-string-h.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strncat.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strncpy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-strstr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-symlink.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-sys_ioctl-h.Po@am__quote@ # am--include-marker @@ -15610,6 +15636,13 @@ test-strncat.log: test-strncat$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test-strncpy.log: test-strncpy$(EXEEXT) + @p='test-strncpy$(EXEEXT)'; \ + b='test-strncpy'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test-strstr.log: test-strstr$(EXEEXT) @p='test-strstr$(EXEEXT)'; \ b='test-strstr'; \ @@ -19413,6 +19446,7 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/test-striconveha.Po -rm -f ./$(DEPDIR)/test-string-h.Po -rm -f ./$(DEPDIR)/test-strncat.Po + -rm -f ./$(DEPDIR)/test-strncpy.Po -rm -f ./$(DEPDIR)/test-strstr.Po -rm -f ./$(DEPDIR)/test-symlink.Po -rm -f ./$(DEPDIR)/test-sys_ioctl-h.Po @@ -20209,6 +20243,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/test-striconveha.Po -rm -f ./$(DEPDIR)/test-string-h.Po -rm -f ./$(DEPDIR)/test-strncat.Po + -rm -f ./$(DEPDIR)/test-strncpy.Po -rm -f ./$(DEPDIR)/test-strstr.Po -rm -f ./$(DEPDIR)/test-symlink.Po -rm -f ./$(DEPDIR)/test-sys_ioctl-h.Po diff --git a/tests/_Noreturn.h b/tests/_Noreturn.h index d42f15ee..0bab051e 100644 --- a/tests/_Noreturn.h +++ b/tests/_Noreturn.h @@ -1,5 +1,5 @@ /* A C macro for declaring that a function does not return. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/tests/accept.c b/tests/accept.c index e57e218c..d7ec71b5 100644 --- a/tests/accept.c +++ b/tests/accept.c @@ -1,6 +1,6 @@ /* accept.c --- wrappers for Windows accept function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/alloca.c b/tests/alloca.c index 5eb16a9f..aff0c3bb 100644 --- a/tests/alloca.c +++ b/tests/alloca.c @@ -61,11 +61,11 @@ static int stack_dir; /* 1 or -1 once known. */ static int find_stack_direction (int *addr, int depth) { - int dir, dummy = 0; + int dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; + int dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } @@ -140,14 +140,11 @@ alloca (size_t size) /* Allocate combined header + user data storage. */ { - /* Address of header. */ - register header *new; - size_t combined_size = sizeof (header) + size; if (combined_size < sizeof (header)) memory_full (); - new = malloc (combined_size); + register header *new = malloc (combined_size); if (! new) memory_full (); diff --git a/tests/arg-nonnull.h b/tests/arg-nonnull.h index 747bb413..d370d139 100644 --- a/tests/arg-nonnull.h +++ b/tests/arg-nonnull.h @@ -1,5 +1,5 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/tests/arpa_inet.c b/tests/arpa_inet.c index fae7c241..d0ff3a31 100644 --- a/tests/arpa_inet.c +++ b/tests/arpa_inet.c @@ -1,6 +1,6 @@ /* Inline functions for <arpa/inet.h>. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> - #define _GL_ARPA_INET_INLINE _GL_EXTERN_INLINE +#include <config.h> #include <arpa/inet.h> diff --git a/tests/arpa_inet.in.h b/tests/arpa_inet.in.h index d7417bfd..a9c93d07 100644 --- a/tests/arpa_inet.in.h +++ b/tests/arpa_inet.in.h @@ -1,6 +1,6 @@ /* A GNU-like <arpa/inet.h>. - Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -159,7 +159,6 @@ _GL_CXXALIAS_SYS_CAST (inet_ntop, const char *, _GL_CXXALIASWARN (inet_ntop); # endif #elif defined GNULIB_POSIXCHECK -# undef inet_ntop # if HAVE_RAW_DECL_INET_NTOP _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " "use gnulib module inet_ntop for portability"); @@ -190,7 +189,6 @@ _GL_CXXALIAS_SYS (inet_pton, int, _GL_CXXALIASWARN (inet_pton); # endif #elif defined GNULIB_POSIXCHECK -# undef inet_pton # if HAVE_RAW_DECL_INET_PTON _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " "use gnulib module inet_pton for portability"); diff --git a/tests/atomic-int-gnulib.h b/tests/atomic-int-gnulib.h index 73ded1c8..1f70eaf9 100644 --- a/tests/atomic-int-gnulib.h +++ b/tests/atomic-int-gnulib.h @@ -1,5 +1,5 @@ /* Atomic integers. Useful for testing multithreaded locking primitives. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/atomic-int-posix.h b/tests/atomic-int-posix.h index d573e60c..d6400801 100644 --- a/tests/atomic-int-posix.h +++ b/tests/atomic-int-posix.h @@ -1,5 +1,5 @@ /* Atomic integers. Useful for testing multithreaded locking primitives. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/basename-lgpl.c b/tests/basename-lgpl.c index 2aecb0dd..53f3bae5 100644 --- a/tests/basename-lgpl.c +++ b/tests/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2025 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -29,13 +29,11 @@ char * last_component (char const *name) { char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); - char const *p; - bool last_was_slash = false; - while (ISSLASH (*base)) base++; - for (p = base; *p; p++) + bool last_was_slash = false; + for (char const *p = base; *p; p++) { if (ISSLASH (*p)) last_was_slash = true; @@ -53,8 +51,6 @@ size_t base_len (char const *name) { size_t len; - size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); - for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) continue; @@ -62,6 +58,7 @@ base_len (char const *name) && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) return 2; + size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len && len == prefix_len && ISSLASH (name[prefix_len])) return prefix_len + 1; diff --git a/tests/basename-lgpl.h b/tests/basename-lgpl.h index 120bd1cf..fa43cffb 100644 --- a/tests/basename-lgpl.h +++ b/tests/basename-lgpl.h @@ -1,6 +1,6 @@ /* Extract the last component (base name) of a file name. - Copyright (C) 1998, 2001, 2003-2006, 2009-2025 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify diff --git a/tests/binary-io.c b/tests/binary-io.c index d2937b8f..45060f68 100644 --- a/tests/binary-io.c +++ b/tests/binary-io.c @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright 2017-2025 Free Software Foundation, Inc. + Copyright 2017-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -14,9 +14,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> - #define BINARY_IO_INLINE _GL_EXTERN_INLINE +#include <config.h> #include "binary-io.h" #if defined __DJGPP__ || defined __EMX__ diff --git a/tests/binary-io.h b/tests/binary-io.h index 20b9b5d8..37eb3c4b 100644 --- a/tests/binary-io.h +++ b/tests/binary-io.h @@ -1,5 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/bind.c b/tests/bind.c index 2b44963a..73d3d156 100644 --- a/tests/bind.c +++ b/tests/bind.c @@ -1,6 +1,6 @@ /* bind.c --- wrappers for Windows bind function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/btoc32.c b/tests/btoc32.c index 28792cb5..e4ca972d 100644 --- a/tests/btoc32.c +++ b/tests/btoc32.c @@ -1,5 +1,5 @@ /* Convert unibyte character to 32-bit wide character. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -42,11 +42,10 @@ btoc32 (int c) if (c != EOF) { mbstate_t state; - char s[1]; - char32_t wc; - mbszero (&state); + char s[1]; s[0] = (unsigned char) c; + char32_t wc; if (mbrtoc32 (&wc, s, 1, &state) <= 1) return wc; } diff --git a/tests/btowc.c b/tests/btowc.c index 891347de..19b490d1 100644 --- a/tests/btowc.c +++ b/tests/btowc.c @@ -1,5 +1,5 @@ /* Convert unibyte character to wide character. - Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This file is free software: you can redistribute it and/or modify diff --git a/tests/c++defs.h b/tests/c++defs.h index b77979a3..cfe68cb1 100644 --- a/tests/c++defs.h +++ b/tests/c++defs.h @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -127,6 +127,16 @@ #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters,...) \ _GL_EXTERN_C_FUNC __VA_ARGS__ rettype rpl_func parameters +/* _GL_FUNCDECL_SYS_NAME (func) expands to plain func if C++, and to + parenthesized func otherwise. Parenthesization is needed in C23 if + the function is like strchr and so is a qualifier-generic macro + that expands to something more complicated. */ +#ifdef __cplusplus +# define _GL_FUNCDECL_SYS_NAME(func) func +#else +# define _GL_FUNCDECL_SYS_NAME(func) (func) +#endif + /* _GL_FUNCDECL_SYS (func, rettype, parameters, [attributes]); declares the system function, named func, with the given prototype, consisting of return type, parameters, and attributes. @@ -139,7 +149,7 @@ _GL_FUNCDECL_SYS (posix_openpt, int, (int flags), _GL_ATTRIBUTE_NODISCARD); */ #define _GL_FUNCDECL_SYS(func,rettype,parameters,...) \ - _GL_EXTERN_C_FUNC __VA_ARGS__ rettype func parameters + _GL_EXTERN_C_FUNC __VA_ARGS__ rettype _GL_FUNCDECL_SYS_NAME (func) parameters /* _GL_CXXALIAS_RPL (func, rettype, parameters); declares a C++ alias called GNULIB_NAMESPACE::func diff --git a/tests/c32rtomb.c b/tests/c32rtomb.c index 39148146..74d38ed7 100644 --- a/tests/c32rtomb.c +++ b/tests/c32rtomb.c @@ -1,5 +1,5 @@ /* Convert 32-bit wide character to multibyte character. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -26,7 +26,7 @@ #include "attribute.h" /* FALLTHROUGH */ #include "localcharset.h" -#include "streq.h" +#include "streq-opt.h" #if GL_CHAR32_T_IS_UNICODE # include "lc-charset-unicode.h" diff --git a/tests/c32tob.c b/tests/c32tob.c index ecaf3d2a..2424e1ee 100644 --- a/tests/c32tob.c +++ b/tests/c32tob.c @@ -1,5 +1,5 @@ /* Convert 32-bit wide character to unibyte character. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -42,9 +42,9 @@ c32tob (wint_t wc) if (wc != WEOF) { mbstate_t state; - char buf[8]; - mbszero (&state); + + char buf[8]; if (c32rtomb (buf, wc, &state) == 1) return (unsigned char) buf[0]; } diff --git a/tests/calloc.c b/tests/calloc.c index 66ed0cf9..b4ca8f89 100644 --- a/tests/calloc.c +++ b/tests/calloc.c @@ -1,6 +1,6 @@ /* calloc() function that is glibc compatible. This wrapper function is required at least on mingw. - Copyright (C) 2004-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2004-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/cdefs.h b/tests/cdefs.h index 2682c092..42024b20 100644 --- a/tests/cdefs.h +++ b/tests/cdefs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2025 Free Software Foundation, Inc. +/* Copyright (C) 1992-2026 Free Software Foundation, Inc. Copyright The GNU Toolchain Authors. This file is part of the GNU C Library. @@ -24,13 +24,6 @@ # include <features.h> #endif -/* The GNU libc does not support any K&R compilers or the traditional mode - of ISO C compilers anymore. Check for some of the combinations not - supported anymore. */ -#if defined __GNUC__ && !defined __STDC__ -# error "You need a ISO C conforming compiler to use the glibc headers" -#endif - /* Some user header file might have defined this before. */ #undef __P #undef __PMT @@ -100,6 +93,12 @@ # endif # endif +# if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__) +# define __COLD __attribute__ ((__cold__)) +# else +# define __COLD +# endif + #else /* Not GCC or clang. */ # if (defined __cplusplus \ @@ -112,6 +111,7 @@ # define __THROW # define __THROWNL # define __NTH(fct) fct +# define __COLD #endif /* GCC || clang. */ @@ -140,38 +140,47 @@ #endif +/* The overloadable attribute was added on clang 2.6. */ +#if defined __clang_major__ \ + && (__clang_major__ + (__clang_minor__ >= 6) > 2) +# define __attribute_overloadable__ __attribute__((__overloadable__)) +#else +# define __attribute_overloadable__ +#endif + /* Gnulib avoids these definitions, as they don't work on non-glibc platforms. In particular, __bos and __bos0 are defined differently in the Android libc. */ #ifndef __GNULIB_CDEFS /* Fortify support. */ -# define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) -# define __bos0(ptr) __builtin_object_size (ptr, 0) +#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +#define __bos0(ptr) __builtin_object_size (ptr, 0) /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ -# if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ - || __GNUC_PREREQ (12, 0)) -# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) -# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) -# else -# define __glibc_objsize0(__o) __bos0 (__o) -# define __glibc_objsize(__o) __bos (__o) -# endif +#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ + || __GNUC_PREREQ (12, 0)) +# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) +# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) +#else +# define __glibc_objsize0(__o) __bos0 (__o) +# define __glibc_objsize(__o) __bos (__o) +#endif +#if __USE_FORTIFY_LEVEL > 0 /* Compile time conditions to choose between the regular, _chk and _chk_warn variants. These conditions should get evaluated to constant and optimized away. */ -# define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) -# define __glibc_unsigned_or_positive(__l) \ +#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) +#define __glibc_unsigned_or_positive(__l) \ ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ || (__builtin_constant_p (__l) && (__l) > 0)) /* Length is known to be safe at compile time if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is true, or unknown (-1) */ -# define __glibc_safe_or_unknown_len(__l, __s, __osz) \ - ((__osz) == (__SIZE_TYPE__) -1 \ +#define __glibc_safe_or_unknown_len(__l, __s, __osz) \ + ((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \ || (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ (__s), (__osz))) \ @@ -180,34 +189,179 @@ /* Conversely, we know at compile time that the length is unsafe if the __L * __S <= __OBJSZ condition can be folded to a constant and if it is false. */ -# define __glibc_unsafe_len(__l, __s, __osz) \ +#define __glibc_unsafe_len(__l, __s, __osz) \ (__glibc_unsigned_or_positive (__l) \ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ __s, __osz)) \ && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) +/* To correctly instrument the fortify wrapper clang requires the + pass_object_size attribute, and the attribute has the restriction that the + argument needs to be 'const'. Furthermore, to make it usable with C + interfaces, clang provides the overload attribute, which provides a C++ + like function overload support. The overloaded fortify wrapper with the + pass_object_size attribute has precedence over the default symbol. + + Also, clang does not support __va_arg_pack, so variadic functions are + expanded to issue va_arg implementations. The error function must not have + bodies (address takes are expanded to nonfortified calls), and with + __fortify_function compiler might still create a body with the C++ + mangling name (due to the overload attribute). In this case, the function + is defined with __fortify_function_error_function macro instead. + + The argument size check is also done with a clang-only attribute, + __attribute__ ((__diagnose_if__ (...))), different than gcc which calls + symbol_chk_warn alias with uses __warnattr attribute. + + The pass_object_size was added on clang 4.0, __diagnose_if__ on 5.0, + and pass_dynamic_object_size on 9.0. */ +#if defined __clang_major__ && __clang_major__ >= 5 +# define __fortify_use_clang 1 + +# define __fortify_function_error_function static __attribute__((__unused__)) + +# define __fortify_clang_pass_object_size_n(n) \ + __attribute__ ((__pass_object_size__ (n))) +# define __fortify_clang_pass_object_size0 \ + __fortify_clang_pass_object_size_n (0) +# define __fortify_clang_pass_object_size \ + __fortify_clang_pass_object_size_n (__USE_FORTIFY_LEVEL > 1) + +# if __clang_major__ >= 9 +# define __fortify_clang_pass_dynamic_object_size_n(n) \ + __attribute__ ((__pass_dynamic_object_size__ (n))) +# define __fortify_clang_pass_dynamic_object_size0 \ + __fortify_clang_pass_dynamic_object_size_n (0) +# define __fortify_clang_pass_dynamic_object_size \ + __fortify_clang_pass_dynamic_object_size_n (1) +# else +# define __fortify_clang_pass_dynamic_object_size_n(n) +# define __fortify_clang_pass_dynamic_object_size0 +# define __fortify_clang_pass_dynamic_object_size +# endif + +# define __fortify_clang_bos_static_lt_impl(bos_val, n, s) \ + ((bos_val) != -1ULL && (n) > (bos_val) / (s)) +# define __fortify_clang_bos_static_lt2(__n, __e, __s) \ + __fortify_clang_bos_static_lt_impl (__bos (__e), __n, __s) +# define __fortify_clang_bos_static_lt(__n, __e) \ + __fortify_clang_bos_static_lt2 (__n, __e, 1) +# define __fortify_clang_bos0_static_lt2(__n, __e, __s) \ + __fortify_clang_bos_static_lt_impl (__bos0 (__e), __n, __s) +# define __fortify_clang_bos0_static_lt(__n, __e) \ + __fortify_clang_bos0_static_lt2 (__n, __e, 1) + +# define __fortify_clang_bosn_args(bos_fn, n, buf, div, complaint) \ + (__fortify_clang_bos_static_lt_impl (bos_fn (buf), n, div)), (complaint), \ + "warning" + +# define __fortify_clang_warning(__c, __msg) \ + __attribute__ ((__diagnose_if__ ((__c), (__msg), "warning"))) +# define __fortify_clang_error(__c, __msg) \ + __attribute__ ((__diagnose_if__ ((__c), (__msg), "error"))) +# define __fortify_clang_warning_only_if_bos0_lt(n, buf, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos0, n, buf, 1, complaint)))) +# define __fortify_clang_warning_only_if_bos0_lt2(n, buf, div, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos0, n, buf, div, complaint)))) +# define __fortify_clang_warning_only_if_bos_lt(n, buf, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos, n, buf, 1, complaint)))) +# define __fortify_clang_warning_only_if_bos_lt2(n, buf, div, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos, n, buf, div, complaint)))) + +# define __fortify_clang_prefer_this_overload \ + __attribute__ ((enable_if (1, ""))) +# define __fortify_clang_unavailable(__msg) \ + __attribute__ ((unavailable(__msg))) + +# if __USE_FORTIFY_LEVEL == 3 +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_dynamic_object_size __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_dynamic_object_size0 __name +# else +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_object_size __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_object_size0 __name +# endif + +# define __fortify_clang_mul_may_overflow(size, n) \ + ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2))) + +# define __fortify_clang_size_too_small(__bos, __dest, __len) \ + (__bos (__dest) != (size_t) -1 && __bos (__dest) < __len) +# define __fortify_clang_warn_if_src_too_large(__dest, __src) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \ + __dest, \ + __builtin_strlen (__src) + 1), \ + "destination buffer will always be overflown by source") +# define __fortify_clang_warn_if_dest_too_small(__dest, __len) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \ + __dest, \ + __len), \ + "function called with bigger length than the destination buffer") +# define __fortify_clang_warn_if_dest_too_small0(__dest, __len) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize0, \ + __dest, \ + __len), \ + "function called with bigger length than the destination buffer") +#else +# define __fortify_use_clang 0 +# define __fortify_clang_warning(__c, __msg) +# define __fortify_clang_warning_only_if_bos0_lt(__n, __buf, __complaint) +# define __fortify_clang_warning_only_if_bos0_lt2(__n, __buf, __div, complaint) +# define __fortify_clang_warning_only_if_bos_lt(__n, __buf, __complaint) +# define __fortify_clang_warning_only_if_bos_lt2(__n, __buf, div, __complaint) +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __fortify_clang_overload_arg (__type, __attr, __name) +# define __fortify_clang_warn_if_src_too_large(__dest, __src) +# define __fortify_clang_warn_if_dest_too_small(__dest, __len) +# define __fortify_clang_warn_if_dest_too_small0(__dest, __len) +#endif + + /* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be declared. */ +#if !__fortify_use_clang # define __glibc_fortify(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ - : __ ## f ## _chk (__VA_ARGS__, __osz))) \ + : __ ## f ## _chk (__VA_ARGS__, __osz))) +#else +# define __glibc_fortify(f, __l, __s, __osz, ...) \ + (__osz == (__SIZE_TYPE__) -1) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : __ ## f ## _chk (__VA_ARGS__, __osz) +#endif /* Fortify function f, where object size argument passed to f is the number of elements and not total size. */ +#if !__fortify_use_clang # define __glibc_fortify_n(f, __l, __s, __osz, ...) \ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ? __ ## f ## _alias (__VA_ARGS__) \ : (__glibc_unsafe_len (__l, __s, __osz) \ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ - : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ - + : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) +# else +# define __glibc_fortify_n(f, __l, __s, __osz, ...) \ + (__osz == (__SIZE_TYPE__) -1) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)) #endif +#endif /* __USE_FORTIFY_LEVEL > 0 */ +#endif /* !__GNULIB_CDEFS */ #if __GNUC_PREREQ (4,3) # define __warnattr(msg) __attribute__((__warning__ (msg))) @@ -269,6 +423,14 @@ # define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) # define __ASMNAME2(prefix, cname) __STRING (prefix) cname +#ifndef __REDIRECT_FORTIFY +#define __REDIRECT_FORTIFY __REDIRECT +#endif + +#ifndef __REDIRECT_FORTIFY_NTH +#define __REDIRECT_FORTIFY_NTH __REDIRECT_NTH +#endif + /* #elif __SOME_OTHER_COMPILER__ @@ -277,10 +439,10 @@ */ #endif -/* GCC and clang have various useful declarations that can be made with - the '__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !(defined __GNUC__ || defined __clang__) +/* GCC, clang, and compatible compilers have various useful declarations + that can be made with the '__attribute__' syntax. All of the ways we use + this do fine if they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__) # define __attribute__(xyz) /* Ignore */ #endif @@ -445,14 +607,14 @@ # define __attribute_artificial__ /* Ignore */ #endif -/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 - inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ - or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions +/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline + semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ or + __GNUC_GNU_INLINE__ is not a good enough check for gcc because gcc versions older than 4.3 may define these macros and still not guarantee GNU inlining semantics. clang++ identifies itself as gcc-4.2, but has support for GNU inlining - semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and + semantics, that can be checked for by using the __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ macro definitions. */ #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ @@ -577,6 +739,8 @@ # define __LDBL_REDIR(name, proto) ... unused__ldbl_redir # define __LDBL_REDIR_DECL(name) \ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); +# define __REDIRECT_LDBL(name, proto, alias) \ + name proto __asm (__ASMNAME ("__" #alias "ieee128")) /* Alias name defined automatically, with leading underscores. */ # define __LDBL_REDIR2_DECL(name) \ @@ -594,7 +758,6 @@ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) /* Unused. */ -# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl # define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth # else @@ -666,6 +829,18 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __HAVE_GENERIC_SELECTION 0 #endif +#if __HAVE_GENERIC_SELECTION +/* If PTR is a pointer to const, return CALL cast to type CTYPE, + otherwise return CALL. Pointers to types with non-const qualifiers + are not valid. This should not be defined for C++, as macros are + not an appropriate way of implementing such qualifier-generic + operations for C++. */ +# define __glibc_const_generic(PTR, CTYPE, CALL) \ + _Generic (0 ? (PTR) : (void *) 1, \ + const void *: (CTYPE) (CALL), \ + default: CALL) +#endif + #if __GNUC_PREREQ (10, 0) /* Designates a 1-based positional argument ref-index of pointer type that can be used to access size-index elements of the pointed-to @@ -675,10 +850,10 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __attr_access(x) __attribute__ ((__access__ x)) /* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may use the access attribute to get object sizes from function definition - arguments, so we can't use them on functions we fortify. Drop the object - size hints for such functions. */ + arguments, so we can't use them on functions we fortify. Drop the access + attribute for such functions. */ # if __USE_FORTIFY_LEVEL == 3 -# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o))) +# define __fortified_attr_access(a, o, s) # else # define __fortified_attr_access(a, o, s) __attr_access ((a, o, s)) # endif @@ -712,4 +887,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __attribute_returns_twice__ /* Ignore. */ #endif +/* Mark struct types as aliasable. Restricted to compilers that + support forward declarations of structs in the presence of the + attribute. */ +#if __GNUC_PREREQ (7, 1) || defined __clang__ +# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__)) +#else +# define __attribute_struct_may_alias__ +#endif + #endif /* sys/cdefs.h */ diff --git a/tests/cloexec.c b/tests/cloexec.c index 8ab5591f..3d4f916b 100644 --- a/tests/cloexec.c +++ b/tests/cloexec.c @@ -1,6 +1,6 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/cloexec.h b/tests/cloexec.h index 0eb9fa09..3716bd72 100644 --- a/tests/cloexec.h +++ b/tests/cloexec.h @@ -1,6 +1,6 @@ /* cloexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/close.c b/tests/close.c index 3bcfc479..86ccdf9a 100644 --- a/tests/close.c +++ b/tests/close.c @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/concat-filename.c b/tests/concat-filename.c index 3524f4e4..7fb15aee 100644 --- a/tests/concat-filename.c +++ b/tests/concat-filename.c @@ -1,5 +1,5 @@ /* Construct a full filename from a directory and a relative filename. - Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/concat-filename.h b/tests/concat-filename.h index 358238b5..1c961451 100644 --- a/tests/concat-filename.h +++ b/tests/concat-filename.h @@ -1,5 +1,5 @@ /* Construct a full filename from a directory and a relative filename. - Copyright (C) 2001-2004, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/connect.c b/tests/connect.c index 6bdf8f86..101047b6 100644 --- a/tests/connect.c +++ b/tests/connect.c @@ -1,6 +1,6 @@ /* connect.c --- wrappers for Windows connect function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/ctype.in.h b/tests/ctype.in.h index f0e62395..e57c2705 100644 --- a/tests/ctype.in.h +++ b/tests/ctype.in.h @@ -1,6 +1,6 @@ /* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -80,7 +80,6 @@ _GL_CXXALIAS_SYS (isalnum_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isalnum_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isalnum_l # if HAVE_RAW_DECL_ISALNUM_L _GL_WARN_ON_USE (isalnum_l, "isalnum_l is unportable - " "use gnulib module isalnum_l for portability"); @@ -98,7 +97,6 @@ _GL_CXXALIAS_SYS (isalpha_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isalpha_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isalpha_l # if HAVE_RAW_DECL_ISALPHA_L _GL_WARN_ON_USE (isalpha_l, "isalpha_l is unportable - " "use gnulib module isalpha_l for portability"); @@ -111,7 +109,6 @@ _GL_WARN_ON_USE (isalpha_l, "isalpha_l is unportable - " _GL_EXTERN_C int isblank (int c); # endif #elif defined GNULIB_POSIXCHECK -# undef isblank # if HAVE_RAW_DECL_ISBLANK _GL_WARN_ON_USE (isblank, "isblank is unportable - " "use gnulib module isblank for portability"); @@ -129,7 +126,6 @@ _GL_CXXALIAS_SYS (isblank_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isblank_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isblank_l # if HAVE_RAW_DECL_ISBLANK_L _GL_WARN_ON_USE (isblank_l, "isblank_l is unportable - " "use gnulib module isblank_l for portability"); @@ -147,7 +143,6 @@ _GL_CXXALIAS_SYS (iscntrl_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (iscntrl_l); # endif #elif defined GNULIB_POSIXCHECK -# undef iscntrl_l # if HAVE_RAW_DECL_ISCNTRL_L _GL_WARN_ON_USE (iscntrl_l, "iscntrl_l is unportable - " "use gnulib module iscntrl_l for portability"); @@ -165,7 +160,6 @@ _GL_CXXALIAS_SYS (isdigit_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isdigit_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isdigit_l # if HAVE_RAW_DECL_ISDIGIT_L _GL_WARN_ON_USE (isdigit_l, "isdigit_l is unportable - " "use gnulib module isdigit_l for portability"); @@ -183,7 +177,6 @@ _GL_CXXALIAS_SYS (isgraph_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isgraph_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isgraph_l # if HAVE_RAW_DECL_ISGRAPH_L _GL_WARN_ON_USE (isgraph_l, "isgraph_l is unportable - " "use gnulib module isgraph_l for portability"); @@ -201,7 +194,6 @@ _GL_CXXALIAS_SYS (islower_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (islower_l); # endif #elif defined GNULIB_POSIXCHECK -# undef islower_l # if HAVE_RAW_DECL_ISLOWER_L _GL_WARN_ON_USE (islower_l, "islower_l is unportable - " "use gnulib module islower_l for portability"); @@ -219,7 +211,6 @@ _GL_CXXALIAS_SYS (isprint_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isprint_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isprint_l # if HAVE_RAW_DECL_ISPRINT_L _GL_WARN_ON_USE (isprint_l, "isprint_l is unportable - " "use gnulib module isprint_l for portability"); @@ -237,7 +228,6 @@ _GL_CXXALIAS_SYS (ispunct_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (ispunct_l); # endif #elif defined GNULIB_POSIXCHECK -# undef ispunct_l # if HAVE_RAW_DECL_ISPUNCT_L _GL_WARN_ON_USE (ispunct_l, "ispunct_l is unportable - " "use gnulib module ispunct_l for portability"); @@ -255,7 +245,6 @@ _GL_CXXALIAS_SYS (isspace_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isspace_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isspace_l # if HAVE_RAW_DECL_ISSPACE_L _GL_WARN_ON_USE (isspace_l, "isspace_l is unportable - " "use gnulib module isspace_l for portability"); @@ -273,7 +262,6 @@ _GL_CXXALIAS_SYS (isupper_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isupper_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isupper_l # if HAVE_RAW_DECL_ISUPPER_L _GL_WARN_ON_USE (isupper_l, "isupper_l is unportable - " "use gnulib module isupper_l for portability"); @@ -291,7 +279,6 @@ _GL_CXXALIAS_SYS (isxdigit_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (isxdigit_l); # endif #elif defined GNULIB_POSIXCHECK -# undef isxdigit_l # if HAVE_RAW_DECL_ISXDIGIT_L _GL_WARN_ON_USE (isxdigit_l, "isxdigit_l is unportable - " "use gnulib module isxdigit_l for portability"); @@ -309,7 +296,6 @@ _GL_CXXALIAS_SYS (tolower_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (tolower_l); # endif #elif defined GNULIB_POSIXCHECK -# undef tolower_l # if HAVE_RAW_DECL_TOLOWER_L _GL_WARN_ON_USE (tolower_l, "tolower_l is unportable - " "use gnulib module tolower_l for portability"); @@ -327,7 +313,6 @@ _GL_CXXALIAS_SYS (toupper_l, int, (int c, locale_t locale)); _GL_CXXALIASWARN (toupper_l); # endif #elif defined GNULIB_POSIXCHECK -# undef toupper_l # if HAVE_RAW_DECL_TOUPPER_L _GL_WARN_ON_USE (toupper_l, "toupper_l is unportable - " "use gnulib module toupper_l for portability"); diff --git a/tests/dup2.c b/tests/dup2.c index 69b37196..b9a55263 100644 --- a/tests/dup2.c +++ b/tests/dup2.c @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -70,8 +70,6 @@ dup2_nothrow (int fd, int desired_fd) static int ms_windows_dup2 (int fd, int desired_fd) { - int result; - /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, dup2 (fd, fd) returns 0, but all further attempts to use fd in future dup2 calls will hang. */ @@ -93,7 +91,7 @@ ms_windows_dup2 (int fd, int desired_fd) return -1; } - result = dup2_nothrow (fd, desired_fd); + int result = dup2_nothrow (fd, desired_fd); if (result == 0) result = desired_fd; @@ -110,14 +108,11 @@ ms_windows_dup2 (int fd, int desired_fd) static int klibc_dup2dirfd (int fd, int desired_fd) { - int tempfd; - int dupfd; - - tempfd = open ("NUL", O_RDONLY); - if (tempfd == -1) - return -1; + int tempfd = open ("NUL", O_RDONLY); + if (tempfd < 0) + return tempfd; - if (tempfd == desired_fd) + if (tempfd >= desired_fd) { close (tempfd); @@ -125,10 +120,32 @@ klibc_dup2dirfd (int fd, int desired_fd) if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) return -1; - return open(path, O_RDONLY); + for (;;) + { + close (desired_fd); + + int dupfd = open (path, O_RDONLY); + if (dupfd < 0) + return dupfd; + + if (dupfd == desired_fd) + return dupfd; + + /* If lower FD was closed by other threads, fill again. */ + if (dupfd < desired_fd) + { + tempfd = dupfd; + break; + } + + /* desired_fd was opened by other threads. Try again. */ + /* FIXME: Closing desired_fd opened by other threads may lead to + unexpected behavior. */ + close (dupfd); + } } - dupfd = klibc_dup2dirfd (fd, desired_fd); + int dupfd = klibc_dup2dirfd (fd, desired_fd); close (tempfd); @@ -138,16 +155,16 @@ klibc_dup2dirfd (int fd, int desired_fd) static int klibc_dup2 (int fd, int desired_fd) { - int dupfd; - struct stat sbuf; - - dupfd = dup2 (fd, desired_fd); - if (dupfd == -1 && errno == ENOTSUP \ - && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + int dupfd = dup2 (fd, desired_fd); + if (dupfd < 0 && errno == ENOTSUP) { - close (desired_fd); + struct stat sbuf; + if (!fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + close (desired_fd); - return klibc_dup2dirfd (fd, desired_fd); + return klibc_dup2dirfd (fd, desired_fd); + } } return dupfd; @@ -159,8 +176,6 @@ klibc_dup2 (int fd, int desired_fd) int rpl_dup2 (int fd, int desired_fd) { - int result; - #ifdef F_GETFL /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. On Cygwin 1.5.x, dup2 (1, 1) returns 0. @@ -176,13 +191,14 @@ rpl_dup2 (int fd, int desired_fd) return fcntl (fd, F_GETFL) == -1 ? -1 : fd; #endif - result = dup2 (fd, desired_fd); + int result = dup2 (fd, desired_fd); /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ - if (result == -1 && errno == EMFILE) + if (result < 0 && errno == EMFILE) errno = EBADF; + #if REPLACE_FCHDIR - if (fd != desired_fd && result != -1) + if (! (result < 0 || fd == desired_fd)) result = _gl_register_dup (fd, result); #endif return result; diff --git a/tests/error.c b/tests/error.c index ab4c38f3..e066241b 100644 --- a/tests/error.c +++ b/tests/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-2025 Free Software Foundation, Inc. + Copyright (C) 1990-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/tests/error.in.h b/tests/error.in.h index 6c512ec8..3355fb3b 100644 --- a/tests/error.in.h +++ b/tests/error.in.h @@ -1,5 +1,5 @@ /* Declarations for error-reporting functions. - Copyright (C) 1995-1997, 2003, 2006, 2008-2025 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/tests/exitfail.c b/tests/exitfail.c index 5b37c10b..148468b7 100644 --- a/tests/exitfail.c +++ b/tests/exitfail.c @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/exitfail.h b/tests/exitfail.h index 9d6b1528..64e2aa33 100644 --- a/tests/exitfail.h +++ b/tests/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/fcntl.c b/tests/fcntl.c index f47ebde1..1c0e52d2 100644 --- a/tests/fcntl.c +++ b/tests/fcntl.c @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -29,8 +29,8 @@ #include <unistd.h> #ifdef __KLIBC__ -# define INCL_DOS -# include <os2.h> +# include <emx/io.h> +# include <InnoTekLIBC/backend.h> #endif #if defined _WIN32 && ! defined __CYGWIN__ @@ -56,19 +56,15 @@ dupfd (int oldfd, int newfd, int flags) { /* Mingw has no way to create an arbitrary fd. Iterate until all file descriptors less than newfd are filled up. */ - HANDLE curr_process = GetCurrentProcess (); - HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd); - unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT]; - unsigned int fds_to_close_bound = 0; - int result; - BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE; - int mode; if (newfd < 0 || getdtablesize () <= newfd) { errno = EINVAL; return -1; } + + HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd); + int mode; if (old_handle == INVALID_HANDLE_VALUE || (mode = _setmode (oldfd, O_BINARY)) == -1) { @@ -80,6 +76,11 @@ dupfd (int oldfd, int newfd, int flags) _setmode (oldfd, mode); flags |= mode; + HANDLE curr_process = GetCurrentProcess (); + BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE; + unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT]; + unsigned int fds_to_close_bound = 0; + int result; for (;;) { HANDLE new_handle; @@ -146,9 +147,8 @@ dupfd (int oldfd, int newfd, int flags) /* Close the previous fds that turned out to be too small. */ { int saved_errno = errno; - unsigned int duplicated_fd; - for (duplicated_fd = 0; + for (unsigned int duplicated_fd = 0; duplicated_fd < fds_to_close_bound * CHAR_BIT; duplicated_fd++) if ((fds_to_close[duplicated_fd / CHAR_BIT] @@ -206,8 +206,9 @@ fcntl (int fd, int action, /* arg */...) #endif { va_list arg; - int result = -1; va_start (arg, action); + + int result = -1; switch (action) { case F_DUPFD: @@ -433,7 +434,9 @@ fcntl (int fd, int action, /* arg */...) break; } } + va_end (arg); + return result; } @@ -540,78 +543,115 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target) #undef fcntl #ifdef __KLIBC__ - static int -klibc_fcntl (int fd, int action, /* arg */...) +klibc_dupdirfd (int fd, int minfd) { - va_list arg_ptr; - int arg; - struct stat sbuf; - int result; + int tempfd = open ("NUL", O_RDONLY); + if (tempfd == -1) + return -1; - va_start (arg_ptr, action); - arg = va_arg (arg_ptr, int); - result = fcntl (fd, action, arg); - /* EPERM for F_DUPFD, ENOTSUP for others */ - if (result == -1 && (errno == EPERM || errno == ENOTSUP) - && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + if (tempfd >= minfd) { - ULONG ulMode; + close (tempfd); - switch (action) - { - case F_DUPFD: - /* Find available fd */ - while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) - arg++; + char path[_MAX_PATH]; + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return -1; - result = dup2 (fd, arg); - break; + int dupfd = open (path, O_RDONLY); + if (dupfd == -1) + return -1; - /* Using underlying APIs is right ? */ - case F_GETFD: - if (DosQueryFHState (fd, &ulMode)) - break; + if (dupfd >= minfd) + return dupfd; - result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; - break; - - case F_SETFD: - if (arg & ~FD_CLOEXEC) - break; - - if (DosQueryFHState (fd, &ulMode)) - break; - - if (arg & FD_CLOEXEC) - ulMode |= OPEN_FLAGS_NOINHERIT; - else - ulMode &= ~OPEN_FLAGS_NOINHERIT; + /* Lower FD was closed by other threads. Fill again. */ + tempfd = dupfd; + } - /* Filter supported flags. */ - ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR - | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + int dupfd = klibc_dupdirfd (fd, minfd); - if (DosSetFHState (fd, ulMode)) - break; + close (tempfd); - result = 0; - break; + return dupfd; +} - case F_GETFL: - result = 0; - break; +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + va_start (arg_ptr, action); - case F_SETFL: - if (arg != 0) - break; + int arg = va_arg (arg_ptr, int); + int result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP)) + { + struct stat sbuf; + if (!fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + switch (action) + { + case F_DUPFD: + result = klibc_dupdirfd (fd, arg); + break; + + case F_GETFD: + { + PLIBCFH pFH = __libc_FH (fd); + if (!pFH) + { + errno = EBADF; + break; + } + + result = (pFH->fFlags & ((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT ) + | O_NOINHERIT)) ? FD_CLOEXEC : 0; + } + break; + + case F_SETFD: + { + if (arg & ~FD_CLOEXEC) + break; + + PLIBCFH pFH = __libc_FH (fd); + if (!pFH) + { + errno = EBADF; + break; + } + + unsigned fFlags = pFH->fFlags; + if (arg & FD_CLOEXEC) + fFlags |= (FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT; + else + fFlags &= ~((FD_CLOEXEC << __LIBC_FH_FDFLAGS_SHIFT) | O_NOINHERIT); + + result = __libc_FHSetFlags (pFH, fd, fFlags); + if (result < 0) + { + errno = -result; + result = -1; + } + } + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; - result = 0; - break; + result = 0; + break; - default: - errno = EINVAL; - break; + default: + errno = EINVAL; + break; + } } } diff --git a/tests/fd-hook.c b/tests/fd-hook.c index 4a5014eb..eef4e81e 100644 --- a/tests/fd-hook.c +++ b/tests/fd-hook.c @@ -1,5 +1,5 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This file is free software: you can redistribute it and/or modify diff --git a/tests/fd-hook.h b/tests/fd-hook.h index a960eaf3..0f029d42 100644 --- a/tests/fd-hook.h +++ b/tests/fd-hook.h @@ -1,5 +1,5 @@ /* Hook for making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/fdopen.c b/tests/fdopen.c index 5476532a..29da9857 100644 --- a/tests/fdopen.c +++ b/tests/fdopen.c @@ -1,5 +1,5 @@ /* Open a stream with a given file descriptor. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -57,10 +57,9 @@ FILE * rpl_fdopen (int fd, const char *mode) { int saved_errno = errno; - FILE *fp; errno = 0; - fp = fdopen_nothrow (fd, mode); + FILE *fp = fdopen_nothrow (fd, mode); if (fp == NULL) { if (errno == 0) diff --git a/tests/filename.h b/tests/filename.h index e353363e..e37a373e 100644 --- a/tests/filename.h +++ b/tests/filename.h @@ -1,5 +1,5 @@ /* Basic filename support macros. - Copyright (C) 2001-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -49,7 +49,10 @@ extern "C" { any notion of "current directory". IS_RELATIVE_FILE_NAME(Filename) tests whether Filename may be concatenated - to a directory filename. + to a directory filename to yield the name + of a file relative to that directory. + Watch out: IS_RELATIVE_FILE_NAME ("") is 1 + even though "" is not a relative file name. Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a relative file name! IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device diff --git a/tests/fstat.c b/tests/fstat.c index e219cf99..292ce75f 100644 --- a/tests/fstat.c +++ b/tests/fstat.c @@ -1,5 +1,5 @@ /* fstat() replacement. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/ftruncate.c b/tests/ftruncate.c index ca19f21e..8e8bad8d 100644 --- a/tests/ftruncate.c +++ b/tests/ftruncate.c @@ -1,5 +1,5 @@ /* ftruncate emulations for native Windows. - Copyright (C) 1992-2025 Free Software Foundation, Inc. + Copyright (C) 1992-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -96,14 +96,13 @@ SetFileSize (HANDLE h, LONGLONG size) static char zero_bytes[1024]; LONG pos_hi = 0; LONG pos_lo = SetFilePointer (tmph, (LONG) 0, &pos_hi, FILE_END); - LONGLONG pos; if (pos_lo == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { CloseHandle (tmph); return FALSE; } - pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo; + LONGLONG pos = ((LONGLONG) pos_hi << 32) | (ULONGLONG) (ULONG) pos_lo; while (pos < size) { DWORD written; diff --git a/tests/getcwd-lgpl.c b/tests/getcwd-lgpl.c index 155cf33f..dacafb91 100644 --- a/tests/getcwd-lgpl.c +++ b/tests/getcwd-lgpl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2025 Free Software Foundation, Inc. +/* Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is part of gnulib. This file is free software: you can redistribute it and/or modify @@ -45,8 +45,6 @@ typedef int dummy; char * rpl_getcwd (char *buf, size_t size) { - char *result; - /* Handle single size operations. */ if (buf) { @@ -67,7 +65,7 @@ rpl_getcwd (char *buf, size_t size) errno = ENOMEM; return NULL; } - result = getcwd (buf, size); + char *result = getcwd (buf, size); if (!result) free (buf); return result; @@ -82,7 +80,7 @@ rpl_getcwd (char *buf, size_t size) char *ptr = getcwd (tmp, size); if (ptr) { - result = strdup (ptr); + char *result = strdup (ptr); if (!result) errno = ENOMEM; return result; @@ -92,6 +90,7 @@ rpl_getcwd (char *buf, size_t size) } /* My what a large directory name we have. */ + char *result; do { size <<= 1; diff --git a/tests/getdtablesize.c b/tests/getdtablesize.c index b98fbb70..cc823952 100644 --- a/tests/getdtablesize.c +++ b/tests/getdtablesize.c @@ -1,5 +1,5 @@ /* getdtablesize() function: Return maximum possible file descriptor value + 1. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This file is free software: you can redistribute it and/or modify @@ -61,13 +61,10 @@ getdtablesize (void) { /* We are looking for the number N such that the valid file descriptors are 0..N-1. It can be obtained through a loop as follows: - { - int fd; - for (fd = 3; fd < 65536; fd++) - if (dup2 (0, fd) == -1) - break; - return fd; - } + for (int fd = 3; fd < 65536; fd++) + if (dup2 (0, fd) == -1) + break; + return fd; On Windows XP, the result is 2048. The drawback of this loop is that it allocates memory for a libc internal array that is never freed. diff --git a/tests/getprogname.c b/tests/getprogname.c index 4da2159f..8eec96c5 100644 --- a/tests/getprogname.c +++ b/tests/getprogname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2025 Free Software Foundation, Inc. + Copyright (C) 2016-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -188,7 +188,6 @@ getprogname (void) if (first) { pid_t pid = getpid (); - int token; W_PSPROC buf; first = 0; memset (&buf, 0, sizeof(buf)); @@ -197,7 +196,8 @@ getprogname (void) buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) { - for (token = 0; token >= 0; + for (int token = 0; + token >= 0; token = w_getpsent (token, &buf, sizeof(buf))) { if (token > 0 && buf.ps_pid == pid) @@ -228,27 +228,20 @@ getprogname (void) return p; # elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */ char buf[80]; - int fd; sprintf (buf, "/proc/%d/cmdline", getpid()); - fd = open (buf, O_RDONLY); + int fd = open (buf, O_RDONLY); if (0 <= fd) { size_t n = read (fd, buf, 79); if (n > 0) { buf[n] = '\0'; /* Guarantee null-termination */ - char *progname; - progname = strrchr (buf, '/'); + char *progname = strrchr (buf, '/'); if (progname) - { - progname = progname + 1; /* Skip the '/' */ - } + progname = progname + 1; /* Skip the '/' */ else - { - progname = buf; - } - char *ret; - ret = malloc (strlen (progname) + 1); + progname = buf; + char *ret = malloc (strlen (progname) + 1); if (ret) { strcpy (ret, progname); diff --git a/tests/getprogname.h b/tests/getprogname.h index ee9bb286..3b5e502e 100644 --- a/tests/getprogname.h +++ b/tests/getprogname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2016-2025 Free Software Foundation, Inc. + Copyright (C) 2016-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/tests/gettext.h b/tests/gettext.h index 0650abc9..0291cf09 100644 --- a/tests/gettext.h +++ b/tests/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-2025 Free Software Foundation, Inc. + Copyright (C) 1995-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -298,12 +298,11 @@ dcpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { - int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); - found_translation = (translation != msg_ctxt_id); + int found_translation = (translation != msg_ctxt_id); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); @@ -346,12 +345,11 @@ dcnpgettext_expr (const char *domain, if (msg_ctxt_id != NULL) #endif { - int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); - found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); + int found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); diff --git a/tests/gettimeofday.c b/tests/gettimeofday.c index 304e23b2..f236c427 100644 --- a/tests/gettimeofday.c +++ b/tests/gettimeofday.c @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -92,12 +92,12 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz) microseconds. More discussion on this topic: <http://www.windowstimestamp.com/description>. */ - FILETIME current_time; - # if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8) if (!initialized) initialize (); # endif + + FILETIME current_time; if (GetSystemTimePreciseAsFileTimeFunc != NULL) GetSystemTimePreciseAsFileTimeFunc (¤t_time); else diff --git a/tests/glthread/thread.c b/tests/glthread/thread.c index 2d015b6b..8182c7fd 100644 --- a/tests/glthread/thread.c +++ b/tests/glthread/thread.c @@ -1,5 +1,5 @@ /* Creating and controlling threads. - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -208,9 +208,7 @@ gl_thread_t gl_thread_create (void *(*func) (void *arg), void *arg) { gl_thread_t thread; - int ret; - - ret = glthread_create (&thread, func, arg); + int ret = glthread_create (&thread, func, arg); if (ret != 0) abort (); return thread; diff --git a/tests/glthread/thread.h b/tests/glthread/thread.h index 9db5eef5..c8cb28a2 100644 --- a/tests/glthread/thread.h +++ b/tests/glthread/thread.h @@ -1,5 +1,5 @@ /* Creating and controlling threads. - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/glthread/yield.h b/tests/glthread/yield.h index 9b43b336..99515d31 100644 --- a/tests/glthread/yield.h +++ b/tests/glthread/yield.h @@ -1,5 +1,5 @@ /* Yielding the processor to other threads and processes. - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/ialloc.c b/tests/ialloc.c index 881c8f04..38ec1d05 100644 --- a/tests/ialloc.c +++ b/tests/ialloc.c @@ -1,6 +1,6 @@ /* malloc with idx_t rather than size_t - Copyright 2021-2025 Free Software Foundation, Inc. + Copyright 2021-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> - #define IALLOC_INLINE _GL_EXTERN_INLINE +#include <config.h> #include "ialloc.h" diff --git a/tests/ialloc.h b/tests/ialloc.h index 8bf5dd12..97b0e0c5 100644 --- a/tests/ialloc.h +++ b/tests/ialloc.h @@ -1,6 +1,6 @@ /* ialloc.h -- malloc with idx_t rather than size_t - Copyright 2021-2025 Free Software Foundation, Inc. + Copyright 2021-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/iconvsupport.c b/tests/iconvsupport.c index cc2e4657..9e0838be 100644 --- a/tests/iconvsupport.c +++ b/tests/iconvsupport.c @@ -1,5 +1,5 @@ /* Test iconv support. - Copyright (C) 2018-2025 Free Software Foundation, Inc. + Copyright (C) 2018-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/ignore-value.h b/tests/ignore-value.h index 794fbd18..1738afa9 100644 --- a/tests/ignore-value.h +++ b/tests/ignore-value.h @@ -1,6 +1,6 @@ /* ignore a function return without a compiler warning. -*- coding: utf-8 -*- - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/inet_pton.c b/tests/inet_pton.c index 74d55c43..1e75c8c5 100644 --- a/tests/inet_pton.c +++ b/tests/inet_pton.c @@ -1,6 +1,6 @@ /* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form - Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2006, 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -112,43 +112,44 @@ inet_pton (int af, const char *restrict src, void *restrict dst) static int inet_pton4 (const char *restrict src, unsigned char *restrict dst) { - int saw_digit, octets, ch; - unsigned char tmp[NS_INADDRSZ], *tp; + unsigned char tmp[NS_INADDRSZ]; - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') - { - - if (ch >= '0' && ch <= '9') - { - unsigned new = *tp * 10 + (ch - '0'); - - if (saw_digit && *tp == 0) - return (0); - if (new > 255) - return (0); - *tp = new; - if (!saw_digit) - { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } - else if (ch == '.' && saw_digit) - { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } - else - return (0); - } - if (octets < 4) - return (0); + { + int saw_digit = 0; + int octets = 0; + unsigned char *tp = tmp; + *tp = 0; + int ch; + while ((ch = *src++) != '\0') + { + if (ch >= '0' && ch <= '9') + { + if (saw_digit && *tp == 0) + return (0); + unsigned new = *tp * 10 + (ch - '0'); + if (new > 255) + return (0); + *tp = new; + if (!saw_digit) + { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } + else if (ch == '.' && saw_digit) + { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } + else + return (0); + } + if (octets < 4) + return (0); + } memcpy (dst, tmp, NS_INADDRSZ); return (1); } @@ -172,93 +173,89 @@ static int inet_pton6 (const char *restrict src, unsigned char *restrict dst) { static const char xdigits[] = "0123456789abcdef"; - unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *curtok; - int ch, saw_xdigit; - unsigned val; + unsigned char tmp[NS_IN6ADDRSZ]; - tp = memset (tmp, '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; /* Leading :: requires some special handling. */ if (*src == ':') if (*++src != ':') return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = c_tolower (*src++)) != '\0') - { - const char *pch; - pch = strchr (xdigits, ch); - if (pch != NULL) - { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') - { - curtok = src; - if (!saw_xdigit) - { - if (colonp) - return (0); - colonp = tp; - continue; - } - else if (*src == '\0') - { + { + unsigned char *tp = memset (tmp, '\0', NS_IN6ADDRSZ); + unsigned char *endp = tp + NS_IN6ADDRSZ; + unsigned char *colonp = NULL; + const char *curtok = src; + int saw_xdigit = 0; + unsigned int val = 0; + int ch; + while ((ch = c_tolower (*src++)) != '\0') + { + const char *pch = strchr (xdigits, ch); + if (pch != NULL) + { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) return (0); - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4 (curtok, tp) > 0) - { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } + saw_xdigit = 1; + } + else if (ch == ':') + { + curtok = src; + if (!saw_xdigit) + { + if (colonp) + return (0); + colonp = tp; + } + else if (*src == '\0') + return (0); + else if (tp + NS_INT16SZ > endp) + return (0); + else + { + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + saw_xdigit = 0; + val = 0; + } + } + else if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4 (curtok, tp) > 0) + { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + else + return (0); + } + if (saw_xdigit) + { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (unsigned char) (val >> 8) & 0xff; + *tp++ = (unsigned char) val & 0xff; + } + if (colonp != NULL) + { + if (tp == endp) + return (0); + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + for (int i = 1; i <= n; i++) + { + endp[-i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) return (0); - } - if (saw_xdigit) - { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - } - if (colonp != NULL) - { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - if (tp == endp) - return (0); - for (i = 1; i <= n; i++) - { - endp[-i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); + } memcpy (dst, tmp, NS_IN6ADDRSZ); return (1); } diff --git a/tests/infinity.h b/tests/infinity.h index 37b5ab26..d60a7a57 100644 --- a/tests/infinity.h +++ b/tests/infinity.h @@ -1,5 +1,5 @@ /* Macros for infinity. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/init.sh b/tests/init.sh index 21a43898..e2e4ce8d 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009-2025 Free Software Foundation, Inc. +# Copyright (C) 2009-2026 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/intprops-internal.h b/tests/intprops-internal.h index 26098030..0df385b9 100644 --- a/tests/intprops-internal.h +++ b/tests/intprops-internal.h @@ -1,6 +1,6 @@ /* intprops-internal.h -- properties of integer types not visible to users - Copyright (C) 2001-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -116,8 +116,8 @@ #endif /* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ -#if defined __clang_major__ && __clang_major__ < 14 -/* Work around Clang bug <https://bugs.llvm.org/show_bug.cgi?id=16404>. */ +#if defined __clang_major__ && __clang_major__ < 21 +/* Work around Clang bug <https://github.com/llvm/llvm-project/issues/16778>. */ # define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 #else # define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW @@ -179,9 +179,9 @@ _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) #endif -/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25764. See: https://gcc.gnu.org/PR68193 - https://llvm.org/bugs/show_bug.cgi?id=25390 + https://github.com/llvm/llvm-project/issues/25764 For now, assume GCC < 14 and all Clang versions generate bogus warnings for _Generic. This matters only for compilers that lack relevant builtins. */ diff --git a/tests/intprops.h b/tests/intprops.h index 72e866ff..924b6f9a 100644 --- a/tests/intprops.h +++ b/tests/intprops.h @@ -1,6 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/tests/ioctl.c b/tests/ioctl.c index a92df8b1..a807c8ae 100644 --- a/tests/ioctl.c +++ b/tests/ioctl.c @@ -1,6 +1,6 @@ /* ioctl.c --- wrappers for Windows ioctl function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -30,11 +30,9 @@ int rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */) { - void *buf; va_list args; - va_start (args, request); - buf = va_arg (args, void *); + void *buf = va_arg (args, void *); va_end (args); /* Cast 'request' so that when the system's ioctl function takes a 64-bit @@ -75,11 +73,9 @@ primary_ioctl (int fd, int request, void *arg) int ioctl (int fd, int request, ... /* {void *,char *} arg */) { - void *arg; va_list args; - va_start (args, request); - arg = va_arg (args, void *); + void *arg = va_arg (args, void *); va_end (args); # if WINDOWS_SOCKETS diff --git a/tests/isblank.c b/tests/isblank.c index a80a668c..449beeaf 100644 --- a/tests/isblank.c +++ b/tests/isblank.c @@ -1,6 +1,6 @@ /* Test whether a character is a blank. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/libc-config.h b/tests/libc-config.h index 33da9cf1..e5102aa9 100644 --- a/tests/libc-config.h +++ b/tests/libc-config.h @@ -1,6 +1,6 @@ /* System definitions for code taken from the GNU C Library - Copyright 2017-2025 Free Software Foundation, Inc. + Copyright 2017-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/tests/listen.c b/tests/listen.c index d73ffcb9..91ac35eb 100644 --- a/tests/listen.c +++ b/tests/listen.c @@ -1,6 +1,6 @@ /* listen.c --- wrappers for Windows listen function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/locale.c b/tests/locale.c index 084a36c2..34d4844d 100644 --- a/tests/locale.c +++ b/tests/locale.c @@ -1,5 +1,5 @@ /* Program that prints the names of the categories of the current locale. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/lstat.c b/tests/lstat.c index f5fda4af..2495568f 100644 --- a/tests/lstat.c +++ b/tests/lstat.c @@ -1,6 +1,6 @@ /* Work around a bug of lstat on some systems - Copyright (C) 1997-2006, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 1997-2006, 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/macros.h b/tests/macros.h index e65d8ebd..9982239e 100644 --- a/tests/macros.h +++ b/tests/macros.h @@ -1,5 +1,5 @@ /* Common macros used by gnulib tests. - Copyright (C) 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2006-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/malloc.c b/tests/malloc.c index 5642c83c..f7d11921 100644 --- a/tests/malloc.c +++ b/tests/malloc.c @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/mbtowc-impl.h b/tests/mbtowc-impl.h index 3366c9da..c6d61968 100644 --- a/tests/mbtowc-impl.h +++ b/tests/mbtowc-impl.h @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This file is free software: you can redistribute it and/or modify @@ -27,11 +27,10 @@ mbtowc (wchar_t *pwc, const char *s, size_t n) else { mbstate_t state; - wchar_t wc; - size_t result; - mbszero (&state); - result = mbrtowc (&wc, s, n, &state); + + wchar_t wc; + size_t result = mbrtowc (&wc, s, n, &state); if (result == (size_t)-1 || result == (size_t)-2) { errno = EILSEQ; diff --git a/tests/mbtowc.c b/tests/mbtowc.c index 27ff35c6..2f30b9fb 100644 --- a/tests/mbtowc.c +++ b/tests/mbtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This file is free software: you can redistribute it and/or modify diff --git a/tests/minus-zero.h b/tests/minus-zero.h index 6383064b..f15e2a8c 100644 --- a/tests/minus-zero.h +++ b/tests/minus-zero.h @@ -1,5 +1,5 @@ /* Macros for floating-point negative zero. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/mkfifo.c b/tests/mkfifo.c index 419b7b1d..bdc1ed52 100644 --- a/tests/mkfifo.c +++ b/tests/mkfifo.c @@ -1,5 +1,5 @@ /* Create a named fifo. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/msvc-inval.c b/tests/msvc-inval.c index 1b51b1b0..774447b6 100644 --- a/tests/msvc-inval.c +++ b/tests/msvc-inval.c @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/msvc-inval.h b/tests/msvc-inval.h index 9bb8a156..25bb6a3a 100644 --- a/tests/msvc-inval.h +++ b/tests/msvc-inval.h @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -179,9 +179,9 @@ extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void); # define TRY_MSVC_INVAL \ do \ { \ - struct gl_msvc_inval_per_thread *msvc_inval_current; \ gl_msvc_inval_ensure_handler (); \ - msvc_inval_current = gl_msvc_inval_current (); \ + struct gl_msvc_inval_per_thread *msvc_inval_current = \ + gl_msvc_inval_current (); \ /* First, initialize gl_msvc_inval_restart. */ \ if (setjmp (msvc_inval_current->restart) == 0) \ { \ diff --git a/tests/msvc-nothrow.c b/tests/msvc-nothrow.c index 7cf7517e..dea273d5 100644 --- a/tests/msvc-nothrow.c +++ b/tests/msvc-nothrow.c @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/msvc-nothrow.h b/tests/msvc-nothrow.h index b02f36c4..f059d2d9 100644 --- a/tests/msvc-nothrow.h +++ b/tests/msvc-nothrow.h @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/nan.h b/tests/nan.h index db3d960a..271c43f4 100644 --- a/tests/nan.h +++ b/tests/nan.h @@ -1,5 +1,5 @@ /* Macros for quiet not-a-number. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/nanosleep.c b/tests/nanosleep.c index cfafa4e3..a7abb530 100644 --- a/tests/nanosleep.c +++ b/tests/nanosleep.c @@ -1,6 +1,6 @@ /* Provide a replacement for the POSIX nanosleep function. - Copyright (C) 1999-2000, 2002, 2004-2025 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002, 2004-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -64,9 +64,8 @@ nanosleep (const struct timespec *requested_delay, while (limit < seconds) { - int result; intermediate.tv_sec = limit; - result = nanosleep (&intermediate, remaining_delay); + int result = nanosleep (&intermediate, remaining_delay); seconds -= limit; if (result) { diff --git a/tests/nap.h b/tests/nap.h index eb37bd4b..1b10c389 100644 --- a/tests/nap.h +++ b/tests/nap.h @@ -1,5 +1,5 @@ /* Assist in file system timestamp tests. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/netinet_in.in.h b/tests/netinet_in.in.h index 402d01a9..933f5823 100644 --- a/tests/netinet_in.in.h +++ b/tests/netinet_in.in.h @@ -1,5 +1,5 @@ /* Substitute for <netinet/in.h>. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/open.c b/tests/open.c index fceacfcc..c3b5648e 100644 --- a/tests/open.c +++ b/tests/open.c @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/pathmax.h b/tests/pathmax.h index 5f535517..11c13592 100644 --- a/tests/pathmax.h +++ b/tests/pathmax.h @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2025 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify diff --git a/tests/perror.c b/tests/perror.c index da7fb2c6..c7b14a71 100644 --- a/tests/perror.c +++ b/tests/perror.c @@ -1,5 +1,5 @@ /* Print a message describing error code. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -33,12 +33,11 @@ void perror (const char *string) { char stackbuf[STACKBUF_LEN]; - int ret; /* Our implementation guarantees that this will be a non-empty string, even if it returns EINVAL; and stackbuf should be sized large enough to avoid ERANGE. */ - ret = strerror_r (errno, stackbuf, sizeof stackbuf); + int ret = strerror_r (errno, stackbuf, sizeof stackbuf); if (ret == ERANGE) abort (); diff --git a/tests/pipe.c b/tests/pipe.c index 1add15b4..9dbf4beb 100644 --- a/tests/pipe.c +++ b/tests/pipe.c @@ -1,5 +1,5 @@ /* Create a pipe. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/pselect.c b/tests/pselect.c index 78f0446f..0e6cff42 100644 --- a/tests/pselect.c +++ b/tests/pselect.c @@ -1,6 +1,6 @@ /* pselect - synchronous I/O multiplexing - Copyright 2011-2025 Free Software Foundation, Inc. + Copyright 2011-2026 Free Software Foundation, Inc. This file is part of gnulib. @@ -41,16 +41,14 @@ pselect (int nfds, fd_set *restrict rfds, struct timespec const *restrict timeout, sigset_t const *restrict sigmask) { - int select_result; - sigset_t origmask; - struct timeval tv, *tvp; - if (nfds < 0 || nfds > FD_SETSIZE) { errno = EINVAL; return -1; } + struct timeval tv; + struct timeval *tvp; if (timeout) { if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000)) @@ -68,12 +66,13 @@ pselect (int nfds, fd_set *restrict rfds, else tvp = NULL; + sigset_t origmask; /* Signal mask munging should be atomic, but this is the best we can do in this emulation. */ if (sigmask) pthread_sigmask (SIG_SETMASK, sigmask, &origmask); - select_result = select (nfds, rfds, wfds, xfds, tvp); + int select_result = select (nfds, rfds, wfds, xfds, tvp); if (sigmask) { @@ -95,15 +94,13 @@ rpl_pselect (int nfds, fd_set *restrict rfds, struct timespec const *restrict timeout, sigset_t const *restrict sigmask) { - int i; - /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */ if (nfds < 0 || nfds > FD_SETSIZE) { errno = EINVAL; return -1; } - for (i = 0; i < nfds; i++) + for (int i = 0; i < nfds; i++) { if (((rfds && FD_ISSET (i, rfds)) || (wfds && FD_ISSET (i, wfds)) diff --git a/tests/pthread-cond.c b/tests/pthread-cond.c index 5117f495..169572d2 100644 --- a/tests/pthread-cond.c +++ b/tests/pthread-cond.c @@ -1,5 +1,5 @@ /* POSIX condition variables. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -134,10 +134,9 @@ pthread_cond_timedwait (_GL_UNUSED pthread_cond_t *cond, for (;;) { struct timeval currtime; - unsigned long remaining; - gettimeofday (&currtime, NULL); + unsigned long remaining; if (currtime.tv_sec > abstime->tv_sec) remaining = 0; else diff --git a/tests/pthread-mutex.c b/tests/pthread-mutex.c index 7458d261..1fb67442 100644 --- a/tests/pthread-mutex.c +++ b/tests/pthread-mutex.c @@ -1,5 +1,5 @@ /* POSIX mutexes (locks). - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/pthread-rwlock.c b/tests/pthread-rwlock.c index d4213c8f..9e7efd2f 100644 --- a/tests/pthread-rwlock.c +++ b/tests/pthread-rwlock.c @@ -1,5 +1,5 @@ /* POSIX read-write locks. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -57,18 +57,20 @@ int pthread_rwlockattr_init (pthread_rwlockattr_t *attr) # undef pthread_rwlockattr_init { - int err; - - err = pthread_rwlockattr_init (attr); - if (err != 0) - return err; - err = pthread_rwlockattr_setkind_np (attr, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); - if (err != 0) - { - pthread_rwlockattr_destroy (attr); + { + int err = pthread_rwlockattr_init (attr); + if (err != 0) return err; - } + } + { + int err = pthread_rwlockattr_setkind_np (attr, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + if (err != 0) + { + pthread_rwlockattr_destroy (attr); + return err; + } + } return 0; } @@ -144,17 +146,21 @@ int pthread_rwlock_init (pthread_rwlock_t *lock, _GL_UNUSED const pthread_rwlockattr_t *attr) { - int err; - - err = pthread_mutex_init (&lock->lock, NULL); - if (err != 0) - return err; - err = pthread_cond_init (&lock->waiting_readers, NULL); - if (err != 0) - return err; - err = pthread_cond_init (&lock->waiting_writers, NULL); - if (err != 0) - return err; + { + int err = pthread_mutex_init (&lock->lock, NULL); + if (err != 0) + return err; + } + { + int err = pthread_cond_init (&lock->waiting_readers, NULL); + if (err != 0) + return err; + } + { + int err = pthread_cond_init (&lock->waiting_writers, NULL); + if (err != 0) + return err; + } lock->waiting_writers_count = 0; lock->runcount = 0; return 0; @@ -163,11 +169,11 @@ pthread_rwlock_init (pthread_rwlock_t *lock, int pthread_rwlock_rdlock (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take @@ -176,7 +182,7 @@ pthread_rwlock_rdlock (pthread_rwlock_t *lock) { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ - err = pthread_cond_wait (&lock->waiting_readers, &lock->lock); + int err = pthread_cond_wait (&lock->waiting_readers, &lock->lock); if (err != 0) { pthread_mutex_unlock (&lock->lock); @@ -190,18 +196,18 @@ pthread_rwlock_rdlock (pthread_rwlock_t *lock) int pthread_rwlock_wrlock (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether no readers or writers are currently running. */ while (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ lock->waiting_writers_count++; - err = pthread_cond_wait (&lock->waiting_writers, &lock->lock); + int err = pthread_cond_wait (&lock->waiting_writers, &lock->lock); if (err != 0) { lock->waiting_writers_count--; @@ -217,11 +223,11 @@ pthread_rwlock_wrlock (pthread_rwlock_t *lock) int pthread_rwlock_tryrdlock (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take @@ -239,11 +245,11 @@ pthread_rwlock_tryrdlock (pthread_rwlock_t *lock) int pthread_rwlock_trywrlock (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether no readers or writers are currently running. */ if (!(lock->runcount == 0)) { @@ -259,11 +265,11 @@ int pthread_rwlock_timedrdlock (pthread_rwlock_t *lock, const struct timespec *abstime) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether only readers are currently running, and whether the runcount field will not overflow, and whether no writer is waiting. The latter condition is because POSIX recommends that "write locks shall take @@ -272,8 +278,8 @@ pthread_rwlock_timedrdlock (pthread_rwlock_t *lock, { /* This thread has to wait for a while. Enqueue it among the waiting_readers. */ - err = pthread_cond_timedwait (&lock->waiting_readers, &lock->lock, - abstime); + int err = pthread_cond_timedwait (&lock->waiting_readers, &lock->lock, + abstime); if (err != 0) { pthread_mutex_unlock (&lock->lock); @@ -288,19 +294,19 @@ int pthread_rwlock_timedwrlock (pthread_rwlock_t *lock, const struct timespec *abstime) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } /* Test whether no readers or writers are currently running. */ while (!(lock->runcount == 0)) { /* This thread has to wait for a while. Enqueue it among the waiting_writers. */ lock->waiting_writers_count++; - err = pthread_cond_timedwait (&lock->waiting_writers, &lock->lock, - abstime); + int err = pthread_cond_timedwait (&lock->waiting_writers, &lock->lock, + abstime); if (err != 0) { lock->waiting_writers_count--; @@ -316,11 +322,11 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *lock, int pthread_rwlock_unlock (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_lock (&lock->lock); - if (err != 0) - return err; + { + int err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + } if (lock->runcount < 0) { /* Drop a writer lock. */ @@ -348,7 +354,7 @@ pthread_rwlock_unlock (pthread_rwlock_t *lock) if (lock->waiting_writers_count > 0) { /* Wake up one of the waiting writers. */ - err = pthread_cond_signal (&lock->waiting_writers); + int err = pthread_cond_signal (&lock->waiting_writers); if (err != 0) { pthread_mutex_unlock (&lock->lock); @@ -358,7 +364,7 @@ pthread_rwlock_unlock (pthread_rwlock_t *lock) else { /* Wake up all waiting readers. */ - err = pthread_cond_broadcast (&lock->waiting_readers); + int err = pthread_cond_broadcast (&lock->waiting_readers); if (err != 0) { pthread_mutex_unlock (&lock->lock); @@ -372,17 +378,21 @@ pthread_rwlock_unlock (pthread_rwlock_t *lock) int pthread_rwlock_destroy (pthread_rwlock_t *lock) { - int err; - - err = pthread_mutex_destroy (&lock->lock); - if (err != 0) - return err; - err = pthread_cond_destroy (&lock->waiting_readers); - if (err != 0) - return err; - err = pthread_cond_destroy (&lock->waiting_writers); - if (err != 0) - return err; + { + int err = pthread_mutex_destroy (&lock->lock); + if (err != 0) + return err; + } + { + int err = pthread_cond_destroy (&lock->waiting_readers); + if (err != 0) + return err; + } + { + int err = pthread_cond_destroy (&lock->waiting_writers); + if (err != 0) + return err; + } return 0; } @@ -397,28 +407,31 @@ int pthread_rwlock_init (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr) # undef pthread_rwlock_init { - int err; - if (attr != NULL) - err = pthread_rwlock_init (lock, attr); + return pthread_rwlock_init (lock, attr); else { pthread_rwlockattr_t replacement_attr; - - err = pthread_rwlockattr_init (&replacement_attr); - if (err != 0) - return err; - err = pthread_rwlockattr_setkind_np (&replacement_attr, - PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); - if (err != 0) - { - pthread_rwlockattr_destroy (&replacement_attr); + { + int err = pthread_rwlockattr_init (&replacement_attr); + if (err != 0) return err; - } - err = pthread_rwlock_init (lock, &replacement_attr); - pthread_rwlockattr_destroy (&replacement_attr); + } + { + int err = pthread_rwlockattr_setkind_np (&replacement_attr, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + if (err != 0) + { + pthread_rwlockattr_destroy (&replacement_attr); + return err; + } + } + { + int err = pthread_rwlock_init (lock, &replacement_attr); + pthread_rwlockattr_destroy (&replacement_attr); + return err; + } } - return err; } # endif @@ -432,16 +445,16 @@ pthread_rwlock_timedrdlock (pthread_rwlock_t *lock, /* Poll the lock's state in regular intervals. Ugh. */ for (;;) { - int err; - struct timeval currtime; - unsigned long remaining; - - err = pthread_rwlock_tryrdlock (lock); - if (err != EBUSY) - return err; + { + int err = pthread_rwlock_tryrdlock (lock); + if (err != EBUSY) + return err; + } + struct timeval currtime; gettimeofday (&currtime, NULL); + unsigned long remaining; if (currtime.tv_sec > abstime->tv_sec) remaining = 0; else @@ -489,16 +502,16 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *lock, /* Poll the lock's state in regular intervals. Ugh. */ for (;;) { - int err; - struct timeval currtime; - unsigned long remaining; - - err = pthread_rwlock_trywrlock (lock); - if (err != EBUSY) - return err; + { + int err = pthread_rwlock_trywrlock (lock); + if (err != EBUSY) + return err; + } + struct timeval currtime; gettimeofday (&currtime, NULL); + unsigned long remaining; if (currtime.tv_sec > abstime->tv_sec) remaining = 0; else diff --git a/tests/pthread-thread.c b/tests/pthread-thread.c index b182fa4a..bf0eebba 100644 --- a/tests/pthread-thread.c +++ b/tests/pthread-thread.c @@ -1,5 +1,5 @@ /* Creating and controlling POSIX threads. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/pthread_mutex_timedlock.c b/tests/pthread_mutex_timedlock.c index 0249dc0c..84a6d847 100644 --- a/tests/pthread_mutex_timedlock.c +++ b/tests/pthread_mutex_timedlock.c @@ -1,5 +1,5 @@ /* Lock a mutex, abandoning after a certain time. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -40,16 +40,16 @@ pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime) Therefore start the loop with a pthread_mutex_trylock call. */ for (;;) { - int err; - struct timeval currtime; - unsigned long remaining; - - err = pthread_mutex_trylock (mutex); - if (err != EBUSY) - return err; + { + int err = pthread_mutex_trylock (mutex); + if (err != EBUSY) + return err; + } + struct timeval currtime; gettimeofday (&currtime, NULL); + unsigned long remaining; if (currtime.tv_sec > abstime->tv_sec) remaining = 0; else diff --git a/tests/pthread_sigmask.c b/tests/pthread_sigmask.c index 0d0a5c21..95600d60 100644 --- a/tests/pthread_sigmask.c +++ b/tests/pthread_sigmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking for threads. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -31,21 +31,20 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) #undef pthread_sigmask { #if HAVE_PTHREAD_SIGMASK - int ret; - # if PTHREAD_SIGMASK_INEFFECTIVE - sigset_t omask, omask_copy; + sigset_t omask; sigset_t *old_mask_ptr = &omask; sigemptyset (&omask); /* Add a signal unlikely to be blocked, so that OMASK_COPY is unlikely to match the actual mask. */ sigaddset (&omask, SIGILL); + sigset_t omask_copy; memcpy (&omask_copy, &omask, sizeof omask); # else sigset_t *old_mask_ptr = old_mask; # endif - ret = pthread_sigmask (how, new_mask, old_mask_ptr); + int ret = pthread_sigmask (how, new_mask, old_mask_ptr); # if PTHREAD_SIGMASK_INEFFECTIVE if (ret == 0) diff --git a/tests/putenv.c b/tests/putenv.c index c310ebda..a8abede7 100644 --- a/tests/putenv.c +++ b/tests/putenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2025 Free Software +/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2026 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C @@ -70,7 +70,6 @@ int putenv (char *string) { const char *name_end = strchr (string, '='); - char **ep; if (name_end == NULL) { @@ -97,15 +96,14 @@ putenv (char *string) /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ") to allocate the environ vector and then replace the new entry with "NAME=". */ - int putenv_result; char *name_x = malloc (name_end - string + sizeof "= "); if (!name_x) return -1; memcpy (name_x, string, name_end - string + 1); name_x[name_end - string + 1] = ' '; name_x[name_end - string + 2] = 0; - putenv_result = _putenv (name_x); - for (ep = environ; *ep; ep++) + int putenv_result = _putenv (name_x); + for (char **ep = environ; *ep; ep++) if (streq (*ep, name_x)) { *ep = string; @@ -125,6 +123,7 @@ putenv (char *string) return putenv_result; } #else + char **ep; for (ep = environ; *ep; ep++) if (strncmp (*ep, string, name_end - string) == 0 && (*ep)[name_end - string] == '=') diff --git a/tests/raise.c b/tests/raise.c index f0db2232..fcd6c8e3 100644 --- a/tests/raise.c +++ b/tests/raise.c @@ -1,6 +1,6 @@ /* Provide a non-threads replacement for the POSIX raise function. - Copyright (C) 2002-2003, 2005-2006, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/random.c b/tests/random.c index e0d4b07a..4e3676d9 100644 --- a/tests/random.c +++ b/tests/random.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2025 Free Software Foundation, Inc. +/* Copyright (C) 1995-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -246,14 +246,11 @@ weak_alias (__srandom, srand) char * __initstate (unsigned int seed, char *arg_state, size_t n) { - int32_t *ostate; - int ret; - __libc_lock_lock (lock); - ostate = &unsafe_state.state[-1]; + int32_t *ostate = &unsafe_state.state[-1]; - ret = __initstate_r (seed, arg_state, n, &unsafe_state); + int ret = __initstate_r (seed, arg_state, n, &unsafe_state); __libc_lock_unlock (lock); @@ -273,11 +270,9 @@ weak_alias (__initstate, initstate) char * __setstate (char *arg_state) { - int32_t *ostate; - __libc_lock_lock (lock); - ostate = &unsafe_state.state[-1]; + int32_t *ostate = &unsafe_state.state[-1]; if (__setstate_r (arg_state, &unsafe_state) < 0) ostate = NULL; @@ -303,10 +298,9 @@ weak_alias (__setstate, setstate) long int __random (void) { - int32_t retval; - __libc_lock_lock (lock); + int32_t retval; (void) __random_r (&unsafe_state, &retval); __libc_lock_unlock (lock); diff --git a/tests/random_r.c b/tests/random_r.c index 19ffb6a6..9f478313 100644 --- a/tests/random_r.c +++ b/tests/random_r.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995-2025 Free Software Foundation, Inc. + Copyright (C) 1995-2026 Free Software Foundation, Inc. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -187,20 +187,13 @@ set_int32 (void *p, int32_t v) int __srandom_r (unsigned int seed, struct random_data *buf) { - int type; - int32_t *state; - long int i; - int32_t word; - int32_t *dst; - int kc; - if (buf == NULL) goto fail; - type = buf->rand_type; + int type = buf->rand_type; if ((unsigned int) type >= MAX_TYPES) goto fail; - state = buf->state; + int32_t *state = buf->state; /* We must make sure the seed is not 0. Take arbitrarily 1 in this case. */ if (seed == 0) seed = 1; @@ -208,10 +201,10 @@ __srandom_r (unsigned int seed, struct random_data *buf) if (type == TYPE_0) goto done; - dst = state; - word = seed; - kc = buf->rand_deg; - for (i = 1; i < kc; ++i) + int32_t *dst = state; + int32_t word = seed; + int kc = buf->rand_deg; + for (long int i = 1; i < kc; ++i) { /* This does: state[i] = (16807 * state[i - 1]) % 2147483647; @@ -321,28 +314,26 @@ int __setstate_r (char *arg_state, struct random_data *buf) { int32_t *new_state = 1 + (int32_t *) arg_state; - int type; - int old_type; - int32_t *old_state; - int degree; - int separation; if (arg_state == NULL || buf == NULL) goto fail; - old_type = buf->rand_type; - old_state = buf->state; + int old_type = buf->rand_type; + int32_t *old_state = buf->state; set_int32 (&old_state[-1], (old_type == TYPE_0 ? TYPE_0 : (MAX_TYPES * (buf->rptr - old_state)) + old_type)); - type = get_int32 (&new_state[-1]) % MAX_TYPES; + int type = get_int32 (&new_state[-1]) % MAX_TYPES; if (type < TYPE_0 || type > TYPE_4) goto fail; - buf->rand_deg = degree = random_poly_info.degrees[type]; - buf->rand_sep = separation = random_poly_info.seps[type]; + int degree = random_poly_info.degrees[type]; + int separation = random_poly_info.seps[type]; + + buf->rand_deg = degree; + buf->rand_sep = separation; buf->rand_type = type; if (type != TYPE_0) @@ -378,12 +369,10 @@ weak_alias (__setstate_r, setstate_r) int __random_r (struct random_data *buf, int32_t *result) { - int32_t *state; - if (buf == NULL || result == NULL) goto fail; - state = buf->state; + int32_t *state = buf->state; if (buf->rand_type == TYPE_0) { diff --git a/tests/randomd.c b/tests/randomd.c index a6f7a185..c642af8c 100644 --- a/tests/randomd.c +++ b/tests/randomd.c @@ -1,5 +1,5 @@ /* Some random 'double' numbers used by gnulib tests. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/randoml.c b/tests/randoml.c index 2790f348..edb313f2 100644 --- a/tests/randoml.c +++ b/tests/randoml.c @@ -1,5 +1,5 @@ /* Some random 'long double' numbers used by gnulib tests. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/realloc.c b/tests/realloc.c index 62efd5a3..9b35c235 100644 --- a/tests/realloc.c +++ b/tests/realloc.c @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2025 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify @@ -20,9 +20,9 @@ /* Ensure that we call the system's realloc() below. */ #define _GL_USE_STDLIB_ALLOC 1 -#include <config.h> #define _GL_REALLOC_INLINE _GL_EXTERN_INLINE +#include <config.h> #include <stdlib.h> #include <errno.h> @@ -94,7 +94,7 @@ rpl_realloc (void *p, size_t n) void *result = realloc (p, n1); -# if !HAVE_MALLOC_POSIX +# if !HAVE_REALLOC_POSIX if (result == NULL) errno = ENOMEM; # endif diff --git a/tests/reallocarray.c b/tests/reallocarray.c index 77e8d84c..60573fef 100644 --- a/tests/reallocarray.c +++ b/tests/reallocarray.c @@ -1,6 +1,6 @@ /* reallocarray function that is glibc compatible. - Copyright (C) 2017-2025 Free Software Foundation, Inc. + Copyright (C) 2017-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/same-inode.c b/tests/same-inode.c index 49a49e08..c319c40b 100644 --- a/tests/same-inode.c +++ b/tests/same-inode.c @@ -1,6 +1,6 @@ /* Determine whether two stat buffers are known to refer to the same file. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,6 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> #define SAME_INODE_INLINE _GL_EXTERN_INLINE +#include <config.h> #include "same-inode.h" diff --git a/tests/same-inode.h b/tests/same-inode.h index 70f17b03..025901a2 100644 --- a/tests/same-inode.h +++ b/tests/same-inode.h @@ -1,6 +1,6 @@ /* Determine whether two stat buffers are known to refer to the same file. - Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/sched_yield.c b/tests/sched_yield.c index ccf4c948..9909039d 100644 --- a/tests/sched_yield.c +++ b/tests/sched_yield.c @@ -1,5 +1,5 @@ /* Schedule other threads to run. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/select.c b/tests/select.c index 5a58d6ee..a08e3867 100644 --- a/tests/select.c +++ b/tests/select.c @@ -1,7 +1,7 @@ /* Emulation for select(2) Contributed by Paolo Bonzini. - Copyright 2008-2025 Free Software Foundation, Inc. + Copyright 2008-2026 Free Software Foundation, Inc. This file is part of gnulib. @@ -114,13 +114,12 @@ static BOOL IsConsoleHandle (HANDLE h) static BOOL IsSocketHandle (HANDLE h) { - WSANETWORKEVENTS ev; - if (IsConsoleHandle (h)) return FALSE; /* Under Wine, it seems that getsockopt returns 0 for pipes too. WSAEnumNetworkEvents instead distinguishes the two correctly. */ + WSANETWORKEVENTS ev; ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev); return ev.lNetworkEvents != 0xDEADBEEF; @@ -135,17 +134,12 @@ windows_poll_handle (HANDLE h, int fd, struct bitset *wbits, struct bitset *xbits) { - BOOL read, write, except; - int i, ret; - INPUT_RECORD *irbuffer; - DWORD avail, nbuffer; - BOOL bRet; - IO_STATUS_BLOCK iosb; - FILE_PIPE_LOCAL_INFORMATION fpli; static PNtQueryInformationFile NtQueryInformationFile; static BOOL once_only; - read = write = except = FALSE; + BOOL read = FALSE; + BOOL write = FALSE; + BOOL except = FALSE; switch (GetFileType (h)) { case FILE_TYPE_DISK: @@ -162,6 +156,7 @@ windows_poll_handle (HANDLE h, int fd, once_only = TRUE; } + DWORD avail; if (PeekNamedPipe (h, NULL, 0, NULL, &avail, NULL) != 0) { if (avail) @@ -169,7 +164,6 @@ windows_poll_handle (HANDLE h, int fd, } else if (GetLastError () == ERROR_BROKEN_PIPE) ; - else { /* It was the write-end of the pipe. Check if it is writable. @@ -180,7 +174,9 @@ windows_poll_handle (HANDLE h, int fd, (I think this should not happen since Windows XP SP2; WINE seems fine too). Otherwise, ensure that enough space is available for atomic writes. */ + IO_STATUS_BLOCK iosb; memset (&iosb, 0, sizeof (iosb)); + FILE_PIPE_LOCAL_INFORMATION fpli; memset (&fpli, 0, sizeof (fpli)); if (!NtQueryInformationFile @@ -198,8 +194,7 @@ windows_poll_handle (HANDLE h, int fd, if (!(rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) break; - ret = WaitForSingleObject (h, 0); - if (ret == WAIT_OBJECT_0) + if (WaitForSingleObject (h, 0) == WAIT_OBJECT_0) { if (!IsConsoleHandle (h)) { @@ -207,9 +202,8 @@ windows_poll_handle (HANDLE h, int fd, break; } - nbuffer = avail = 0; - bRet = GetNumberOfConsoleInputEvents (h, &nbuffer); - + DWORD nbuffer = 0; + BOOL bRet = GetNumberOfConsoleInputEvents (h, &nbuffer); /* Screen buffers handles are filtered earlier. */ assert (bRet); if (nbuffer == 0) @@ -218,30 +212,32 @@ windows_poll_handle (HANDLE h, int fd, break; } - irbuffer = (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD)); - bRet = PeekConsoleInput (h, irbuffer, nbuffer, &avail); - if (!bRet || avail == 0) + INPUT_RECORD *irbuffer = + (INPUT_RECORD *) alloca (nbuffer * sizeof (INPUT_RECORD)); + DWORD avail = 0; + if (! PeekConsoleInput (h, irbuffer, nbuffer, &avail) || avail == 0) { except = TRUE; break; } - for (i = 0; i < avail; i++) + for (int i = 0; i < avail; i++) if (irbuffer[i].EventType == KEY_EVENT) read = TRUE; } break; default: - ret = WaitForSingleObject (h, 0); - write = TRUE; - if (ret == WAIT_OBJECT_0) - read = TRUE; - + { + int ret = WaitForSingleObject (h, 0); + write = TRUE; + if (ret == WAIT_OBJECT_0) + read = TRUE; + } break; } - ret = 0; + int ret = 0; if (read && (rbits->in[fd / CHAR_BIT] & (1 << (fd & (CHAR_BIT - 1))))) { rbits->out[fd / CHAR_BIT] |= (1 << (fd & (CHAR_BIT - 1))); @@ -270,14 +266,6 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, { static struct timeval tv0; static HANDLE hEvent; - HANDLE h, handle_array[FD_SETSIZE + 2]; - fd_set handle_rfds, handle_wfds, handle_xfds; - struct bitset rbits, wbits, xbits; - unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT]; - DWORD ret, wait_timeout, nhandles, nsock, nbuffer; - MSG msg; - int i, fd, rc; - clock_t tend; if (nfds < 0 || nfds > FD_SETSIZE) { @@ -285,6 +273,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, return -1; } + DWORD wait_timeout; if (!timeout) wait_timeout = INFINITE; else @@ -302,52 +291,54 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, if (!hEvent) hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); - handle_array[0] = hEvent; - nhandles = 1; - nsock = 0; - /* Copy descriptors to bitsets. At the same time, eliminate bits in the "wrong" direction for console input buffers and screen buffers, because screen buffers are waitable and they will block until a character is available. */ + struct bitset rbits; memset (&rbits, 0, sizeof (rbits)); + struct bitset wbits; memset (&wbits, 0, sizeof (wbits)); + struct bitset xbits; memset (&xbits, 0, sizeof (xbits)); + unsigned char anyfds_in[FD_SETSIZE / CHAR_BIT]; memset (anyfds_in, 0, sizeof (anyfds_in)); if (rfds) - for (i = 0; i < rfds->fd_count; i++) + for (int i = 0; i < rfds->fd_count; i++) { - fd = rfds->fd_array[i]; - h = (HANDLE) _get_osfhandle (fd); - if (IsConsoleHandle (h) - && !GetNumberOfConsoleInputEvents (h, &nbuffer)) - continue; - - rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + int fd = rfds->fd_array[i]; + HANDLE h = (HANDLE) _get_osfhandle (fd); + DWORD nbuffer; + if (!IsConsoleHandle (h) + || GetNumberOfConsoleInputEvents (h, &nbuffer)) + { + rbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + } } else rfds = (fd_set *) alloca (sizeof (fd_set)); if (wfds) - for (i = 0; i < wfds->fd_count; i++) + for (int i = 0; i < wfds->fd_count; i++) { - fd = wfds->fd_array[i]; - h = (HANDLE) _get_osfhandle (fd); - if (IsConsoleHandle (h) - && GetNumberOfConsoleInputEvents (h, &nbuffer)) - continue; - - wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); - anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + int fd = wfds->fd_array[i]; + HANDLE h = (HANDLE) _get_osfhandle (fd); + DWORD nbuffer; + if (!IsConsoleHandle (h) + || !GetNumberOfConsoleInputEvents (h, &nbuffer)) + { + wbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); + } } else wfds = (fd_set *) alloca (sizeof (fd_set)); if (xfds) - for (i = 0; i < xfds->fd_count; i++) + for (int i = 0; i < xfds->fd_count; i++) { - fd = xfds->fd_array[i]; + int fd = xfds->fd_array[i]; xbits.in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); anyfds_in[fd / CHAR_BIT] |= 1 << (fd & (CHAR_BIT - 1)); } @@ -358,59 +349,67 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, FD_ZERO (rfds); FD_ZERO (wfds); FD_ZERO (xfds); + fd_set handle_rfds; FD_ZERO (&handle_rfds); + fd_set handle_wfds; FD_ZERO (&handle_wfds); + fd_set handle_xfds; FD_ZERO (&handle_xfds); + HANDLE handle_array[FD_SETSIZE + 2]; + handle_array[0] = hEvent; + DWORD nhandles = 1; + DWORD nsock = 0; + /* Classify handles. Create fd sets for sockets, poll the others. */ - for (i = 0; i < nfds; i++) + for (int i = 0; i < nfds; i++) { - if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) - continue; - - h = (HANDLE) _get_osfhandle (i); - if (!h) - { - errno = EBADF; - return -1; - } - - if (IsSocketHandle (h)) + if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) != 0) { - int requested = FD_CLOSE; - - /* See above; socket handles are mapped onto select, but we - need to map descriptors to handles. */ - if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + HANDLE h = (HANDLE) _get_osfhandle (i); + if (!h) { - requested |= FD_READ | FD_ACCEPT; - FD_SET ((SOCKET) h, rfds); - FD_SET ((SOCKET) h, &handle_rfds); + errno = EBADF; + return -1; } - if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + + if (IsSocketHandle (h)) { - requested |= FD_WRITE | FD_CONNECT; - FD_SET ((SOCKET) h, wfds); - FD_SET ((SOCKET) h, &handle_wfds); + int requested = FD_CLOSE; + + /* See above; socket handles are mapped onto select, but we + need to map descriptors to handles. */ + if (rbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + { + requested |= FD_READ | FD_ACCEPT; + FD_SET ((SOCKET) h, rfds); + FD_SET ((SOCKET) h, &handle_rfds); + } + if (wbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + { + requested |= FD_WRITE | FD_CONNECT; + FD_SET ((SOCKET) h, wfds); + FD_SET ((SOCKET) h, &handle_wfds); + } + if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + { + requested |= FD_OOB; + FD_SET ((SOCKET) h, xfds); + FD_SET ((SOCKET) h, &handle_xfds); + } + + WSAEventSelect ((SOCKET) h, hEvent, requested); + nsock++; } - if (xbits.in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + else { - requested |= FD_OOB; - FD_SET ((SOCKET) h, xfds); - FD_SET ((SOCKET) h, &handle_xfds); - } - - WSAEventSelect ((SOCKET) h, hEvent, requested); - nsock++; - } - else - { - handle_array[nhandles++] = h; + handle_array[nhandles++] = h; - /* Poll now. If we get an event, do not wait below. */ - if (wait_timeout != 0 - && windows_poll_handle (h, i, &rbits, &wbits, &xbits)) - wait_timeout = 0; + /* Poll now. If we get an event, do not wait below. */ + if (wait_timeout != 0 + && windows_poll_handle (h, i, &rbits, &wbits, &xbits)) + wait_timeout = 0; + } } } @@ -418,10 +417,12 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, handle_array[nhandles] = NULL; /* When will the waiting period expire? */ + clock_t tend; if (wait_timeout != INFINITE) tend = clock () + wait_timeout; -restart: +restart: ; + int rc; if (wait_timeout == 0 || nsock == 0) rc = 0; else @@ -453,14 +454,14 @@ restart: for (;;) { - ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, - wait_timeout, QS_ALLINPUT); + DWORD ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE, + wait_timeout, QS_ALLINPUT); if (ret == WAIT_OBJECT_0 + nhandles) { /* new input of some other kind */ - BOOL bRet; - while ((bRet = PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) != 0) + MSG msg; + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE) != 0) { TranslateMessage (&msg); DispatchMessage (&msg); @@ -478,21 +479,21 @@ restart: { /* Count results that are not counted in the return value of select. */ nhandles = 1; - for (i = 0; i < nfds; i++) + for (int i = 0; i < nfds; i++) { - if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) - continue; - - h = (HANDLE) _get_osfhandle (i); - if (h == handle_array[nhandles]) + if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) != 0) { - /* Not a socket. */ - nhandles++; - windows_poll_handle (h, i, &rbits, &wbits, &xbits); - if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) - || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) - || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - rc++; + HANDLE h = (HANDLE) _get_osfhandle (i); + if (h == handle_array[nhandles]) + { + /* Not a socket. */ + nhandles++; + windows_poll_handle (h, i, &rbits, &wbits, &xbits); + if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) + || wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1))) + || xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + rc++; + } } } @@ -524,34 +525,34 @@ restart: FD_ZERO (wfds); FD_ZERO (xfds); nhandles = 1; - for (i = 0; i < nfds; i++) + for (int i = 0; i < nfds; i++) { - if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) == 0) - continue; - - h = (HANDLE) _get_osfhandle (i); - if (h != handle_array[nhandles]) - { - /* Perform handle->descriptor mapping. */ - SOCKET s = (SOCKET) h; - WSAEventSelect (s, NULL, 0); - if (FD_ISSET (s, &handle_rfds)) - FD_SET (i, rfds); - if (FD_ISSET (s, &handle_wfds)) - FD_SET (i, wfds); - if (FD_ISSET (s, &handle_xfds)) - FD_SET (i, xfds); - } - else + if ((anyfds_in[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) != 0) { - /* Not a socket. */ - nhandles++; - if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - FD_SET (i, rfds); - if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - FD_SET (i, wfds); - if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) - FD_SET (i, xfds); + HANDLE h = (HANDLE) _get_osfhandle (i); + if (h != handle_array[nhandles]) + { + /* Perform handle->descriptor mapping. */ + SOCKET s = (SOCKET) h; + WSAEventSelect (s, NULL, 0); + if (FD_ISSET (s, &handle_rfds)) + FD_SET (i, rfds); + if (FD_ISSET (s, &handle_wfds)) + FD_SET (i, wfds); + if (FD_ISSET (s, &handle_xfds)) + FD_SET (i, xfds); + } + else + { + /* Not a socket. */ + nhandles++; + if (rbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + FD_SET (i, rfds); + if (wbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + FD_SET (i, wfds); + if (xbits.out[i / CHAR_BIT] & (1 << (i & (CHAR_BIT - 1)))) + FD_SET (i, xfds); + } } } @@ -570,15 +571,13 @@ int rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds, struct timeval *timeout) { - int i; - /* FreeBSD 8.2 has a bug: it does not always detect invalid fds. */ if (nfds < 0 || nfds > FD_SETSIZE) { errno = EINVAL; return -1; } - for (i = 0; i < nfds; i++) + for (int i = 0; i < nfds; i++) { if (((rfds && FD_ISSET (i, rfds)) || (wfds && FD_ISSET (i, wfds)) diff --git a/tests/setenv.c b/tests/setenv.c index ef301d41..ae53146f 100644 --- a/tests/setenv.c +++ b/tests/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995-2003, 2005-2025 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2003, 2005-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is free software: you can redistribute it and/or modify @@ -126,8 +126,6 @@ int __add_to_environ (const char *name, const char *value, const char *combined, int replace) { - char **ep; - size_t size; const size_t namelen = strlen (name); const size_t vallen = value != NULL ? strlen (value) + 1 : 0; @@ -135,9 +133,9 @@ __add_to_environ (const char *name, const char *value, const char *combined, /* We have to get the pointer now that we have the lock and not earlier since another thread might have created a new environment. */ - ep = __environ; + char **ep = __environ; - size = 0; + size_t size = 0; if (ep != NULL) { for (; *ep != NULL; ++ep) @@ -149,13 +147,8 @@ __add_to_environ (const char *name, const char *value, const char *combined, if (ep == NULL || *ep == NULL) { - char **new_environ; -#ifdef USE_TSEARCH - char *new_value; -#endif - /* We allocated this space; we can extend it. */ - new_environ = + char **new_environ = (char **) (last_environ == NULL ? malloc ((size + 2) * sizeof (char *)) : realloc (last_environ, (size + 2) * sizeof (char *))); @@ -177,6 +170,7 @@ __add_to_environ (const char *name, const char *value, const char *combined, { /* See whether the value is already known. */ #ifdef USE_TSEARCH + char *new_value; # ifdef _LIBC new_value = (char *) alloca (namelen + 1 + vallen); __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1), @@ -448,7 +442,6 @@ extern int setenv (const char *, const char *, int); int rpl_setenv (const char *name, const char *value, int replace) { - int result; if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { errno = EINVAL; @@ -456,13 +449,12 @@ rpl_setenv (const char *name, const char *value, int replace) } /* Call the real setenv even if replace is 0, in case implementation has underlying data to update, such as when environ changes. */ - result = setenv (name, value, replace); + int result = setenv (name, value, replace); if (result == 0 && replace && *value == '=') { char *tmp = getenv (name); if (!STREQ (tmp, value)) { - int saved_errno; size_t len = strlen (value); tmp = malloca (len + 2); if (tmp == NULL) @@ -474,7 +466,7 @@ rpl_setenv (const char *name, const char *value, int replace) *tmp = '='; memcpy (tmp + 1, value, len + 1); result = setenv (name, tmp, replace); - saved_errno = errno; + int saved_errno = errno; freea (tmp); errno = saved_errno; } diff --git a/tests/setlocale.c b/tests/setlocale.c index 814a9bd8..c4f00610 100644 --- a/tests/setlocale.c +++ b/tests/setlocale.c @@ -1,5 +1,5 @@ /* Set the current locale. -*- coding: utf-8 -*- - Copyright (C) 2009, 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2009, 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -638,31 +638,23 @@ search (const struct table_entry *table, size_t table_size, const char *string, /* Found an i with strcmp (language_table[i].code, string) == 0. Find the entire interval of such i. */ - { - size_t i; - - for (i = mid; i > lo; ) - { - i--; - if (strcmp (table[i].code, string) < 0) - { - lo = i + 1; - break; - } - } - } - { - size_t i; - - for (i = mid + 1; i < hi; i++) - { - if (strcmp (table[i].code, string) > 0) - { - hi = i; - break; - } - } - } + for (size_t i = mid; i > lo; ) + { + i--; + if (strcmp (table[i].code, string) < 0) + { + lo = i + 1; + break; + } + } + for (size_t i = mid + 1; i < hi; i++) + { + if (strcmp (table[i].code, string) > 0) + { + hi = i; + break; + } + } /* The set of i with strcmp (language_table[i].code, string) == 0 is the interval [lo, hi-1]. */ @@ -679,10 +671,6 @@ static char * setlocale_unixlike (int category, const char *locale) { int is_utf8 = (GetACP () == 65001); - char *result; - char llCC_buf[64]; - char ll_buf[64]; - char CC_buf[64]; /* The native Windows implementation of setlocale understands the special locale name "C", but not "POSIX". Therefore map "POSIX" to "C". */ @@ -699,13 +687,14 @@ setlocale_unixlike (int category, const char *locale) locale = "English_United States.65001"; /* First, try setlocale with the original argument unchanged. */ - result = setlocale_mtsafe (category, locale); + char *result = setlocale_mtsafe (category, locale); if (result != NULL) return result; /* Otherwise, assume the argument is in the form language[_territory][.codeset][@modifier] and try to map it using the tables. */ + char llCC_buf[64]; if (strlen (locale) < sizeof (llCC_buf)) { /* Second try: Remove the codeset part. */ @@ -745,14 +734,13 @@ setlocale_unixlike (int category, const char *locale) /* Look it up in language_table. */ { range_t range; - size_t i; search (language_table, sizeof (language_table) / sizeof (language_table[0]), llCC_buf, &range); - for (i = range.lo; i < range.hi; i++) + for (size_t i = range.lo; i < range.hi; i++) { /* Try the replacement in language_table[i]. */ if (is_utf8) @@ -781,9 +769,11 @@ setlocale_unixlike (int category, const char *locale) if (territory_end == NULL) territory_end = territory_start + strlen (territory_start); + char ll_buf[64]; memcpy (ll_buf, llCC_buf, underscore - llCC_buf); strcpy (ll_buf + (underscore - llCC_buf), territory_end); + char CC_buf[64]; memcpy (CC_buf, territory_start, territory_end - territory_start); CC_buf[territory_end - territory_start] = '\0'; @@ -805,58 +795,49 @@ setlocale_unixlike (int category, const char *locale) CC_buf, &country_range); if (country_range.lo < country_range.hi) - { - size_t i; - size_t j; + for (size_t i = language_range.lo; i < language_range.hi; i++) + for (size_t j = country_range.lo; j < country_range.hi; j++) + { + /* Concatenate the replacements. */ + const char *part1 = language_table[i].english; + size_t part1_len = strlen (part1); + const char *part2 = country_table[j].english; + size_t part2_len = strlen (part2) + 1; + char buf[64+64+6]; + + if (!(part1_len + 1 + part2_len + 6 <= sizeof (buf))) + abort (); + memcpy (buf, part1, part1_len); + buf[part1_len] = '_'; + memcpy (buf + part1_len + 1, part2, part2_len); + if (is_utf8) + strcat (buf, ".65001"); - for (i = language_range.lo; i < language_range.hi; i++) - for (j = country_range.lo; j < country_range.hi; j++) - { - /* Concatenate the replacements. */ - const char *part1 = language_table[i].english; - size_t part1_len = strlen (part1); - const char *part2 = country_table[j].english; - size_t part2_len = strlen (part2) + 1; - char buf[64+64+6]; - - if (!(part1_len + 1 + part2_len + 6 <= sizeof (buf))) - abort (); - memcpy (buf, part1, part1_len); - buf[part1_len] = '_'; - memcpy (buf + part1_len + 1, part2, part2_len); - if (is_utf8) - strcat (buf, ".65001"); - - /* Try the concatenated replacements. */ - result = setlocale (category, buf); - if (result != NULL) - return result; - } - } + /* Try the concatenated replacements. */ + result = setlocale (category, buf); + if (result != NULL) + return result; + } /* Try omitting the country entirely. This may set a locale corresponding to the wrong country, but is better than failing entirely. */ - { - size_t i; - - for (i = language_range.lo; i < language_range.hi; i++) - { - /* Try only the language replacement. */ - if (is_utf8) - { - char buf[64+6]; - strcpy (buf, language_table[i].english); - strcat (buf, ".65001"); - result = setlocale (category, buf); - } - else - result = - setlocale (category, language_table[i].english); - if (result != NULL) - return result; - } - } + for (size_t i = language_range.lo; i < language_range.hi; i++) + { + /* Try only the language replacement. */ + if (is_utf8) + { + char buf[64+6]; + strcpy (buf, language_table[i].english); + strcat (buf, ".65001"); + result = setlocale (category, buf); + } + else + result = + setlocale (category, language_table[i].english); + if (result != NULL) + return result; + } } } } @@ -960,7 +941,7 @@ static char const locales_with_principal_territory[][6 + 1] = "cr_CA", /* Cree Canada */ /* Don't put "crh_UZ" or "crh_UA" here. That would be asking for fruitless political discussion. */ - "cs_CZ", /* Czech Czech Republic */ + "cs_CZ", /* Czech Czechia */ "csb_PL", /* Kashubian Poland */ "cy_GB", /* Welsh Britain */ "da_DK", /* Danish Denmark */ @@ -1140,9 +1121,6 @@ static int langcmp (const char *locale1, const char *locale2) { size_t locale1_len; - size_t locale2_len; - int cmp; - { const char *locale1_end = strchr (locale1, '_'); if (locale1_end != NULL) @@ -1150,6 +1128,7 @@ langcmp (const char *locale1, const char *locale2) else locale1_len = strlen (locale1); } + size_t locale2_len; { const char *locale2_end = strchr (locale2, '_'); if (locale2_end != NULL) @@ -1158,6 +1137,7 @@ langcmp (const char *locale1, const char *locale2) locale2_len = strlen (locale2); } + int cmp; if (locale1_len < locale2_len) { cmp = memcmp (locale1, locale2, locale1_len); @@ -1267,7 +1247,7 @@ static char const locales_with_principal_language[][6 + 1] = "es_CU", /* Spanish Cuba */ /* Curaçao has three official languages: "nl_CW", "pap_CW", "en_CW". */ "el_CY", /* Greek Cyprus */ - "cs_CZ", /* Czech Czech Republic */ + "cs_CZ", /* Czech Czechia */ "de_DE", /* German Germany */ /* Djibouti has two official languages: "ar_DJ" and "fr_DJ". */ "da_DK", /* Danish Denmark */ @@ -1461,12 +1441,9 @@ setlocale_improved (int category, const char *locale) LC_MONETARY, LC_MESSAGES }; - char *saved_locale; - const char *base_name; - unsigned int i; /* Back up the old locale, in case one of the steps fails. */ - saved_locale = setlocale (LC_ALL, NULL); + char *saved_locale = setlocale (LC_ALL, NULL); if (saved_locale == NULL) return NULL; saved_locale = strdup (saved_locale); @@ -1476,11 +1453,12 @@ setlocale_improved (int category, const char *locale) /* Set LC_CTYPE category. Set all other categories (except possibly LC_MESSAGES) to the same value in the same call; this is likely to save calls. */ - base_name = + const char *base_name = gl_locale_name_environ (LC_CTYPE, category_to_name (LC_CTYPE)); if (base_name == NULL) base_name = gl_locale_name_default (); + unsigned int i; if (setlocale_unixlike (LC_ALL, base_name) != NULL) { /* LC_CTYPE category already set. */ @@ -1508,9 +1486,8 @@ setlocale_improved (int category, const char *locale) for (; i < sizeof (categories) / sizeof (categories[0]); i++) { int cat = categories[i]; - const char *name; - - name = gl_locale_name_environ (cat, category_to_name (cat)); + const char *name = + gl_locale_name_environ (cat, category_to_name (cat)); if (name == NULL) name = gl_locale_name_default (); diff --git a/tests/setsockopt.c b/tests/setsockopt.c index 18a5c33c..b58db1f9 100644 --- a/tests/setsockopt.c +++ b/tests/setsockopt.c @@ -1,6 +1,6 @@ /* setsockopt.c --- wrappers for Windows setsockopt function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -35,8 +35,6 @@ int rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) { SOCKET sock = FD_TO_SOCKET (fd); - int r; - if (sock == INVALID_SOCKET) { errno = EBADF; @@ -44,6 +42,8 @@ rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t op } else { + int r; + if (level == SOL_SOCKET && (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)) { diff --git a/tests/signal.in.h b/tests/signal.in.h index 66e0c310..ce844b1a 100644 --- a/tests/signal.in.h +++ b/tests/signal.in.h @@ -1,6 +1,6 @@ /* A GNU-like <signal.h>. - Copyright (C) 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2006-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -156,7 +156,6 @@ _GL_CXXALIAS_SYS (sig2str, int, (int signo, char *str)); _GL_CXXALIASWARN (sig2str); # endif #elif defined GNULIB_POSIXCHECK -# undef sig2str # if HAVE_RAW_DECL_SIG2STR _GL_WARN_ON_USE (sig2str, "sig2str is not portable - " "use gnulib module sig2str for portability"); @@ -172,7 +171,6 @@ _GL_CXXALIAS_SYS (str2sig, int, (char const *str, int *signo_p)); _GL_CXXALIASWARN (str2sig); # endif #elif defined GNULIB_POSIXCHECK -# undef str2sig # if HAVE_RAW_DECL_STR2SIG _GL_WARN_ON_USE (str2sig, "str2sig is not portable - " "use gnulib module sig2str for portability"); @@ -210,7 +208,6 @@ _GL_CXXALIAS_SYS (pthread_sigmask, int, _GL_CXXALIASWARN (pthread_sigmask); # endif #elif defined GNULIB_POSIXCHECK -# undef pthread_sigmask # if HAVE_RAW_DECL_PTHREAD_SIGMASK _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " "use gnulib module pthread_sigmask for portability"); @@ -236,7 +233,6 @@ _GL_CXXALIAS_SYS (raise, int, (int sig)); _GL_CXXALIASWARN (raise); # endif #elif defined GNULIB_POSIXCHECK -# undef raise /* Assume raise is always declared. */ _GL_WARN_ON_USE (raise, "raise can crash on native Windows - " "use gnulib module raise for portability"); @@ -407,37 +403,30 @@ _GL_EXTERN_C int _gl_raise_SIGPIPE (void); # endif #elif defined GNULIB_POSIXCHECK -# undef sigaddset # if HAVE_RAW_DECL_SIGADDSET _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigdelset # if HAVE_RAW_DECL_SIGDELSET _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigemptyset # if HAVE_RAW_DECL_SIGEMPTYSET _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigfillset # if HAVE_RAW_DECL_SIGFILLSET _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigismember # if HAVE_RAW_DECL_SIGISMEMBER _GL_WARN_ON_USE (sigismember, "sigismember is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigpending # if HAVE_RAW_DECL_SIGPENDING _GL_WARN_ON_USE (sigpending, "sigpending is unportable - " "use the gnulib module sigprocmask for portability"); # endif -# undef sigprocmask # if HAVE_RAW_DECL_SIGPROCMASK _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " "use the gnulib module sigprocmask for portability"); @@ -523,7 +512,6 @@ _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, _GL_CXXALIASWARN (sigaction); #elif defined GNULIB_POSIXCHECK -# undef sigaction # if HAVE_RAW_DECL_SIGACTION _GL_WARN_ON_USE (sigaction, "sigaction is unportable - " "use the gnulib module sigaction for portability"); diff --git a/tests/signature.h b/tests/signature.h index 35f204dd..9f81e8d3 100644 --- a/tests/signature.h +++ b/tests/signature.h @@ -1,5 +1,5 @@ /* Macro for checking that a function declaration is compliant. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/signed-nan.h b/tests/signed-nan.h index 41360db5..2c04bd7a 100644 --- a/tests/signed-nan.h +++ b/tests/signed-nan.h @@ -1,5 +1,5 @@ /* Macros for quiet not-a-number. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/signed-snan.h b/tests/signed-snan.h index ad0f4cdd..bf51dd1a 100644 --- a/tests/signed-snan.h +++ b/tests/signed-snan.h @@ -1,5 +1,5 @@ /* Macros for signalling not-a-number. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/sigprocmask.c b/tests/sigprocmask.c index d52e191c..2399f58e 100644 --- a/tests/sigprocmask.c +++ b/tests/sigprocmask.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2006. This file is free software: you can redistribute it and/or modify @@ -211,11 +211,10 @@ int sigpending (sigset_t *set) { sigset_t pending = 0; - int sig; - - for (sig = 0; sig < NSIG; sig++) + for (int sig = 0; sig < NSIG; sig++) if (pending_array[sig]) pending |= 1U << sig; + *set = pending; return 0; } @@ -235,9 +234,6 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) if (set != NULL) { sigset_t new_blocked_set; - sigset_t to_unblock; - sigset_t to_block; - switch (operation) { case SIG_BLOCK: @@ -254,28 +250,24 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) errno = EINVAL; return -1; } - to_unblock = blocked_set & ~new_blocked_set; - to_block = new_blocked_set & ~blocked_set; - if (to_block != 0) - { - int sig; + sigset_t to_unblock = blocked_set & ~new_blocked_set; + sigset_t to_block = new_blocked_set & ~blocked_set; - for (sig = 0; sig < NSIG; sig++) - if ((to_block >> sig) & 1) - { - pending_array[sig] = 0; - if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) - blocked_set |= 1U << sig; - } - } + if (to_block != 0) + for (int sig = 0; sig < NSIG; sig++) + if ((to_block >> sig) & 1) + { + pending_array[sig] = 0; + if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) + blocked_set |= 1U << sig; + } if (to_unblock != 0) { sig_atomic_t received[NSIG]; - int sig; - for (sig = 0; sig < NSIG; sig++) + for (int sig = 0; sig < NSIG; sig++) if ((to_unblock >> sig) & 1) { if (signal (sig, old_handlers[sig]) != blocked_handler) @@ -290,7 +282,7 @@ sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) else received[sig] = 0; - for (sig = 0; sig < NSIG; sig++) + for (int sig = 0; sig < NSIG; sig++) if (received[sig]) raise (sig); } diff --git a/tests/sleep.c b/tests/sleep.c index d7c0b38e..6192a8dd 100644 --- a/tests/sleep.c +++ b/tests/sleep.c @@ -1,5 +1,5 @@ /* Pausing execution of the current thread. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This file is free software: you can redistribute it and/or modify @@ -58,9 +58,8 @@ rpl_sleep (unsigned int seconds) const unsigned int limit = 24 * 24 * 60 * 60; while (limit < seconds) { - unsigned int result; seconds -= limit; - result = sleep (limit); + unsigned int result = sleep (limit); if (result) return seconds + result; } diff --git a/tests/snan.h b/tests/snan.h index 2d955abc..b5e00b63 100644 --- a/tests/snan.h +++ b/tests/snan.h @@ -1,5 +1,5 @@ /* Macros for signalling not-a-number. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -216,7 +216,7 @@ construct_memory_SNaNl (long double quiet_value) { memory_long_double m; m.value = quiet_value; - #if defined __powerpc__ && LDBL_MANT_DIG == 106 + #if defined _ARCH_PPC && LDBL_MANT_DIG == 106 /* This is PowerPC "double double", a pair of two doubles. Inf and NaN are represented as the corresponding 64-bit IEEE values in the first double; the second is ignored. Manipulate only the first double. */ diff --git a/tests/socket.c b/tests/socket.c index 5b252409..7c6aa115 100644 --- a/tests/socket.c +++ b/tests/socket.c @@ -1,6 +1,6 @@ /* socket.c --- wrappers for Windows socket function - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -35,13 +35,11 @@ int rpl_socket (int domain, int type, int protocol) { - SOCKET fh; - gl_sockets_startup (SOCKETS_1_1); /* We have to use WSASocket() to create non-overlapped IO sockets. Overlapped IO sockets cannot be used with read/write. */ - fh = WSASocket (domain, type, protocol, NULL, 0, 0); + SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0); if (fh == INVALID_SOCKET) { diff --git a/tests/sockets.c b/tests/sockets.c index 7accfdd3..ce98698d 100644 --- a/tests/sockets.c +++ b/tests/sockets.c @@ -1,6 +1,6 @@ /* sockets.c --- wrappers for Windows socket functions - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -46,11 +46,10 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list, our calls to closesocket() and the primary close(), some other thread could make system calls that allocate precisely the same HANDLE value as sock; then the primary close() would call CloseHandle() on it. */ - SOCKET sock; - WSANETWORKEVENTS ev; /* Test whether fd refers to a socket. */ - sock = FD_TO_SOCKET (fd); + SOCKET sock = FD_TO_SOCKET (fd); + WSANETWORKEVENTS ev; ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents (sock, NULL, &ev); if (ev.lNetworkEvents != 0xDEADBEEF) @@ -83,11 +82,9 @@ ioctl_fd_maybe_socket (const struct fd_hook *remaining_list, gl_ioctl_fn primary, int fd, int request, void *arg) { - SOCKET sock; - WSANETWORKEVENTS ev; - /* Test whether fd refers to a socket. */ - sock = FD_TO_SOCKET (fd); + SOCKET sock = FD_TO_SOCKET (fd); + WSANETWORKEVENTS ev; ev.lNetworkEvents = 0xDEADBEEF; WSAEnumNetworkEvents (sock, NULL, &ev); if (ev.lNetworkEvents != 0xDEADBEEF) @@ -119,9 +116,7 @@ gl_sockets_startup (_GL_UNUSED int version) if (version > initialized_sockets_version) { WSADATA data; - int err; - - err = WSAStartup (version, &data); + int err = WSAStartup (version, &data); if (err != 0) return 1; @@ -146,13 +141,11 @@ int gl_sockets_cleanup (void) { #if WINDOWS_SOCKETS - int err; - initialized_sockets_version = 0; unregister_fd_hook (&fd_sockets_hook); - err = WSACleanup (); + int err = WSACleanup (); if (err != 0) return 1; #endif diff --git a/tests/sockets.h b/tests/sockets.h index 5be5d3f6..ed12cf9a 100644 --- a/tests/sockets.h +++ b/tests/sockets.h @@ -1,6 +1,6 @@ /* sockets.h - wrappers for Windows socket functions - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/stat-time.c b/tests/stat-time.c index fa93e16c..9dcdc377 100644 --- a/tests/stat-time.c +++ b/tests/stat-time.c @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -15,7 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> - #define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE +#include <config.h> #include "stat-time.h" diff --git a/tests/stat-time.h b/tests/stat-time.h index 38315b9f..45364316 100644 --- a/tests/stat-time.h +++ b/tests/stat-time.h @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -232,8 +232,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st) short int const ts_off[] = { STAT_TIMESPEC_OFFSETOF (st_atim), STAT_TIMESPEC_OFFSETOF (st_mtim), STAT_TIMESPEC_OFFSETOF (st_ctim) }; - int i; - for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) + for (int i = 0; i < sizeof ts_off / sizeof *ts_off; i++) { struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); long int q = ts->tv_nsec / timespec_hz; diff --git a/tests/stat-w32.c b/tests/stat-w32.c index 8da8fe5c..583ef09b 100644 --- a/tests/stat-w32.c +++ b/tests/stat-w32.c @@ -1,5 +1,5 @@ /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2025 Free Software Foundation, Inc. + Copyright (C) 2017-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -112,11 +112,11 @@ initialize (void) struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft) { - struct timespec result; /* FILETIME: <https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime> */ unsigned long long since_1601 = ((unsigned long long) ft->dwHighDateTime << 32) | (unsigned long long) ft->dwLowDateTime; + struct timespec result; if (since_1601 == 0) { result.tv_sec = 0; @@ -289,8 +289,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) && (path = fpath, 1))) { const char *last_dot = NULL; - const char *p; - for (p = path; *p != '\0'; p++) + for (const char *p = path; *p != '\0'; p++) if (*p == '.') last_dot = p; if (last_dot != NULL) diff --git a/tests/stat-w32.h b/tests/stat-w32.h index c70c1be3..f5cc82f4 100644 --- a/tests/stat-w32.h +++ b/tests/stat-w32.h @@ -1,5 +1,5 @@ /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2025 Free Software Foundation, Inc. + Copyright (C) 2017-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/stat.c b/tests/stat.c index f4cc02e9..da6a9862 100644 --- a/tests/stat.c +++ b/tests/stat.c @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -287,8 +287,7 @@ rpl_stat (char const *name, struct stat *buf) if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) { const char *last_dot = NULL; - const char *p; - for (p = info.cFileName; *p != '\0'; p++) + for (const char *p = info.cFileName; *p != '\0'; p++) if (*p == '.') last_dot = p; if (last_dot != NULL) diff --git a/tests/stdio-consolesafe.c b/tests/stdio-consolesafe.c index fbea20be..f634de13 100644 --- a/tests/stdio-consolesafe.c +++ b/tests/stdio-consolesafe.c @@ -1,5 +1,5 @@ /* msvcrt workarounds. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -74,6 +74,59 @@ gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp) #if defined __MINGW32__ && __USE_MINGW_ANSI_STDIO # include "fseterr.h" +# include <stdarg.h> + +# if !HAVE_VASPRINTF + +# include <errno.h> + +/* The old mingw (before mingw-w64) does not have the vasprintf function. + Define a suitable replacement here, that supports the same format + specifiers as the mingw *printf functions. */ + +static int +local_vasprintf (char **resultp, const char *format, va_list args) +{ + /* First try: Use a stack-allocated buffer. */ + char buf[2048]; + size_t bufsize = sizeof (buf); + int ret = __mingw_vsnprintf (buf, bufsize, format, args); + if (ret < 0) + return -1; + size_t nbytes = ret; + char *mem = (char *) malloc (nbytes + 1); + if (mem == NULL) + { + errno = ENOMEM; + return -1; + } + if (ret < bufsize) + { + /* The buffer was sufficiently large. */ + memcpy (mem, buf, nbytes + 1); + } + else + { + /* Second try: Use the heap-allocated memory. */ + ret = __mingw_vsnprintf (mem, nbytes + 1, format, args); + if (ret < 0) + { + int saved_errno = errno; + free (mem); + errno = saved_errno; + return -1; + } + if (ret != nbytes) + abort (); + } + *resultp = mem; + return nbytes; +} + +# undef vasprintf +# define vasprintf local_vasprintf + +# endif /* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt, but without losing the support for modern format specifiers added by @@ -83,8 +136,8 @@ int gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...) { va_list args; - char *tmpstring; va_start (args, format); + char *tmpstring; int result = vasprintf (&tmpstring, format, args); va_end (args); if (result >= 0) @@ -101,8 +154,8 @@ int gl_consolesafe_printf (const char *restrict format, ...) { va_list args; - char *tmpstring; va_start (args, format); + char *tmpstring; int result = vasprintf (&tmpstring, format, args); va_end (args); if (result >= 0) diff --git a/tests/stdio-read.c b/tests/stdio-read.c index 70452b48..0ca956dc 100644 --- a/tests/stdio-read.c +++ b/tests/stdio-read.c @@ -1,5 +1,5 @@ /* POSIX compatible FILE stream read function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This file is free software: you can redistribute it and/or modify @@ -52,9 +52,8 @@ return (EXPRESSION); \ else \ { \ - RETTYPE ret; \ SetLastError (0); \ - ret = (EXPRESSION); \ + RETTYPE ret = (EXPRESSION); \ if (FAILED) \ { \ if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ @@ -86,11 +85,9 @@ int scanf (const char *format, ...) { - int retval; va_list args; - va_start (args, format); - retval = vfscanf (stdin, format, args); + int retval = vfscanf (stdin, format, args); va_end (args); return retval; @@ -103,11 +100,9 @@ scanf (const char *format, ...) int fscanf (FILE *stream, const char *format, ...) { - int retval; va_list args; - va_start (args, format); - retval = vfscanf (stream, format, args); + int retval = vfscanf (stream, format, args); va_end (args); return retval; diff --git a/tests/stdio-write.c b/tests/stdio-write.c index 59ba8fc4..fc7f74fe 100644 --- a/tests/stdio-write.c +++ b/tests/stdio-write.c @@ -1,5 +1,5 @@ /* POSIX compatible FILE stream write function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This file is free software: you can redistribute it and/or modify @@ -107,10 +107,9 @@ return (EXPRESSION); \ else \ { \ - RETTYPE ret; \ CLEAR_ERRNO \ CLEAR_LastError \ - ret = (EXPRESSION); \ + RETTYPE ret = (EXPRESSION); \ if (FAILED) \ { \ HANDLE_ENOSPC \ @@ -124,11 +123,9 @@ int printf (const char *format, ...) { - int retval; va_list args; - va_start (args, format); - retval = vfprintf (stdout, format, args); + int retval = vfprintf (stdout, format, args); va_end (args); return retval; @@ -139,11 +136,9 @@ printf (const char *format, ...) int fprintf (FILE *stream, const char *format, ...) { - int retval; va_list args; - va_start (args, format); - retval = vfprintf (stream, format, args); + int retval = vfprintf (stream, format, args); va_end (args); return retval; diff --git a/tests/stdio.in.h b/tests/stdio.in.h index f3ab7969..33b0b8e4 100644 --- a/tests/stdio.in.h +++ b/tests/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -338,7 +338,7 @@ _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); _GL_CXXALIASWARN (dprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef dprintf +# undef dprintf /* https://lists.gnu.org/r/bug-gnulib/2025-11/msg00254.html */ # if HAVE_RAW_DECL_DPRINTF _GL_WARN_ON_USE (dprintf, "dprintf is unportable - " "use gnulib module dprintf for portability"); @@ -360,7 +360,6 @@ _GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); _GL_CXXALIASWARN (fclose); # endif #elif defined GNULIB_POSIXCHECK -# undef fclose /* Assume fclose is always declared. */ _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " "use gnulib module fclose for portable POSIX compliance"); @@ -447,7 +446,6 @@ _GL_FUNCDECL_SYS (fdopen, FILE *, # endif # endif # if defined GNULIB_POSIXCHECK -# undef fdopen /* Assume fdopen is always declared. */ _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " "use gnulib module fdopen for portability"); @@ -488,7 +486,6 @@ _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fflush); # endif #elif defined GNULIB_POSIXCHECK -# undef fflush /* Assume fflush is always declared. */ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " "use gnulib module fflush for portable POSIX compliance"); @@ -581,7 +578,6 @@ _GL_FUNCDECL_SYS (fopen, FILE *, _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_DEALLOC (fclose, 1)); # endif # if defined GNULIB_POSIXCHECK -# undef fopen /* Assume fopen is always declared. */ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " "use gnulib module fopen for portability"); @@ -641,9 +637,6 @@ _GL_CXXALIASWARN (fprintf); # endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_fprintf -# undef fprintf -# endif /* Assume fprintf is always declared. */ _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " "use gnulib module fprintf-posix for portable " @@ -673,7 +666,6 @@ _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); _GL_CXXALIASWARN (fpurge); # endif #elif defined GNULIB_POSIXCHECK -# undef fpurge # if HAVE_RAW_DECL_FPURGE _GL_WARN_ON_USE (fpurge, "fpurge is not always present - " "use gnulib module fpurge for portability"); @@ -761,7 +753,6 @@ _GL_CXXALIAS_SYS (freopen, FILE *, _GL_CXXALIASWARN (freopen); # endif #elif defined GNULIB_POSIXCHECK -# undef freopen /* Assume freopen is always declared. */ _GL_WARN_ON_USE (freopen, "freopen on native Windows platforms is not POSIX compliant - " @@ -868,7 +859,6 @@ _GL_CXXALIASWARN (fseeko); #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ # undef fseek -# undef fseeko # if HAVE_RAW_DECL_FSEEKO _GL_WARN_ON_USE (fseeko, "fseeko is unportable - " "use gnulib module fseeko for portability"); @@ -932,7 +922,6 @@ _GL_CXXALIASWARN (ftello); #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ # undef ftell -# undef ftello # if HAVE_RAW_DECL_FTELLO _GL_WARN_ON_USE (ftello, "ftello is unportable - " "use gnulib module ftello for portability"); @@ -1044,6 +1033,17 @@ _GL_CXXALIASWARN (getchar); # undef getdelim # define getdelim rpl_getdelim # endif +# ifndef __has_feature +# define __has_feature(a) 0 +# endif +# if __GLIBC__ >= 2 && !(defined __SANITIZE_ADDRESS__ \ + || __has_feature (address_sanitizer)) +/* Arrange for the inline definition of getline() in <bits/stdio.h> + to call our getdelim() override. Do not use the __getdelim symbol + if address sanitizer is in use, otherwise it may be overridden by + __interceptor_trampoline___getdelim. */ +# define rpl_getdelim __getdelim +# endif _GL_FUNCDECL_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, @@ -1070,7 +1070,6 @@ _GL_CXXALIAS_SYS (getdelim, ssize_t, _GL_CXXALIASWARN (getdelim); # endif #elif defined GNULIB_POSIXCHECK -# undef getdelim # if HAVE_RAW_DECL_GETDELIM _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " "use gnulib module getdelim for portability"); @@ -1085,14 +1084,27 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if @REPLACE_GETLINE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getline -# define getline rpl_getline -# endif _GL_FUNCDECL_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream), _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); +# if defined __cplusplus +/* The C++ standard library defines std::basic_istream::getline in <istream> + or <string>. */ +# if !(__GLIBC__ >= 2) +extern "C" { +inline ssize_t +getline (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) +{ + return rpl_getline (lineptr, linesize, stream); +} +} +# endif +# else +# undef getline +# define getline rpl_getline +# endif _GL_CXXALIAS_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream)); @@ -1111,7 +1123,6 @@ _GL_CXXALIAS_SYS (getline, ssize_t, _GL_CXXALIASWARN (getline); # endif #elif defined GNULIB_POSIXCHECK -# undef getline # if HAVE_RAW_DECL_GETLINE _GL_WARN_ON_USE (getline, "getline is unportable - " "use gnulib module getline for portability"); @@ -1121,7 +1132,6 @@ _GL_WARN_ON_USE (getline, "getline is unportable - " /* It is very rare that the developer ever has full control of stdin, so any use of gets warrants an unconditional warning; besides, C11 removed it. */ -#undef gets #if HAVE_RAW_DECL_GETS && !defined __cplusplus _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif @@ -1234,7 +1244,6 @@ _GL_FUNCDECL_SYS (pclose, int, (FILE *stream), _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); _GL_CXXALIASWARN (pclose); #elif defined GNULIB_POSIXCHECK -# undef pclose # if HAVE_RAW_DECL_PCLOSE _GL_WARN_ON_USE (pclose, "pclose is unportable - " "use gnulib module pclose for more portability"); @@ -1258,7 +1267,6 @@ _GL_CXXALIAS_SYS (perror, void, (const char *string)); _GL_CXXALIASWARN (perror); # endif #elif defined GNULIB_POSIXCHECK -# undef perror /* Assume perror is always declared. */ _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " "use gnulib module perror for portability"); @@ -1295,7 +1303,6 @@ _GL_FUNCDECL_SYS (popen, FILE *, _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef popen # if HAVE_RAW_DECL_POPEN _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " "use gnulib module popen or pipe for more portability"); @@ -1368,9 +1375,6 @@ _GL_CXXALIASWARN (printf); # endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_printf -# undef printf -# endif /* Assume printf is always declared. */ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " "use gnulib module printf-posix for portable " @@ -1464,7 +1468,6 @@ _GL_CXXALIAS_SYS (remove, int, (const char *name)); _GL_CXXALIASWARN (remove); # endif #elif defined GNULIB_POSIXCHECK -# undef remove /* Assume remove is always declared. */ _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " "use gnulib module remove for more portability"); @@ -1489,7 +1492,6 @@ _GL_CXXALIAS_SYS (rename, int, _GL_CXXALIASWARN (rename); # endif #elif defined GNULIB_POSIXCHECK -# undef rename /* Assume rename is always declared. */ _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " "use gnulib module rename for more portability"); @@ -1517,7 +1519,6 @@ _GL_CXXALIAS_SYS (renameat, int, # endif _GL_CXXALIASWARN (renameat); #elif defined GNULIB_POSIXCHECK -# undef renameat # if HAVE_RAW_DECL_RENAMEAT _GL_WARN_ON_USE (renameat, "renameat is not portable - " "use gnulib module renameat for portability"); @@ -1611,7 +1612,6 @@ _GL_CXXALIAS_SYS (snprintf, int, _GL_CXXALIASWARN (snprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef snprintf # if HAVE_RAW_DECL_SNPRINTF _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " "use gnulib module snprintf for portability"); @@ -1667,7 +1667,6 @@ _GL_CXXALIAS_SYS (sprintf, int, _GL_CXXALIASWARN (sprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef sprintf /* Assume sprintf is always declared. */ _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " "use gnulib module sprintf-posix for portable " @@ -1722,7 +1721,6 @@ _GL_FUNCDECL_SYS (tmpfile, FILE *, (void), _GL_ATTRIBUTE_MALLOC); # endif # if defined GNULIB_POSIXCHECK -# undef tmpfile # if HAVE_RAW_DECL_TMPFILE _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " "use gnulib module tmpfile for portability"); @@ -1856,7 +1854,6 @@ _GL_CXXALIAS_SYS_CAST (vdprintf, int, _GL_CXXALIASWARN (vdprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vdprintf # if HAVE_RAW_DECL_VDPRINTF _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " "use gnulib module vdprintf for portability"); @@ -1925,9 +1922,6 @@ _GL_CXXALIASWARN (vfprintf); # endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vfprintf -# undef vfprintf -# endif /* Assume vfprintf is always declared. */ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " "use gnulib module vfprintf-posix for portable " @@ -2011,9 +2005,6 @@ _GL_CXXALIASWARN (vprintf); # endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK -# if !GNULIB_overrides_vprintf -# undef vprintf -# endif /* Assume vprintf is always declared. */ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " "use gnulib module vprintf-posix for portable " @@ -2092,7 +2083,6 @@ _GL_CXXALIAS_SYS (vsnprintf, int, _GL_CXXALIASWARN (vsnprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsnprintf # if HAVE_RAW_DECL_VSNPRINTF _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " "use gnulib module vsnprintf for portability"); @@ -2145,7 +2135,6 @@ _GL_CXXALIAS_SYS_CAST (vsprintf, int, _GL_CXXALIASWARN (vsprintf); # endif #elif defined GNULIB_POSIXCHECK -# undef vsprintf /* Assume vsprintf is always declared. */ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " "use gnulib module vsprintf-posix for portable " diff --git a/tests/stpcpy.c b/tests/stpcpy.c index 6d5458c2..862de088 100644 --- a/tests/stpcpy.c +++ b/tests/stpcpy.c @@ -1,5 +1,5 @@ /* stpcpy.c -- copy a string and return pointer to end of new string - Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2025 Free Software + Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2026 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. diff --git a/tests/str_endswith.c b/tests/str_endswith.c index cd2cc9e1..e38569ac 100644 --- a/tests/str_endswith.c +++ b/tests/str_endswith.c @@ -1,5 +1,5 @@ /* str_endswith function. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/str_startswith.c b/tests/str_startswith.c index a312728b..2c650cea 100644 --- a/tests/str_startswith.c +++ b/tests/str_startswith.c @@ -1,5 +1,5 @@ /* str_startswith function. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/strerror-override.c b/tests/strerror-override.c index 3cc25905..a07ed62f 100644 --- a/tests/strerror-override.c +++ b/tests/strerror-override.c @@ -1,6 +1,6 @@ /* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/strerror-override.h b/tests/strerror-override.h index 653ea0ad..1e84bdbc 100644 --- a/tests/strerror-override.h +++ b/tests/strerror-override.h @@ -1,6 +1,6 @@ /* strerror-override.h --- POSIX compatible system error routine - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/strerror.c b/tests/strerror.c index 72572ae4..c451f055 100644 --- a/tests/strerror.c +++ b/tests/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -42,7 +42,6 @@ strerror (int n) #undef strerror { static char buf[STACKBUF_LEN]; - size_t len; /* Cast away const, due to the historical signature of strerror; callers should not be modifying the string. */ @@ -67,7 +66,7 @@ strerror (int n) } /* Fix STACKBUF_LEN if this ever aborts. */ - len = strlen (msg); + size_t len = strlen (msg); if (sizeof buf <= len) abort (); diff --git a/tests/strerror_r.c b/tests/strerror_r.c index 1e6974e3..ec7bfe6b 100644 --- a/tests/strerror_r.c +++ b/tests/strerror_r.c @@ -1,6 +1,6 @@ /* strerror_r.c --- POSIX compatible system error routine - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -103,10 +103,8 @@ static int local_snprintf (char *buf, size_t buflen, const char *format, ...) { va_list args; - int result; - va_start (args, format); - result = _vsnprintf (buf, buflen, format, args); + int result = _vsnprintf (buf, buflen, format, args); va_end (args); if (buflen > 0 && (result < 0 || result >= buflen)) buf[buflen - 1] = '\0'; @@ -222,9 +220,8 @@ strerror_r (int errnum, char *buf, size_t buflen) if (!ret && strlen (buf) == buflen - 1) { char stackbuf[STACKBUF_LEN]; - size_t len; strerror_r (errnum, stackbuf, sizeof stackbuf); - len = strlen (stackbuf); + size_t len = strlen (stackbuf); /* STACKBUF_LEN should have been large enough. */ if (len + 1 == sizeof stackbuf) abort (); diff --git a/tests/symlink.c b/tests/symlink.c index 8839a981..80ac16ce 100644 --- a/tests/symlink.c +++ b/tests/symlink.c @@ -1,5 +1,5 @@ /* Stub for symlink(). - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/sys_ioctl.in.h b/tests/sys_ioctl.in.h index 208c807e..9fa64a25 100644 --- a/tests/sys_ioctl.in.h +++ b/tests/sys_ioctl.in.h @@ -1,5 +1,5 @@ /* Substitute for and wrapper around <sys/ioctl.h>. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -76,7 +76,6 @@ _GL_CXXALIASWARN (ioctl); # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl # endif #elif defined GNULIB_POSIXCHECK -# undef ioctl # if HAVE_RAW_DECL_IOCTL _GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - " "use gnulib module ioctl for portability"); diff --git a/tests/sys_select.in.h b/tests/sys_select.in.h index 69c2fa9f..6a85efe8 100644 --- a/tests/sys_select.in.h +++ b/tests/sys_select.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/select.h>. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -152,11 +152,10 @@ typedef int suseconds_t; static int rpl_fd_isset (SOCKET fd, const fd_set * set) { - u_int i; if (set == NULL) return 0; - for (i = 0; i < set->fd_count; i++) + for (u_int i = 0; i < set->fd_count; i++) if (set->fd_array[i] == fd) return 1; @@ -284,7 +283,6 @@ _GL_CXXALIAS_SYS_CAST (pselect, int, _GL_CXXALIASWARN (pselect); # endif #elif defined GNULIB_POSIXCHECK -# undef pselect # if HAVE_RAW_DECL_PSELECT _GL_WARN_ON_USE (pselect, "pselect is not portable - " "use gnulib module pselect for portability"); @@ -317,7 +315,6 @@ _GL_CXXALIASWARN (select); # define select select_used_without_requesting_gnulib_module_select # endif #elif defined GNULIB_POSIXCHECK -# undef select # if HAVE_RAW_DECL_SELECT _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " "use gnulib module select for portability"); diff --git a/tests/sys_socket.c b/tests/sys_socket.c index efd36610..023a7c55 100644 --- a/tests/sys_socket.c +++ b/tests/sys_socket.c @@ -1,6 +1,6 @@ /* Inline functions for <sys/socket.h>. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/sys_socket.in.h b/tests/sys_socket.in.h index 8632c66d..c19b7461 100644 --- a/tests/sys_socket.in.h +++ b/tests/sys_socket.in.h @@ -1,6 +1,6 @@ /* Provide a sys/socket header file for systems lacking it (read: MinGW) and for systems where it is incomplete. - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. Written by Simon Josefsson. This file is free software: you can redistribute it and/or modify @@ -235,11 +235,10 @@ struct msghdr { _GL_SYS_SOCKET_INLINE int rpl_fd_isset (SOCKET fd, fd_set * set) { - u_int i; if (set == NULL) return 0; - for (i = 0; i < set->fd_count; i++) + for (u_int i = 0; i < set->fd_count; i++) if (set->fd_array[i] == fd) return 1; @@ -304,7 +303,6 @@ _GL_CXXALIASWARN (socket); # define socket socket_used_without_requesting_gnulib_module_socket # endif #elif defined GNULIB_POSIXCHECK -# undef socket # if HAVE_RAW_DECL_SOCKET _GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - " "use gnulib module socket for portability"); @@ -336,7 +334,6 @@ _GL_CXXALIASWARN (connect); # define connect connect_used_without_requesting_gnulib_module_connect # endif #elif defined GNULIB_POSIXCHECK -# undef connect # if HAVE_RAW_DECL_CONNECT _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " "use gnulib module connect for portability"); @@ -374,7 +371,6 @@ _GL_CXXALIASWARN (accept); # define accept accept_used_without_requesting_gnulib_module_accept # endif #elif defined GNULIB_POSIXCHECK -# undef accept # if HAVE_RAW_DECL_ACCEPT _GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - " "use gnulib module accept for portability"); @@ -406,7 +402,6 @@ _GL_CXXALIASWARN (bind); # define bind bind_used_without_requesting_gnulib_module_bind # endif #elif defined GNULIB_POSIXCHECK -# undef bind # if HAVE_RAW_DECL_BIND _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " "use gnulib module bind for portability"); @@ -442,7 +437,6 @@ _GL_CXXALIASWARN (getpeername); # define getpeername getpeername_used_without_requesting_gnulib_module_getpeername # endif #elif defined GNULIB_POSIXCHECK -# undef getpeername # if HAVE_RAW_DECL_GETPEERNAME _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " "use gnulib module getpeername for portability"); @@ -478,7 +472,6 @@ _GL_CXXALIASWARN (getsockname); # define getsockname getsockname_used_without_requesting_gnulib_module_getsockname # endif #elif defined GNULIB_POSIXCHECK -# undef getsockname # if HAVE_RAW_DECL_GETSOCKNAME _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " "use gnulib module getsockname for portability"); @@ -512,7 +505,6 @@ _GL_CXXALIASWARN (getsockopt); # define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt # endif #elif defined GNULIB_POSIXCHECK -# undef getsockopt # if HAVE_RAW_DECL_GETSOCKOPT _GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - " "use gnulib module getsockopt for portability"); @@ -537,7 +529,6 @@ _GL_CXXALIASWARN (listen); # define listen listen_used_without_requesting_gnulib_module_listen # endif #elif defined GNULIB_POSIXCHECK -# undef listen # if HAVE_RAW_DECL_LISTEN _GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - " "use gnulib module listen for portability"); @@ -566,7 +557,6 @@ _GL_CXXALIASWARN (recv); # define recv recv_used_without_requesting_gnulib_module_recv # endif #elif defined GNULIB_POSIXCHECK -# undef recv # if HAVE_RAW_DECL_RECV _GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - " "use gnulib module recv for portability"); @@ -598,7 +588,6 @@ _GL_CXXALIASWARN (send); # define send send_used_without_requesting_gnulib_module_send # endif #elif defined GNULIB_POSIXCHECK -# undef send # if HAVE_RAW_DECL_SEND _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " "use gnulib module send for portability"); @@ -637,7 +626,6 @@ _GL_CXXALIASWARN (recvfrom); # define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom # endif #elif defined GNULIB_POSIXCHECK -# undef recvfrom # if HAVE_RAW_DECL_RECVFROM _GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - " "use gnulib module recvfrom for portability"); @@ -671,7 +659,6 @@ _GL_CXXALIASWARN (sendto); # define sendto sendto_used_without_requesting_gnulib_module_sendto # endif #elif defined GNULIB_POSIXCHECK -# undef sendto # if HAVE_RAW_DECL_SENDTO _GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - " "use gnulib module sendto for portability"); @@ -703,7 +690,6 @@ _GL_CXXALIASWARN (setsockopt); # define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt # endif #elif defined GNULIB_POSIXCHECK -# undef setsockopt # if HAVE_RAW_DECL_SETSOCKOPT _GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - " "use gnulib module setsockopt for portability"); @@ -728,7 +714,6 @@ _GL_CXXALIASWARN (shutdown); # define shutdown shutdown_used_without_requesting_gnulib_module_shutdown # endif #elif defined GNULIB_POSIXCHECK -# undef shutdown # if HAVE_RAW_DECL_SHUTDOWN _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - " "use gnulib module shutdown for portability"); @@ -761,7 +746,6 @@ _GL_CXXALIAS_SYS (accept4, int, # endif _GL_CXXALIASWARN (accept4); #elif defined GNULIB_POSIXCHECK -# undef accept4 # if HAVE_RAW_DECL_ACCEPT4 _GL_WARN_ON_USE (accept4, "accept4 is unportable - " "use gnulib module accept4 for portability"); diff --git a/tests/sys_stat.in.h b/tests/sys_stat.in.h index 8f676cb3..deed21cd 100644 --- a/tests/sys_stat.in.h +++ b/tests/sys_stat.in.h @@ -1,5 +1,5 @@ /* Provide a more complete sys/stat.h header file. - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -451,7 +451,6 @@ _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode)); # endif _GL_CXXALIASWARN (chmod); #elif defined GNULIB_POSIXCHECK -# undef chmod # if HAVE_RAW_DECL_CHMOD _GL_WARN_ON_USE (chmod, "chmod has portability problems - " "use gnulib module chmod for portability"); @@ -496,7 +495,6 @@ _GL_CXXALIAS_SYS (fchmodat, int, # endif _GL_CXXALIASWARN (fchmodat); #elif defined GNULIB_POSIXCHECK -# undef fchmodat # if HAVE_RAW_DECL_FCHMODAT _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " "use gnulib module openat for portability"); @@ -528,7 +526,6 @@ _GL_CXXALIASWARN (fstat); /* Above, we define stat to _stati64. */ # define fstat _fstati64 #elif defined GNULIB_POSIXCHECK -# undef fstat # if HAVE_RAW_DECL_FSTAT _GL_WARN_ON_USE (fstat, "fstat has portability problems - " "use gnulib module fstat for portability"); @@ -567,7 +564,6 @@ _GL_CXXALIASWARN (fstatat); # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat # endif #elif defined GNULIB_POSIXCHECK -# undef fstatat # if HAVE_RAW_DECL_FSTATAT _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " "use gnulib module openat for portability"); @@ -597,7 +593,6 @@ _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); _GL_CXXALIASWARN (futimens); # endif #elif defined GNULIB_POSIXCHECK -# undef futimens # if HAVE_RAW_DECL_FUTIMENS _GL_WARN_ON_USE (futimens, "futimens is not portable - " "use gnulib module futimens for portability"); @@ -618,7 +613,6 @@ _GL_CXXALIAS_SYS (getumask, mode_t, (void)); _GL_CXXALIASWARN (getumask); # endif #elif defined GNULIB_POSIXCHECK -# undef getumask # if HAVE_RAW_DECL_GETUMASK _GL_WARN_ON_USE (getumask, "getumask is not portable - " "use gnulib module getumask for portability"); @@ -636,7 +630,6 @@ _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode), _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); _GL_CXXALIASWARN (lchmod); #elif defined GNULIB_POSIXCHECK -# undef lchmod # if HAVE_RAW_DECL_LCHMOD _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " "use gnulib module lchmod for portability"); @@ -698,7 +691,6 @@ _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); #elif defined GNULIB_POSIXCHECK -# undef mkdir # if HAVE_RAW_DECL_MKDIR _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " "use gnulib module mkdir for portability"); @@ -714,7 +706,6 @@ _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode), _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkdirat); #elif defined GNULIB_POSIXCHECK -# undef mkdirat # if HAVE_RAW_DECL_MKDIRAT _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " "use gnulib module openat for portability"); @@ -740,7 +731,6 @@ _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); # endif _GL_CXXALIASWARN (mkfifo); #elif defined GNULIB_POSIXCHECK -# undef mkfifo # if HAVE_RAW_DECL_MKFIFO _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " "use gnulib module mkfifo for portability"); @@ -768,7 +758,6 @@ _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); _GL_CXXALIASWARN (mkfifoat); # endif #elif defined GNULIB_POSIXCHECK -# undef mkfifoat # if HAVE_RAW_DECL_MKFIFOAT _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " "use gnulib module mkfifoat for portability"); @@ -794,7 +783,6 @@ _GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK -# undef mknod # if HAVE_RAW_DECL_MKNOD _GL_WARN_ON_USE (mknod, "mknod is not portable - " "use gnulib module mknod for portability"); @@ -826,7 +814,6 @@ _GL_CXXALIAS_SYS (mknodat, int, _GL_CXXALIASWARN (mknodat); # endif #elif defined GNULIB_POSIXCHECK -# undef mknodat # if HAVE_RAW_DECL_MKNODAT _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " "use gnulib module mkfifoat for portability"); @@ -904,7 +891,6 @@ _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) #define stat stat_used_without_requesting_gnulib_module_stat */ #elif defined GNULIB_POSIXCHECK -# undef stat # if HAVE_RAW_DECL_STAT _GL_WARN_ON_USE (stat, "stat is unportable - " "use gnulib module stat for portability"); @@ -944,7 +930,6 @@ _GL_CXXALIASWARN (lstat); # define lstat lstat_used_without_requesting_gnulib_module_lstat # endif #elif defined GNULIB_POSIXCHECK -# undef lstat # if HAVE_RAW_DECL_LSTAT _GL_WARN_ON_USE (lstat, "lstat is unportable - " "use gnulib module lstat for portability"); @@ -998,7 +983,6 @@ _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, _GL_CXXALIASWARN (utimensat); # endif #elif defined GNULIB_POSIXCHECK -# undef utimensat # if HAVE_RAW_DECL_UTIMENSAT _GL_WARN_ON_USE (utimensat, "utimensat is not portable - " "use gnulib module utimensat for portability"); diff --git a/tests/sys_time.in.h b/tests/sys_time.in.h index e6d15613..666d9dd1 100644 --- a/tests/sys_time.in.h +++ b/tests/sys_time.in.h @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -133,7 +133,6 @@ namespace GNULIB_NAMESPACE { } # endif #elif defined GNULIB_POSIXCHECK -# undef gettimeofday # if HAVE_RAW_DECL_GETTIMEOFDAY _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " "use gnulib module gettimeofday for portability"); diff --git a/tests/sys_uio.in.h b/tests/sys_uio.in.h index fec3a70a..8f7f506f 100644 --- a/tests/sys_uio.in.h +++ b/tests/sys_uio.in.h @@ -1,5 +1,5 @@ /* Substitute for <sys/uio.h>. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/test-accept.c b/tests/test-accept.c index 2557d06e..b8aaeff1 100644 --- a/tests/test-accept.c +++ b/tests/test-accept.c @@ -1,5 +1,5 @@ /* Test accepting a connection to a server socket. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-alignasof.c b/tests/test-alignasof.c index b0c74f84..b92a24fc 100644 --- a/tests/test-alignasof.c +++ b/tests/test-alignasof.c @@ -1,5 +1,5 @@ /* Test of alignasof module. - Copyright 2009-2025 Free Software Foundation, Inc. + Copyright 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-alloca-opt.c b/tests/test-alloca-opt.c index 5cd56405..395db9d7 100644 --- a/tests/test-alloca-opt.c +++ b/tests/test-alloca-opt.c @@ -1,5 +1,5 @@ /* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. diff --git a/tests/test-arpa_inet-h.c b/tests/test-arpa_inet-h.c index c81ddc6f..553106ff 100644 --- a/tests/test-arpa_inet-h.c +++ b/tests/test-arpa_inet-h.c @@ -1,5 +1,5 @@ /* Test of <arpa/inet.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-array-mergesort.c b/tests/test-array-mergesort.c index dd6dc0b2..a19bcc6f 100644 --- a/tests/test-array-mergesort.c +++ b/tests/test-array-mergesort.c @@ -1,5 +1,5 @@ /* Test of stable-sorting of an array using mergesort. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/test-assert.c b/tests/test-assert.c index 1262d5dd..2344dbcb 100644 --- a/tests/test-assert.c +++ b/tests/test-assert.c @@ -1,5 +1,5 @@ /* Test assert.h and static_assert. - Copyright 2022-2025 Free Software Foundation, Inc. + Copyright 2022-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-binary-io.c b/tests/test-binary-io.c index 7cdf7ba9..682a5234 100644 --- a/tests/test-binary-io.c +++ b/tests/test-binary-io.c @@ -1,5 +1,5 @@ /* Test of binary mode I/O. - Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-bind.c b/tests/test-bind.c index 5b9ca8c5..a6b1a186 100644 --- a/tests/test-bind.c +++ b/tests/test-bind.c @@ -1,5 +1,5 @@ /* Test binding a server socket to a port. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-bool.c b/tests/test-bool.c index 0dbbf38b..ba8c316d 100644 --- a/tests/test-bool.c +++ b/tests/test-bool.c @@ -1,5 +1,5 @@ /* Test bool. - Copyright (C) 2002-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-btoc32.c b/tests/test-btoc32.c index a4664e76..15b64442 100644 --- a/tests/test-btoc32.c +++ b/tests/test-btoc32.c @@ -1,5 +1,5 @@ /* Test of conversion of unibyte character to 32-bit wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; } diff --git a/tests/test-btowc.c b/tests/test-btowc.c index de3c5603..facc1540 100644 --- a/tests/test-btowc.c +++ b/tests/test-btowc.c @@ -1,5 +1,5 @@ /* Test of conversion of unibyte character to wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; } diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c index c5eadb29..512f5ce7 100644 --- a/tests/test-c-ctype.c +++ b/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)) { diff --git a/tests/test-c-strcasecmp.c b/tests/test-c-strcasecmp.c index b02caad0..ffe7687c 100644 --- a/tests/test-c-strcasecmp.c +++ b/tests/test-c-strcasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-c32isalnum.c b/tests/test-c32isalnum.c index 20e4d30a..17880fa1 100644 --- a/tests/test-c32isalnum.c +++ b/tests/test-c32isalnum.c @@ -1,5 +1,5 @@ /* Test of c32isalnum() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32isalpha.c b/tests/test-c32isalpha.c index c9d2c19f..bd473842 100644 --- a/tests/test-c32isalpha.c +++ b/tests/test-c32isalpha.c @@ -1,5 +1,5 @@ /* Test of c32isalpha() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32isblank.c b/tests/test-c32isblank.c index 0d919867..33e7c3c8 100644 --- a/tests/test-c32isblank.c +++ b/tests/test-c32isblank.c @@ -1,5 +1,5 @@ /* Test of c32isblank() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32iscntrl.c b/tests/test-c32iscntrl.c index d9a98f89..8bf7d35c 100644 --- a/tests/test-c32iscntrl.c +++ b/tests/test-c32iscntrl.c @@ -1,5 +1,5 @@ /* Test of c32iscntrl() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) @@ -145,7 +141,7 @@ main (int argc, char *argv[]) /* U+00A0 NO-BREAK SPACE */ is = for_character ("\302\240", 2); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__ || defined __HAIKU__) /* U+202E RIGHT-TO-LEFT OVERRIDE */ is = for_character ("\342\200\256", 3); ASSERT (is != 0); @@ -153,7 +149,7 @@ main (int argc, char *argv[]) /* U+3000 IDEOGRAPHIC SPACE */ is = for_character ("\343\200\200", 3); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__ || defined __HAIKU__) /* U+FEFF ZERO WIDTH NO-BREAK SPACE */ is = for_character ("\357\273\277", 3); ASSERT (is != 0); @@ -161,7 +157,7 @@ main (int argc, char *argv[]) /* U+20000 <CJK Ideograph> */ is = for_character ("\360\240\200\200", 4); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+E0001 LANGUAGE TAG */ is = for_character ("\363\240\200\201", 4); ASSERT (is != 0); diff --git a/tests/test-c32isdigit.c b/tests/test-c32isdigit.c index 4300da18..97b3538e 100644 --- a/tests/test-c32isdigit.c +++ b/tests/test-c32isdigit.c @@ -1,5 +1,5 @@ /* Test of c32isdigit() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32isgraph.c b/tests/test-c32isgraph.c index f6f7276f..471710f3 100644 --- a/tests/test-c32isgraph.c +++ b/tests/test-c32isgraph.c @@ -1,5 +1,5 @@ /* Test of c32isgraph() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) @@ -155,7 +151,7 @@ main (int argc, char *argv[]) /* U+007F <control> */ is = for_character ("\177", 1); ASSERT (is == 0); - #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__)) + #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __HAIKU__) /* U+00A0 NO-BREAK SPACE */ is = for_character ("\302\240", 2); ASSERT (is != 0); @@ -166,7 +162,7 @@ main (int argc, char *argv[]) /* U+2002 EN SPACE */ is = for_character ("\342\200\202", 3); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__ || defined __HAIKU__) /* U+202E RIGHT-TO-LEFT OVERRIDE */ is = for_character ("\342\200\256", 3); ASSERT (is == 0); @@ -174,7 +170,7 @@ main (int argc, char *argv[]) /* U+3000 IDEOGRAPHIC SPACE */ is = for_character ("\343\200\200", 3); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__ || defined __HAIKU__) /* U+FEFF ZERO WIDTH NO-BREAK SPACE */ is = for_character ("\357\273\277", 3); ASSERT (is == 0); @@ -184,7 +180,7 @@ main (int argc, char *argv[]) is = for_character ("\360\240\200\200", 4); ASSERT (is != 0); #endif - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+E0001 LANGUAGE TAG */ is = for_character ("\363\240\200\201", 4); ASSERT (is == 0); diff --git a/tests/test-c32islower.c b/tests/test-c32islower.c index a66199f8..ea176b14 100644 --- a/tests/test-c32islower.c +++ b/tests/test-c32islower.c @@ -1,5 +1,5 @@ /* Test of c32islower() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) @@ -202,7 +198,7 @@ main (int argc, char *argv[]) /* U+00B2 SUPERSCRIPT TWO */ is = for_character ("\302\262", 2); ASSERT (is == 0); - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+00B5 MICRO SIGN */ is = for_character ("\302\265", 2); ASSERT (is == 0); diff --git a/tests/test-c32isprint.c b/tests/test-c32isprint.c index b025d7cb..c64eec43 100644 --- a/tests/test-c32isprint.c +++ b/tests/test-c32isprint.c @@ -1,5 +1,5 @@ /* Test of c32isprint() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) @@ -167,7 +163,7 @@ main (int argc, char *argv[]) is = for_character ("\342\200\202", 3); ASSERT (is != 0); #endif - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || defined __ANDROID__ || defined __HAIKU__) /* U+202E RIGHT-TO-LEFT OVERRIDE */ is = for_character ("\342\200\256", 3); ASSERT (is == 0); @@ -177,7 +173,7 @@ main (int argc, char *argv[]) is = for_character ("\343\200\200", 3); ASSERT (is != 0); #endif - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+FEFF ZERO WIDTH NO-BREAK SPACE */ is = for_character ("\357\273\277", 3); ASSERT (is == 0); @@ -187,7 +183,7 @@ main (int argc, char *argv[]) is = for_character ("\360\240\200\200", 4); ASSERT (is != 0); #endif - #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__) + #if !(defined __GLIBC__ || defined MUSL_LIBC || (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined _AIX || defined __sun || defined __CYGWIN__ || (defined _WIN32 && !defined __CYGWIN__) || defined __ANDROID__ || defined __HAIKU__) /* U+E0001 LANGUAGE TAG */ is = for_character ("\363\240\200\201", 4); ASSERT (is == 0); diff --git a/tests/test-c32ispunct.c b/tests/test-c32ispunct.c index 535d0c49..52be41e0 100644 --- a/tests/test-c32ispunct.c +++ b/tests/test-c32ispunct.c @@ -1,5 +1,5 @@ /* Test of c32ispunct() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,74 +62,74 @@ 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. */ + 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. */ + #if defined __HAIKU__ + if (!(c == '+' || c == '<' || c == '=' || c == '>' + || c == '^' || c == '|' || c == '~')) + #endif ASSERT (is != 0); - break; - default: - ASSERT (is == 0); - break; - } - break; - } - } + break; + default: + ASSERT (is == 0); + break; + } + break; + } if (argc > 1) switch (argv[1][0]) @@ -216,7 +216,7 @@ main (int argc, char *argv[]) /* U+00BF INVERTED QUESTION MARK */ is = for_character ("\302\277", 2); ASSERT (is != 0); - #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) + #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun || defined __HAIKU__) /* U+00D7 MULTIPLICATION SIGN */ is = for_character ("\303\227", 2); ASSERT (is != 0); @@ -233,7 +233,7 @@ main (int argc, char *argv[]) /* U+05F3 HEBREW PUNCTUATION GERESH */ is = for_character ("\327\263", 2); ASSERT (is != 0); - #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun || (defined _WIN32 && !defined __CYGWIN__)) + #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun || (defined _WIN32 && !defined __CYGWIN__) || defined __HAIKU__) /* U+2192 RIGHTWARDS ARROW */ is = for_character ("\342\206\222", 3); ASSERT (is != 0); @@ -250,7 +250,7 @@ main (int argc, char *argv[]) /* U+10330 GOTHIC LETTER AHSA */ is = for_character ("\360\220\214\260", 4); ASSERT (is == 0); - #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun) + #if !((defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __DragonFly__ || defined __sun || defined __HAIKU__) /* U+1D100 MUSICAL SYMBOL SINGLE BARLINE */ is = for_character ("\360\235\204\200", 4); ASSERT (is != 0); diff --git a/tests/test-c32isspace.c b/tests/test-c32isspace.c index 6381e42d..1b1a679d 100644 --- a/tests/test-c32isspace.c +++ b/tests/test-c32isspace.c @@ -1,5 +1,5 @@ /* Test of c32isspace() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32isupper.c b/tests/test-c32isupper.c index 460328ea..3c70a0d8 100644 --- a/tests/test-c32isupper.c +++ b/tests/test-c32isupper.c @@ -1,5 +1,5 @@ /* Test of c32isupper() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32isxdigit.c b/tests/test-c32isxdigit.c index c433fe44..9367de8b 100644 --- a/tests/test-c32isxdigit.c +++ b/tests/test-c32isxdigit.c @@ -1,5 +1,5 @@ /* Test of c32isxdigit() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32rtomb-w32.c b/tests/test-c32rtomb-w32.c index 9ee86301..e23b4a2f 100644 --- a/tests/test-c32rtomb-w32.c +++ b/tests/test-c32rtomb-w32.c @@ -1,5 +1,5 @@ /* Test of conversion of wide character to multibyte character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-c32rtomb.c b/tests/test-c32rtomb.c index 14dc60fa..8e5cdff2 100644 --- a/tests/test-c32rtomb.c +++ b/tests/test-c32rtomb.c @@ -1,5 +1,5 @@ /* Test of conversion of wide character to multibyte character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ { diff --git a/tests/test-c32tolower.c b/tests/test-c32tolower.c index f118021e..8198a3c5 100644 --- a/tests/test-c32tolower.c +++ b/tests/test-c32tolower.c @@ -1,5 +1,5 @@ /* Test of c32tolower() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-c32width.c b/tests/test-c32width.c index d9eec4a7..6d844679 100644 --- a/tests/test-c32width.c +++ b/tests/test-c32width.c @@ -1,5 +1,5 @@ /* Test of c32width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ diff --git a/tests/test-calloc-gnu.c b/tests/test-calloc-gnu.c index 98a3fb8b..b7eb2ac5 100644 --- a/tests/test-calloc-gnu.c +++ b/tests/test-calloc-gnu.c @@ -1,5 +1,5 @@ /* Test of calloc function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-calloc-posix.c b/tests/test-calloc-posix.c index 702c7b6a..5c310775 100644 --- a/tests/test-calloc-posix.c +++ b/tests/test-calloc-posix.c @@ -1,5 +1,5 @@ /* Test of calloc function. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-cloexec.c b/tests/test-cloexec.c index ed9d6ebc..903d6061 100644 --- a/tests/test-cloexec.c +++ b/tests/test-cloexec.c @@ -1,5 +1,5 @@ /* Test duplicating non-inheritable file descriptors. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-close.c b/tests/test-close.c index c2e280c7..0c286845 100644 --- a/tests/test-close.c +++ b/tests/test-close.c @@ -1,5 +1,5 @@ /* Test closing a file or socket. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-connect.c b/tests/test-connect.c index 1d826c2b..7377d9eb 100644 --- a/tests/test-connect.c +++ b/tests/test-connect.c @@ -1,5 +1,5 @@ /* Test connecting a client socket. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-ctype-h.c b/tests/test-ctype-h.c index bde62720..8f29381c 100644 --- a/tests/test-ctype-h.c +++ b/tests/test-ctype-h.c @@ -1,5 +1,5 @@ /* Test of <ctype.h> substitute. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-dup2.c b/tests/test-dup2.c index e13d2e9f..65d5aaf0 100644 --- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -1,5 +1,5 @@ /* Test duplicating file descriptors. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-environ.c b/tests/test-environ.c index 21641b89..dcd408f4 100644 --- a/tests/test-environ.c +++ b/tests/test-environ.c @@ -1,5 +1,5 @@ /* Test of environ variable. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-errno-h.c b/tests/test-errno-h.c index cb20635b..f1103dd3 100644 --- a/tests/test-errno-h.c +++ b/tests/test-errno-h.c @@ -1,5 +1,5 @@ /* Test of <errno.h> substitute. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-error.c b/tests/test-error.c index ba7941ff..1b490691 100644 --- a/tests/test-error.c +++ b/tests/test-error.c @@ -1,5 +1,5 @@ /* Test of error.h functions. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c index 6ed6b574..f9664d5e 100644 --- a/tests/test-fcntl-h.c +++ b/tests/test-fcntl-h.c @@ -1,5 +1,5 @@ /* Test of <fcntl.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c index f5d6c351..58a907b0 100644 --- a/tests/test-fcntl.c +++ b/tests/test-fcntl.c @@ -1,5 +1,5 @@ /* Test of fcntl(2). - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fdopen.c b/tests/test-fdopen.c index 5ac7ab74..cf25e084 100644 --- a/tests/test-fdopen.c +++ b/tests/test-fdopen.c @@ -1,5 +1,5 @@ /* Test opening a stream with a file descriptor. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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")) diff --git a/tests/test-fgetc.c b/tests/test-fgetc.c index 1e179971..80e02944 100644 --- a/tests/test-fgetc.c +++ b/tests/test-fgetc.c @@ -1,5 +1,5 @@ /* Test of fgetc() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fputc.c b/tests/test-fputc.c index 60c65c7d..76442024 100644 --- a/tests/test-fputc.c +++ b/tests/test-fputc.c @@ -1,5 +1,5 @@ /* Test of fputc() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fread.c b/tests/test-fread.c index 86e48883..171399c8 100644 --- a/tests/test-fread.c +++ b/tests/test-fread.c @@ -1,5 +1,5 @@ /* Test of fread() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-free.c b/tests/test-free.c index fff1c3a6..49b76bc5 100644 --- a/tests/test-free.c +++ b/tests/test-free.c @@ -1,5 +1,5 @@ /* Test of free() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/test-frexp.c b/tests/test-frexp.c index b5fac9fa..74bd4fae 100644 --- a/tests/test-frexp.c +++ b/tests/test-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-frexp.h b/tests/test-frexp.h index ed687387..7cf24d88 100644 --- a/tests/test-frexp.h +++ b/tests/test-frexp.h @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ { diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index 550648b6..d74dceb8 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *)); /* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -968. For exponents below that, the precision may be truncated to the precision used for 'double'. */ -#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__ +#if defined _ARCH_PPC # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53) #else # define MIN_NORMAL_EXP LDBL_MIN_EXP diff --git a/tests/test-fseterr.c b/tests/test-fseterr.c index f4dc2af1..88d3293d 100644 --- a/tests/test-fseterr.c +++ b/tests/test-fseterr.c @@ -1,5 +1,5 @@ /* Test setting the error indicator of a stream. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fstat.c b/tests/test-fstat.c index 2fda6963..74c3a5d2 100644 --- a/tests/test-fstat.c +++ b/tests/test-fstat.c @@ -1,5 +1,5 @@ /* Tests of fstat() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-ftruncate.c b/tests/test-ftruncate.c index f749a65c..08b585e5 100644 --- a/tests/test-ftruncate.c +++ b/tests/test-ftruncate.c @@ -1,5 +1,5 @@ /* Test truncating a file. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-fwrite.c b/tests/test-fwrite.c index 8cabd58c..fc29501f 100644 --- a/tests/test-fwrite.c +++ b/tests/test-fwrite.c @@ -1,5 +1,5 @@ /* Test of fwrite() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-getcwd-lgpl.c b/tests/test-getcwd-lgpl.c index fc3ebc6b..8421cda9 100644 --- a/tests/test-getcwd-lgpl.c +++ b/tests/test-getcwd-lgpl.c @@ -1,5 +1,5 @@ /* Test of getcwd() function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c index d8f083fc..85cb6182 100644 --- a/tests/test-getdtablesize.c +++ b/tests/test-getdtablesize.c @@ -1,5 +1,5 @@ /* Test of getdtablesize() function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-getprogname.c b/tests/test-getprogname.c index e1e8cb53..57f8e2e0 100644 --- a/tests/test-getprogname.c +++ b/tests/test-getprogname.c @@ -1,5 +1,5 @@ /* Test the gnulib getprogname module. - Copyright (C) 2016-2025 Free Software Foundation, Inc. + Copyright (C) 2016-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-gettext-h.c b/tests/test-gettext-h.c index 04e6c6df..e65733dd 100644 --- a/tests/test-gettext-h.c +++ b/tests/test-gettext-h.c @@ -1,5 +1,5 @@ /* Test of gettext.h convenience header. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-gettimeofday.c b/tests/test-gettimeofday.c index 8b55ac00..3317b06b 100644 --- a/tests/test-gettimeofday.c +++ b/tests/test-gettimeofday.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. + * Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/tests/test-hard-locale.c b/tests/test-hard-locale.c index a056fe59..bc3dbb64 100644 --- a/tests/test-hard-locale.c +++ b/tests/test-hard-locale.c @@ -1,5 +1,5 @@ /* Test of determination whether a locale is different from the "C" locale. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-iconv-h.c b/tests/test-iconv-h.c index 78004e16..82a38f5e 100644 --- a/tests/test-iconv-h.c +++ b/tests/test-iconv-h.c @@ -1,5 +1,5 @@ /* Test of <iconv.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-iconv.c b/tests/test-iconv.c index 6e084741..bf577442 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-ignore-value.c b/tests/test-ignore-value.c index 95bd3dfc..aa1ac341 100644 --- a/tests/test-ignore-value.c +++ b/tests/test-ignore-value.c @@ -1,6 +1,6 @@ /* Test the "ignore-value" module. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-inet_pton.c b/tests/test-inet_pton.c index af26f97e..7a76a128 100644 --- a/tests/test-inet_pton.c +++ b/tests/test-inet_pton.c @@ -1,5 +1,5 @@ /* Test of inet_pton function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-init.sh b/tests/test-init.sh index cd046286..05075807 100755 --- a/tests/test-init.sh +++ b/tests/test-init.sh @@ -1,6 +1,6 @@ #!/bin/sh # Unit tests for init.sh -# Copyright (C) 2011-2025 Free Software Foundation, Inc. +# Copyright (C) 2011-2026 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify diff --git a/tests/test-intprops.c b/tests/test-intprops.c index cce1386e..8cbc8f9c 100644 --- a/tests/test-intprops.c +++ b/tests/test-intprops.c @@ -1,5 +1,5 @@ /* Test intprops.h. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-inttypes-h.c b/tests/test-inttypes-h.c index 5887a2bc..6e7a22ac 100644 --- a/tests/test-inttypes-h.c +++ b/tests/test-inttypes-h.c @@ -1,5 +1,5 @@ /* Test of <inttypes.h> substitute. - Copyright (C) 2006-2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-ioctl.c b/tests/test-ioctl.c index 804c1724..281dd094 100644 --- a/tests/test-ioctl.c +++ b/tests/test-ioctl.c @@ -1,5 +1,5 @@ /* Test of ioctl() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isblank.c b/tests/test-isblank.c index 6a66b917..662f704e 100644 --- a/tests/test-isblank.c +++ b/tests/test-isblank.c @@ -1,5 +1,5 @@ /* Test of isblank() function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); diff --git a/tests/test-isnand-nolibm.c b/tests/test-isnand-nolibm.c index 1fd3122a..096a2958 100644 --- a/tests/test-isnand-nolibm.c +++ b/tests/test-isnand-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnand.h b/tests/test-isnand.h index a6714f77..3024f7c8 100644 --- a/tests/test-isnand.h +++ b/tests/test-isnand.h @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanf-nolibm.c b/tests/test-isnanf-nolibm.c index 847bfe9a..5aaba6de 100644 --- a/tests/test-isnanf-nolibm.c +++ b/tests/test-isnanf-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanf.h b/tests/test-isnanf.h index 31f40976..2fd04d5d 100644 --- a/tests/test-isnanf.h +++ b/tests/test-isnanf.h @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanl-nolibm.c b/tests/test-isnanl-nolibm.c index 0854f33a..79802e9b 100644 --- a/tests/test-isnanl-nolibm.c +++ b/tests/test-isnanl-nolibm.c @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index 3a2d997a..41a139d9 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-iswblank.c b/tests/test-iswblank.c index 9489d531..501a33ca 100644 --- a/tests/test-iswblank.c +++ b/tests/test-iswblank.c @@ -1,5 +1,5 @@ /* Test of iswblank() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-iswdigit.c b/tests/test-iswdigit.c index f80ffb63..38104cb1 100644 --- a/tests/test-iswdigit.c +++ b/tests/test-iswdigit.c @@ -1,5 +1,5 @@ /* Test of iswdigit() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-iswpunct.c b/tests/test-iswpunct.c index 0d42c427..4fd252dd 100644 --- a/tests/test-iswpunct.c +++ b/tests/test-iswpunct.c @@ -1,5 +1,5 @@ /* Test of iswpunct() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-iswxdigit.c b/tests/test-iswxdigit.c index 466e3ac9..5b3d2908 100644 --- a/tests/test-iswxdigit.c +++ b/tests/test-iswxdigit.c @@ -1,5 +1,5 @@ /* Test of iswxdigit() function. - Copyright (C) 2020-2025 Free Software Foundation, Inc. + Copyright (C) 2020-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]) diff --git a/tests/test-largefile.c b/tests/test-largefile.c index b20d83cb..56419285 100644 --- a/tests/test-largefile.c +++ b/tests/test-largefile.c @@ -1,5 +1,5 @@ /* Test of largefile module. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-limits-h.c b/tests/test-limits-h.c index 45e51822..5f9b4a0a 100644 --- a/tests/test-limits-h.c +++ b/tests/test-limits-h.c @@ -1,5 +1,5 @@ /* Test of <limits.h> substitute. - Copyright 2016-2025 Free Software Foundation, Inc. + Copyright 2016-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-listen.c b/tests/test-listen.c index 213df7f8..96c9e073 100644 --- a/tests/test-listen.c +++ b/tests/test-listen.c @@ -1,5 +1,5 @@ /* Test listen() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localcharset-w32utf8.c b/tests/test-localcharset-w32utf8.c index 361c9e90..4a2fe815 100644 --- a/tests/test-localcharset-w32utf8.c +++ b/tests/test-localcharset-w32utf8.c @@ -1,6 +1,6 @@ /* Test of localcharset() function on native Windows in the UTF-8 environment. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localcharset.c b/tests/test-localcharset.c index cb31fffe..68e943f5 100644 --- a/tests/test-localcharset.c +++ b/tests/test-localcharset.c @@ -1,5 +1,5 @@ /* Manual test of localcharset() function. - Copyright (C) 2018-2025 Free Software Foundation, Inc. + Copyright (C) 2018-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-locale-h.c b/tests/test-locale-h.c index 201cd125..517a85bd 100644 --- a/tests/test-locale-h.c +++ b/tests/test-locale-h.c @@ -1,5 +1,5 @@ /* Test of <locale.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localeconv-mt.c b/tests/test-localeconv-mt.c index b6c28c22..0e9ecd31 100644 --- a/tests/test-localeconv-mt.c +++ b/tests/test-localeconv-mt.c @@ -1,6 +1,6 @@ /* Multithread-safety test for localeconv() (in the absence of setlocale() or uselocale() calls). - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localeconv.c b/tests/test-localeconv.c index c39d37d3..238ef35e 100644 --- a/tests/test-localeconv.c +++ b/tests/test-localeconv.c @@ -1,5 +1,5 @@ /* Test of localeconv() function. - Copyright (C) 2012-2025 Free Software Foundation, Inc. + Copyright (C) 2012-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localename-w32utf8.c b/tests/test-localename-w32utf8.c index 892769d2..52ec0798 100644 --- a/tests/test-localename-w32utf8.c +++ b/tests/test-localename-w32utf8.c @@ -1,6 +1,6 @@ /* Test of gl_locale_name function and its variants on native Windows in the UTF-8 environment. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-localename.c b/tests/test-localename.c index 0bbc2c76..837ff9ca 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -1,5 +1,5 @@ /* Test of gl_locale_name function and its variants. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]); diff --git a/tests/test-lock.c b/tests/test-lock.c index 35142031..d44c2152 100644 --- a/tests/test-lock.c +++ b/tests/test-lock.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/test-lstat.c b/tests/test-lstat.c index 9fd43a58..abd1430d 100644 --- a/tests/test-lstat.c +++ b/tests/test-lstat.c @@ -1,5 +1,5 @@ /* Test of lstat() function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-lstat.h b/tests/test-lstat.h index 899cb267..5bf14223 100644 --- a/tests/test-lstat.h +++ b/tests/test-lstat.h @@ -1,5 +1,5 @@ /* Test of lstat() function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-malloc-gnu.c b/tests/test-malloc-gnu.c index 55cc0d34..7b243ac4 100644 --- a/tests/test-malloc-gnu.c +++ b/tests/test-malloc-gnu.c @@ -1,5 +1,5 @@ /* Test of malloc function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-malloc-posix.c b/tests/test-malloc-posix.c index 1d00abe2..e64dffb7 100644 --- a/tests/test-malloc-posix.c +++ b/tests/test-malloc-posix.c @@ -1,5 +1,5 @@ /* Test of malloc function. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-malloca.c b/tests/test-malloca.c index 438106e1..9db68797 100644 --- a/tests/test-malloca.c +++ b/tests/test-malloca.c @@ -1,5 +1,5 @@ /* Test of safe automatic memory allocation. - Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. diff --git a/tests/test-math-h.c b/tests/test-math-h.c index 4a878bb3..24a27b98 100644 --- a/tests/test-math-h.c +++ b/tests/test-math-h.c @@ -1,5 +1,5 @@ /* Test of <math.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-mbrtoc32-w32.c b/tests/test-mbrtoc32-w32.c index 107497d0..490df377 100644 --- a/tests/test-mbrtoc32-w32.c +++ b/tests/test-mbrtoc32-w32.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to 32-bit wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-mbrtoc32.c b/tests/test-mbrtoc32.c index d1bf56bc..6c081c2c 100644 --- a/tests/test-mbrtoc32.c +++ b/tests/test-mbrtoc32.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to 32-bit wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ diff --git a/tests/test-mbrtowc-w32.c b/tests/test-mbrtowc-w32.c index 4ec33f94..d71d10c7 100644 --- a/tests/test-mbrtowc-w32.c +++ b/tests/test-mbrtowc-w32.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-mbrtowc-w32utf8.c b/tests/test-mbrtowc-w32utf8.c index b2501660..5b7a2d9d 100644 --- a/tests/test-mbrtowc-w32utf8.c +++ b/tests/test-mbrtowc-w32utf8.c @@ -1,6 +1,6 @@ /* Test of conversion of multibyte character to wide character on native Windows in the UTF-8 environment. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 2c288a29..e17f5b1a 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ diff --git a/tests/test-mbsinit.c b/tests/test-mbsinit.c index cd57e9ff..f0093a7d 100644 --- a/tests/test-mbsinit.c +++ b/tests/test-mbsinit.c @@ -1,5 +1,5 @@ /* Test of test for initial conversion state. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-mbsnlen.c b/tests/test-mbsnlen.c index 233cdc4e..66a4d70a 100644 --- a/tests/test-mbsnlen.c +++ b/tests/test-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of searching a string for a character outside a given set of characters. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 48f9b2ea..7d72dbac 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2025 Free Software Foundation, Inc. + * Copyright (C) 2008-2026 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * This program is free software: you can redistribute it and/or modify @@ -31,7 +31,7 @@ SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); static void * lib_memchr (void const *s, int c, size_t n) { - return memchr (s, c, n); + return (void *) memchr (s, c, n); } static void *(*volatile volatile_memchr) (void const *, int, size_t) = lib_memchr; @@ -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); diff --git a/tests/test-mkfifo.c b/tests/test-mkfifo.c index c30b999f..7c93a98b 100644 --- a/tests/test-mkfifo.c +++ b/tests/test-mkfifo.c @@ -1,5 +1,5 @@ /* Tests of mkfifo. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-mkfifo.h b/tests/test-mkfifo.h index 986d7dcf..d8c1c789 100644 --- a/tests/test-mkfifo.h +++ b/tests/test-mkfifo.h @@ -1,5 +1,5 @@ /* Tests of mkfifo and friends. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-nanosleep.c b/tests/test-nanosleep.c index 7f51e6c8..812c7ccb 100644 --- a/tests/test-nanosleep.c +++ b/tests/test-nanosleep.c @@ -1,5 +1,5 @@ /* Test of nanosleep() function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-netinet_in-h.c b/tests/test-netinet_in-h.c index b5b7cd1b..45b8af49 100644 --- a/tests/test-netinet_in-h.c +++ b/tests/test-netinet_in-h.c @@ -1,5 +1,5 @@ /* Test of <netinet/in.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-once.c b/tests/test-once.c index 8121e584..77bf0b41 100644 --- a/tests/test-once.c +++ b/tests/test-once.c @@ -1,5 +1,5 @@ /* Test of once-only execution in multithreaded situations. - Copyright (C) 2018-2025 Free Software Foundation, Inc. + Copyright (C) 2018-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-open.c b/tests/test-open.c index 84df160f..5db0d812 100644 --- a/tests/test-open.c +++ b/tests/test-open.c @@ -1,5 +1,5 @@ /* Test of opening a file descriptor. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-open.h b/tests/test-open.h index 1a80af45..6a0a8b3e 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -1,5 +1,5 @@ /* Test of opening a file descriptor. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,8 +32,9 @@ # define ALWAYS_INLINE #endif -/* This file is designed to test both open(n,buf[,mode]) and - openat(AT_FDCWD,n,buf[,mode]). FUNC is the function to test. +/* This file is designed to test open(n,buf[,mode]), + openat(dfd,n,buf[,mode]), and openat2(dfd,n,how,size). + FUNC is the function to test; for openat and openat2 it is a wrapper. Assumes that BASE and ASSERT are already defined, and that appropriate headers are already included. If PRINT, warn before skipping symlink tests with status 77. */ @@ -144,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; diff --git a/tests/test-pathmax.c b/tests/test-pathmax.c index f47ae9c2..50ee0be7 100644 --- a/tests/test-pathmax.c +++ b/tests/test-pathmax.c @@ -1,5 +1,5 @@ /* Test of "pathmax.h". - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-perror.c b/tests/test-perror.c index 92779bd9..0efc1a94 100644 --- a/tests/test-perror.c +++ b/tests/test-perror.c @@ -1,5 +1,5 @@ /* Test of perror() function. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-perror2.c b/tests/test-perror2.c index a0c87b23..92dd7357 100644 --- a/tests/test-perror2.c +++ b/tests/test-perror2.c @@ -1,5 +1,5 @@ /* Test of perror() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]); diff --git a/tests/test-pipe.c b/tests/test-pipe.c index afe91989..4b3eca28 100644 --- a/tests/test-pipe.c +++ b/tests/test-pipe.c @@ -1,5 +1,5 @@ /* Test of pipe. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c index b3736b84..ece2ffc5 100644 --- a/tests/test-printf-frexp.c +++ b/tests/test-printf-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-printf-frexpl.c b/tests/test-printf-frexpl.c index f64f16d5..3e63de7f 100644 --- a/tests/test-printf-frexpl.c +++ b/tests/test-printf-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ /* On PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -968. For exponents below that, the precision may be truncated to the precision used for 'double'. */ -#if defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__ +#if defined _ARCH_PPC # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53) # define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP #else diff --git a/tests/test-pselect.c b/tests/test-pselect.c index eef7a0f5..f324e674 100644 --- a/tests/test-pselect.c +++ b/tests/test-pselect.c @@ -1,5 +1,5 @@ /* Test of pselect() substitute. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread-cond.c b/tests/test-pthread-cond.c index 9a46b018..1aff912a 100644 --- a/tests/test-pthread-cond.c +++ b/tests/test-pthread-cond.c @@ -1,5 +1,5 @@ /* Test of condition variables in multithreaded situations. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -204,11 +204,11 @@ test_pthread_cond_timedwait (void) pthread_cond_timedwait_routine, &skipped) == 0); - /* Sleep for 2 seconds. */ + /* Sleep for 3 seconds. */ { struct timespec remaining; - remaining.tv_sec = 2; + remaining.tv_sec = 3; remaining.tv_nsec = 0; do diff --git a/tests/test-pthread-mutex-type.c b/tests/test-pthread-mutex-type.c index e23b9adf..ba14ba32 100644 --- a/tests/test-pthread-mutex-type.c +++ b/tests/test-pthread-mutex-type.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread-mutex.c b/tests/test-pthread-mutex.c index 5671263e..a82ae8c3 100644 --- a/tests/test-pthread-mutex.c +++ b/tests/test-pthread-mutex.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-pthread-once1.c b/tests/test-pthread-once1.c index 825380d1..572bc312 100644 --- a/tests/test-pthread-once1.c +++ b/tests/test-pthread-once1.c @@ -1,5 +1,5 @@ /* Test of once-only execution in multithreaded situations. - Copyright (C) 2018-2025 Free Software Foundation, Inc. + Copyright (C) 2018-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread-once2.c b/tests/test-pthread-once2.c index 4df7b350..c199307b 100644 --- a/tests/test-pthread-once2.c +++ b/tests/test-pthread-once2.c @@ -1,5 +1,5 @@ /* Test of once-only execution in multithreaded situations. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/test-pthread-rwlock.c b/tests/test-pthread-rwlock.c index 8a4ab93b..0edd669c 100644 --- a/tests/test-pthread-rwlock.c +++ b/tests/test-pthread-rwlock.c @@ -1,5 +1,5 @@ /* Test of read-write locks in multithreaded situations. - Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 (); } diff --git a/tests/test-pthread-thread.c b/tests/test-pthread-thread.c index 12bb062f..c74553fa 100644 --- a/tests/test-pthread-thread.c +++ b/tests/test-pthread-thread.c @@ -1,5 +1,5 @@ /* Test of pthread_create () function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread.c b/tests/test-pthread.c index 911da82b..776bd9c8 100644 --- a/tests/test-pthread.c +++ b/tests/test-pthread.c @@ -1,5 +1,5 @@ /* Test of <pthread.h> substitute. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread_sigmask1.c b/tests/test-pthread_sigmask1.c index 82105729..d97e75d2 100644 --- a/tests/test-pthread_sigmask1.c +++ b/tests/test-pthread_sigmask1.c @@ -1,5 +1,5 @@ /* Test of pthread_sigmask in a single-threaded program. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-pthread_sigmask2.c b/tests/test-pthread_sigmask2.c index c6f99cb1..13a9c8a0 100644 --- a/tests/test-pthread_sigmask2.c +++ b/tests/test-pthread_sigmask2.c @@ -1,5 +1,5 @@ /* Test of pthread_sigmask in a multi-threaded program. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-putenv.c b/tests/test-putenv.c index f13bfad4..9ea08b0a 100644 --- a/tests/test-putenv.c +++ b/tests/test-putenv.c @@ -1,5 +1,5 @@ /* Test the putenv function. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/tests/test-raise.c b/tests/test-raise.c index 893909b0..11f501cb 100644 --- a/tests/test-raise.c +++ b/tests/test-raise.c @@ -1,5 +1,5 @@ /* Test raising a signal. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-random-mt.c b/tests/test-random-mt.c index c438c881..04c4a7cf 100644 --- a/tests/test-random-mt.c +++ b/tests/test-random-mt.c @@ -1,5 +1,5 @@ /* Multithread-safety test for random(). - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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++) { diff --git a/tests/test-random.c b/tests/test-random.c index 4a4e0af9..ecc873dc 100644 --- a/tests/test-random.c +++ b/tests/test-random.c @@ -1,5 +1,5 @@ /* Test random. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-random_r.c b/tests/test-random_r.c index d86252e2..8c8562e8 100644 --- a/tests/test-random_r.c +++ b/tests/test-random_r.c @@ -1,5 +1,5 @@ /* Test random_r. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ SIGNATURE_CHECK (random_r, int, (struct random_data *, int32_t *)); #include "macros.h" -/* Note: This test crashes on glibc/SPARC systems. +/* Note: This test crashes on glibc/SPARC systems with glibc < 2.41. Reported at <https://sourceware.org/PR30584>. */ static int @@ -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; diff --git a/tests/test-realloc-posix.c b/tests/test-realloc-posix.c index d50f8603..0782b2b6 100644 --- a/tests/test-realloc-posix.c +++ b/tests/test-realloc-posix.c @@ -1,5 +1,5 @@ /* Test of realloc function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-reallocarray.c b/tests/test-reallocarray.c index 5b96bca7..ec7fbceb 100644 --- a/tests/test-reallocarray.c +++ b/tests/test-reallocarray.c @@ -1,5 +1,5 @@ /* Test of reallocarray function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-rwlock1.c b/tests/test-rwlock1.c index bc4a64be..d715fb8d 100644 --- a/tests/test-rwlock1.c +++ b/tests/test-rwlock1.c @@ -1,5 +1,5 @@ /* Test of glthread_rwlock_rdlock function. - Copyright (C) 2017-2025 Free Software Foundation, Inc. + Copyright (C) 2017-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sched-h.c b/tests/test-sched-h.c index 1fad89b9..e9041512 100644 --- a/tests/test-sched-h.c +++ b/tests/test-sched-h.c @@ -1,5 +1,5 @@ /* Test of <sched.h> substitute. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-select-fd.c b/tests/test-select-fd.c index 232a4f16..f223d5aa 100644 --- a/tests/test-select-fd.c +++ b/tests/test-select-fd.c @@ -1,5 +1,5 @@ /* Test of select() substitute, reading or writing from a given file descriptor. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-select-stdin.c b/tests/test-select-stdin.c index 4e03b329..87b7e0e4 100644 --- a/tests/test-select-stdin.c +++ b/tests/test-select-stdin.c @@ -1,5 +1,5 @@ /* Test of select() substitute, reading from stdin. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-select.c b/tests/test-select.c index df9d8a12..0c47cfc6 100644 --- a/tests/test-select.c +++ b/tests/test-select.c @@ -1,5 +1,5 @@ /* Test of select() substitute. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-select.h b/tests/test-select.h index 7123ef6b..89f9c0f5 100644 --- a/tests/test-select.h +++ b/tests/test-select.h @@ -1,5 +1,5 @@ /* Test of select() substitute. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setenv.c b/tests/test-setenv.c index 0b08f528..361910f3 100644 --- a/tests/test-setenv.c +++ b/tests/test-setenv.c @@ -1,5 +1,5 @@ /* Tests of setenv. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale-w32.c b/tests/test-setlocale-w32.c index 254cf523..a96985e9 100644 --- a/tests/test-setlocale-w32.c +++ b/tests/test-setlocale-w32.c @@ -1,5 +1,5 @@ /* Test of setting the current locale. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale-w32utf8.c b/tests/test-setlocale-w32utf8.c index 51828db1..4e17203e 100644 --- a/tests/test-setlocale-w32utf8.c +++ b/tests/test-setlocale-w32utf8.c @@ -1,6 +1,6 @@ /* Test of setting the current locale on native Windows in the UTF-8 environment. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale1.c b/tests/test-setlocale1.c index 894c6cd0..a3abdacb 100644 --- a/tests/test-setlocale1.c +++ b/tests/test-setlocale1.c @@ -1,5 +1,5 @@ /* Test of setting the current locale. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale2.c b/tests/test-setlocale2.c index 6d0cb6aa..6c330729 100644 --- a/tests/test-setlocale2.c +++ b/tests/test-setlocale2.c @@ -1,5 +1,5 @@ /* Test of setting the current locale. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale_null-mt-all.c b/tests/test-setlocale_null-mt-all.c index 44efcba8..adf7cb91 100644 --- a/tests/test-setlocale_null-mt-all.c +++ b/tests/test-setlocale_null-mt-all.c @@ -1,5 +1,5 @@ /* Multithread-safety test for setlocale_null_r (LC_ALL, ...). - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale_null-mt-one.c b/tests/test-setlocale_null-mt-one.c index e09f88e0..64248b3a 100644 --- a/tests/test-setlocale_null-mt-one.c +++ b/tests/test-setlocale_null-mt-one.c @@ -1,5 +1,5 @@ /* Multithread-safety test for setlocale_null_r (LC_xxx, ...). - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale_null-unlocked.c b/tests/test-setlocale_null-unlocked.c index a62d1874..e6a0aed8 100644 --- a/tests/test-setlocale_null-unlocked.c +++ b/tests/test-setlocale_null-unlocked.c @@ -1,5 +1,5 @@ /* Test of setlocale_null_r_unlocked function. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setlocale_null.c b/tests/test-setlocale_null.c index 061fbbb2..bb317df3 100644 --- a/tests/test-setlocale_null.c +++ b/tests/test-setlocale_null.c @@ -1,5 +1,5 @@ /* Test of setlocale_null_r function. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-setsockopt.c b/tests/test-setsockopt.c index b5d0c945..f5ff0a84 100644 --- a/tests/test-setsockopt.c +++ b/tests/test-setsockopt.c @@ -1,5 +1,5 @@ /* Test setsockopt() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-signal-h.c b/tests/test-signal-h.c index 8bec53e6..014dc88d 100644 --- a/tests/test-signal-h.c +++ b/tests/test-signal-h.c @@ -1,5 +1,5 @@ /* Test of <signal.h> substitute. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 025687f4..2adf7745 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -1,5 +1,5 @@ /* Test of signbit() substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sigprocmask.c b/tests/test-sigprocmask.c index 74eafbad..f419c2c1 100644 --- a/tests/test-sigprocmask.c +++ b/tests/test-sigprocmask.c @@ -1,5 +1,5 @@ /* Test of sigprocmask. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sleep.c b/tests/test-sleep.c index b02c78cf..5aba44b4 100644 --- a/tests/test-sleep.c +++ b/tests/test-sleep.c @@ -1,5 +1,5 @@ /* Test of sleep() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sockets.c b/tests/test-sockets.c index 3577ddc3..d9b25ad1 100644 --- a/tests/test-sockets.c +++ b/tests/test-sockets.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2025 Free Software Foundation, Inc. + * Copyright (C) 2008-2026 Free Software Foundation, Inc. * Written by Simon Josefsson. * * This program is free software: you can redistribute it and/or modify diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c index 19ecc838..7c6e5955 100644 --- a/tests/test-stat-time.c +++ b/tests/test-stat-time.c @@ -1,5 +1,5 @@ /* Test of <stat-time.h>. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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) diff --git a/tests/test-stat.c b/tests/test-stat.c index 66747658..ce529918 100644 --- a/tests/test-stat.c +++ b/tests/test-stat.c @@ -1,5 +1,5 @@ /* Tests of stat. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stat.h b/tests/test-stat.h index d055522f..4d44dea6 100644 --- a/tests/test-stat.h +++ b/tests/test-stat.h @@ -1,5 +1,5 @@ /* Tests of stat. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stdckdint-h.c b/tests/test-stdckdint-h.c index 332b1b0a..6fe84f7c 100644 --- a/tests/test-stdckdint-h.c +++ b/tests/test-stdckdint-h.c @@ -1,5 +1,5 @@ /* Test <stdckdint.h>. - Copyright 2022-2025 Free Software Foundation, Inc. + Copyright 2022-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stddef-h.c b/tests/test-stddef-h.c index b80df4d4..2057c80a 100644 --- a/tests/test-stddef-h.c +++ b/tests/test-stddef-h.c @@ -1,5 +1,5 @@ /* Test of <stddef.h> substitute. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stdint-h.c b/tests/test-stdint-h.c index 4f55370a..6572251e 100644 --- a/tests/test-stdint-h.c +++ b/tests/test-stdint-h.c @@ -1,5 +1,5 @@ /* Test of <stdint.h> substitute. - Copyright (C) 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2006-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stdio-h.c b/tests/test-stdio-h.c index 855ac8e6..4a1be4ac 100644 --- a/tests/test-stdio-h.c +++ b/tests/test-stdio-h.c @@ -1,5 +1,5 @@ /* Test of <stdio.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-stdlib-h.c b/tests/test-stdlib-h.c index ea3da1bf..ed817b90 100644 --- a/tests/test-stdlib-h.c +++ b/tests/test-stdlib-h.c @@ -1,5 +1,5 @@ /* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-str_endswith.c b/tests/test-str_endswith.c index fc1ec0ab..9ded498f 100644 --- a/tests/test-str_endswith.c +++ b/tests/test-str_endswith.c @@ -1,5 +1,5 @@ /* Test of str_endswith() function. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-str_startswith.c b/tests/test-str_startswith.c index 5dd741ae..754dccd2 100644 --- a/tests/test-str_startswith.c +++ b/tests/test-str_startswith.c @@ -1,5 +1,5 @@ /* Test of str_startswith() function. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-strerror.c b/tests/test-strerror.c index 7a1e85f8..0b0fd8a8 100644 --- a/tests/test-strerror.c +++ b/tests/test-strerror.c @@ -1,5 +1,5 @@ /* Test of strerror() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-strerror_r.c b/tests/test-strerror_r.c index ec5a71a8..63a0623a 100644 --- a/tests/test-strerror_r.c +++ b/tests/test-strerror_r.c @@ -1,5 +1,5 @@ /* Test of strerror_r() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c index fac29457..c5d06b43 100644 --- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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"; diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index 803a312d..c2453955 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling and autodetection. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ diff --git a/tests/test-string-h.c b/tests/test-string-h.c index 6834b0b8..3c607302 100644 --- a/tests/test-string-h.c +++ b/tests/test-string-h.c @@ -1,5 +1,5 @@ /* Test of <string.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-strncat.c b/tests/test-strncat.c index 7b2e682a..ccf65197 100644 --- a/tests/test-strncat.c +++ b/tests/test-strncat.c @@ -1,5 +1,5 @@ /* Test of strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-strncpy.c b/tests/test-strncpy.c new file mode 100644 index 00000000..847e55f8 --- /dev/null +++ b/tests/test-strncpy.c @@ -0,0 +1,122 @@ +/* Test of strncpy() function. + Copyright (C) 2010-2026 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification. */ +#include <string.h> + +#include <stddef.h> + +#include "zerosize-ptr.h" +#include "macros.h" + +/* Test the library, not the compiler+library. */ +static char * +lib_strncpy (char *s1, char const *s2, size_t n) +{ + return strncpy (s1, s2, n); +} +static char *(*volatile volatile_strncpy) (char *, char const *, size_t) + = lib_strncpy; +#undef strncpy +#define strncpy volatile_strncpy + +#define MAGIC (char)0xBA + +static void +check_single (const char *input, size_t length, size_t n) +{ + char *dest; + char *result; + + dest = (char *) malloc (1 + n + 1); + ASSERT (dest != NULL); + + for (size_t i = 0; i < 1 + n + 1; i++) + dest[i] = MAGIC; + + result = strncpy (dest + 1, input, n); + ASSERT (result == dest + 1); + + ASSERT (dest[0] == MAGIC); + { + 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); +} + +static void +check (const char *input, size_t input_length) +{ + size_t length; + + ASSERT (input_length > 0); + ASSERT (input[input_length - 1] == 0); + length = input_length - 1; /* = strlen (input) */ + + for (size_t n = 0; n <= 2 * length + 2; n++) + check_single (input, length, n); + + /* Check that strncpy (D, S, N) does not look at more than + MIN (strlen (S) + 1, N) units. */ + { + char *page_boundary = (char *) zerosize_ptr (); + + if (page_boundary != NULL) + { + for (size_t n = 0; n <= 2 * length + 2; n++) + { + size_t n_to_copy = (n <= length ? n : length + 1); + char *copy; + + copy = (char *) page_boundary - n_to_copy; + for (size_t i = 0; i < n_to_copy; i++) + copy[i] = input[i]; + + check_single (copy, length, n); + } + } + } +} + +int +main (void) +{ + /* Simple string. */ + { /* "Grüß Gott." */ + static const char input[] = "Gr\303\274\303\237 Gott."; + check (input, SIZEOF (input)); + } + + /* Test zero-length operations on NULL pointers, allowed by + <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */ + + ASSERT (strncpy (NULL, "x", 0) == NULL); + + { + char y[1]; + ASSERT (strncpy (y, NULL, 0) == y); + } + + return test_exit_status; +} diff --git a/tests/test-strstr.c b/tests/test-strstr.c index db29076c..47656b93 100644 --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2007-2025 Free Software Foundation, Inc. + * Copyright (C) 2004, 2007-2026 Free Software Foundation, Inc. * Written by Bruno Haible and Eric Blake * * This program is free software: you can redistribute it and/or modify @@ -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); diff --git a/tests/test-symlink.c b/tests/test-symlink.c index 0dd33b85..26b9d7de 100644 --- a/tests/test-symlink.c +++ b/tests/test-symlink.c @@ -1,5 +1,5 @@ /* Tests of symlink. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-symlink.h b/tests/test-symlink.h index 00199c58..d54cb62b 100644 --- a/tests/test-symlink.h +++ b/tests/test-symlink.h @@ -1,5 +1,5 @@ /* Tests of symlink. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_ioctl-h.c b/tests/test-sys_ioctl-h.c index 28d3e1af..5313b3e9 100644 --- a/tests/test-sys_ioctl-h.c +++ b/tests/test-sys_ioctl-h.c @@ -1,5 +1,5 @@ /* Test of <sys/ioctl.h> substitute. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_select-h.c b/tests/test-sys_select-h.c index 08aa83e0..b5258deb 100644 --- a/tests/test-sys_select-h.c +++ b/tests/test-sys_select-h.c @@ -1,5 +1,5 @@ /* Test of <sys/select.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_socket-h.c b/tests/test-sys_socket-h.c index fffd44ec..af449f65 100644 --- a/tests/test-sys_socket-h.c +++ b/tests/test-sys_socket-h.c @@ -1,5 +1,5 @@ /* Test of <sys/socket.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_stat-h.c b/tests/test-sys_stat-h.c index 6936cc7a..f41c4dfb 100644 --- a/tests/test-sys_stat-h.c +++ b/tests/test-sys_stat-h.c @@ -1,5 +1,5 @@ /* Test of <sys/stat.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -339,14 +339,15 @@ struct timespec st; static_assert (TYPE_SIGNED (off_t)); /* POSIX requires that blksize_t is a signed integer type. */ -#if !(defined __ANDROID__ \ +#if !(defined __ANDROID__ || defined __QNX__ \ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) \ - || defined __GLIBC__ && defined __alpha) + || (defined __GLIBC__ && defined __alpha)) static_assert (TYPE_SIGNED (blksize_t)); #endif /* POSIX requires that blkcnt_t is a signed integer type. */ -#if !(defined __ANDROID__ || defined __GLIBC__ && defined __alpha) +#if !(defined __ANDROID__ || defined __QNX__ \ + || (defined __GLIBC__ && defined __alpha)) static_assert (TYPE_SIGNED (blkcnt_t)); #endif diff --git a/tests/test-sys_time-h.c b/tests/test-sys_time-h.c index 53132709..4ff2ceca 100644 --- a/tests/test-sys_time-h.c +++ b/tests/test-sys_time-h.c @@ -1,5 +1,5 @@ /* Test of <sys/time.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_types-h.c b/tests/test-sys_types-h.c index b3d6abec..4d47328c 100644 --- a/tests/test-sys_types-h.c +++ b/tests/test-sys_types-h.c @@ -1,5 +1,5 @@ /* Test of <sys/types.h> substitute. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,14 +46,15 @@ static_assert (TYPE_SIGNED (off_t)); static_assert (TYPE_SIGNED (off64_t)); /* POSIX requires that blksize_t is a signed integer type. */ -#if !(defined __ANDROID__ \ +#if !(defined __ANDROID__ || defined __QNX__ \ || (defined __FreeBSD_kernel__ && !defined __FreeBSD__) \ - || defined __GLIBC__ && defined __alpha) + || (defined __GLIBC__ && defined __alpha)) static_assert (TYPE_SIGNED (blksize_t)); #endif /* POSIX requires that blkcnt_t is a signed integer type. */ -#if !(defined __ANDROID__ || defined __GLIBC__ && defined __alpha) +#if !(defined __ANDROID__ || defined __QNX__ \ + || (defined __GLIBC__ && defined __alpha)) static_assert (TYPE_SIGNED (blkcnt_t)); #endif diff --git a/tests/test-sys_uio-h.c b/tests/test-sys_uio-h.c index 97238cb4..cbabdf63 100644 --- a/tests/test-sys_uio-h.c +++ b/tests/test-sys_uio-h.c @@ -1,5 +1,5 @@ /* Test of <sys/uio.h> substitute. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-sys_wait-h.h b/tests/test-sys_wait-h.h index cb160d8d..dbcd1fa4 100644 --- a/tests/test-sys_wait-h.h +++ b/tests/test-sys_wait-h.h @@ -1,5 +1,5 @@ /* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-thread_create.c b/tests/test-thread_create.c index 3b024f53..44bfd7aa 100644 --- a/tests/test-thread_create.c +++ b/tests/test-thread_create.c @@ -1,5 +1,5 @@ /* Test of gl_thread_create () macro. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-thread_self.c b/tests/test-thread_self.c index eaeb2f28..98043357 100644 --- a/tests/test-thread_self.c +++ b/tests/test-thread_self.c @@ -1,5 +1,5 @@ /* Test of gl_thread_self () macro. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-time-h.c b/tests/test-time-h.c index 34eb10e4..28c3c49a 100644 --- a/tests/test-time-h.c +++ b/tests/test-time-h.c @@ -1,5 +1,5 @@ /* Test of <time.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-time.c b/tests/test-time.c index 1f373ef5..2f472357 100644 --- a/tests/test-time.c +++ b/tests/test-time.c @@ -1,5 +1,5 @@ /* Test of time() function. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-uchar-h.c b/tests/test-uchar-h.c index 614a5431..e59bfdb8 100644 --- a/tests/test-uchar-h.c +++ b/tests/test-uchar-h.c @@ -1,5 +1,5 @@ /* Test of <uchar.h> substitute. - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-unistd-h.c b/tests/test-unistd-h.c index fa869695..aa9565ff 100644 --- a/tests/test-unistd-h.c +++ b/tests/test-unistd-h.c @@ -1,5 +1,5 @@ /* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c index 95d7d0a7..242d17e7 100644 --- a/tests/test-unsetenv.c +++ b/tests/test-unsetenv.c @@ -1,5 +1,5 @@ /* Tests of unsetenv. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-usleep.c b/tests/test-usleep.c index 751390d3..88ad6c68 100644 --- a/tests/test-usleep.c +++ b/tests/test-usleep.c @@ -1,5 +1,5 @@ /* Test of usleep() function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-verify-try.c b/tests/test-verify-try.c index 41fb30cb..326de82f 100644 --- a/tests/test-verify-try.c +++ b/tests/test-verify-try.c @@ -1,6 +1,6 @@ /* Test the "verify" module. - Copyright (C) 2017-2025 Free Software Foundation, Inc. + Copyright (C) 2017-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-verify.c b/tests/test-verify.c index e19bfa81..1051e7eb 100644 --- a/tests/test-verify.c +++ b/tests/test-verify.c @@ -1,6 +1,6 @@ /* Test the "verify" module. - Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-wchar-h.c b/tests/test-wchar-h.c index 965ee11a..5b4dd246 100644 --- a/tests/test-wchar-h.c +++ b/tests/test-wchar-h.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-wcrtomb-w32.c b/tests/test-wcrtomb-w32.c index 843e4952..505ffeab 100644 --- a/tests/test-wcrtomb-w32.c +++ b/tests/test-wcrtomb-w32.c @@ -1,5 +1,5 @@ /* Test of conversion of wide character to multibyte character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/test-wcrtomb.c b/tests/test-wcrtomb.c index 26320419..bf6c8a59 100644 --- a/tests/test-wcrtomb.c +++ b/tests/test-wcrtomb.c @@ -1,5 +1,5 @@ /* Test of conversion of wide character to multibyte character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ { diff --git a/tests/test-wctype-h.c b/tests/test-wctype-h.c index c41ce49f..0fed6c17 100644 --- a/tests/test-wctype-h.c +++ b/tests/test-wctype-h.c @@ -1,5 +1,5 @@ /* Test of <wctype.h> substitute. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index 82888f59..2793b2ed 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -1,5 +1,5 @@ /* Test of wcwidth() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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. */ diff --git a/tests/test-windows-mutex-type.c b/tests/test-windows-mutex-type.c index fe5d9f39..4aced0b1 100644 --- a/tests/test-windows-mutex-type.c +++ b/tests/test-windows-mutex-type.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-windows-recmutex-type.c b/tests/test-windows-recmutex-type.c index 83dd234d..3047257e 100644 --- a/tests/test-windows-recmutex-type.c +++ b/tests/test-windows-recmutex-type.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-windows-timedmutex-type.c b/tests/test-windows-timedmutex-type.c index ce916cf4..ca79ea19 100644 --- a/tests/test-windows-timedmutex-type.c +++ b/tests/test-windows-timedmutex-type.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-windows-timedrecmutex-type.c b/tests/test-windows-timedrecmutex-type.c index 081dcd76..fd50597c 100644 --- a/tests/test-windows-timedrecmutex-type.c +++ b/tests/test-windows-timedrecmutex-type.c @@ -1,5 +1,5 @@ /* Test of locking in multithreaded situations. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-xalloc-die.c b/tests/test-xalloc-die.c index d47ae5e8..64701af1 100644 --- a/tests/test-xalloc-die.c +++ b/tests/test-xalloc-die.c @@ -1,5 +1,5 @@ /* Test of xalloc_die() function. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/test-xalloc-die.sh b/tests/test-xalloc-die.sh index 9985670f..f132b8cc 100755 --- a/tests/test-xalloc-die.sh +++ b/tests/test-xalloc-die.sh @@ -1,6 +1,6 @@ #!/bin/sh # Test suite for xalloc_die. -# Copyright (C) 2009-2025 Free Software Foundation, Inc. +# Copyright (C) 2009-2026 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify diff --git a/tests/time.c b/tests/time.c index 1d35c5d4..f5b67fc1 100644 --- a/tests/time.c +++ b/tests/time.c @@ -1,5 +1,5 @@ /* Provide time() for systems for which it's broken. - Copyright (C) 2023-2025 Free Software Foundation, Inc. + Copyright (C) 2023-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,11 +28,9 @@ time_t time (time_t *tp) { struct timeval tv; - time_t tt; - if (gettimeofday (&tv, NULL) < 0) abort (); - tt = tv.tv_sec; + time_t tt = tv.tv_sec; if (tp) *tp = tt; diff --git a/tests/unicase/test-casecmp.h b/tests/unicase/test-casecmp.h index b79a0aac..9fa52f24 100644 --- a/tests/unicase/test-casecmp.h +++ b/tests/unicase/test-casecmp.h @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of Unicode strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-cased.h b/tests/unicase/test-is-cased.h index 3c1e1513..cade4347 100644 --- a/tests/unicase/test-is-cased.h +++ b/tests/unicase/test-is-cased.h @@ -1,5 +1,5 @@ /* Test of test whether case matters for a Unicode string. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-casefolded.h b/tests/unicase/test-is-casefolded.h index 102eca60..9d322ce1 100644 --- a/tests/unicase/test-is-casefolded.h +++ b/tests/unicase/test-is-casefolded.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is already case-folded. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-lowercase.h b/tests/unicase/test-is-lowercase.h index 7475f082..d7e578d5 100644 --- a/tests/unicase/test-is-lowercase.h +++ b/tests/unicase/test-is-lowercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely lower case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-titlecase.h b/tests/unicase/test-is-titlecase.h index f67d798d..f7b8a001 100644 --- a/tests/unicase/test-is-titlecase.h +++ b/tests/unicase/test-is-titlecase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely title case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-is-uppercase.h b/tests/unicase/test-is-uppercase.h index bd15c81b..50fa02ab 100644 --- a/tests/unicase/test-is-uppercase.h +++ b/tests/unicase/test-is-uppercase.h @@ -1,5 +1,5 @@ /* Test of test whether a Unicode string is entirely upper case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-locale-language.c b/tests/unicase/test-locale-language.c index e35fab89..f1bba399 100644 --- a/tests/unicase/test-locale-language.c +++ b/tests/unicase/test-locale-language.c @@ -1,5 +1,5 @@ /* Test of language code determination. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-mapping-part1.h b/tests/unicase/test-mapping-part1.h index d64bb32f..71171bdc 100644 --- a/tests/unicase/test-mapping-part1.h +++ b/tests/unicase/test-mapping-part1.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-mapping-part2.h b/tests/unicase/test-mapping-part2.h index aa143845..f0828d4a 100644 --- a/tests/unicase/test-mapping-part2.h +++ b/tests/unicase/test-mapping-part2.h @@ -1,5 +1,5 @@ /* Test of single character case mapping functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unicase/test-predicate-part1.h b/tests/unicase/test-predicate-part1.h index 3e4c620d..51299e3f 100644 --- a/tests/unicase/test-predicate-part1.h +++ b/tests/unicase/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-predicate-part2.h b/tests/unicase/test-predicate-part2.h index 7ad81db2..1ca36c1a 100644 --- a/tests/unicase/test-predicate-part2.h +++ b/tests/unicase/test-predicate-part2.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); diff --git a/tests/unicase/test-u16-casecmp.c b/tests/unicase/test-u16-casecmp.c index c2a244d0..1643543e 100644 --- a/tests/unicase/test-u16-casecmp.c +++ b/tests/unicase/test-u16-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-casecoll.c b/tests/unicase/test-u16-casecoll.c index 3397b300..e9347048 100644 --- a/tests/unicase/test-u16-casecoll.c +++ b/tests/unicase/test-u16-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-casefold.c b/tests/unicase/test-u16-casefold.c index 85de6eb3..50a990bb 100644 --- a/tests/unicase/test-u16-casefold.c +++ b/tests/unicase/test-u16-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-is-cased.c b/tests/unicase/test-u16-is-cased.c index c1584259..5fd0673f 100644 --- a/tests/unicase/test-u16-is-cased.c +++ b/tests/unicase/test-u16-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-16 string. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-is-casefolded.c b/tests/unicase/test-u16-is-casefolded.c index 8cea10ed..6e7c577d 100644 --- a/tests/unicase/test-u16-is-casefolded.c +++ b/tests/unicase/test-u16-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is already case-folded. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-is-lowercase.c b/tests/unicase/test-u16-is-lowercase.c index 5341b666..64888af2 100644 --- a/tests/unicase/test-u16-is-lowercase.c +++ b/tests/unicase/test-u16-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely lower case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-is-titlecase.c b/tests/unicase/test-u16-is-titlecase.c index 390e8af9..7f7e7865 100644 --- a/tests/unicase/test-u16-is-titlecase.c +++ b/tests/unicase/test-u16-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely title case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-is-uppercase.c b/tests/unicase/test-u16-is-uppercase.c index 190b2a92..174f25e4 100644 --- a/tests/unicase/test-u16-is-uppercase.c +++ b/tests/unicase/test-u16-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-16 string is entirely upper case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-tolower.c b/tests/unicase/test-u16-tolower.c index ee30c47d..ed6d0a9b 100644 --- a/tests/unicase/test-u16-tolower.c +++ b/tests/unicase/test-u16-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-totitle.c b/tests/unicase/test-u16-totitle.c index 53fe9787..dec7b317 100644 --- a/tests/unicase/test-u16-totitle.c +++ b/tests/unicase/test-u16-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u16-toupper.c b/tests/unicase/test-u16-toupper.c index 19f3c0ce..ccb84994 100644 --- a/tests/unicase/test-u16-toupper.c +++ b/tests/unicase/test-u16-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-casecmp.c b/tests/unicase/test-u32-casecmp.c index 8ec7ff0a..1a44f139 100644 --- a/tests/unicase/test-u32-casecmp.c +++ b/tests/unicase/test-u32-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-casecoll.c b/tests/unicase/test-u32-casecoll.c index f58e99f9..89df9646 100644 --- a/tests/unicase/test-u32-casecoll.c +++ b/tests/unicase/test-u32-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-casefold.c b/tests/unicase/test-u32-casefold.c index 0b722b60..aae99d2d 100644 --- a/tests/unicase/test-u32-casefold.c +++ b/tests/unicase/test-u32-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-is-cased.c b/tests/unicase/test-u32-is-cased.c index 3875fd5c..297584ab 100644 --- a/tests/unicase/test-u32-is-cased.c +++ b/tests/unicase/test-u32-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-32 string. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-is-casefolded.c b/tests/unicase/test-u32-is-casefolded.c index 0b135fd3..d29495b9 100644 --- a/tests/unicase/test-u32-is-casefolded.c +++ b/tests/unicase/test-u32-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is already case-folded. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-is-lowercase.c b/tests/unicase/test-u32-is-lowercase.c index a9062aa5..b36210ad 100644 --- a/tests/unicase/test-u32-is-lowercase.c +++ b/tests/unicase/test-u32-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely lower case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-is-titlecase.c b/tests/unicase/test-u32-is-titlecase.c index cd6e011f..e51b1489 100644 --- a/tests/unicase/test-u32-is-titlecase.c +++ b/tests/unicase/test-u32-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely title case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-is-uppercase.c b/tests/unicase/test-u32-is-uppercase.c index 5df2920f..ae431bdd 100644 --- a/tests/unicase/test-u32-is-uppercase.c +++ b/tests/unicase/test-u32-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-32 string is entirely upper case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-tolower.c b/tests/unicase/test-u32-tolower.c index 343a0ac2..eda53f2e 100644 --- a/tests/unicase/test-u32-tolower.c +++ b/tests/unicase/test-u32-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-totitle.c b/tests/unicase/test-u32-totitle.c index 3e6d4f68..a9141300 100644 --- a/tests/unicase/test-u32-totitle.c +++ b/tests/unicase/test-u32-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u32-toupper.c b/tests/unicase/test-u32-toupper.c index 7a490f08..4f23ea3a 100644 --- a/tests/unicase/test-u32-toupper.c +++ b/tests/unicase/test-u32-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-casecmp.c b/tests/unicase/test-u8-casecmp.c index 80f6cc8a..67fff4e8 100644 --- a/tests/unicase/test-u8-casecmp.c +++ b/tests/unicase/test-u8-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-casecoll.c b/tests/unicase/test-u8-casecoll.c index f06e07de..e9075a14 100644 --- a/tests/unicase/test-u8-casecoll.c +++ b/tests/unicase/test-u8-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-casefold.c b/tests/unicase/test-u8-casefold.c index 9f236a35..f66b4222 100644 --- a/tests/unicase/test-u8-casefold.c +++ b/tests/unicase/test-u8-casefold.c @@ -1,5 +1,5 @@ /* Test of casefolding mapping for UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-is-cased.c b/tests/unicase/test-u8-is-cased.c index 0e7b5351..28a6ff74 100644 --- a/tests/unicase/test-u8-is-cased.c +++ b/tests/unicase/test-u8-is-cased.c @@ -1,5 +1,5 @@ /* Test of test whether case matters for an UTF-8 string. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-is-casefolded.c b/tests/unicase/test-u8-is-casefolded.c index c5bcc89c..9ec726f8 100644 --- a/tests/unicase/test-u8-is-casefolded.c +++ b/tests/unicase/test-u8-is-casefolded.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is already case-folded. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-is-lowercase.c b/tests/unicase/test-u8-is-lowercase.c index 52c2d731..06426e14 100644 --- a/tests/unicase/test-u8-is-lowercase.c +++ b/tests/unicase/test-u8-is-lowercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely lower case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-is-titlecase.c b/tests/unicase/test-u8-is-titlecase.c index ed54d3da..eb4b8368 100644 --- a/tests/unicase/test-u8-is-titlecase.c +++ b/tests/unicase/test-u8-is-titlecase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely title case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-is-uppercase.c b/tests/unicase/test-u8-is-uppercase.c index 54deced0..1b368b15 100644 --- a/tests/unicase/test-u8-is-uppercase.c +++ b/tests/unicase/test-u8-is-uppercase.c @@ -1,5 +1,5 @@ /* Test of test whether an UTF-8 string is entirely upper case. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-tolower.c b/tests/unicase/test-u8-tolower.c index 1a475a3c..e74749b9 100644 --- a/tests/unicase/test-u8-tolower.c +++ b/tests/unicase/test-u8-tolower.c @@ -1,5 +1,5 @@ /* Test of lowercase mapping for UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-totitle.c b/tests/unicase/test-u8-totitle.c index 438b0384..23443e9e 100644 --- a/tests/unicase/test-u8-totitle.c +++ b/tests/unicase/test-u8-totitle.c @@ -1,5 +1,5 @@ /* Test of titlecase mapping for UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-u8-toupper.c b/tests/unicase/test-u8-toupper.c index 272c46a9..a99fcaad 100644 --- a/tests/unicase/test-u8-toupper.c +++ b/tests/unicase/test-u8-toupper.c @@ -1,5 +1,5 @@ /* Test of uppercase mapping for UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-ulc-casecmp.c b/tests/unicase/test-ulc-casecmp.c index 9d139759..570e0f1f 100644 --- a/tests/unicase/test-ulc-casecmp.c +++ b/tests/unicase/test-ulc-casecmp.c @@ -1,5 +1,5 @@ /* Test of case and normalization insensitive comparison of strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-ulc-casecoll.c b/tests/unicase/test-ulc-casecoll.c index dff17bd6..f40331aa 100644 --- a/tests/unicase/test-ulc-casecoll.c +++ b/tests/unicase/test-ulc-casecoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, case and normalization insensitive comparison of strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unicase/test-unicase-h.c b/tests/unicase/test-unicase-h.c index b09e0f05..f656d7be 100644 --- a/tests/unicase/test-unicase-h.c +++ b/tests/unicase/test-unicase-h.c @@ -1,5 +1,5 @@ /* Test of <unicase.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c index 6dffc71e..4ff51a26 100644 --- a/tests/uniconv/test-u16-conv-from-enc.c +++ b/tests/uniconv/test-u16-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c index 2d12c1d1..6464b56e 100644 --- a/tests/uniconv/test-u16-conv-to-enc.c +++ b/tests/uniconv/test-u16-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c index 93ebead6..af321276 100644 --- a/tests/uniconv/test-u16-strconv-from-enc.c +++ b/tests/uniconv/test-u16-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-16 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c index 9378c647..6dfc9460 100644 --- a/tests/uniconv/test-u16-strconv-to-enc.c +++ b/tests/uniconv/test-u16-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 }; diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c index 677c11fc..8cd013f9 100644 --- a/tests/uniconv/test-u32-conv-from-enc.c +++ b/tests/uniconv/test-u32-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c index cdb9c363..e23e2867 100644 --- a/tests/uniconv/test-u32-conv-to-enc.c +++ b/tests/uniconv/test-u32-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c index 9d7d7349..b2040d44 100644 --- a/tests/uniconv/test-u32-strconv-from-enc.c +++ b/tests/uniconv/test-u32-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-32 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c index 8ff053e5..7b4d80b4 100644 --- a/tests/uniconv/test-u32-strconv-to-enc.c +++ b/tests/uniconv/test-u32-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c index f0bc956e..9fda9959 100644 --- a/tests/uniconv/test-u8-conv-from-enc.c +++ b/tests/uniconv/test-u8-conv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index 1f1b5c7b..4953d521 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c index 0211aa34..9ff66383 100644 --- a/tests/uniconv/test-u8-strconv-from-enc.c +++ b/tests/uniconv/test-u8-strconv-from-enc.c @@ -1,5 +1,5 @@ /* Test of conversion to UTF-8 from legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 */ diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c index 48e5d075..09521487 100644 --- a/tests/uniconv/test-u8-strconv-to-enc.c +++ b/tests/uniconv/test-u8-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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"; diff --git a/tests/uniconv/test-uniconv-h.c b/tests/uniconv/test-uniconv-h.c index 150cbe73..cfb16aa4 100644 --- a/tests/uniconv/test-uniconv-h.c +++ b/tests/uniconv/test-uniconv-h.c @@ -1,5 +1,5 @@ /* Test of <uniconv.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c index f1d50b12..5fc3d4b9 100644 --- a/tests/unictype/test-bidi_byname.c +++ b/tests/unictype/test-bidi_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-bidi_longname.c b/tests/unictype/test-bidi_longname.c index 365a065e..2b5173ec 100644 --- a/tests/unictype/test-bidi_longname.c +++ b/tests/unictype/test-bidi_longname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-bidi_name.c b/tests/unictype/test-bidi_name.c index fac5f27a..a679b503 100644 --- a/tests/unictype/test-bidi_name.c +++ b/tests/unictype/test-bidi_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-bidi_of.c b/tests/unictype/test-bidi_of.c index 8715ba92..06822a5f 100644 --- a/tests/unictype/test-bidi_of.c +++ b/tests/unictype/test-bidi_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-bidi_test.c b/tests/unictype/test-bidi_test.c index 2cdb4dc2..86b2bfd0 100644 --- a/tests/unictype/test-bidi_test.c +++ b/tests/unictype/test-bidi_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; } diff --git a/tests/unictype/test-block_list.c b/tests/unictype/test-block_list.c index a026c4b6..4105e19f 100644 --- a/tests/unictype/test-block_list.c +++ b/tests/unictype/test-block_list.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]; diff --git a/tests/unictype/test-block_of.c b/tests/unictype/test-block_of.c index 28ca1b27..7aceef09 100644 --- a/tests/unictype/test-block_of.c +++ b/tests/unictype/test-block_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]); } } diff --git a/tests/unictype/test-block_test.c b/tests/unictype/test-block_test.c index 9139ea71..6499a47c 100644 --- a/tests/unictype/test-block_test.c +++ b/tests/unictype/test-block_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_and.c b/tests/unictype/test-categ_and.c index eb620d05..9f5be0bf 100644 --- a/tests/unictype/test-categ_and.c +++ b/tests/unictype/test-categ_and.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c index d09d6859..0f90c1d9 100644 --- a/tests/unictype/test-categ_and_not.c +++ b/tests/unictype/test-categ_and_not.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_byname.c b/tests/unictype/test-categ_byname.c index d7f4924d..5fe54499 100644 --- a/tests/unictype/test-categ_byname.c +++ b/tests/unictype/test-categ_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); } diff --git a/tests/unictype/test-categ_longname.c b/tests/unictype/test-categ_longname.c index 45426b5b..72827bd7 100644 --- a/tests/unictype/test-categ_longname.c +++ b/tests/unictype/test-categ_longname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_name.c b/tests/unictype/test-categ_name.c index 26435ea0..f75b625e 100644 --- a/tests/unictype/test-categ_name.c +++ b/tests/unictype/test-categ_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_none.c b/tests/unictype/test-categ_none.c index 9cd80044..3c68f643 100644 --- a/tests/unictype/test-categ_none.c +++ b/tests/unictype/test-categ_none.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/unictype/test-categ_of.c b/tests/unictype/test-categ_of.c index 007e0c40..5b2c8742 100644 --- a/tests/unictype/test-categ_of.c +++ b/tests/unictype/test-categ_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,29 +25,24 @@ 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)); } diff --git a/tests/unictype/test-categ_or.c b/tests/unictype/test-categ_or.c index fbef5cf3..89687e31 100644 --- a/tests/unictype/test-categ_or.c +++ b/tests/unictype/test-categ_or.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-categ_test_withtable.c b/tests/unictype/test-categ_test_withtable.c index 7e796fb6..c724ec4e 100644 --- a/tests/unictype/test-categ_test_withtable.c +++ b/tests/unictype/test-categ_test_withtable.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-combiningclass.c b/tests/unictype/test-combiningclass.c index ba6645cb..4d1911a9 100644 --- a/tests/unictype/test-combiningclass.c +++ b/tests/unictype/test-combiningclass.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-combiningclass_byname.c b/tests/unictype/test-combiningclass_byname.c index 98f4fbad..731442fb 100644 --- a/tests/unictype/test-combiningclass_byname.c +++ b/tests/unictype/test-combiningclass_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining group functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-combiningclass_longname.c b/tests/unictype/test-combiningclass_longname.c index 2ee2520a..469e0a66 100644 --- a/tests/unictype/test-combiningclass_longname.c +++ b/tests/unictype/test-combiningclass_longname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-combiningclass_name.c b/tests/unictype/test-combiningclass_name.c index 1f06d08c..728707c3 100644 --- a/tests/unictype/test-combiningclass_name.c +++ b/tests/unictype/test-combiningclass_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-decdigit.c b/tests/unictype/test-decdigit.c index 1e860f05..632f1c8d 100644 --- a/tests/unictype/test-decdigit.c +++ b/tests/unictype/test-decdigit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unictype/test-digit.c b/tests/unictype/test-digit.c index a9cd6518..2a0663c1 100644 --- a/tests/unictype/test-digit.c +++ b/tests/unictype/test-digit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unictype/test-incb_byname.c b/tests/unictype/test-incb_byname.c index a7ab1730..747d7275 100644 --- a/tests/unictype/test-incb_byname.c +++ b/tests/unictype/test-incb_byname.c @@ -1,5 +1,5 @@ /* Test the Indic_Conjunct_Break value functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2024. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-incb_name.c b/tests/unictype/test-incb_name.c index bf46adc0..c486fc60 100644 --- a/tests/unictype/test-incb_name.c +++ b/tests/unictype/test-incb_name.c @@ -1,5 +1,5 @@ /* Test the Indic_Conjunct_Break value functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2024. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-incb_of.c b/tests/unictype/test-incb_of.c index c4d8cd71..3c08a0ef 100644 --- a/tests/unictype/test-incb_of.c +++ b/tests/unictype/test-incb_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character Indic_Conjunct_Break attribute functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2024. This program is free software: you can redistribute it and/or modify it @@ -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); diff --git a/tests/unictype/test-joininggroup_byname.c b/tests/unictype/test-joininggroup_byname.c index fdd96801..b960a829 100644 --- a/tests/unictype/test-joininggroup_byname.c +++ b/tests/unictype/test-joininggroup_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining group functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-joininggroup_name.c b/tests/unictype/test-joininggroup_name.c index 9196014b..f3cce59d 100644 --- a/tests/unictype/test-joininggroup_name.c +++ b/tests/unictype/test-joininggroup_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining group functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-joininggroup_of.c b/tests/unictype/test-joininggroup_of.c index 8ff37325..20d40788 100644 --- a/tests/unictype/test-joininggroup_of.c +++ b/tests/unictype/test-joininggroup_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining group functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it @@ -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); diff --git a/tests/unictype/test-joiningtype_byname.c b/tests/unictype/test-joiningtype_byname.c index 81798156..b794584a 100644 --- a/tests/unictype/test-joiningtype_byname.c +++ b/tests/unictype/test-joiningtype_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-joiningtype_longname.c b/tests/unictype/test-joiningtype_longname.c index 1c347eb1..e1970150 100644 --- a/tests/unictype/test-joiningtype_longname.c +++ b/tests/unictype/test-joiningtype_longname.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-joiningtype_name.c b/tests/unictype/test-joiningtype_name.c index 9f93f5f2..1bb8edcd 100644 --- a/tests/unictype/test-joiningtype_name.c +++ b/tests/unictype/test-joiningtype_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it diff --git a/tests/unictype/test-joiningtype_of.c b/tests/unictype/test-joiningtype_of.c index f04695a9..c67ff87a 100644 --- a/tests/unictype/test-joiningtype_of.c +++ b/tests/unictype/test-joiningtype_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character Arabic joining type functions. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This program is free software: you can redistribute it and/or modify it @@ -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 diff --git a/tests/unictype/test-mirror.c b/tests/unictype/test-mirror.c index 70b8fae8..de7dc2b0 100644 --- a/tests/unictype/test-mirror.c +++ b/tests/unictype/test-mirror.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-numeric.c b/tests/unictype/test-numeric.c index 824db1a2..7b230dcd 100644 --- a/tests/unictype/test-numeric.c +++ b/tests/unictype/test-numeric.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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++) { diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c index fc0908c7..788889b9 100644 --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); } diff --git a/tests/unictype/test-pr_test.c b/tests/unictype/test-pr_test.c index c8b52328..5a1f4820 100644 --- a/tests/unictype/test-pr_test.c +++ b/tests/unictype/test-pr_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unictype/test-predicate-part1.h b/tests/unictype/test-predicate-part1.h index caf2dc2f..207e465b 100644 --- a/tests/unictype/test-predicate-part1.h +++ b/tests/unictype/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-predicate-part2.h b/tests/unictype/test-predicate-part2.h index b4eef82e..83cf7e89 100644 --- a/tests/unictype/test-predicate-part2.h +++ b/tests/unictype/test-predicate-part2.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); diff --git a/tests/unictype/test-scripts.c b/tests/unictype/test-scripts.c index 54699b31..86841c63 100644 --- a/tests/unictype/test-scripts.c +++ b/tests/unictype/test-scripts.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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) diff --git a/tests/unictype/test-sy_c_ident.c b/tests/unictype/test-sy_c_ident.c index db42c4af..b23da71d 100644 --- a/tests/unictype/test-sy_c_ident.c +++ b/tests/unictype/test-sy_c_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-sy_java_ident.c b/tests/unictype/test-sy_java_ident.c index 0030ec2f..e3ea67bd 100644 --- a/tests/unictype/test-sy_java_ident.c +++ b/tests/unictype/test-sy_java_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unictype/test-unictype-h.c b/tests/unictype/test-unictype-h.c index b1f07c99..53032ebf 100644 --- a/tests/unictype/test-unictype-h.c +++ b/tests/unictype/test-unictype-h.c @@ -1,5 +1,5 @@ /* Test of <unictype.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unigbrk/test-u16-grapheme-breaks.c b/tests/unigbrk/test-u16-grapheme-breaks.c index f4af9984..634ec4dc 100644 --- a/tests/unigbrk/test-u16-grapheme-breaks.c +++ b/tests/unigbrk/test-u16-grapheme-breaks.c @@ -1,5 +1,5 @@ /* Grapheme cluster breaks test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u16-grapheme-next.c b/tests/unigbrk/test-u16-grapheme-next.c index eb68b7bd..542b4ba9 100644 --- a/tests/unigbrk/test-u16-grapheme-next.c +++ b/tests/unigbrk/test-u16-grapheme-next.c @@ -1,5 +1,5 @@ /* Next grapheme cluster length test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u16-grapheme-prev.c b/tests/unigbrk/test-u16-grapheme-prev.c index 8c17bdac..a0f4f1ae 100644 --- a/tests/unigbrk/test-u16-grapheme-prev.c +++ b/tests/unigbrk/test-u16-grapheme-prev.c @@ -1,5 +1,5 @@ /* Previous grapheme cluster test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u32-grapheme-breaks.c b/tests/unigbrk/test-u32-grapheme-breaks.c index 9f4267eb..7094da05 100644 --- a/tests/unigbrk/test-u32-grapheme-breaks.c +++ b/tests/unigbrk/test-u32-grapheme-breaks.c @@ -1,5 +1,5 @@ /* Grapheme cluster breaks test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u32-grapheme-next.c b/tests/unigbrk/test-u32-grapheme-next.c index eee9bafd..c5ba5a54 100644 --- a/tests/unigbrk/test-u32-grapheme-next.c +++ b/tests/unigbrk/test-u32-grapheme-next.c @@ -1,5 +1,5 @@ /* Next grapheme cluster length test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u32-grapheme-prev.c b/tests/unigbrk/test-u32-grapheme-prev.c index ab50a630..9543f939 100644 --- a/tests/unigbrk/test-u32-grapheme-prev.c +++ b/tests/unigbrk/test-u32-grapheme-prev.c @@ -1,5 +1,5 @@ /* Previous grapheme cluster test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u8-grapheme-breaks.c b/tests/unigbrk/test-u8-grapheme-breaks.c index 3549186c..9966a9e7 100644 --- a/tests/unigbrk/test-u8-grapheme-breaks.c +++ b/tests/unigbrk/test-u8-grapheme-breaks.c @@ -1,5 +1,5 @@ /* Grapheme cluster breaks test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u8-grapheme-next.c b/tests/unigbrk/test-u8-grapheme-next.c index 8929814f..da0fc807 100644 --- a/tests/unigbrk/test-u8-grapheme-next.c +++ b/tests/unigbrk/test-u8-grapheme-next.c @@ -1,5 +1,5 @@ /* Next grapheme cluster length test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-u8-grapheme-prev.c b/tests/unigbrk/test-u8-grapheme-prev.c index 9d635100..0612836d 100644 --- a/tests/unigbrk/test-u8-grapheme-prev.c +++ b/tests/unigbrk/test-u8-grapheme-prev.c @@ -1,5 +1,5 @@ /* Previous grapheme cluster test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-uc-gbrk-prop.c b/tests/unigbrk/test-uc-gbrk-prop.c index 23dc7c89..18d982b9 100644 --- a/tests/unigbrk/test-uc-gbrk-prop.c +++ b/tests/unigbrk/test-uc-gbrk-prop.c @@ -1,5 +1,5 @@ /* Test the Unicode grapheme break property function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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++) { diff --git a/tests/unigbrk/test-uc-grapheme-breaks.c b/tests/unigbrk/test-uc-grapheme-breaks.c index 860751c4..3de349e7 100644 --- a/tests/unigbrk/test-uc-grapheme-breaks.c +++ b/tests/unigbrk/test-uc-grapheme-breaks.c @@ -1,5 +1,5 @@ /* Grapheme cluster break function test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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); diff --git a/tests/unigbrk/test-uc-is-grapheme-break.c b/tests/unigbrk/test-uc-is-grapheme-break.c index 04614891..61b3a2bd 100644 --- a/tests/unigbrk/test-uc-is-grapheme-break.c +++ b/tests/unigbrk/test-uc-is-grapheme-break.c @@ -1,5 +1,5 @@ /* Grapheme cluster break function test. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/tests/unigbrk/test-ulc-grapheme-breaks.c b/tests/unigbrk/test-ulc-grapheme-breaks.c index b66222e8..acd0e757 100644 --- a/tests/unigbrk/test-ulc-grapheme-breaks.c +++ b/tests/unigbrk/test-ulc-grapheme-breaks.c @@ -1,5 +1,5 @@ /* Grapheme cluster breaks test. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unigbrk/test-unigbrk-h.c b/tests/unigbrk/test-unigbrk-h.c index 4058f252..b7d3032d 100644 --- a/tests/unigbrk/test-unigbrk-h.c +++ b/tests/unigbrk/test-unigbrk-h.c @@ -1,5 +1,5 @@ /* Test of <unigbrk.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unilbrk/test-u16-possible-linebreaks.c b/tests/unilbrk/test-u16-possible-linebreaks.c index c66a7331..93448045 100644 --- a/tests/unilbrk/test-u16-possible-linebreaks.c +++ b/tests/unilbrk/test-u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unilbrk/test-u16-width-linebreaks.c b/tests/unilbrk/test-u16-width-linebreaks.c index e2a9b6bc..ba3bf9ea 100644 --- a/tests/unilbrk/test-u16-width-linebreaks.c +++ b/tests/unilbrk/test-u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/unilbrk/test-u32-possible-linebreaks.c b/tests/unilbrk/test-u32-possible-linebreaks.c index f70d07f9..8bec8e6e 100644 --- a/tests/unilbrk/test-u32-possible-linebreaks.c +++ b/tests/unilbrk/test-u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unilbrk/test-u32-width-linebreaks.c b/tests/unilbrk/test-u32-width-linebreaks.c index 68ffbb2f..09e7652a 100644 --- a/tests/unilbrk/test-u32-width-linebreaks.c +++ b/tests/unilbrk/test-u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/unilbrk/test-u8-possible-linebreaks.c b/tests/unilbrk/test-u8-possible-linebreaks.c index 88a0d30c..4616f00c 100644 --- a/tests/unilbrk/test-u8-possible-linebreaks.c +++ b/tests/unilbrk/test-u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unilbrk/test-u8-width-linebreaks.c b/tests/unilbrk/test-u8-width-linebreaks.c index a9c9378b..60e3e383 100644 --- a/tests/unilbrk/test-u8-width-linebreaks.c +++ b/tests/unilbrk/test-u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/unilbrk/test-uc-possible-linebreaks.c b/tests/unilbrk/test-uc-possible-linebreaks.c index a54699b6..bf268286 100644 --- a/tests/unilbrk/test-uc-possible-linebreaks.c +++ b/tests/unilbrk/test-uc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line break function test, using test data from UCD. - Copyright (C) 2024-2025 Free Software Foundation, Inc. + Copyright (C) 2024-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -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 diff --git a/tests/unilbrk/test-ulc-possible-linebreaks.c b/tests/unilbrk/test-ulc-possible-linebreaks.c index 70c572ca..d821cf3d 100644 --- a/tests/unilbrk/test-ulc-possible-linebreaks.c +++ b/tests/unilbrk/test-ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); diff --git a/tests/unilbrk/test-ulc-width-linebreaks.c b/tests/unilbrk/test-ulc-width-linebreaks.c index b9c74b23..52423e39 100644 --- a/tests/unilbrk/test-ulc-width-linebreaks.c +++ b/tests/unilbrk/test-ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 : diff --git a/tests/unilbrk/test-unilbrk-h.c b/tests/unilbrk/test-unilbrk-h.c index c06cbeeb..146bddfe 100644 --- a/tests/unilbrk/test-unilbrk-h.c +++ b/tests/unilbrk/test-unilbrk-h.c @@ -1,5 +1,5 @@ /* Test of <unilbrk.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unimetadata/test-u-version.c b/tests/unimetadata/test-u-version.c index e52dd980..20812778 100644 --- a/tests/unimetadata/test-u-version.c +++ b/tests/unimetadata/test-u-version.c @@ -1,5 +1,5 @@ /* Test of supported Unicode version. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unimetadata/test-unimetadata-h.c b/tests/unimetadata/test-unimetadata-h.c index 9c9bf7ee..f7a9564a 100644 --- a/tests/unimetadata/test-unimetadata-h.c +++ b/tests/unimetadata/test-unimetadata-h.c @@ -1,5 +1,5 @@ /* Test of <unimetadata.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniname/test-uniname-h.c b/tests/uniname/test-uniname-h.c index 4ad982ac..35ba27eb 100644 --- a/tests/uniname/test-uniname-h.c +++ b/tests/uniname/test-uniname-h.c @@ -1,5 +1,5 @@ /* Test of <uniname.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c index 0804abf2..38dc618c 100644 --- a/tests/uniname/test-uninames.c +++ b/tests/uniname/test-uninames.c @@ -1,5 +1,5 @@ /* Test the Unicode character name functions. - Copyright (C) 2000-2003, 2005, 2007, 2009-2025 Free Software Foundation, + Copyright (C) 2000-2003, 2005, 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -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++; diff --git a/tests/uninorm/test-canonical-decomposition.c b/tests/uninorm/test-canonical-decomposition.c index 2502f56c..7298a61e 100644 --- a/tests/uninorm/test-canonical-decomposition.c +++ b/tests/uninorm/test-canonical-decomposition.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode characters. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-compat-decomposition.c b/tests/uninorm/test-compat-decomposition.c index b4266fd7..be4dc9fc 100644 --- a/tests/uninorm/test-compat-decomposition.c +++ b/tests/uninorm/test-compat-decomposition.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode characters. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-composition.c b/tests/uninorm/test-composition.c index 1aa885d1..3b24410f 100644 --- a/tests/uninorm/test-composition.c +++ b/tests/uninorm/test-composition.c @@ -1,5 +1,5 @@ /* Test of canonical composition of Unicode characters. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-decomposing-form.c b/tests/uninorm/test-decomposing-form.c index 2d46f3d4..1a3efd8e 100644 --- a/tests/uninorm/test-decomposing-form.c +++ b/tests/uninorm/test-decomposing-form.c @@ -1,5 +1,5 @@ /* Test of decomposing variant of a normalization form. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-decomposition.c b/tests/uninorm/test-decomposition.c index 5b02ab7e..a50d781d 100644 --- a/tests/uninorm/test-decomposition.c +++ b/tests/uninorm/test-decomposition.c @@ -1,5 +1,5 @@ /* Test of decomposition of Unicode characters. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfc.c b/tests/uninorm/test-nfc.c index 654892fd..3f9b3c24 100644 --- a/tests/uninorm/test-nfc.c +++ b/tests/uninorm/test-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of Unicode strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfd.c b/tests/uninorm/test-nfd.c index 1a84946c..57afb977 100644 --- a/tests/uninorm/test-nfd.c +++ b/tests/uninorm/test-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of Unicode strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfkc.c b/tests/uninorm/test-nfkc.c index 0a8102fe..035c60b8 100644 --- a/tests/uninorm/test-nfkc.c +++ b/tests/uninorm/test-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of Unicode strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-nfkd.c b/tests/uninorm/test-nfkd.c index 1bb889d6..3a9e1273 100644 --- a/tests/uninorm/test-nfkd.c +++ b/tests/uninorm/test-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of Unicode strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u16-nfc.c b/tests/uninorm/test-u16-nfc.c index de65b308..0cfd0c1f 100644 --- a/tests/uninorm/test-u16-nfc.c +++ b/tests/uninorm/test-u16-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u16-nfd.c b/tests/uninorm/test-u16-nfd.c index f83fc8e2..bdeca562 100644 --- a/tests/uninorm/test-u16-nfd.c +++ b/tests/uninorm/test-u16-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u16-nfkc.c b/tests/uninorm/test-u16-nfkc.c index 63215ce0..ef25acef 100644 --- a/tests/uninorm/test-u16-nfkc.c +++ b/tests/uninorm/test-u16-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u16-nfkd.c b/tests/uninorm/test-u16-nfkd.c index d560bb1b..30f39ea3 100644 --- a/tests/uninorm/test-u16-nfkd.c +++ b/tests/uninorm/test-u16-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u16-normcmp.c b/tests/uninorm/test-u16-normcmp.c index 117279c7..7a1a7d9b 100644 --- a/tests/uninorm/test-u16-normcmp.c +++ b/tests/uninorm/test-u16-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u16-normcmp.h b/tests/uninorm/test-u16-normcmp.h index ba9784b3..10bdfd06 100644 --- a/tests/uninorm/test-u16-normcmp.h +++ b/tests/uninorm/test-u16-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u16-normcoll.c b/tests/uninorm/test-u16-normcoll.c index 25d6b0e4..cb65a813 100644 --- a/tests/uninorm/test-u16-normcoll.c +++ b/tests/uninorm/test-u16-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-nfc-big.c b/tests/uninorm/test-u32-nfc-big.c index 6282d512..a5aac2c5 100644 --- a/tests/uninorm/test-u32-nfc-big.c +++ b/tests/uninorm/test-u32-nfc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-nfc.c b/tests/uninorm/test-u32-nfc.c index 119af6b2..89f0d652 100644 --- a/tests/uninorm/test-u32-nfc.c +++ b/tests/uninorm/test-u32-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u32-nfd-big.c b/tests/uninorm/test-u32-nfd-big.c index 94d5d511..a471a035 100644 --- a/tests/uninorm/test-u32-nfd-big.c +++ b/tests/uninorm/test-u32-nfd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of canonical decomposition of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-nfd.c b/tests/uninorm/test-u32-nfd.c index 248e0eca..49a12359 100644 --- a/tests/uninorm/test-u32-nfd.c +++ b/tests/uninorm/test-u32-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u32-nfkc-big.c b/tests/uninorm/test-u32-nfkc-big.c index 380f674c..63aa1acc 100644 --- a/tests/uninorm/test-u32-nfkc-big.c +++ b/tests/uninorm/test-u32-nfkc-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-nfkc.c b/tests/uninorm/test-u32-nfkc.c index 454b7afd..6dfc745e 100644 --- a/tests/uninorm/test-u32-nfkc.c +++ b/tests/uninorm/test-u32-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u32-nfkd-big.c b/tests/uninorm/test-u32-nfkd-big.c index 8aafb7d7..ee176342 100644 --- a/tests/uninorm/test-u32-nfkd-big.c +++ b/tests/uninorm/test-u32-nfkd-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-nfkd.c b/tests/uninorm/test-u32-nfkd.c index 4120d7bc..50fc7960 100644 --- a/tests/uninorm/test-u32-nfkd.c +++ b/tests/uninorm/test-u32-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u32-normalize-big.c b/tests/uninorm/test-u32-normalize-big.c index ae197991..863c7181 100644 --- a/tests/uninorm/test-u32-normalize-big.c +++ b/tests/uninorm/test-u32-normalize-big.c @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/uninorm/test-u32-normalize-big.h b/tests/uninorm/test-u32-normalize-big.h index f691ea05..5402d7b0 100644 --- a/tests/uninorm/test-u32-normalize-big.h +++ b/tests/uninorm/test-u32-normalize-big.h @@ -1,5 +1,5 @@ /* Test of Unicode compliance of normalization of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-normcmp.c b/tests/uninorm/test-u32-normcmp.c index 6ec6384a..e18de216 100644 --- a/tests/uninorm/test-u32-normcmp.c +++ b/tests/uninorm/test-u32-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-normcmp.h b/tests/uninorm/test-u32-normcmp.h index b184c762..b1a97bd7 100644 --- a/tests/uninorm/test-u32-normcmp.h +++ b/tests/uninorm/test-u32-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u32-normcoll.c b/tests/uninorm/test-u32-normcoll.c index 1087233a..bc9c68c8 100644 --- a/tests/uninorm/test-u32-normcoll.c +++ b/tests/uninorm/test-u32-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u8-nfc.c b/tests/uninorm/test-u8-nfc.c index 6d98721c..96993cf7 100644 --- a/tests/uninorm/test-u8-nfc.c +++ b/tests/uninorm/test-u8-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u8-nfd.c b/tests/uninorm/test-u8-nfd.c index 78b9fa77..d7602f1e 100644 --- a/tests/uninorm/test-u8-nfd.c +++ b/tests/uninorm/test-u8-nfd.c @@ -1,5 +1,5 @@ /* Test of canonical decomposition of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u8-nfkc.c b/tests/uninorm/test-u8-nfkc.c index a8379908..551d112f 100644 --- a/tests/uninorm/test-u8-nfkc.c +++ b/tests/uninorm/test-u8-nfkc.c @@ -1,5 +1,5 @@ /* Test of compatibility normalization of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u8-nfkd.c b/tests/uninorm/test-u8-nfkd.c index ddc1ddde..b18dd531 100644 --- a/tests/uninorm/test-u8-nfkd.c +++ b/tests/uninorm/test-u8-nfkd.c @@ -1,5 +1,5 @@ /* Test of compatibility decomposition of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 diff --git a/tests/uninorm/test-u8-normcmp.c b/tests/uninorm/test-u8-normcmp.c index 772da7fc..5c6b6c8d 100644 --- a/tests/uninorm/test-u8-normcmp.c +++ b/tests/uninorm/test-u8-normcmp.c @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u8-normcmp.h b/tests/uninorm/test-u8-normcmp.h index 843a5233..e033ae76 100644 --- a/tests/uninorm/test-u8-normcmp.h +++ b/tests/uninorm/test-u8-normcmp.h @@ -1,5 +1,5 @@ /* Test of normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-u8-normcoll.c b/tests/uninorm/test-u8-normcoll.c index 6ab628c0..5026b731 100644 --- a/tests/uninorm/test-u8-normcoll.c +++ b/tests/uninorm/test-u8-normcoll.c @@ -1,6 +1,6 @@ /* Test of locale dependent, normalization insensitive comparison of UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uninorm/test-uninorm-filter-nfc.c b/tests/uninorm/test-uninorm-filter-nfc.c index 98904182..8ff16205 100644 --- a/tests/uninorm/test-uninorm-filter-nfc.c +++ b/tests/uninorm/test-uninorm-filter-nfc.c @@ -1,5 +1,5 @@ /* Test of canonical normalization of streams. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/uninorm/test-uninorm-h.c b/tests/uninorm/test-uninorm-h.c index 0398d24e..16d8688b 100644 --- a/tests/uninorm/test-uninorm-h.c +++ b/tests/uninorm/test-uninorm-h.c @@ -1,5 +1,5 @@ /* Test of <uninorm.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-asnprintf1.c b/tests/unistdio/test-u16-asnprintf1.c index 8e047cce..672b4662 100644 --- a/tests/unistdio/test-u16-asnprintf1.c +++ b/tests/unistdio/test-u16-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_asnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-asnprintf1.h b/tests/unistdio/test-u16-asnprintf1.h index 6d1be290..79d53293 100644 --- a/tests/unistdio/test-u16-asnprintf1.h +++ b/tests/unistdio/test-u16-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u16_[v]asnprintf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 }; diff --git a/tests/unistdio/test-u16-printf1.h b/tests/unistdio/test-u16-printf1.h index 0498b32e..020b4d59 100644 --- a/tests/unistdio/test-u16-printf1.h +++ b/tests/unistdio/test-u16-printf1.h @@ -1,5 +1,5 @@ /* Test of u16_v[a]s[n]printf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vasnprintf1.c b/tests/unistdio/test-u16-vasnprintf1.c index c6c0f520..c17d6e63 100644 --- a/tests/unistdio/test-u16-vasnprintf1.c +++ b/tests/unistdio/test-u16-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vasnprintf2.c b/tests/unistdio/test-u16-vasnprintf2.c index cb9fb27a..cef1b654 100644 --- a/tests/unistdio/test-u16-vasnprintf2.c +++ b/tests/unistdio/test-u16-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vasnprintf3.c b/tests/unistdio/test-u16-vasnprintf3.c index 80391a38..44604a00 100644 --- a/tests/unistdio/test-u16-vasnprintf3.c +++ b/tests/unistdio/test-u16-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vasprintf1.c b/tests/unistdio/test-u16-vasprintf1.c index f1613023..f43bebd5 100644 --- a/tests/unistdio/test-u16-vasprintf1.c +++ b/tests/unistdio/test-u16-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c index ac9d81f5..e2b35fc5 100644 --- a/tests/unistdio/test-u16-vsnprintf1.c +++ b/tests/unistdio/test-u16-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c index dd323bd0..0fee1c04 100644 --- a/tests/unistdio/test-u16-vsprintf1.c +++ b/tests/unistdio/test-u16-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vsprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-asnprintf1.c b/tests/unistdio/test-u32-asnprintf1.c index 4fd23030..c899e488 100644 --- a/tests/unistdio/test-u32-asnprintf1.c +++ b/tests/unistdio/test-u32-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_asnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-asnprintf1.h b/tests/unistdio/test-u32-asnprintf1.h index 2046d4f6..da619725 100644 --- a/tests/unistdio/test-u32-asnprintf1.h +++ b/tests/unistdio/test-u32-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u32_[v]asnprintf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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 }; diff --git a/tests/unistdio/test-u32-printf1.h b/tests/unistdio/test-u32-printf1.h index 05cedd07..0bc80288 100644 --- a/tests/unistdio/test-u32-printf1.h +++ b/tests/unistdio/test-u32-printf1.h @@ -1,5 +1,5 @@ /* Test of u32_v[a]s[n]printf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vasnprintf1.c b/tests/unistdio/test-u32-vasnprintf1.c index e73753ea..91e9a5f0 100644 --- a/tests/unistdio/test-u32-vasnprintf1.c +++ b/tests/unistdio/test-u32-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vasnprintf2.c b/tests/unistdio/test-u32-vasnprintf2.c index b45fa8ef..6c52352f 100644 --- a/tests/unistdio/test-u32-vasnprintf2.c +++ b/tests/unistdio/test-u32-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vasnprintf3.c b/tests/unistdio/test-u32-vasnprintf3.c index 1a73f248..361a2e1d 100644 --- a/tests/unistdio/test-u32-vasnprintf3.c +++ b/tests/unistdio/test-u32-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vasprintf1.c b/tests/unistdio/test-u32-vasprintf1.c index ac030cd6..52d62242 100644 --- a/tests/unistdio/test-u32-vasprintf1.c +++ b/tests/unistdio/test-u32-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c index 94602d85..3c6713f8 100644 --- a/tests/unistdio/test-u32-vsnprintf1.c +++ b/tests/unistdio/test-u32-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c index 2fd3b137..af9ea173 100644 --- a/tests/unistdio/test-u32-vsprintf1.c +++ b/tests/unistdio/test-u32-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vsprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-asnprintf1.c b/tests/unistdio/test-u8-asnprintf1.c index 49ee6134..2939e719 100644 --- a/tests/unistdio/test-u8-asnprintf1.c +++ b/tests/unistdio/test-u8-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_asnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-asnprintf1.h b/tests/unistdio/test-u8-asnprintf1.h index 90238c8e..6e9759ce 100644 --- a/tests/unistdio/test-u8-asnprintf1.h +++ b/tests/unistdio/test-u8-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of u8_[v]asnprintf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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"; diff --git a/tests/unistdio/test-u8-printf1.h b/tests/unistdio/test-u8-printf1.h index 1dd28469..e12500de 100644 --- a/tests/unistdio/test-u8-printf1.h +++ b/tests/unistdio/test-u8-printf1.h @@ -1,5 +1,5 @@ /* Test of u8_v[a]s[n]printf() function. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vasnprintf1.c b/tests/unistdio/test-u8-vasnprintf1.c index 2aaf839f..2be743e1 100644 --- a/tests/unistdio/test-u8-vasnprintf1.c +++ b/tests/unistdio/test-u8-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vasnprintf2.c b/tests/unistdio/test-u8-vasnprintf2.c index 9fa03988..6ad7b368 100644 --- a/tests/unistdio/test-u8-vasnprintf2.c +++ b/tests/unistdio/test-u8-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vasnprintf3.c b/tests/unistdio/test-u8-vasnprintf3.c index aab9dfe3..44539d52 100644 --- a/tests/unistdio/test-u8-vasnprintf3.c +++ b/tests/unistdio/test-u8-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vasprintf1.c b/tests/unistdio/test-u8-vasprintf1.c index 82512028..a9b9bc44 100644 --- a/tests/unistdio/test-u8-vasprintf1.c +++ b/tests/unistdio/test-u8-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c index 015c1725..2bf41b26 100644 --- a/tests/unistdio/test-u8-vsnprintf1.c +++ b/tests/unistdio/test-u8-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c index 0d846de2..e1e597b8 100644 --- a/tests/unistdio/test-u8-vsprintf1.c +++ b/tests/unistdio/test-u8-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vsprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-asnprintf1.c b/tests/unistdio/test-ulc-asnprintf1.c index 5e40575c..2127d2e3 100644 --- a/tests/unistdio/test-ulc-asnprintf1.c +++ b/tests/unistdio/test-ulc-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_asnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h index 0e7e9cff..ab7e0d89 100644 --- a/tests/unistdio/test-ulc-asnprintf1.h +++ b/tests/unistdio/test-ulc-asnprintf1.h @@ -1,5 +1,5 @@ /* Test of ulc_[v]asnprintf() functions. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistdio/test-ulc-printf1.h b/tests/unistdio/test-ulc-printf1.h index 02e0372d..0b13116e 100644 --- a/tests/unistdio/test-ulc-printf1.h +++ b/tests/unistdio/test-ulc-printf1.h @@ -1,5 +1,5 @@ /* Test of ulc_v[a]s[n]printf() functions. - Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vasnprintf1.c b/tests/unistdio/test-ulc-vasnprintf1.c index f662f4e9..32d2c1c5 100644 --- a/tests/unistdio/test-ulc-vasnprintf1.c +++ b/tests/unistdio/test-ulc-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vasnprintf2.c b/tests/unistdio/test-ulc-vasnprintf2.c index 5375c8e8..bbd50512 100644 --- a/tests/unistdio/test-ulc-vasnprintf2.c +++ b/tests/unistdio/test-ulc-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vasnprintf3.c b/tests/unistdio/test-ulc-vasnprintf3.c index e71887c8..b35aefc9 100644 --- a/tests/unistdio/test-ulc-vasnprintf3.c +++ b/tests/unistdio/test-ulc-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vasprintf1.c b/tests/unistdio/test-ulc-vasprintf1.c index 3eed14f9..3a449796 100644 --- a/tests/unistdio/test-ulc-vasprintf1.c +++ b/tests/unistdio/test-ulc-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c index 344fd353..66a391fd 100644 --- a/tests/unistdio/test-ulc-vsnprintf1.c +++ b/tests/unistdio/test-ulc-vsnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsnprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c index 1f8bb8ac..7c5deb0d 100644 --- a/tests/unistdio/test-ulc-vsprintf1.c +++ b/tests/unistdio/test-ulc-vsprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vsprintf() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistdio/test-unistdio-h.c b/tests/unistdio/test-unistdio-h.c index b5a085d2..a4fef93f 100644 --- a/tests/unistdio/test-unistdio-h.c +++ b/tests/unistdio/test-unistdio-h.c @@ -1,5 +1,5 @@ /* Test of <unistdio.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-chr.h b/tests/unistr/test-chr.h index 7e95af1b..fe007261 100644 --- a/tests/unistr/test-chr.h +++ b/tests/unistr/test-chr.h @@ -1,5 +1,5 @@ /* Test of uN_chr() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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'; + } } } } diff --git a/tests/unistr/test-cmp.h b/tests/unistr/test-cmp.h index 94e3d3f5..84f89287 100644 --- a/tests/unistr/test-cmp.h +++ b/tests/unistr/test-cmp.h @@ -1,5 +1,5 @@ /* Test of uN_cmp() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-cmp2.h b/tests/unistr/test-cmp2.h index d032bd89..5bf70674 100644 --- a/tests/unistr/test-cmp2.h +++ b/tests/unistr/test-cmp2.h @@ -1,5 +1,5 @@ /* Test of uN_cmp2() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-cpy-alloc.h b/tests/unistr/test-cpy-alloc.h index 4a2bfa05..9c490875 100644 --- a/tests/unistr/test-cpy-alloc.h +++ b/tests/unistr/test-cpy-alloc.h @@ -1,5 +1,5 @@ /* Test of uN_cpy_alloc() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-cpy.h b/tests/unistr/test-cpy.h index e1a167bb..db264f43 100644 --- a/tests/unistr/test-cpy.h +++ b/tests/unistr/test-cpy.h @@ -1,5 +1,5 @@ /* Test of uN_cpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-move.h b/tests/unistr/test-move.h index 765dcb5f..a4a22e45 100644 --- a/tests/unistr/test-move.h +++ b/tests/unistr/test-move.h @@ -1,5 +1,5 @@ /* Test of uN_move() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]); diff --git a/tests/unistr/test-pcpy.h b/tests/unistr/test-pcpy.h index c7298dca..62199043 100644 --- a/tests/unistr/test-pcpy.h +++ b/tests/unistr/test-pcpy.h @@ -1,5 +1,5 @@ /* Test of uN_pcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-set.h b/tests/unistr/test-set.h index 133ea638..36fb6d00 100644 --- a/tests/unistr/test-set.h +++ b/tests/unistr/test-set.h @@ -1,5 +1,5 @@ /* Test of uN_set() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,26 +19,21 @@ 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; } diff --git a/tests/unistr/test-stpcpy.h b/tests/unistr/test-stpcpy.h index d8b433d5..859f4869 100644 --- a/tests/unistr/test-stpcpy.h +++ b/tests/unistr/test-stpcpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-stpncpy.h b/tests/unistr/test-stpncpy.h index c651a83e..ff283868 100644 --- a/tests/unistr/test-stpncpy.h +++ b/tests/unistr/test-stpncpy.h @@ -1,5 +1,5 @@ /* Test of uN_stpncpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-strcat.h b/tests/unistr/test-strcat.h index cd0fb9f0..20d7564d 100644 --- a/tests/unistr/test-strcat.h +++ b/tests/unistr/test-strcat.h @@ -1,5 +1,5 @@ /* Test of uN_strcat() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-strchr.h b/tests/unistr/test-strchr.h index c5740a5d..e078e232 100644 --- a/tests/unistr/test-strchr.h +++ b/tests/unistr/test-strchr.h @@ -1,5 +1,5 @@ /* Test of uN_strchr() functions. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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'; + } } } } diff --git a/tests/unistr/test-strcmp.h b/tests/unistr/test-strcmp.h index 97cb203a..234a2fbf 100644 --- a/tests/unistr/test-strcmp.h +++ b/tests/unistr/test-strcmp.h @@ -1,5 +1,5 @@ /* Test of uN_strcmp() and uN_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strcpy.h b/tests/unistr/test-strcpy.h index 6a1d81e8..a0818bb6 100644 --- a/tests/unistr/test-strcpy.h +++ b/tests/unistr/test-strcpy.h @@ -1,5 +1,5 @@ /* Test of uN_strcpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); } diff --git a/tests/unistr/test-strdup.h b/tests/unistr/test-strdup.h index 4f59bc06..9d53a544 100644 --- a/tests/unistr/test-strdup.h +++ b/tests/unistr/test-strdup.h @@ -1,5 +1,5 @@ /* Test of uN_strdup() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-strncat.h b/tests/unistr/test-strncat.h index 0ba63afe..c2533c7c 100644 --- a/tests/unistr/test-strncat.h +++ b/tests/unistr/test-strncat.h @@ -1,5 +1,5 @@ /* Test of uN_strncat() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-strncmp.h b/tests/unistr/test-strncmp.h index bbd0aa68..033a24fb 100644 --- a/tests/unistr/test-strncmp.h +++ b/tests/unistr/test-strncmp.h @@ -1,5 +1,5 @@ /* Test of uN_strncmp() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-strncpy.h b/tests/unistr/test-strncpy.h index e24fa507..3e4afb8e 100644 --- a/tests/unistr/test-strncpy.h +++ b/tests/unistr/test-strncpy.h @@ -1,5 +1,5 @@ /* Test of uN_strncpy() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-strnlen.h b/tests/unistr/test-strnlen.h index fd0c25cc..e8aff09c 100644 --- a/tests/unistr/test-strnlen.h +++ b/tests/unistr/test-strnlen.h @@ -1,5 +1,5 @@ /* Test of uN_strnlen() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u-strstr.h b/tests/unistr/test-u-strstr.h index 826089d9..9676072a 100644 --- a/tests/unistr/test-u-strstr.h +++ b/tests/unistr/test-u-strstr.h @@ -1,5 +1,5 @@ /* Test of uN_strstr() functions. - Copyright (C) 2004, 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u-strtok.h b/tests/unistr/test-u-strtok.h index 6f73baf7..a4705104 100644 --- a/tests/unistr/test-u-strtok.h +++ b/tests/unistr/test-u-strtok.h @@ -1,5 +1,5 @@ /* Test of uN_strtok() functions. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-check.c b/tests/unistr/test-u16-check.c index 5e6c5daf..c45867b7 100644 --- a/tests/unistr/test-u16-check.c +++ b/tests/unistr/test-u16-check.c @@ -1,5 +1,5 @@ /* Test of u16_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-chr.c b/tests/unistr/test-u16-chr.c index 3457cd91..eb56dea7 100644 --- a/tests/unistr/test-u16-chr.c +++ b/tests/unistr/test-u16-chr.c @@ -1,5 +1,5 @@ /* Test of u16_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cmp.c b/tests/unistr/test-u16-cmp.c index 87ef97cf..501a60af 100644 --- a/tests/unistr/test-u16-cmp.c +++ b/tests/unistr/test-u16-cmp.c @@ -1,5 +1,5 @@ /* Test of u16_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cmp2.c b/tests/unistr/test-u16-cmp2.c index 274aee7c..4c825bc3 100644 --- a/tests/unistr/test-u16-cmp2.c +++ b/tests/unistr/test-u16-cmp2.c @@ -1,5 +1,5 @@ /* Test of u16_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cpy-alloc.c b/tests/unistr/test-u16-cpy-alloc.c index 0398e100..9842d77e 100644 --- a/tests/unistr/test-u16-cpy-alloc.c +++ b/tests/unistr/test-u16-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u16_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-cpy.c b/tests/unistr/test-u16-cpy.c index 5cdfbc73..8985fced 100644 --- a/tests/unistr/test-u16-cpy.c +++ b/tests/unistr/test-u16-cpy.c @@ -1,5 +1,5 @@ /* Test of u16_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mblen.c b/tests/unistr/test-u16-mblen.c index 6d0c4765..b2fb5501 100644 --- a/tests/unistr/test-u16-mblen.c +++ b/tests/unistr/test-u16-mblen.c @@ -1,5 +1,5 @@ /* Test of u16_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u16-mbsnlen.c b/tests/unistr/test-u16-mbsnlen.c index c354ddfb..13419e66 100644 --- a/tests/unistr/test-u16-mbsnlen.c +++ b/tests/unistr/test-u16-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u16_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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]); diff --git a/tests/unistr/test-u16-mbtouc-unsafe.c b/tests/unistr/test-u16-mbtouc-unsafe.c index eb78205e..406c5120 100644 --- a/tests/unistr/test-u16-mbtouc-unsafe.c +++ b/tests/unistr/test-u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtouc.c b/tests/unistr/test-u16-mbtouc.c index 3caee4c0..d677ac1c 100644 --- a/tests/unistr/test-u16-mbtouc.c +++ b/tests/unistr/test-u16-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-mbtouc.h b/tests/unistr/test-u16-mbtouc.h index 07931f71..30c85d7f 100644 --- a/tests/unistr/test-u16-mbtouc.h +++ b/tests/unistr/test-u16-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u16_mbtouc() and u16_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-mbtoucr.c b/tests/unistr/test-u16-mbtoucr.c index 67226cc1..2e3e3c6d 100644 --- a/tests/unistr/test-u16-mbtoucr.c +++ b/tests/unistr/test-u16-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u16_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-move.c b/tests/unistr/test-u16-move.c index 2190cbdb..b53eeb9e 100644 --- a/tests/unistr/test-u16-move.c +++ b/tests/unistr/test-u16-move.c @@ -1,5 +1,5 @@ /* Test of u16_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-next.c b/tests/unistr/test-u16-next.c index afb4da3e..992933bf 100644 --- a/tests/unistr/test-u16-next.c +++ b/tests/unistr/test-u16-next.c @@ -1,5 +1,5 @@ /* Test of u16_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-pcpy.c b/tests/unistr/test-u16-pcpy.c index d53aa1da..f83cee68 100644 --- a/tests/unistr/test-u16-pcpy.c +++ b/tests/unistr/test-u16-pcpy.c @@ -1,5 +1,5 @@ /* Test of u16_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-prev.c b/tests/unistr/test-u16-prev.c index 911b2c89..c2540499 100644 --- a/tests/unistr/test-u16-prev.c +++ b/tests/unistr/test-u16-prev.c @@ -1,5 +1,5 @@ /* Test of u16_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-set.c b/tests/unistr/test-u16-set.c index 7ec1845a..adc33644 100644 --- a/tests/unistr/test-u16-set.c +++ b/tests/unistr/test-u16-set.c @@ -1,5 +1,5 @@ /* Test of u16_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-stpcpy.c b/tests/unistr/test-u16-stpcpy.c index 2d56c8d9..9985a8db 100644 --- a/tests/unistr/test-u16-stpcpy.c +++ b/tests/unistr/test-u16-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-stpncpy.c b/tests/unistr/test-u16-stpncpy.c index 58e0c4a2..d8b2cab1 100644 --- a/tests/unistr/test-u16-stpncpy.c +++ b/tests/unistr/test-u16-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u16_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcat.c b/tests/unistr/test-u16-strcat.c index a00bb5cd..30d2475a 100644 --- a/tests/unistr/test-u16-strcat.c +++ b/tests/unistr/test-u16-strcat.c @@ -1,5 +1,5 @@ /* Test of u16_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strchr.c b/tests/unistr/test-u16-strchr.c index 5be29979..b59ca0fb 100644 --- a/tests/unistr/test-u16-strchr.c +++ b/tests/unistr/test-u16-strchr.c @@ -1,5 +1,5 @@ /* Test of u16_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcmp.c b/tests/unistr/test-u16-strcmp.c index c2d704fb..caa41898 100644 --- a/tests/unistr/test-u16-strcmp.c +++ b/tests/unistr/test-u16-strcmp.c @@ -1,5 +1,5 @@ /* Test of u16_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcmp.h b/tests/unistr/test-u16-strcmp.h index 46b6f72d..571cc8db 100644 --- a/tests/unistr/test-u16-strcmp.h +++ b/tests/unistr/test-u16-strcmp.h @@ -1,5 +1,5 @@ /* Test of u16_strcmp() and u16_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcoll.c b/tests/unistr/test-u16-strcoll.c index 7d6801d7..de32dad7 100644 --- a/tests/unistr/test-u16-strcoll.c +++ b/tests/unistr/test-u16-strcoll.c @@ -1,5 +1,5 @@ /* Test of u16_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strcpy.c b/tests/unistr/test-u16-strcpy.c index 62aac951..9e604cec 100644 --- a/tests/unistr/test-u16-strcpy.c +++ b/tests/unistr/test-u16-strcpy.c @@ -1,5 +1,5 @@ /* Test of u16_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strdup.c b/tests/unistr/test-u16-strdup.c index 95488128..31f34c32 100644 --- a/tests/unistr/test-u16-strdup.c +++ b/tests/unistr/test-u16-strdup.c @@ -1,5 +1,5 @@ /* Test of u16_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strlen.c b/tests/unistr/test-u16-strlen.c index 42058cb6..c842912a 100644 --- a/tests/unistr/test-u16-strlen.c +++ b/tests/unistr/test-u16-strlen.c @@ -1,5 +1,5 @@ /* Test of u16_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strmblen.c b/tests/unistr/test-u16-strmblen.c index 42cf3e6f..bfe70c6f 100644 --- a/tests/unistr/test-u16-strmblen.c +++ b/tests/unistr/test-u16-strmblen.c @@ -1,5 +1,5 @@ /* Test of u16_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-strmbtouc.c b/tests/unistr/test-u16-strmbtouc.c index 8f2e37ec..12ab3c0d 100644 --- a/tests/unistr/test-u16-strmbtouc.c +++ b/tests/unistr/test-u16-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u16_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u16-strncat.c b/tests/unistr/test-u16-strncat.c index 2cf25a81..ab60d7c6 100644 --- a/tests/unistr/test-u16-strncat.c +++ b/tests/unistr/test-u16-strncat.c @@ -1,5 +1,5 @@ /* Test of u16_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strncmp.c b/tests/unistr/test-u16-strncmp.c index c8325830..5f4ab386 100644 --- a/tests/unistr/test-u16-strncmp.c +++ b/tests/unistr/test-u16-strncmp.c @@ -1,5 +1,5 @@ /* Test of u16_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strncpy.c b/tests/unistr/test-u16-strncpy.c index 1aad5c21..c0f562ed 100644 --- a/tests/unistr/test-u16-strncpy.c +++ b/tests/unistr/test-u16-strncpy.c @@ -1,5 +1,5 @@ /* Test of u16_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strnlen.c b/tests/unistr/test-u16-strnlen.c index 26922923..5bd461ae 100644 --- a/tests/unistr/test-u16-strnlen.c +++ b/tests/unistr/test-u16-strnlen.c @@ -1,5 +1,5 @@ /* Test of u16_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strstr.c b/tests/unistr/test-u16-strstr.c index 7c2996d2..51514994 100644 --- a/tests/unistr/test-u16-strstr.c +++ b/tests/unistr/test-u16-strstr.c @@ -1,5 +1,5 @@ /* Test of u16_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-strtok.c b/tests/unistr/test-u16-strtok.c index 8d08da0a..939895a3 100644 --- a/tests/unistr/test-u16-strtok.c +++ b/tests/unistr/test-u16-strtok.c @@ -1,5 +1,5 @@ /* Test of u16_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-to-u32.c b/tests/unistr/test-u16-to-u32.c index 5ddc99cd..00ea5554 100644 --- a/tests/unistr/test-u16-to-u32.c +++ b/tests/unistr/test-u16-to-u32.c @@ -1,5 +1,5 @@ /* Test of u16_to_u32() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-to-u8.c b/tests/unistr/test-u16-to-u8.c index 54cd3afb..d97db4c8 100644 --- a/tests/unistr/test-u16-to-u8.c +++ b/tests/unistr/test-u16-to-u8.c @@ -1,5 +1,5 @@ /* Test of u16_to_u8() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u16-uctomb.c b/tests/unistr/test-u16-uctomb.c index 93149219..5288f25d 100644 --- a/tests/unistr/test-u16-uctomb.c +++ b/tests/unistr/test-u16-uctomb.c @@ -1,5 +1,5 @@ /* Test of u16_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u32-check.c b/tests/unistr/test-u32-check.c index c6cf547e..9639e3d0 100644 --- a/tests/unistr/test-u32-check.c +++ b/tests/unistr/test-u32-check.c @@ -1,5 +1,5 @@ /* Test of u32_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-chr.c b/tests/unistr/test-u32-chr.c index 3d38487d..5079105e 100644 --- a/tests/unistr/test-u32-chr.c +++ b/tests/unistr/test-u32-chr.c @@ -1,5 +1,5 @@ /* Test of u32_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cmp.c b/tests/unistr/test-u32-cmp.c index a0574c36..30da4253 100644 --- a/tests/unistr/test-u32-cmp.c +++ b/tests/unistr/test-u32-cmp.c @@ -1,5 +1,5 @@ /* Test of u32_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cmp2.c b/tests/unistr/test-u32-cmp2.c index 097a92ec..46cc1d3c 100644 --- a/tests/unistr/test-u32-cmp2.c +++ b/tests/unistr/test-u32-cmp2.c @@ -1,5 +1,5 @@ /* Test of u32_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cpy-alloc.c b/tests/unistr/test-u32-cpy-alloc.c index 3d86c606..06b3244b 100644 --- a/tests/unistr/test-u32-cpy-alloc.c +++ b/tests/unistr/test-u32-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u32_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-cpy.c b/tests/unistr/test-u32-cpy.c index 8329592a..a6245b52 100644 --- a/tests/unistr/test-u32-cpy.c +++ b/tests/unistr/test-u32-cpy.c @@ -1,5 +1,5 @@ /* Test of u32_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mblen.c b/tests/unistr/test-u32-mblen.c index 8ce13426..ff6139d9 100644 --- a/tests/unistr/test-u32-mblen.c +++ b/tests/unistr/test-u32-mblen.c @@ -1,5 +1,5 @@ /* Test of u32_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u32-mbsnlen.c b/tests/unistr/test-u32-mbsnlen.c index 113b0c5f..212bb755 100644 --- a/tests/unistr/test-u32-mbsnlen.c +++ b/tests/unistr/test-u32-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u32_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u32-mbtouc-unsafe.c b/tests/unistr/test-u32-mbtouc-unsafe.c index 5bc8e0e9..4a50585e 100644 --- a/tests/unistr/test-u32-mbtouc-unsafe.c +++ b/tests/unistr/test-u32-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtouc.c b/tests/unistr/test-u32-mbtouc.c index b62c26d3..a05b6576 100644 --- a/tests/unistr/test-u32-mbtouc.c +++ b/tests/unistr/test-u32-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-mbtouc.h b/tests/unistr/test-u32-mbtouc.h index 3a44c096..ef29debf 100644 --- a/tests/unistr/test-u32-mbtouc.h +++ b/tests/unistr/test-u32-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u32_mbtouc() and u32_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-mbtoucr.c b/tests/unistr/test-u32-mbtoucr.c index 11137449..5e01e7b2 100644 --- a/tests/unistr/test-u32-mbtoucr.c +++ b/tests/unistr/test-u32-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u32_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-move.c b/tests/unistr/test-u32-move.c index 71cf48eb..a027c1d0 100644 --- a/tests/unistr/test-u32-move.c +++ b/tests/unistr/test-u32-move.c @@ -1,5 +1,5 @@ /* Test of u32_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-next.c b/tests/unistr/test-u32-next.c index dc17eca4..02ba1463 100644 --- a/tests/unistr/test-u32-next.c +++ b/tests/unistr/test-u32-next.c @@ -1,5 +1,5 @@ /* Test of u32_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-pcpy.c b/tests/unistr/test-u32-pcpy.c index 8dc07d4c..3e891f5e 100644 --- a/tests/unistr/test-u32-pcpy.c +++ b/tests/unistr/test-u32-pcpy.c @@ -1,5 +1,5 @@ /* Test of u32_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-prev.c b/tests/unistr/test-u32-prev.c index b9a339a1..b5974aa3 100644 --- a/tests/unistr/test-u32-prev.c +++ b/tests/unistr/test-u32-prev.c @@ -1,5 +1,5 @@ /* Test of u32_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-set.c b/tests/unistr/test-u32-set.c index 801f60a8..42243079 100644 --- a/tests/unistr/test-u32-set.c +++ b/tests/unistr/test-u32-set.c @@ -1,5 +1,5 @@ /* Test of u32_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-stpcpy.c b/tests/unistr/test-u32-stpcpy.c index 3c1ea6d2..3108a3f9 100644 --- a/tests/unistr/test-u32-stpcpy.c +++ b/tests/unistr/test-u32-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-stpncpy.c b/tests/unistr/test-u32-stpncpy.c index 130ee221..9272492d 100644 --- a/tests/unistr/test-u32-stpncpy.c +++ b/tests/unistr/test-u32-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u32_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcat.c b/tests/unistr/test-u32-strcat.c index 77a39f9d..3f797c19 100644 --- a/tests/unistr/test-u32-strcat.c +++ b/tests/unistr/test-u32-strcat.c @@ -1,5 +1,5 @@ /* Test of u32_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strchr.c b/tests/unistr/test-u32-strchr.c index 0d5abe31..a598eb5f 100644 --- a/tests/unistr/test-u32-strchr.c +++ b/tests/unistr/test-u32-strchr.c @@ -1,5 +1,5 @@ /* Test of u32_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcmp.c b/tests/unistr/test-u32-strcmp.c index e7ebfaed..1ae637e2 100644 --- a/tests/unistr/test-u32-strcmp.c +++ b/tests/unistr/test-u32-strcmp.c @@ -1,5 +1,5 @@ /* Test of u32_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcmp.h b/tests/unistr/test-u32-strcmp.h index 475f8c98..c58376ac 100644 --- a/tests/unistr/test-u32-strcmp.h +++ b/tests/unistr/test-u32-strcmp.h @@ -1,5 +1,5 @@ /* Test of u32_strcmp() and u32_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcoll.c b/tests/unistr/test-u32-strcoll.c index 52d27f3a..13d7055e 100644 --- a/tests/unistr/test-u32-strcoll.c +++ b/tests/unistr/test-u32-strcoll.c @@ -1,5 +1,5 @@ /* Test of u32_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strcpy.c b/tests/unistr/test-u32-strcpy.c index e946a9e9..76665915 100644 --- a/tests/unistr/test-u32-strcpy.c +++ b/tests/unistr/test-u32-strcpy.c @@ -1,5 +1,5 @@ /* Test of u32_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strdup.c b/tests/unistr/test-u32-strdup.c index 8ce1c2a1..aa1d61ef 100644 --- a/tests/unistr/test-u32-strdup.c +++ b/tests/unistr/test-u32-strdup.c @@ -1,5 +1,5 @@ /* Test of u32_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strlen.c b/tests/unistr/test-u32-strlen.c index f376a95d..b8eb276c 100644 --- a/tests/unistr/test-u32-strlen.c +++ b/tests/unistr/test-u32-strlen.c @@ -1,5 +1,5 @@ /* Test of u32_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strmblen.c b/tests/unistr/test-u32-strmblen.c index dc60b17b..305bf586 100644 --- a/tests/unistr/test-u32-strmblen.c +++ b/tests/unistr/test-u32-strmblen.c @@ -1,5 +1,5 @@ /* Test of u32_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-strmbtouc.c b/tests/unistr/test-u32-strmbtouc.c index 54a2b4a6..03006b38 100644 --- a/tests/unistr/test-u32-strmbtouc.c +++ b/tests/unistr/test-u32-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u32_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u32-strncat.c b/tests/unistr/test-u32-strncat.c index 03e79a16..d77d8603 100644 --- a/tests/unistr/test-u32-strncat.c +++ b/tests/unistr/test-u32-strncat.c @@ -1,5 +1,5 @@ /* Test of u32_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strncmp.c b/tests/unistr/test-u32-strncmp.c index 04d10b40..7681ad26 100644 --- a/tests/unistr/test-u32-strncmp.c +++ b/tests/unistr/test-u32-strncmp.c @@ -1,5 +1,5 @@ /* Test of u32_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strncpy.c b/tests/unistr/test-u32-strncpy.c index 6df69c45..cd4f0385 100644 --- a/tests/unistr/test-u32-strncpy.c +++ b/tests/unistr/test-u32-strncpy.c @@ -1,5 +1,5 @@ /* Test of u32_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strnlen.c b/tests/unistr/test-u32-strnlen.c index 81d24aa0..503fb82c 100644 --- a/tests/unistr/test-u32-strnlen.c +++ b/tests/unistr/test-u32-strnlen.c @@ -1,5 +1,5 @@ /* Test of u32_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strstr.c b/tests/unistr/test-u32-strstr.c index 09e258b1..39e9524d 100644 --- a/tests/unistr/test-u32-strstr.c +++ b/tests/unistr/test-u32-strstr.c @@ -1,5 +1,5 @@ /* Test of u32_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-strtok.c b/tests/unistr/test-u32-strtok.c index 14a4702c..5beefaac 100644 --- a/tests/unistr/test-u32-strtok.c +++ b/tests/unistr/test-u32-strtok.c @@ -1,5 +1,5 @@ /* Test of u32_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-to-u16.c b/tests/unistr/test-u32-to-u16.c index 7bb4567b..3941c1af 100644 --- a/tests/unistr/test-u32-to-u16.c +++ b/tests/unistr/test-u32-to-u16.c @@ -1,5 +1,5 @@ /* Test of u32_to_u16() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-to-u8.c b/tests/unistr/test-u32-to-u8.c index b9290415..98198646 100644 --- a/tests/unistr/test-u32-to-u8.c +++ b/tests/unistr/test-u32-to-u8.c @@ -1,5 +1,5 @@ /* Test of u32_to_u8() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u32-uctomb.c b/tests/unistr/test-u32-uctomb.c index f05b8646..752b2acd 100644 --- a/tests/unistr/test-u32-uctomb.c +++ b/tests/unistr/test-u32-uctomb.c @@ -1,5 +1,5 @@ /* Test of u32_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u8-check.c b/tests/unistr/test-u8-check.c index b4418990..a71c9387 100644 --- a/tests/unistr/test-u8-check.c +++ b/tests/unistr/test-u8-check.c @@ -1,5 +1,5 @@ /* Test of u8_check() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-chr.c b/tests/unistr/test-u8-chr.c index 44bfcf19..779a8d25 100644 --- a/tests/unistr/test-u8-chr.c +++ b/tests/unistr/test-u8-chr.c @@ -1,5 +1,5 @@ /* Test of u8_chr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cmp.c b/tests/unistr/test-u8-cmp.c index caf3577f..9b664720 100644 --- a/tests/unistr/test-u8-cmp.c +++ b/tests/unistr/test-u8-cmp.c @@ -1,5 +1,5 @@ /* Test of u8_cmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cmp2.c b/tests/unistr/test-u8-cmp2.c index 49f30d61..a1493031 100644 --- a/tests/unistr/test-u8-cmp2.c +++ b/tests/unistr/test-u8-cmp2.c @@ -1,5 +1,5 @@ /* Test of u8_cmp2() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cpy-alloc.c b/tests/unistr/test-u8-cpy-alloc.c index fa74fb29..49d671da 100644 --- a/tests/unistr/test-u8-cpy-alloc.c +++ b/tests/unistr/test-u8-cpy-alloc.c @@ -1,5 +1,5 @@ /* Test of u8_cpy_alloc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-cpy.c b/tests/unistr/test-u8-cpy.c index e396175a..5580502c 100644 --- a/tests/unistr/test-u8-cpy.c +++ b/tests/unistr/test-u8-cpy.c @@ -1,5 +1,5 @@ /* Test of u8_cpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-mblen.c b/tests/unistr/test-u8-mblen.c index a6d56242..3889621b 100644 --- a/tests/unistr/test-u8-mblen.c +++ b/tests/unistr/test-u8-mblen.c @@ -1,5 +1,5 @@ /* Test of u8_mblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-u8-mbsnlen.c b/tests/unistr/test-u8-mbsnlen.c index 21231848..85d2dc6e 100644 --- a/tests/unistr/test-u8-mbsnlen.c +++ b/tests/unistr/test-u8-mbsnlen.c @@ -1,5 +1,5 @@ /* Test of u8_mbsnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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] = ' '; diff --git a/tests/unistr/test-u8-mbtouc-unsafe.c b/tests/unistr/test-u8-mbtouc-unsafe.c index 731150b5..6c28d66d 100644 --- a/tests/unistr/test-u8-mbtouc-unsafe.c +++ b/tests/unistr/test-u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc_unsafe() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-mbtouc.c b/tests/unistr/test-u8-mbtouc.c index 62a2258e..bd59f9d7 100644 --- a/tests/unistr/test-u8-mbtouc.c +++ b/tests/unistr/test-u8-mbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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] = ' '; diff --git a/tests/unistr/test-u8-mbtouc.h b/tests/unistr/test-u8-mbtouc.h index 9764088f..6ba21e89 100644 --- a/tests/unistr/test-u8-mbtouc.h +++ b/tests/unistr/test-u8-mbtouc.h @@ -1,5 +1,5 @@ /* Test of u8_mbtouc() and u8_mbtouc_unsafe() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-mbtoucr.c b/tests/unistr/test-u8-mbtoucr.c index 9d016ce6..76691e5b 100644 --- a/tests/unistr/test-u8-mbtoucr.c +++ b/tests/unistr/test-u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Test of u8_mbtoucr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-move.c b/tests/unistr/test-u8-move.c index 88b1171e..ae625498 100644 --- a/tests/unistr/test-u8-move.c +++ b/tests/unistr/test-u8-move.c @@ -1,5 +1,5 @@ /* Test of u8_move() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-next.c b/tests/unistr/test-u8-next.c index 247236b3..83ef7008 100644 --- a/tests/unistr/test-u8-next.c +++ b/tests/unistr/test-u8-next.c @@ -1,5 +1,5 @@ /* Test of u8_next() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-pcpy.c b/tests/unistr/test-u8-pcpy.c index fd86d84e..219fa4cb 100644 --- a/tests/unistr/test-u8-pcpy.c +++ b/tests/unistr/test-u8-pcpy.c @@ -1,5 +1,5 @@ /* Test of u8_pcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-prev.c b/tests/unistr/test-u8-prev.c index f93b3914..c15c0290 100644 --- a/tests/unistr/test-u8-prev.c +++ b/tests/unistr/test-u8-prev.c @@ -1,5 +1,5 @@ /* Test of u8_prev() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-set.c b/tests/unistr/test-u8-set.c index b3c99dbe..c403180d 100644 --- a/tests/unistr/test-u8-set.c +++ b/tests/unistr/test-u8-set.c @@ -1,5 +1,5 @@ /* Test of u8_set() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-stpcpy.c b/tests/unistr/test-u8-stpcpy.c index 3c4175fe..0abbc74c 100644 --- a/tests/unistr/test-u8-stpcpy.c +++ b/tests/unistr/test-u8-stpcpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-stpncpy.c b/tests/unistr/test-u8-stpncpy.c index e21f86c1..8d0bcedc 100644 --- a/tests/unistr/test-u8-stpncpy.c +++ b/tests/unistr/test-u8-stpncpy.c @@ -1,5 +1,5 @@ /* Test of u8_stpncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcat.c b/tests/unistr/test-u8-strcat.c index 8ae770d9..1287a922 100644 --- a/tests/unistr/test-u8-strcat.c +++ b/tests/unistr/test-u8-strcat.c @@ -1,5 +1,5 @@ /* Test of u8_strcat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strchr.c b/tests/unistr/test-u8-strchr.c index ea6b6bb5..f18b872f 100644 --- a/tests/unistr/test-u8-strchr.c +++ b/tests/unistr/test-u8-strchr.c @@ -1,5 +1,5 @@ /* Test of u8_strchr() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcmp.c b/tests/unistr/test-u8-strcmp.c index f940b276..076d97fa 100644 --- a/tests/unistr/test-u8-strcmp.c +++ b/tests/unistr/test-u8-strcmp.c @@ -1,5 +1,5 @@ /* Test of u8_strcmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcmp.h b/tests/unistr/test-u8-strcmp.h index fc010741..b187633d 100644 --- a/tests/unistr/test-u8-strcmp.h +++ b/tests/unistr/test-u8-strcmp.h @@ -1,5 +1,5 @@ /* Test of u8_strcmp() and u8_strcoll() functions. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcoll.c b/tests/unistr/test-u8-strcoll.c index 19cc14cc..ab02ebff 100644 --- a/tests/unistr/test-u8-strcoll.c +++ b/tests/unistr/test-u8-strcoll.c @@ -1,5 +1,5 @@ /* Test of u8_strcoll() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strcpy.c b/tests/unistr/test-u8-strcpy.c index 551daa56..06333a3c 100644 --- a/tests/unistr/test-u8-strcpy.c +++ b/tests/unistr/test-u8-strcpy.c @@ -1,5 +1,5 @@ /* Test of u8_strcpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strdup.c b/tests/unistr/test-u8-strdup.c index 03e31161..4e226124 100644 --- a/tests/unistr/test-u8-strdup.c +++ b/tests/unistr/test-u8-strdup.c @@ -1,5 +1,5 @@ /* Test of u8_strdup() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strlen.c b/tests/unistr/test-u8-strlen.c index 30e3ccbd..e149d739 100644 --- a/tests/unistr/test-u8-strlen.c +++ b/tests/unistr/test-u8-strlen.c @@ -1,5 +1,5 @@ /* Test of u8_strlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strmblen.c b/tests/unistr/test-u8-strmblen.c index 3294445b..cf138251 100644 --- a/tests/unistr/test-u8-strmblen.c +++ b/tests/unistr/test-u8-strmblen.c @@ -1,5 +1,5 @@ /* Test of u8_strmblen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-strmbtouc.c b/tests/unistr/test-u8-strmbtouc.c index a0ccb661..32ec76e2 100644 --- a/tests/unistr/test-u8-strmbtouc.c +++ b/tests/unistr/test-u8-strmbtouc.c @@ -1,5 +1,5 @@ /* Test of u8_strmbtouc() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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; diff --git a/tests/unistr/test-u8-strncat.c b/tests/unistr/test-u8-strncat.c index 37eb68bb..8b9bd598 100644 --- a/tests/unistr/test-u8-strncat.c +++ b/tests/unistr/test-u8-strncat.c @@ -1,5 +1,5 @@ /* Test of u8_strncat() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strncmp.c b/tests/unistr/test-u8-strncmp.c index e7711049..b29d3e41 100644 --- a/tests/unistr/test-u8-strncmp.c +++ b/tests/unistr/test-u8-strncmp.c @@ -1,5 +1,5 @@ /* Test of u8_strncmp() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strncpy.c b/tests/unistr/test-u8-strncpy.c index acae29a9..becfedbc 100644 --- a/tests/unistr/test-u8-strncpy.c +++ b/tests/unistr/test-u8-strncpy.c @@ -1,5 +1,5 @@ /* Test of u8_strncpy() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strnlen.c b/tests/unistr/test-u8-strnlen.c index db720513..15e71353 100644 --- a/tests/unistr/test-u8-strnlen.c +++ b/tests/unistr/test-u8-strnlen.c @@ -1,5 +1,5 @@ /* Test of u8_strnlen() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strstr.c b/tests/unistr/test-u8-strstr.c index 340016f5..86aaea3e 100644 --- a/tests/unistr/test-u8-strstr.c +++ b/tests/unistr/test-u8-strstr.c @@ -1,5 +1,5 @@ /* Test of u8_strstr() function. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-strtok.c b/tests/unistr/test-u8-strtok.c index b61670b9..aa64bc03 100644 --- a/tests/unistr/test-u8-strtok.c +++ b/tests/unistr/test-u8-strtok.c @@ -1,5 +1,5 @@ /* Test of u8_strtok() function. - Copyright (C) 2015-2025 Free Software Foundation, Inc. + Copyright (C) 2015-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-to-u16.c b/tests/unistr/test-u8-to-u16.c index 3cbf675b..8edd01de 100644 --- a/tests/unistr/test-u8-to-u16.c +++ b/tests/unistr/test-u8-to-u16.c @@ -1,5 +1,5 @@ /* Test of u8_to_u16() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-to-u32.c b/tests/unistr/test-u8-to-u32.c index b4c5308a..2286e9a8 100644 --- a/tests/unistr/test-u8-to-u32.c +++ b/tests/unistr/test-u8-to-u32.c @@ -1,5 +1,5 @@ /* Test of u8_to_u32() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unistr/test-u8-uctomb.c b/tests/unistr/test-u8-uctomb.c index 31ae2e56..40f99744 100644 --- a/tests/unistr/test-u8-uctomb.c +++ b/tests/unistr/test-u8-uctomb.c @@ -1,5 +1,5 @@ /* Test of u8_uctomb() function. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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); diff --git a/tests/unistr/test-unistr-h.c b/tests/unistr/test-unistr-h.c index 085fcac5..7178348c 100644 --- a/tests/unistr/test-unistr-h.c +++ b/tests/unistr/test-unistr-h.c @@ -1,5 +1,5 @@ /* Test of <unistr.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwbrk/test-u16-wordbreaks.c b/tests/uniwbrk/test-u16-wordbreaks.c index 408eb809..8c301a4c 100644 --- a/tests/uniwbrk/test-u16-wordbreaks.c +++ b/tests/uniwbrk/test-u16-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-16 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); } diff --git a/tests/uniwbrk/test-u32-wordbreaks.c b/tests/uniwbrk/test-u32-wordbreaks.c index 58fa9cd4..0a2e77e1 100644 --- a/tests/uniwbrk/test-u32-wordbreaks.c +++ b/tests/uniwbrk/test-u32-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-32 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); } diff --git a/tests/uniwbrk/test-u8-wordbreaks.c b/tests/uniwbrk/test-u8-wordbreaks.c index b8d035a9..c6cde97a 100644 --- a/tests/uniwbrk/test-u8-wordbreaks.c +++ b/tests/uniwbrk/test-u8-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in UTF-8 strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)); } diff --git a/tests/uniwbrk/test-uc-wordbreaks.c b/tests/uniwbrk/test-uc-wordbreaks.c index 11f4f201..a9dcb628 100644 --- a/tests/uniwbrk/test-uc-wordbreaks.c +++ b/tests/uniwbrk/test-uc-wordbreaks.c @@ -1,5 +1,5 @@ /* Word break function test, using test data from UCD. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -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) ", diff --git a/tests/uniwbrk/test-ulc-wordbreaks.c b/tests/uniwbrk/test-ulc-wordbreaks.c index 0d95fc38..5974cba8 100644 --- a/tests/uniwbrk/test-ulc-wordbreaks.c +++ b/tests/uniwbrk/test-ulc-wordbreaks.c @@ -1,5 +1,5 @@ /* Test of word breaks in strings. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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) diff --git a/tests/uniwbrk/test-uniwbrk-h.c b/tests/uniwbrk/test-uniwbrk-h.c index 7954b894..4e4ef299 100644 --- a/tests/uniwbrk/test-uniwbrk-h.c +++ b/tests/uniwbrk/test-uniwbrk-h.c @@ -1,5 +1,5 @@ /* Test of <uniwbrk.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u16-strwidth.c b/tests/uniwidth/test-u16-strwidth.c index c85ed0e2..2cf8f1c2 100644 --- a/tests/uniwidth/test-u16-strwidth.c +++ b/tests/uniwidth/test-u16-strwidth.c @@ -1,5 +1,5 @@ /* Test of u16_strwidth() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u16-width.c b/tests/uniwidth/test-u16-width.c index 44bd0bb9..1adaeb15 100644 --- a/tests/uniwidth/test-u16-width.c +++ b/tests/uniwidth/test-u16-width.c @@ -1,5 +1,5 @@ /* Test of u16_width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u32-strwidth.c b/tests/uniwidth/test-u32-strwidth.c index 1fff8f30..cd8337cd 100644 --- a/tests/uniwidth/test-u32-strwidth.c +++ b/tests/uniwidth/test-u32-strwidth.c @@ -1,5 +1,5 @@ /* Test of u32_strwidth() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u32-width.c b/tests/uniwidth/test-u32-width.c index c3479b86..5630d10a 100644 --- a/tests/uniwidth/test-u32-width.c +++ b/tests/uniwidth/test-u32-width.c @@ -1,5 +1,5 @@ /* Test of u32_width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u8-strwidth.c b/tests/uniwidth/test-u8-strwidth.c index 094d45ca..be28a297 100644 --- a/tests/uniwidth/test-u8-strwidth.c +++ b/tests/uniwidth/test-u8-strwidth.c @@ -1,5 +1,5 @@ /* Test of u8_strwidth() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-u8-width.c b/tests/uniwidth/test-u8-width.c index ec3b57dc..6fb7a9b0 100644 --- a/tests/uniwidth/test-u8-width.c +++ b/tests/uniwidth/test-u8-width.c @@ -1,5 +1,5 @@ /* Test of u8_width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/uniwidth/test-uc_width.c b/tests/uniwidth/test-uc_width.c index 27667245..fd7adcf7 100644 --- a/tests/uniwidth/test-uc_width.c +++ b/tests/uniwidth/test-uc_width.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,10 +25,8 @@ 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. */ diff --git a/tests/uniwidth/test-uc_width2.c b/tests/uniwidth/test-uc_width2.c index b651847d..ef2fd88a 100644 --- a/tests/uniwidth/test-uc_width2.c +++ b/tests/uniwidth/test-uc_width2.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2025 Free Software Foundation, Inc. + Copyright (C) 2007-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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"); diff --git a/tests/uniwidth/test-uniwidth-h.c b/tests/uniwidth/test-uniwidth-h.c index 74f1d6ad..70152039 100644 --- a/tests/uniwidth/test-uniwidth-h.c +++ b/tests/uniwidth/test-uniwidth-h.c @@ -1,5 +1,5 @@ /* Test of <uniwidth.h>. - Copyright (C) 2025 Free Software Foundation, Inc. + Copyright (C) 2025-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/unsetenv.c b/tests/unsetenv.c index d38ed37a..dab1b90c 100644 --- a/tests/unsetenv.c +++ b/tests/unsetenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995-2002, 2005-2025 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995-2002, 2005-2026 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is free software: you can redistribute it and/or modify @@ -56,15 +56,13 @@ __libc_lock_define_initialized (static, envlock) int unsetenv (const char *name) { - size_t len; - if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) { __set_errno (EINVAL); return -1; } - len = strlen (name); + size_t len = strlen (name); #if HAVE_DECL__PUTENV /* native Windows */ /* The Microsoft documentation @@ -79,14 +77,13 @@ unsetenv (const char *name) of the form "NAME=". (NB: This is a different convention than with glibc putenv, which expects a string of the form "NAME"!) */ { - int putenv_result; char *name_ = malloc (len + 2); if (name_ == NULL) return -1; memcpy (name_, name, len); name_[len] = '='; name_[len + 1] = 0; - putenv_result = _putenv (name_); + int putenv_result = _putenv (name_); /* In this particular case it is OK to free() the argument passed to _putenv. */ free (name_); @@ -138,12 +135,12 @@ extern int unsetenv (const char *); int rpl_unsetenv (const char *name) { - int result = 0; if (!name || !*name || strchr (name, '=')) { errno = EINVAL; return -1; } + int result = 0; while (getenv (name)) # if !VOID_UNSETENV result = diff --git a/tests/usleep.c b/tests/usleep.c index 3707ddd7..ae03db0a 100644 --- a/tests/usleep.c +++ b/tests/usleep.c @@ -1,5 +1,5 @@ /* Pausing execution of the current thread. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. Written by Eric Blake <ebb9@byu.net>, 2009. This file is free software: you can redistribute it and/or modify diff --git a/tests/verify.h b/tests/verify.h index 3b01d7c2..ad45c39d 100644 --- a/tests/verify.h +++ b/tests/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/virtualbox.h b/tests/virtualbox.h index e3531893..5324ac68 100644 --- a/tests/virtualbox.h +++ b/tests/virtualbox.h @@ -1,5 +1,5 @@ /* Determine whether the current system is running under VirtualBox/KVM. - Copyright (C) 2021-2025 Free Software Foundation, Inc. + Copyright (C) 2021-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -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++; diff --git a/tests/w32sock.h b/tests/w32sock.h index d7087a28..a3201ad9 100644 --- a/tests/w32sock.h +++ b/tests/w32sock.h @@ -1,6 +1,6 @@ /* w32sock.h --- internal auxiliary functions for Windows socket functions - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/warn-on-use.h b/tests/warn-on-use.h index c0072412..97f36ea2 100644 --- a/tests/warn-on-use.h +++ b/tests/warn-on-use.h @@ -1,5 +1,5 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2010-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published diff --git a/tests/wcrtomb.c b/tests/wcrtomb.c index 11d52804..a9b8de78 100644 --- a/tests/wcrtomb.c +++ b/tests/wcrtomb.c @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This file is free software: you can redistribute it and/or modify diff --git a/tests/wctob.c b/tests/wctob.c index 03b2929e..1a569a88 100644 --- a/tests/wctob.c +++ b/tests/wctob.c @@ -1,5 +1,5 @@ /* Convert wide character to unibyte character. - Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2008. This file is free software: you can redistribute it and/or modify diff --git a/tests/wctomb-impl.h b/tests/wctomb-impl.h index e24e9777..bd588357 100644 --- a/tests/wctomb-impl.h +++ b/tests/wctomb-impl.h @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This file is free software: you can redistribute it and/or modify @@ -23,10 +23,9 @@ wctomb (char *s, wchar_t wc) else { mbstate_t state; - size_t result; - mbszero (&state); - result = wcrtomb (s, wc, &state); + + size_t result = wcrtomb (s, wc, &state); if (result == (size_t)-1) return -1; return result; diff --git a/tests/wctomb.c b/tests/wctomb.c index 6fb0c375..249d47b1 100644 --- a/tests/wctomb.c +++ b/tests/wctomb.c @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2011-2025 Free Software Foundation, Inc. + Copyright (C) 2011-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2011. This file is free software: you can redistribute it and/or modify diff --git a/tests/windows-cond.c b/tests/windows-cond.c index c6c6088d..4f848a9a 100644 --- a/tests/windows-cond.c +++ b/tests/windows-cond.c @@ -1,5 +1,5 @@ /* Condition variables (native Windows implementation). - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -54,13 +54,10 @@ glwthread_waitqueue_init (glwthread_waitqueue_t *wq) static struct glwthread_waitqueue_element * glwthread_waitqueue_add (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_element *elt; - HANDLE event; - /* Allocate the memory for the waitqueue element on the heap, not on the thread's stack. If the thread exits unexpectedly, we prefer to leak some memory rather than to access unavailable memory and crash. */ - elt = + struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) malloc (sizeof (struct glwthread_waitqueue_element)); if (elt == NULL) @@ -69,7 +66,7 @@ glwthread_waitqueue_add (glwthread_waitqueue_t *wq) /* Whether the created event is a manual-reset one or an auto-reset one, does not matter, since we will wait on it only once. */ - event = CreateEvent (NULL, TRUE, FALSE, NULL); + HANDLE event = CreateEvent (NULL, TRUE, FALSE, NULL); if (event == INVALID_HANDLE_VALUE) { /* No way to allocate an event. */ @@ -113,12 +110,10 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) wq->wq_list.wql_next; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -134,18 +129,14 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) static void glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_link *l; - - for (l = wq->wq_list.wql_next; l != &wq->wq_list; ) + for (struct glwthread_waitqueue_link *l = wq->wq_list.wql_next; l != &wq->wq_list; ) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) l; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -206,11 +197,9 @@ glwthread_cond_wait (glwthread_cond_t *cond, else { HANDLE event = elt->event; - int err; - DWORD result; /* Now release the mutex and let any other thread take it. */ - err = mutex_unlock (mutex); + int err = mutex_unlock (mutex); if (err != 0) { EnterCriticalSection (&cond->lock); @@ -229,7 +218,7 @@ glwthread_cond_wait (glwthread_cond_t *cond, This is fulfilled here, because the thread signalling is done through SetEvent, not PulseEvent. */ /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); + DWORD result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); @@ -265,7 +254,6 @@ glwthread_cond_timedwait (glwthread_cond_t *cond, { struct timeval currtime; - gettimeofday (&currtime, NULL); if (currtime.tv_sec > abstime->tv_sec || (currtime.tv_sec == abstime->tv_sec @@ -285,21 +273,20 @@ glwthread_cond_timedwait (glwthread_cond_t *cond, else { HANDLE event = elt->event; - int err; - DWORD timeout; - DWORD result; /* Now release the mutex and let any other thread take it. */ - err = mutex_unlock (mutex); - if (err != 0) - { - EnterCriticalSection (&cond->lock); - glwthread_waitqueue_remove (&cond->waiters, elt); - LeaveCriticalSection (&cond->lock); - CloseHandle (event); - free (elt); - return err; - } + { + int err = mutex_unlock (mutex); + if (err != 0) + { + EnterCriticalSection (&cond->lock); + glwthread_waitqueue_remove (&cond->waiters, elt); + LeaveCriticalSection (&cond->lock); + CloseHandle (event); + free (elt); + return err; + } + } /* POSIX says: "If another thread is able to acquire the mutex after the about-to-block thread has released it, then a subsequent call to @@ -311,6 +298,7 @@ glwthread_cond_timedwait (glwthread_cond_t *cond, /* Wait until another thread signals this event or until the abstime passes. */ gettimeofday (&currtime, NULL); + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -338,7 +326,7 @@ glwthread_cond_timedwait (glwthread_cond_t *cond, } } } - result = WaitForSingleObject (event, timeout); + DWORD result = WaitForSingleObject (event, timeout); if (result == WAIT_FAILED) abort (); if (result == WAIT_TIMEOUT) @@ -371,7 +359,7 @@ glwthread_cond_timedwait (glwthread_cond_t *cond, free (elt); /* Take the mutex again. It does not matter whether this is done before or after the bookkeeping for WAIT_TIMEOUT. */ - err = mutex_lock (mutex); + int err = mutex_lock (mutex); return (err ? err : result == WAIT_OBJECT_0 ? 0 : result == WAIT_TIMEOUT ? ETIMEDOUT : diff --git a/tests/windows-cond.h b/tests/windows-cond.h index a99d6841..9546f291 100644 --- a/tests/windows-cond.h +++ b/tests/windows-cond.h @@ -1,5 +1,5 @@ /* Condition variables (native Windows implementation). - Copyright (C) 2008-2025 Free Software Foundation, Inc. + Copyright (C) 2008-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-initguard.h b/tests/windows-initguard.h index 4f45e5bb..e7da4735 100644 --- a/tests/windows-initguard.h +++ b/tests/windows-initguard.h @@ -1,5 +1,5 @@ /* Init guards, somewhat like spinlocks (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-thread.c b/tests/windows-thread.c index 9f6fd8b6..74a2a085 100644 --- a/tests/windows-thread.c +++ b/tests/windows-thread.c @@ -1,5 +1,5 @@ /* Creating and controlling threads (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -84,11 +84,9 @@ get_current_thread_handle (void) glwthread_thread_t glwthread_thread_self (void) { - glwthread_thread_t thread; - if (self_key == (DWORD)-1) init_self_key (); - thread = TlsGetValue (self_key); + glwthread_thread_t thread = TlsGetValue (self_key); if (thread == NULL) { /* This happens only in threads that have not been created through @@ -169,9 +167,7 @@ glwthread_thread_create (glwthread_thread_t *threadp, unsigned int attr, { unsigned int thread_id; - HANDLE thread_handle; - - thread_handle = (HANDLE) + HANDLE thread_handle = (HANDLE) _beginthreadex (NULL, 100000, wrapper_func, thread, 0, &thread_id); /* calls CreateThread with the same arguments */ if (thread_handle == NULL) diff --git a/tests/windows-thread.h b/tests/windows-thread.h index 6598051f..3e2aaf3f 100644 --- a/tests/windows-thread.h +++ b/tests/windows-thread.h @@ -1,5 +1,5 @@ /* Creating and controlling threads (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-timedmutex.c b/tests/windows-timedmutex.c index 6ee6edbf..183122c6 100644 --- a/tests/windows-timedmutex.c +++ b/tests/windows-timedmutex.c @@ -1,5 +1,5 @@ /* Timed mutexes (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -171,13 +171,11 @@ glwthread_timedmutex_timedlock (glwthread_timedmutex_t *mutex, { struct timeval currtime; - DWORD timeout; - DWORD result; - gettimeofday (&currtime, NULL); /* Wait until another thread signals the event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -210,7 +208,7 @@ glwthread_timedmutex_timedlock (glwthread_timedmutex_t *mutex, /* WaitForSingleObject <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */ - result = WaitForSingleObject (mutex->event, timeout); + DWORD result = WaitForSingleObject (mutex->event, timeout); if (result == WAIT_FAILED) abort (); if (result == WAIT_TIMEOUT) diff --git a/tests/windows-timedmutex.h b/tests/windows-timedmutex.h index 6a92465e..247eadb5 100644 --- a/tests/windows-timedmutex.h +++ b/tests/windows-timedmutex.h @@ -1,5 +1,5 @@ /* Timed mutexes (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-timedrecmutex.c b/tests/windows-timedrecmutex.c index 5bc6ecfd..4d43cd23 100644 --- a/tests/windows-timedrecmutex.c +++ b/tests/windows-timedrecmutex.c @@ -1,5 +1,5 @@ /* Timed recursive mutexes (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -179,13 +179,11 @@ glwthread_timedrecmutex_timedlock (glwthread_timedrecmutex_t *mutex, { struct timeval currtime; - DWORD timeout; - DWORD result; - gettimeofday (&currtime, NULL); /* Wait until another thread signals the event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -218,7 +216,7 @@ glwthread_timedrecmutex_timedlock (glwthread_timedrecmutex_t *mutex, /* WaitForSingleObject <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */ - result = WaitForSingleObject (mutex->event, timeout); + DWORD result = WaitForSingleObject (mutex->event, timeout); if (result == WAIT_FAILED) abort (); if (result == WAIT_TIMEOUT) diff --git a/tests/windows-timedrecmutex.h b/tests/windows-timedrecmutex.h index b839a70c..540bb5d8 100644 --- a/tests/windows-timedrecmutex.h +++ b/tests/windows-timedrecmutex.h @@ -1,5 +1,5 @@ /* Timed recursive mutexes (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-timedrwlock.c b/tests/windows-timedrwlock.c index 379b1003..2297f637 100644 --- a/tests/windows-timedrwlock.c +++ b/tests/windows-timedrwlock.c @@ -1,5 +1,5 @@ /* Timed read-write locks (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -54,13 +54,10 @@ glwthread_waitqueue_init (glwthread_waitqueue_t *wq) static struct glwthread_waitqueue_element * glwthread_waitqueue_add (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_element *elt; - HANDLE event; - /* Allocate the memory for the waitqueue element on the heap, not on the thread's stack. If the thread exits unexpectedly, we prefer to leak some memory rather than to access unavailable memory and crash. */ - elt = + struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) malloc (sizeof (struct glwthread_waitqueue_element)); if (elt == NULL) @@ -69,7 +66,7 @@ glwthread_waitqueue_add (glwthread_waitqueue_t *wq) /* Whether the created event is a manual-reset one or an auto-reset one, does not matter, since we will wait on it only once. */ - event = CreateEvent (NULL, TRUE, FALSE, NULL); + HANDLE event = CreateEvent (NULL, TRUE, FALSE, NULL); if (event == INVALID_HANDLE_VALUE) { /* No way to allocate an event. */ @@ -115,12 +112,10 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) wq->wq_list.wql_next; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -137,18 +132,14 @@ glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) static void glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) { - struct glwthread_waitqueue_link *l; - - for (l = wq->wq_list.wql_next; l != &wq->wq_list; ) + for (struct glwthread_waitqueue_link *l = wq->wq_list.wql_next; l != &wq->wq_list; ) { struct glwthread_waitqueue_element *elt = (struct glwthread_waitqueue_element *) l; - struct glwthread_waitqueue_link *prev; - struct glwthread_waitqueue_link *next; /* Remove elt from the circular list. */ - prev = &wq->wq_list; /* = elt->link.wql_prev; */ - next = elt->link.wql_next; + struct glwthread_waitqueue_link *prev = &wq->wq_list; /* = elt->link.wql_prev; */ + struct glwthread_waitqueue_link *next = elt->link.wql_next; prev->wql_next = next; next->wql_prev = prev; elt->link.wql_next = NULL; @@ -209,10 +200,9 @@ glwthread_timedrwlock_rdlock (glwthread_timedrwlock_t *lock) if (elt != NULL) { HANDLE event = elt->event; - DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); + DWORD result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); @@ -269,10 +259,9 @@ glwthread_timedrwlock_wrlock (glwthread_timedrwlock_t *lock) if (elt != NULL) { HANDLE event = elt->event; - DWORD result; LeaveCriticalSection (&lock->lock); /* Wait until another thread signals this event. */ - result = WaitForSingleObject (event, INFINITE); + DWORD result = WaitForSingleObject (event, INFINITE); if (result == WAIT_FAILED || result == WAIT_TIMEOUT) abort (); CloseHandle (event); @@ -402,17 +391,15 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, if (elt != NULL) { HANDLE event = elt->event; - struct timeval currtime; - DWORD timeout; - DWORD result; - int retval; LeaveCriticalSection (&lock->lock); + struct timeval currtime; gettimeofday (&currtime, NULL); /* Wait until another thread signals this event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -444,7 +431,7 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, { /* WaitForSingleObject <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */ - result = WaitForSingleObject (event, timeout); + DWORD result = WaitForSingleObject (event, timeout); if (result == WAIT_FAILED) abort (); if (result != WAIT_TIMEOUT) @@ -461,6 +448,7 @@ glwthread_timedrwlock_timedrdlock (glwthread_timedrwlock_t *lock, } EnterCriticalSection (&lock->lock); /* Remove ourselves from the waiting_readers. */ + int retval; if (glwthread_waitqueue_remove (&lock->waiting_readers, elt)) retval = ETIMEDOUT; else @@ -522,17 +510,15 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, if (elt != NULL) { HANDLE event = elt->event; - struct timeval currtime; - DWORD timeout; - DWORD result; - int retval; LeaveCriticalSection (&lock->lock); + struct timeval currtime; gettimeofday (&currtime, NULL); /* Wait until another thread signals this event or until the abstime passes. */ + DWORD timeout; if (currtime.tv_sec > abstime->tv_sec) timeout = 0; else @@ -564,7 +550,7 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, { /* WaitForSingleObject <https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-waitforsingleobject> */ - result = WaitForSingleObject (event, timeout); + DWORD result = WaitForSingleObject (event, timeout); if (result == WAIT_FAILED) abort (); if (result != WAIT_TIMEOUT) @@ -581,6 +567,7 @@ glwthread_timedrwlock_timedwrlock (glwthread_timedrwlock_t *lock, } EnterCriticalSection (&lock->lock); /* Remove ourselves from the waiting_writers. */ + int retval; if (glwthread_waitqueue_remove (&lock->waiting_writers, elt)) retval = ETIMEDOUT; else diff --git a/tests/windows-timedrwlock.h b/tests/windows-timedrwlock.h index 42862ca6..df97bdfd 100644 --- a/tests/windows-timedrwlock.h +++ b/tests/windows-timedrwlock.h @@ -1,5 +1,5 @@ /* Timed read-write locks (native Windows implementation). - Copyright (C) 2019-2025 Free Software Foundation, Inc. + Copyright (C) 2019-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/windows-tls.c b/tests/windows-tls.c index 00852433..190b0c99 100644 --- a/tests/windows-tls.c +++ b/tests/windows-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -128,8 +128,6 @@ dtor_table_shrink_used (void) void glwthread_tls_process_destructors (void) { - unsigned int repeat; - dtor_table_ensure_initialized (); EnterCriticalSection (&dtor_table_lock); @@ -141,7 +139,7 @@ glwthread_tls_process_destructors (void) } dtor_processing_threads++; - for (repeat = GLWTHREAD_DESTRUCTOR_ITERATIONS; repeat > 0; repeat--) + for (unsigned int repeat = GLWTHREAD_DESTRUCTOR_ITERATIONS; repeat > 0; repeat--) { unsigned int destructors_run = 0; @@ -157,9 +155,8 @@ glwthread_tls_process_destructors (void) entry as inactive, but it will not otherwise change dtors_used nor the contents of the first dtors_used entries of dtor_table. */ unsigned int i_limit = dtors_used; - unsigned int i; - for (i = 0; i < i_limit; i++) + for (unsigned int i = 0; i < i_limit; i++) { struct dtor current = dtor_table[i]; if (current.destructor != NULL) @@ -299,9 +296,8 @@ glwthread_tls_key_delete (glwthread_tls_key_t key) /* Find the key in dtor_table. */ { unsigned int i_limit = dtors_used; - unsigned int i; - for (i = 0; i < i_limit; i++) + for (unsigned int i = 0; i < i_limit; i++) if (dtor_table[i].key == key) { if (i < dtors_used - 1) @@ -317,9 +313,8 @@ glwthread_tls_key_delete (glwthread_tls_key_t key) /* Be careful not to disturb the glwthread_tls_process_destructors invocations that are executing in other threads. */ unsigned int i_limit = dtors_used; - unsigned int i; - for (i = 0; i < i_limit; i++) + for (unsigned int i = 0; i < i_limit; i++) if (dtor_table[i].destructor != NULL /* skip inactive entries */ && dtor_table[i].key == key) { diff --git a/tests/windows-tls.h b/tests/windows-tls.h index 79cf88d5..53f86df6 100644 --- a/tests/windows-tls.h +++ b/tests/windows-tls.h @@ -1,5 +1,5 @@ /* Thread-local storage (native Windows implementation). - Copyright (C) 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2005-2026 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as diff --git a/tests/xalloc-die.c b/tests/xalloc-die.c index c3f3961a..1a51976e 100644 --- a/tests/xalloc-die.c +++ b/tests/xalloc-die.c @@ -1,6 +1,6 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2025 Free Software + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/tests/xalloc.h b/tests/xalloc.h index 438e5caa..d3948270 100644 --- a/tests/xalloc.h +++ b/tests/xalloc.h @@ -1,6 +1,6 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990-2000, 2003-2004, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/xconcat-filename.c b/tests/xconcat-filename.c index 230c747b..d78ab07f 100644 --- a/tests/xconcat-filename.c +++ b/tests/xconcat-filename.c @@ -1,5 +1,5 @@ /* Construct a full filename from a directory and a relative filename. - Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -31,9 +31,7 @@ char * xconcatenated_filename (const char *directory, const char *filename, const char *suffix) { - char *result; - - result = concatenated_filename (directory, filename, suffix); + char *result = concatenated_filename (directory, filename, suffix); if (result == NULL) xalloc_die (); diff --git a/tests/xgetcwd.c b/tests/xgetcwd.c index 17121bf1..b031d72d 100644 --- a/tests/xgetcwd.c +++ b/tests/xgetcwd.c @@ -1,6 +1,6 @@ /* xgetcwd.c -- return current directory with unlimited length - Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2025 Free Software + Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/tests/xgetcwd.h b/tests/xgetcwd.h index b9eec1ac..0d84183d 100644 --- a/tests/xgetcwd.h +++ b/tests/xgetcwd.h @@ -1,5 +1,5 @@ /* prototype for xgetcwd - Copyright (C) 1995, 2001, 2003, 2009-2025 Free Software Foundation, Inc. + Copyright (C) 1995, 2001, 2003, 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/xmalloc.c b/tests/xmalloc.c index 8a715807..545beb35 100644 --- a/tests/xmalloc.c +++ b/tests/xmalloc.c @@ -1,6 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-2000, 2002-2006, 2008-2025 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,10 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <config.h> - #define XALLOC_INLINE _GL_EXTERN_INLINE - +#include <config.h> #include "xalloc.h" #include "ialloc.h" @@ -29,7 +27,13 @@ #include <stdint.h> #include <string.h> -static void * _GL_ATTRIBUTE_PURE +/* Pacify GCC up to at least 15.2, which otherwise would incorrectly + complain about check_nonnull. */ +#if _GL_GNUC_PREREQ (4, 6) +# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#endif + +static void * check_nonnull (void *p) { if (!p) @@ -63,10 +67,7 @@ xcharalloc (size_t n) void * xrealloc (void *p, size_t s) { - void *r = realloc (p, s); - if (!r) - xalloc_die (); - return r; + return check_nonnull (realloc (p, s)); } void * @@ -81,10 +82,7 @@ xirealloc (void *p, idx_t s) void * xreallocarray (void *p, size_t n, size_t s) { - void *r = reallocarray (p, n, s); - if (!r) - xalloc_die (); - return r; + return check_nonnull (reallocarray (p, n, s)); } void * @@ -224,13 +222,13 @@ x2nrealloc (void *p, size_t *pn, size_t s) void * xpalloc (void *pa, idx_t *pn, idx_t n_incr_min, ptrdiff_t n_max, idx_t s) { - idx_t n0 = *pn; - /* The approximate size to use for initial small allocation requests. This is the largest "small" request for the GNU C library malloc. */ enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; + idx_t n0 = *pn; + /* If the array is tiny, grow it to about (but no greater than) DEFAULT_MXFAST bytes. Otherwise, grow it by about 50%. Adjust the growth according to three constraints: N_INCR_MIN, diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h index 07d09f2c..20ab62a3 100644 --- a/tests/zerosize-ptr.h +++ b/tests/zerosize-ptr.h @@ -1,5 +1,5 @@ /* Return a pointer to a zero-size object in memory. - Copyright (C) 2009-2025 Free Software Foundation, Inc. + Copyright (C) 2009-2026 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |
