lib/vasnprintf.c


Log

Author Commit Date CI Message
Paul Eggert 1e979dfd 2025-02-03T16:47:36 c-vasnprintf: pacify -Wswitch-enum * lib/printf-args.c (PRINTF_FETCHARGS): Mention TYPE_NONE as being a default case. * lib/vasnprintf.c (VASNPRINTF): Use switch (+E).
Pádraig Brady 7b089321 2025-01-01T09:24:36 maint: run 'make update-copyright'
Paul Eggert 985dd3e7 2024-11-19T15:48:02 strerror, vasnprintf: pacify clang 14 on macOS * lib/strerror.c, lib/vasnprintf.c: Pacify clang 14 on macOS 12.6.
Bruno Haible e9508205 2024-08-27T00:19:14 Fix some of the warnings from a clang that masquerades as gcc 13. * lib/c-stack.c: Use _GL_GNUC_PREREQ to test for the gcc version. * lib/canonicalize.c: Likewise. * lib/diffseq.h: Likewise. * lib/file-has-acl.c: Likewise. * lib/freopen-safer.c: Likewise. * lib/getndelim2.c: Likewise. * lib/mini-gmp-gnulib.c: Likewise. * lib/propername.c: Likewise. * lib/quotearg.c: Likewise. * lib/savedir.c: Likewise. * lib/vasnprintf.c: Likewise. * tests/test-argmatch.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-explicit_bzero.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-fopen.h: Likewise. * tests/test-getdtablesize.c: Likewise. * tests/test-getgroups.c: Likewise. * tests/test-listen.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-memset_explicit.c: Likewise. * tests/test-open.h: Likewise. * tests/test-perror2.c: Likewise. * tests/test-select.h: Likewise. * lib/stdio.in.h (_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD): Don't use gnu_printf with clang. * lib/string-buffer.h: Likewise. * lib/textstyle.in.h: Likewise.
Bruno Haible 94d34cfb 2024-06-20T08:11:53 vasnwprintf: Support huge wide string arguments. * lib/vasnprintf.c: (VASNPRINTF): In 64-bit builds, handle the %ls directive ourselves. (local_wcslen): Adjust #if condition.
Bruno Haible 4f251600 2024-06-20T03:19:15 vasnprintf, u*-vasnprintf: Support huge wide string arguments. * lib/vasnprintf.c: (VASNPRINTF): In 64-bit builds, handle the %ls directive ourselves. (local_wcslen, local_wcrtomb): Adjust #if condition.
Bruno Haible 4cada7ff 2024-06-19T20:46:47 vasnprintf, u*-vasnprintf: Support string arguments longer than 2 GiB. * lib/vasnprintf.c: Include <stdint.h>. (VASNPRINTF): In 64-bit builds, handle the %s directive ourselves. (local_strnlen): Adjust #if condition. * modules/unistdio/u8-vasnprintf (Depends-on): Add stdint. * modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise. * modules/unistdio/u16-vasnprintf (Depends-on): Likewise. * modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise. * modules/unistdio/u32-vasnprintf (Depends-on): Likewise. * modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise. * modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.
Bruno Haible 0afe83a7 2024-06-19T15:20:21 vasnwprintf: Optimize handling of %c directive. * lib/vasnprintf.c (VASNPRINTF): Use a single ENSURE_ALLOCATION instead of two.
Bruno Haible 4dd9d8a7 2024-06-19T14:57:40 u*-vasnprintf: Fix a rare memory leak. * lib/vasnprintf.c (VASNPRINTF): Use ENSURE_ALLOCATION_ELSE instead of ENSURE_ALLOCATION, to free temporary allocations before failing due to out-of-memory.
Bruno Haible 983a290f 2024-06-19T14:39:02 u*-vasnprintf: Improve comments. * lib/vasnprintf.c (VASNPRINTF): Improve comments.
Bruno Haible 0823ace3 2024-06-18T19:18:27 u*-vasnprintf: Fix handling of %ls, %lc directives on Solaris, MSVC. * lib/vasnprintf.c (VASNPRINTF): When implementing the %ls, %lc directives ourselves: Rename variable 'characters' to 'bytes'. Also count characters, if necessary for the width handling. Fix DCHAR_MBSNLEN invocation.
Bruno Haible ef47dacd 2024-06-18T03:16:17 vasnprintf: Refactor. * lib/vasnprintf.c (VASNPRINTF) [!DCHAR_IS_TCHAR]: Reduce the scope of the tmpsrc variables.
Bruno Haible 2dd75cb9 2024-06-14T19:53:42 vasnprintf: Reject a width > INT_MAX. * lib/vasnprintf.c (VASNPRINTF): If a width is > INT_MAX, fail with EOVERFLOW. * tests/test-vasnprintf.c: Include <errno.h>. (test_function): Test huge widths. * tests/test-vasnwprintf.c: Include <errno.h>. (test_function): Test huge widths. * tests/unistdio/test-u8-asnprintf1.h (test_function): Test huge widths. * tests/unistdio/test-u16-asnprintf1.h (test_function): Likewise. * tests/unistdio/test-u32-asnprintf1.h (test_function): Likewise. * tests/unistdio/test-ulc-asnprintf1.h (test_function): Likewise. * tests/unistdio/test-ulc-asnprintf1.c: Include <errno.h>. * tests/unistdio/test-ulc-vasnprintf1.c: Likewise.
Bruno Haible 952e7f1c 2024-06-14T00:28:45 Assume wchar_t. * lib/stddef.in.h (wchar_t): Remove fallback definition. * m4/stddef_h.m4 (gl_STDDEF_H): Don't require gt_TYPE_WCHAR_T. Assume gt_cv_c_wchar_t is 'yes'. (gl_STDDEF_H_DEFAULTS): Don't initialize HAVE_WCHAR_T. * modules/stddef (Files): Remove m4/wchar_t.m4. (Makefile.am): Don't substitute HAVE_WCHAR_T. * doc/posix-headers/stddef.texi: Don't mention the problem of a missing wchar_t. * lib/printf-args.h (arg_type): Assume HAVE_WCHAR_T is 1. * lib/printf-args.c (PRINTF_FETCHARGS): Likewise. * lib/printf-parse.c (PRINTF_PARSE): Likewise. * lib/vasnprintf.c: Likewise. * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_ARGS, gl_PREREQ_PRINTF_PARSE, gl_PREREQ_VASNXPRINTF): Don't require gt_TYPE_WCHAR_T. * modules/c-vasnprintf (Files): Remove m4/wchar_t.m4. * modules/vasnprintf (Files): Likewise. * modules/vasnwprintf (Files): Likewise. * modules/unistdio/u16-u16-vasnprintf (Files): Likewise. * modules/unistdio/u16-vasnprintf (Files): Likewise. * modules/unistdio/u32-u32-vasnprintf (Files): Likewise. * modules/unistdio/u32-vasnprintf (Files): Likewise. * modules/unistdio/u8-u8-vasnprintf (Files): Likewise. * modules/unistdio/u8-vasnprintf (Files): Likewise. * modules/unistdio/ulc-vasnprintf (Files): Likewise. * tests/test-sprintf-posix.h (test_function): Assume HAVE_WCHAR_T is 1. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Don't require gt_TYPE_WCHAR_T. * modules/wcwidth (Files): Remove m4/wchar_t.m4. * tests/test-stdint.c: Assume HAVE_WCHAR_T is 1. * modules/stdint-tests (Files): Remove m4/wchar_t.m4. (configure.ac): Don't require gt_TYPE_WCHAR_T. * m4/wchar_t.m4: Remove file.
Bruno Haible 5e5a9002 2024-05-21T00:33:55 vasnprintf: Don't abort for pseudo-denormal arguments on macOS 12. Reported by Gaëtan Herfray <g.herfray@gahfy.io> via Erik Blake in <https://lists.gnu.org/archive/html/bug-m4/2022-03/msg00002.html> <https://lists.gnu.org/archive/html/bug-gnulib/2022-03/msg00066.html>. * lib/vasnprintf.c (safe_frexpl): New function. (decode_long_double, floorlog10l): Invoke it instead of frexpl.
Bruno Haible ffac7937 2024-05-15T17:05:43 vasnprintf: Avoid a dummy memory allocation. * lib/vasnprintf.c (NOMEM_PTR): New macro. (multiply, divide): Return it instead of NULL in case of memory allocation failure. (scale10_round_decimal_decoded): Update.
Bruno Haible 0fbc4699 2024-02-21T15:49:23 *printf-posix: Disable support for the 'n' directive by default. * m4/printf-with-n-directive.m4: New file. * modules/printf-with-n-directive: New file. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): If gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the value of the gl_cv_func_printf_directive_n variable. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): If gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the values of the gl_cv_func_printf_directive_n and gl_cv_func_snprintf_directive_n variables. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise. * lib/printf-parse.c (PRINTF_PARSE): If NEED_PRINTF_WITH_N_DIRECTIVE is not defined, treat the 'n' directive like an unknown directive. * lib/vasnprintf.c (VASNPRINTF): If NEED_PRINTF_WITH_N_DIRECTIVE is not defined, disable the processing of the 'n' directive. * tests/test-snprintf-posix.h (test_function): If NEED_PRINTF_WITH_N_DIRECTIVE is not defined, skip the %n test. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/posix-functions/dprintf.texi: Mention that support for the 'n' directive is only enabled together with the module 'printf-with-n-directive'. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * NEWS: Mention the change.
Simon Josefsson 5b92dd0a 2024-01-01T10:31:48 maint: run 'make update-copyright'
Bruno Haible 7375d571 2023-11-14T14:10:57 *printf-posix: Revert expectations of %lc of 0. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): Expect a NUL byte in the output. * lib/vasnprintf.c (VASNPRINTF): In the %lc implementation, don't special-case the NUL wide character. * tests/test-vasnprintf-posix.c (test_function): Change expected result for %lc of L'\0'. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * doc/posix-functions/dprintf.texi: Update platform list regarding %lc of 0 bug. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/glibc-functions/asprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise.
Bruno Haible f5c688cf 2023-10-03T23:27:30 *printf-posix: Work around bug with %#.0x on Mac OS X 10.6. * lib/vasnprintf.c (VASNPRINTF): Enable NEED_PRINTF_UNBOUNDED_PRECISION- guarded code also for NEED_PRINTF_FLAG_ALT_PRECISION_ZERO. Set prec_ourselves to 1 if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO, precision is 0, and the directive is 'x' or 'X'. If prec_ourselves, remove the "0" output if required. * m4/printf.m4 (gl_PRINTF_FLAG_ALT_PRECISION_ZERO): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO): New macro. (gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Invoke it. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Require gl_PRINTF_FLAG_ALT_PRECISION_ZERO and test its result. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise. * doc/glibc-functions/asprintf.texi: Mention the %#.0x bug. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/fwprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
Bruno Haible de88574e 2023-09-22T09:23:32 striconveh, *vasnprintf, vasnwprintf: Make more shared-library friendly. * lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as 'const'. * lib/vasnprintf.c (wctomb_fallback): Likewise.
Bruno Haible dad9ed27 2023-07-16T07:30:55 vasnprintf, vasnwprintf: Optimize clearing an mbstate_t. * lib/vasnprintf.c (VASNPRINTF): Use mbszero. * modules/vasnprintf (Depends-on): Add mbszero. * modules/vasnwprintf (Depends-on): Likewise. * modules/c-vasnprintf (Depends-on): Likewise. * modules/unistdio/u8-vasnprintf (Depends-on): Likewise. * modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise. * modules/unistdio/u16-vasnprintf (Depends-on): Likewise. * modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise. * modules/unistdio/u32-vasnprintf (Depends-on): Likewise. * modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise. * modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.
Bruno Haible 94a7cdb7 2023-06-12T18:39:49 vasnwprintf-posix: Work around another musl libc bug. * m4/printf.m4 (gl_SWPRINTF_DIRECTIVE_LC): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke it, and set NEED_WPRINTF_DIRECTIVE_LC if the %lc test failed. * lib/vasnprintf.c (VASNPRINTF): If NEED_WPRINTF_DIRECTIVE_LC is set, do the processing for %lc and %ls ourselves. (local_wcslen): Update condition. * doc/posix-functions/swprintf.texi: Mention the %lc problem.
Bruno Haible 52cd8f06 2023-05-18T22:58:23 vasnprintf, c-vasnprintf: Silence gcc warning. * lib/vasnprintf.c: Add #pragma GCC diagnostic.
Bruno Haible a6548695 2023-05-18T22:51:17 vasnprintf, c-vasnprintf: Silence gcc warnings. * lib/vasnprintf.c (scale10_round_decimal_decoded): Remove memory==NULL test. (scale10_round_decimal_long_double, scale10_round_decimal_double): Test for memory==NULL here. Remove use of IF_LINT.
Bruno Haible 5826332a 2023-05-03T17:09:20 vasnprintf, vasnwprintf: Make '0' flag handling more ISO C compliant. * lib/vasnprintf.c (VASNPRINTF): When doing the padding ourselves, ignore the '0' flag if a precision is specified and the conversion is one of d, i, o, u, x, X, b, B. * tests/test-vasnprintf-posix.c (test_function): Update expected results accordingly. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise.
Bruno Haible 0a0fb288 2023-04-07T23:54:24 vasnwprintf-posix: Work around %La bug in glibc 2.15 and Haiku. * m4/printf.m4 (gl_SWPRINTF_DIRECTIVE_LA): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_SWPRINTF_DIRECTIVE_LA and define NEED_WPRINTF_DIRECTIVE_LA accordingly. * lib/vasnprintf.c: When compiling vasnwprintf, if NEED_WPRINTF_DIRECTIVE_LA, handle the %La and %LA directives ourselves. * doc/posix-functions/swprintf.texi: Mention the %La bug.
Bruno Haible 142f4669 2023-04-03T14:45:06 vasnprintf-posix: Fix harmless mistake (regression 2023-03-24). Found by Coverity. * lib/vasnprintf.c (MAX_ROOM_NEEDED): Insert 'break;' statement.
Bruno Haible bbf0d3fd 2023-04-01T14:51:22 vasnwprintf-posix: Fix behaviour in the C locale. * lib/vasnprintf.c (VASNPRINTF): If NEED_WPRINTF_DIRECTIVE_C is set, implement the 'c' directive here. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MBRTOWC_C_LOCALE. If mbrtowc is buggy in the C locale, define NEED_WPRINTF_DIRECTIVE_C. * modules/vasnwprintf (Files): Add m4/mbrtowc.m4. * tests/test-vasnwprintf-posix.c (test_function): Add tests of %s and %c in the C locale. * doc/posix-functions/fwprintf.texi: Mention the C locale behaviour bug. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
Bruno Haible 154a389b 2023-04-01T11:45:23 vasnprintf-posix: Fix crash in narrow %lc directive (regr. 2023-03-21). * lib/vasnprintf.c (VASNPRINTF): Negative results of local_wcrtomb can now occur; handle them. * tests/test-vasnprintf-posix.c (test_function): Test %lc directive with a wint_t argument that is not a valid wide character. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise.
Bruno Haible 44c829ff 2023-03-31T13:42:49 vasnwprintf: Fix crash upon conversion failure when processing %s. * lib/vasnprintf.c (VASNPRINTF): When processing %s with !has_precision and !has_width, don't call abort() if there is a conversion failure.
Bruno Haible 480a59ba 2023-03-24T22:14:09 *printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'. * lib/printf-args.h: Include <stdint.h>. (arg_type): Add TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER. (argument): Add the union members a_[u]int8_t, ..., a_[u]int_fast64_t and a_count_int8_t_pointer, ..., a_count_int_fast64_t_pointer. * lib/printf-args.c: Include <limits.h>. (PRINTF_FETCHARGS): Handle TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER. * lib/printf-parse.c (PRINTF_PARSE): Accept only one size specifier, not a sequence of size specifiers. Accept "wN" and "wfN", where N = 8, 16, 32, 64. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Handle the new TYPE_* values as well. * m4/printf.m4 (gl_PRINTF_SIZES_C23): New macro. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Require gl_PRINTF_SIZES_C23. Test gl_cv_func_printf_sizes_c23. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Likewise. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise. * tests/test-vasnprintf-posix.c (test_function): Add tests for size specifiers with %d, %u, %b, %o, %x. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * modules/vasnprintf (Depends-on): Add limits-h. * modules/vasnwprintf (Depends-on): Add limits-h. * modules/c-vasnprintf (Depends-on): Add limits-h, stdint. * modules/unistdio/u-printf-args (Depends-on): Add stdint, limits-h. * doc/posix-functions/dprintf.texi: Mention the ISO C 23 size specifiers. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/fwprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
Bruno Haible 0645e170 2023-03-23T13:51:41 vasnprintf-gnu: New module. Suggested by Eric Blake in <https://lists.gnu.org/archive/html/bug-gnulib/2023-03/msg00060.html>. * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'B' conversion. * lib/printf-parse.h: Update comments. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED): Treat the 'B' conversion like 'b'. (VASNPRINTF): Implement 'B' conversion if NEED_PRINTF_DIRECTIVE_UPPERCASE_B is set. Support the 'B' conversion if requested. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): When cross-compiling, guess yes on glibc >= 2.35. (gl_PRINTF_DIRECTIVE_UPPERCASE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Renamed from gl_PREREQ_VASNPRINTF_WITH_EXTRAS. (gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B, gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS): New macros. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): New macro, extracted from gl_FUNC_VASNPRINTF_POSIX. (gl_FUNC_VASNPRINTF_POSIX): Require it. Invoke gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS. * m4/vasnprintf-gnu.m4: New file. * modules/vasnprintf-gnu: New file. * modules/c-vasnprintf (configure.ac): Update. * modules/unistdio/u8-vasnprintf (configure.ac): Likewise. * modules/unistdio/u8-u8-vasnprintf (configure.ac): Likewise. * modules/unistdio/u16-vasnprintf (configure.ac): Likewise. * modules/unistdio/u16-u16-vasnprintf (configure.ac): Likewise. * modules/unistdio/u32-vasnprintf (configure.ac): Likewise. * modules/unistdio/u32-u32-vasnprintf (configure.ac): Likewise. * modules/unistdio/ulc-vasnprintf (configure.ac): Likewise.
Bruno Haible f61570c0 2023-03-22T21:43:23 *printf-posix: Fix implementation of %b directive. * lib/vasnprintf.c (VASNPRINTF): In the %b directive implementation, fix the precision handling, and ignore the '0' flag when a width and a precision are both present. * tests/test-snprintf-posix.h (test_function): Add test cases for the %x directive and more test cases for the %b directive. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * modules/vasnwprintf-posix-tests (Files): Add m4/musl.m4. (configure.ac): Invoke gl_MUSL_LIBC.
Bruno Haible 806d6f85 2023-03-22T21:33:24 vasnwprintf: Fix a warning: implicit declaration of function ‘wcsnlen’. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test also whether wcsnlen is declared. * lib/vasnprintf.c (local_wcsnlen): Together with HAVE_WCSNLEN, test also HAVE_DECL_WCSNLEN.
Bruno Haible c4aea218 2023-03-22T21:28:21 vasnwprintf: Fix a "warning: unused function local_wcsnlen". * lib/vasnprintf.c: Adjust #if conditions.
Bruno Haible 6b8f2da2 2023-03-22T19:39:33 vasnwprintf: Fix test failures on FreeBSD, NetBSD, AIX, mingw. * m4/printf.m4 (gl_SWPRINTF_WORKS): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke it and define HAVE_WORKING_SWPRINTF accordingly. * lib/vasnprintf.c: Together with HAVE_SWPRINTF, test also HAVE_WORKING_SWPRINTF. (VASNPRINTF): If WIDE_CHAR_VERSION && !DCHAR_IS_TCHAR, don't pass a wchar_t[] to snprintf. Add a workaround against mingw's snwprintf function. * doc/posix-functions/swprintf.texi: Document the null wide character bug.
Bruno Haible cf3252a5 2023-03-22T17:46:23 vasnwprintf: Fix a "warning: unused function 'wmax_room_needed'". * lib/vasnprintf.c (MAX_ROOM_NEEDED): Adjust #if condition.
Bruno Haible b0708553 2023-03-22T15:01:53 vasnwprintf: Simplify last change. * lib/vasnprintf.c (VASNPRINTF): Remove unused variable 'len'.
Bruno Haible c9e246f5 2023-03-22T06:13:18 unistdio/u*-vasnprintf: Fix conversion of %Id directive result. * lib/vasnprintf.c (VASNPRINTF): Don't assume that snprintf's result is entirely ASCII if the directive contain the glibc 'I' flag.
Bruno Haible ff3f33ee 2023-03-21T17:47:04 vasnwprintf: Fix for older platforms without swprintf. * lib/vasnprintf.c (VASNPRINTF): In the %lc handling, ignore the precision. Convert the snprintf result to a wchar_t[] not by mbsrtowcs, but by a loop that does not stop at NUL characters. * tests/test-vasnwprintf-posix.c (test_function): Add more tests for the %c and %lc directives. * modules/vasnwprintf (Depends-on): Add mbrtowc. Remove mbsrtowcs.
Bruno Haible 4928ebfa 2023-03-21T15:49:06 *printf-posix: Work around bug with %lc of 0 on many platforms. * lib/vasnprintf.c (local_wctomb): Define also for NEED_PRINTF_DIRECTIVE_LC. (VASNPRINTF): Implement %lc handling ourselves if NEED_PRINTF_DIRECTIVE_LC. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LC): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_LC and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_LC. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add more tests for the %c and %lc directives. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the %lc 0 bug. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise.
Bruno Haible c70afa97 2023-03-20T19:18:02 vasnwprintf: Port to older platforms without swprintf. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Test for swprintf. * lib/vasnprintf.c (TCHAR_T, DCHAR_IS_TCHAR, SNPRINTF): When WIDE_CHAR_VERSION and swprintf does not exist, use TCHAR_T = char, SNPRINTF = snprintf, and !DCHAR_IS_TCHAR. (VASNPRINTF): In this case, implement %ls and %lc directly. Adjust a couple of #if conditions. For the conversion from TCHAR_T[] to DCHAR_T[], use mbsrtowcs. * modules/vasnwprintf (Depends-on): Add mbsrtowcs.
Bruno Haible 1632b9ad 2023-03-20T03:26:44 vasnwprintf: Fix test failures on musl libc. * m4/vasnprintf.m4 (gl_PREREQ_VASNWPRINTF): Invoke gl_MUSL_LIBC. * lib/vasnprintf.c (VASNPRINTF): On musl libc, when WIDE_CHAR_VERSION, - force pad_ourselves to be 1, - don't use %n. Fix zero-padding when the result starts with a prefix "0x" or "0b". * modules/vasnwprintf (Files): Add musl.m4. * doc/posix-functions/swprintf.texi: Mention two musl libc bugs.
Bruno Haible bb7cf2b6 2023-03-17T22:45:56 *printf-posix: ISO C 23: Add %b directive for binary output of integers. * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive. * lib/printf-parse.h: Update comment. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the 'b' directive. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_B and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add some tests of the %b directive. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the 'b' directive. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/fwprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
Bruno Haible 21ed6e83 2023-03-17T22:33:24 vasnprintf, vasnwprintf: Simplify code. * lib/vasnprintf.c (MAX_ROOM_NEEDED): Remove dead code: The directives 'o', 'x', 'X' always take an unsigned integer argument.
Bruno Haible fa7279f3 2023-03-17T19:16:26 vasnwprintf: Fix test failure on OpenBSD. * lib/vasnprintf.c (VASNPRINTF): Don't use the %n directive on OpenBSD.
Bruno Haible 6cac6f01 2023-03-17T12:58:57 vasnprintf, vasnwprintf: Include all necessary workarounds in libintl. * lib/vasnprintf.c: Remove IN_LIBINTL special-casing.
Bruno Haible cc90bee0 2023-03-17T12:25:37 vasnwprintf: New module. * lib/vasnprintf.c: Enable more code for WIDE_CHAR_VERSION, because snwprintf()/_snwprintf() (Windows) and swprintf() (Unix) don't return the needed buffer size, like snprintf does. * lib/wprintf-parse.h: New file, based on lib/printf-parse.h and gettext/gettext-runtime/intl/wprintf-parse.h. * lib/wprintf-parse.c: New file, based on gettext/gettext-runtime/intl/printf.c. * lib/vasnwprintf.h: New file, based on lib/vasnprintf.h and gettext/gettext-runtime/intl/vasnwprintf.h. * lib/vasnwprintf.c: New file. * lib/asnwprintf.c: New file, based on lib/asnprintf.c. * m4/vasnprintf.m4 (gl_FUNC_VASNWPRINTF): New macro. (gl_PREREQ_VASNXPRINTF): New macro, extracted from gl_PREREQ_VASNPRINTF. (gl_PREREQ_VASNPRINTF): Invoke it. Don't test for wcsnlen and mbrtowc. (gl_PREREQ_VASNWPRINTF): New macro. * modules/vasnwprintf: New file, based on modules/vasnprintf.
Bruno Haible ca1cd9b3 2023-01-28T19:39:23 unistdio/*printf: Fix negative width handling for %U, %lU, %llU. * lib/vasnprintf.c (VASNPRINTF): In the code for %U, %lU, %llU, test for the FLAG_LEFT bit in the flags variable. * tests/unistdio/test-u8-printf1.h (test_xfunction): Add tests for width given as argument for the directives %U, %lU, %llU, %s, %a, %f, %e, %g. * tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise. * tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise. * tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.
Bruno Haible 54c80fb6 2023-01-28T19:05:24 vasnprintf-posix: Fix possible bug with negative width handling for %lc. * lib/vasnprintf.c (VASNPRINTF): In the code for %lc in vasnprintf, test for the FLAG_LEFT bit in the flags variable. * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %c, %lc. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-snprintf-posix.c: Include <wchar.h>, for wint_t. * tests/test-sprintf-posix.c: Likewise.
Bruno Haible 5527d5c5 2023-01-28T18:17:17 vasnprintf-posix: Fix negative width handling for %ls directive. Reported by clang via Po Lu <luangruo@yahoo.com>. * lib/vasnprintf.c (VASNPRINTF): In the code for %ls in vasnprintf and for %s in vasnwprintf, test for the FLAG_LEFT bit in the flags variable. * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %s, %ls. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise.
Bruno Haible c04fda7b 2023-01-25T09:53:21 vasnprintf: Fix compilation error on Android NDK r26b. Reported by Po Lu <luangruo@yahoo.com>. * lib/vasnprintf.c: Include <wchar.h>.
Simon Josefsson 32a72f45 2023-01-01T01:14:21 maint: run 'make update-copyright'
Paul Eggert 28465e16 2022-09-13T17:29:36 assert-h: prefer to ‘verify’ Where it’s easy, prefer ‘static_assert’ to ‘verify’, as this simplifies the source by removing the need to include verify.h. Keep using ‘verify’ if verify.h is used for other reasons, or if code is shared with glibc. * lib/alignalloc.c, lib/argmatch.h, lib/c32is-impl.h: * lib/c32snrtombs.c, lib/c32srtombs.c, lib/exclude.c: * lib/filevercmp.c, lib/fma.c, lib/i-ring.h, lib/ino-map.c: * lib/localeinfo.c, lib/malloca.c, lib/mbrtoc32.c, lib/mbrtowc.c: * lib/mbsinit.c, lib/mbsnrtoc32s.c, lib/mbsrtoc32s.c: * lib/nanosleep.c, lib/parse-datetime.y, lib/pipe2.c: * lib/rawmemchr.c, lib/relocwrapper.c, lib/sleep.c: * lib/stat-w32.c, lib/strerror.c, lib/strtoimax.c: * lib/utimecmp.c, lib/vasnprintf.c, tests/test-alignof.c: * tests/test-intprops.c, tests/test-libgmp.c: * tests/test-limits-h.c, tests/test-locale.c: * tests/test-pthread.c, tests/test-round2.c: * tests/test-stdalign.c, tests/test-stddef.c, tests/test-stdio.c: * tests/test-stdlib.c, tests/test-string.c, tests/test-sys_stat.c: * tests/test-time.c, tests/test-uchar.c, tests/test-unistd.c: * tests/test-wchar.c: Prefer static_assert to verify, and stop including verify.h. * lib/stat.c: Don’t include verify.h (this include was unnecessary). * modules/alignalloc, modules/alignof-tests, modules/argmatch: * modules/c-vasnprintf, modules/c32isalnum, modules/c32isalpha: * modules/c32isblank, modules/c32iscntrl, modules/c32isdigit: * modules/c32isgraph, modules/c32islower, modules/c32isprint: * modules/c32ispunct, modules/c32isspace, modules/c32isupper: * modules/c32isxdigit, modules/c32snrtombs, modules/c32srtombs: * modules/exclude, modules/filevercmp, modules/fma, modules/fmaf: * modules/fmal, modules/fstat, modules/i-ring, modules/ino-map: * modules/intprops-tests, modules/libgmp-tests: * modules/limits-h-tests, modules/locale-tests, modules/malloca: * modules/mbrtoc32, modules/mbrtowc, modules/mbsinit: * modules/mbsnrtoc32s, modules/mbsrtoc32s, modules/nanosleep: * modules/parse-datetime, modules/pipe2, modules/pthread-h-tests: * modules/rawmemchr, modules/relocatable-prog-wrapper: * modules/round-tests, modules/roundf-tests, modules/sleep: * modules/stat, modules/stdalign-tests, modules/stdckdint-tests: * modules/stddef-tests, modules/stdio-tests, modules/stdlib-tests: * modules/strerror, modules/string-tests, modules/strtoimax: * modules/strtoumax, modules/sys_stat-tests, modules/time-tests: * modules/uchar-tests, modules/unistd-tests: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf, modules/unistdio/ulc-vasnprintf: * modules/utimecmp, modules/vasnprintf, modules/wchar-tests: Depend on assert-h, not verify.
Paul Eggert bd114009 2022-05-01T23:24:02 vasnprintf: Simplify. Reduce binary code size. * lib/vasnprintf.c (VASNPRINTF): Coalesce cleanup code.
Paul Eggert eb4e7766 2022-05-01T22:48:07 vasnprintf: Simplify 'result' variable. * lib/vasnprintf.c (VASNPRINTF): Simplify initialization and test of 'result' variable.
Paul Eggert da95c038 2022-05-01T22:38:50 vasnprintf: Simplify a free() call. * lib/vasnprintf.c (divide): Just call free (x) instead of doing ‘if (x != NULL) free (x);’.
Paul Eggert eec12c00 2022-01-01T09:43:19 maint: run 'make update-copyright'
Paul Eggert 6b3915fd 2021-08-01T17:51:11 vasnprintf: improve -fanalyzer malloc checking
Bruno Haible 5d357603 2021-06-20T16:29:39 Sync with GNU gettext. * lib/printf-parse.c: Ignore IN_LIBINTL and IN_LIBASPRINTF. * lib/vasnprintf.c: Ignore IN_LIBINTL.
Bruno Haible 4d288a80 2021-06-05T15:44:26 vasnprintf: Don't leak memory when memory allocation fails. Found by Coverity. Reported by Mike Fabian <mfabian@redhat.com> in <https://lists.gnu.org/archive/html/bug-libunistring/2021-06/msg00000.html>. * lib/vasnprintf.c (VASNPRINTF): In places where a local variable points to heap-allocated storage, free that storage before doing 'goto out_of_memory;'.
Bruno Haible 5ffa1440 2021-06-04T20:55:41 Put LGPLv2+ notices in source files where appropriate. * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
Bruno Haible 05dbb8b6 2021-03-27T01:12:07 vasnprintf: Fix memory leak (regression from yesterday). * lib/vasnprintf.c (VASNPRINTF): Restore omitted CLEANUP invocation. Some more simplifications of errno around free().
Paul Eggert 5b3a6f94 2021-03-25T12:41:41 free-posix: use more often in other modules This lets us simplify cleanup code that calls ‘free’. * lib/amemxfrm.c (amemxfrm): * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): * lib/astrxfrm.c (astrxfrm): * lib/dprintf.c (dprintf): * lib/execute.c (execute): * lib/execvpe.c (execvpe): * lib/fchdir.c (get_name): * lib/file-has-acl.c (file_has_acl): * lib/fprintf.c (fprintf): * lib/getcwd-lgpl.c (rpl_getcwd): * lib/getgroups.c (rpl_getgroups): * lib/link.c (link, rpl_link): * lib/linkat.c (link_immediate, link_follow, linkat_follow): * lib/localename.c (newlocale, duplocale): * lib/mgetgroups.c (mgetgroups): * lib/mountlist.c (read_file_system_list): * lib/pipe-filter-gi.c (pipe_filter_gi_close): * lib/putenv.c (_unsetenv, putenv): * lib/read-file.c (read_file): * lib/rename.c (rpl_rename): * lib/savedir.c (streamsavedir, savedir): * lib/spawni.c (do_open, __spawni): * lib/spawn-pipe.c (create_pipe): * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): * lib/striconveh.c (mem_cd_iconveh_internal, str_cd_iconveh) (mem_iconveh, str_iconveh): * lib/supersede.c (open_supersede, close_supersede): * lib/vasnprintf.c (VASNPRINTF): * lib/vdprintf.c (vdprintf): * lib/vfprintf.c (vfprintf): * lib/wcscoll-impl.h (wcscoll): * lib/wcsxfrm-impl.h (wcsxfrm): * lib/xgetdomainname.c (xgetdomainname): * lib/xgethostname.c (xgethostname): Simplify by assuming that ‘free’ preserves errno. * lib/localename.c: Do not include errno.h. * modules/amemxfrm, modules/areadlink-with-size: * modules/areadlinkat-with-size, modules/astrxfrm: * modules/c-vasnprintf, modules/dprintf, modules/execute: * modules/execvpe, modules/fchdir, modules/file-has-acl: * modules/fprintf-posix, modules/getcwd-lgpl, modules/getgroups: * modules/link, modules/linkat, modules/localename: * modules/mgetgroups, modules/mountlist, modules/pipe-filter-gi: * modules/posix_spawn-internal, modules/putenv, modules/read-file: * modules/rename, modules/savedir, modules/spawn-pipe: * modules/striconv, modules/striconveh, modules/supersede: * modules/vasnprintf, modules/vdprintf, modules/vfprintf-posix: * modules/wcscoll, modules/wcsxfrm, modules/xgetdomainname: * modules/xgethostname: Depend on free-posix.
Paul Eggert 4b948321 2021-01-01T07:28:52 maint: run 'make update-copyright'
Bruno Haible b954346c 2020-10-04T15:59:26 vasnprintf: Don't use %n on modern, ISO C 99 compliant platforms. Suggested by Jeremie Courreges-Anglas <jca@wxcvbn.org> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00010.html>. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF): Define HAVE_SNPRINTF_TRUNCATION_C99. * lib/vasnprintf.c (VASNPRINTF): Don't use %n if HAVE_SNPRINTF_RETVAL_C99 && HAVE_SNPRINTF_TRUNCATION_C99.
Bruno Haible 878c9833 2020-08-05T19:25:42 Use __builtin_clz{,l,ll} with clang, also on Windows. * lib/integer_length.c: With clang, use the GCC built-in, not <intrin.h>. * lib/integer_length_l.c: Likewise. * lib/count-leading-zeros.h (COUNT_LEADING_ZEROS): Use the GCC built-in also on clang. * lib/vasnprintf.c (divide): Likewise.
Paul Eggert c08f85d7 2020-05-01T18:12:12 attribute: new module This simplifies use of GCC and C2X attributes like ‘deprecated’. * MODULES.html.sh: Add attribute. * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. * doc/gnulib.texi (Particular Modules): Add Attributes. * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: * lib/vasnprintf.c: Include attribute.h, and let it define FALLTHROUGH. * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. This is a copy since Gawk doesn’t use Gnulib. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that is incompatible with gl_COMMON_BODY’s. All uses changed. * lib/fts.c: Include attribte.h, for FALLTHROUGH. Keep the existing FALLTHROUGH definition since Glibc might use it, and it does no harm to Gnulib’s FALLTHROUGH. * lib/fts_.h, lib/inttostr.h: (__GNUC_PREREQ): Remove; no longer needed. (__attribute_warn_unused_result__): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed __attribute__ ((__warn_unused_result__)), for forward compatibility to C2X. * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses replaced by gl_COMMON_BODY’s implementation, which has a slightly different signature. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. No doubt all uses should be replaced, at some point. * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. (_Noreturn): Use it. (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) (_GL_ATTRIBUTE_COLD) (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) (_GL_ATTRIBUTE_MAYBE_UNUSED) (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) (_GL_ATTRIBUTE_SENTINEL): New macros. * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: * modules/fnmatch, modules/freopen-safer, modules/fts: * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: * modules/quotearg, modules/savewd: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf: * modules/unistdio/ulc-vasnprintf: * modules/unistr/u8-uctomb, modules/vasnprintf: (Depends-on:): Add attribute module.
Bruno Haible 5cdec0ff 2020-04-19T17:02:16 vasnprintf: Add support for printing wide characters using escapes. * lib/vasnprintf.c (ENABLE_WCHAR_FALLBACK): Document optional macro. (wctomb_fallback): New function. (local_wctomb): New function. (local_wcrtomb): New function or macro. (MAX_ROOM_NEEDED): Adjust estimate for %lc. (VASNPRINTF): Simplify %ls code by use of local_wcrtomb. Add code for %lc.
Paul Eggert 2cdc1baf 2020-01-01T00:00:18 maint: Run 'make update-copyright'
Bruno Haible 5ceaccc0 2019-12-22T09:55:04 vasnprintf: Assume that the compiler supports 'long long'. * lib/printf-args.h: Assume HAVE_LONG_LONG_INT to be 1. * lib/printf-args.c (PRINTF_FETCHARGS): Likewise. * lib/printf-parse.c (PRINTF_PARSE): Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Likewise. * m4/intmax_t.m4 (gl_AC_TYPE_INTMAX_T, gt_AC_TYPE_INTMAX_T): Don't require AC_TYPE_LONG_LONG_INT. * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_ARGS, gl_PREREQ_PRINTF_PARSE, gl_PREREQ_VASNPRINTF): Likewise. * modules/vasnprintf (Files): Remove longlong.m4. * modules/c-vasnprintf (Files): Likewise. * modules/unistdio/u8-vasnprintf (Files): Likewise. * modules/unistdio/u8-u8-vasnprintf (Files): Likewise. * modules/unistdio/u16-vasnprintf (Files): Likewise. * modules/unistdio/u16-u16-vasnprintf (Files): Likewise. * modules/unistdio/u32-vasnprintf (Files): Likewise. * modules/unistdio/u32-u32-vasnprintf (Files): Likewise. * modules/unistdio/ulc-vasnprintf (Files): Likewise.
Bruno Haible 05044004 2019-03-14T09:49:24 all: Update URLs to msdn.microsoft.com. * lib/stat-w32.c et al.: Update URLs after most of msdn.microsoft.com was moved to docs.microsoft.com.
Bruno Haible 6c0f109f 2019-01-23T01:17:07 vasnprintf: Don't use %n on Android. Reported and fix suggested by Hugo Beauzée-Luyssen <hugo@beauzee.fr> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-12/msg00123.html>. * lib/vasnprintf.c (VASNPRINTF): Don’t use %n on Android.
Paul Eggert e6633650 2019-01-01T00:25:11 maint: Run 'make update-copyright'
Bruno Haible 857227b3 2018-09-30T23:16:45 vasnprintf: Avoid warnings from GCC's -Wsign-compare. Reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00105.html>. * lib/vasnprintf.c (VASNPRINTF): Cast 'count' from 'int' to 'unsigned int' before comparison with an unsigned value.
Bruno Haible 278b4175 2018-09-23T14:13:52 vasnprintf: Fix heap memory overrun bug. Reported by Ben Pfaff <blp@cs.stanford.edu> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00107.html>. * lib/vasnprintf.c (convert_to_decimal): Allocate one more byte of memory. * tests/test-vasnprintf.c (test_function): Add another test.
Bruno Haible 44b65c48 2018-05-03T23:09:42 Simplify code. Drop support for Borland C++ on Windows. Reported by Gisle Vanem <gisle.vanem@gmail.com>. * lib/accept4.c: Simplify 'defined _WIN32 || defined __WIN32__' to just 'defined _WIN32'. * lib/canonicalize-lgpl.c: Likewise. * lib/classpath.c: Likewise. * lib/clean-temp.c: Likewise. * lib/csharpexec.c: Likewise. * lib/ctime.c: Likewise. * lib/dosname.h: Likewise. * lib/dup2.c: Likewise. * lib/errno.in.h: Likewise. * lib/error.c: Likewise. * lib/euidaccess.c: Likewise. * lib/execute.c: Likewise. * lib/fcntl.in.h: Likewise. * lib/fcntl.c: Likewise. * lib/filename.h: Likewise. * lib/findprog.c: Likewise. * lib/flock.c: Likewise. * lib/fopen.c: Likewise. * lib/freopen.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/gc-gnulib.c: Likewise. * lib/get-rusage-data.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getdelim.c: Likewise. * lib/getdtablesize.c: Likewise. * lib/gethostname.c: Likewise. * lib/getlogin.c: Likewise. * lib/getlogin_r.c: Likewise. * lib/getopt.c: Likewise. * lib/getpagesize.c: Likewise. * lib/getpass.c: Likewise. * lib/getrusage.c: Likewise. * lib/gettimeofday.c: Likewise. * lib/glob.c: Likewise. * lib/inttypes.in.h: Likewise. * lib/isapipe.c: Likewise. * lib/javaexec.c: Likewise. * lib/link.c: Likewise. * lib/localcharset.c: Likewise. * lib/localename.h: Likewise. * lib/localename.c: Likewise. * lib/localtime.c: Likewise. * lib/lseek.c: Likewise. * lib/mbsinit.c: Likewise. * lib/mkdir.c: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/nanosleep.c: Likewise. * lib/nl_langinfo.c: Likewise. * lib/nonblocking.c: Likewise. * lib/nproc.c: Likewise. * lib/open.c: Likewise. * lib/openpty.c: Likewise. * lib/pathmax.h: Likewise. * lib/pipe-filter-aux.c: Likewise. * lib/pipe-filter-gi.c: Likewise. * lib/pipe-filter-ii.c: Likewise. * lib/pipe.c: Likewise. * lib/pipe2.c: Likewise. * lib/poll.c: Likewise. * lib/popen.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/printf-parse.c: Likewise. * lib/progreloc.c: Likewise. * lib/putenv.c: Likewise. * lib/read.c: Likewise. * lib/relocatable.c: Likewise. * lib/rename.c: Likewise. * lib/same-inode.h: Likewise. * lib/secure_getenv.c: Likewise. * lib/select.c: Likewise. * lib/sethostname.c: Likewise. * lib/setlocale.c: Likewise. * lib/sigaction.c: Likewise. * lib/sigprocmask.c: Likewise. * lib/sleep.c: Likewise. * lib/spawn-pipe.h: Likewise. * lib/spawn-pipe.c: Likewise. * lib/spawni.c: Likewise. * lib/stat-time.h: Likewise. * lib/stat-w32.c: Likewise. * lib/stat.c: Likewise. * lib/stdio.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/stdlib.in.h: Likewise. * lib/strerror_r.c: Likewise. * lib/strftime-fixes.c: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/sys_wait.in.h : Likewise. * lib/system-quote.h: Likewise. * lib/system-quote.c: Likewise. * lib/tmpdir.c: Likewise. * lib/tzset.c: Likewise. * lib/uname.c: Likewise. * lib/unistd.in.h: Likewise. * lib/utime.in.h: Likewise. * lib/utime.c: Likewise. * lib/utimecmp.c: Likewise. * lib/utimens.c: Likewise. * lib/vasnprintf.c: Likewise. * lib/vma-iter.h: Likewise. * lib/vma-iter.c: Likewise. * lib/wait-process.c: Likewise. * lib/wcsftime.c: Likewise. * lib/wctype.in.h: Likewise. * lib/write.c: Likewise. * tests/nap.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-get-rusage-data.c: Likewise. * tests/test-getaddrinfo.c: Likewise. * tests/test-getlogin.h: Likewise. * tests/test-isatty.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-mbrtowc-w32.c: Likewise. * tests/test-nonblocking.c: Likewise. * tests/test-nonblocking-pipe-main.c: Likewise. * tests/test-nonblocking-socket-main.c: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * tests/test-poll.c: Likewise. * tests/test-pthread_sigmask1.c: Likewise. * tests/test-select.h: Likewise. * tests/test-sethostname2.c: Likewise. * tests/test-sigprocmask.c: Likewise. * tests/test-spawn-pipe-child.c: Likewise. * tests/test-stat-time.c: Likewise. * tests/test-system-quote-main.c: Likewise. * tests/test-utimens-common.h: Likewise. * tests/test-wcrtomb-w32.c: Likewise. * m4/csharpexec.m4 (gt_CSHARPEXEC): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. * m4/javacomp.m4 (gt_JAVACOMP): Likewise. * m4/javaexec.m4 (gt_JAVAEXEC): Likewise. * m4/locale-ar.m4 (gt_LOCALE_AR): Likewise. * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Likewise. * m4/nocrash.m4 (GL_NOCRASH): Likewise. * m4/pathmax.m4 (gl_PATHMAX_SNIPPET): Likewise. * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/tmpfile.m4 (gl_FUNC_TMPFILE): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
Paul Eggert 281b825e 2018-01-01T00:57:25 maint: Run 'make update-copyright'
Bruno Haible 03eac9d3 2017-09-14T00:35:56 all: Replace many more http URLs by https URLs. Update stale URLs. * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Bruno Haible 7df04f9b 2017-07-07T23:35:32 vasnprintf: port to macOS 10.13 Improve comments in last commit.
Paul Eggert c41f233c 2017-07-07T14:10:20 vasnprintf: port to macOS 10.13 Problem reported by comex in: http://lists.gnu.org/archive/html/bug-gnulib/2017-07/msg00056.html * lib/vasnprintf.c (VASNPRINTF): Don’t use %n on macOS.
Paul Eggert 5e22aee7 2017-05-16T09:23:52 manywarnings: update for GCC 7 * build-aux/gcc-warning.spec: * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add GCC 7 warnings, notably -Wimplicit-fallthrough=5, which requires a non-comment fallthrough attribute. This is a bit cleaner than the comment versions. * lib/strftime.c, lib/dfa.c, lib/fnmatch.c, lib/mbrtowc.c: * lib/vasnprintf.c, tests/macros.h (FALLTHROUGH): New macro. Use it whenever one switch case falls through into the next.
Bruno Haible 0d01189c 2017-04-21T17:24:48 vasnprintf: Fix for MSVC 14. * lib/vasnprintf.c (USE_MSVC__SNPRINTF): New macro. Everywhere, use !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF instead of !HAVE_SNPRINTF_RETVAL_C99.
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Jim Meyering e63f5eb5 2016-10-02T12:09:13 vasnprintf.c: avoid spurious warning from GCC 7 The presence of cpp directives renders this "FALLTHROUGH" comment ineffective, so does not suppress the -Wimplicit-fallthrough warning from GCC 7 built from git on 2016-10-02. * lib/vasnprintf.c (VASNPRINTF): Move comment down past two cpp directives, so that it takes effect once again. This is clearly not a proper change, and I will revert it once this bug is fixed: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817
Paul Eggert 96609bb2 2016-05-30T12:18:19 Use GCC_LINT, not lint FreeBSD and Cygwin #define _Noreturn to empty if 'lint' is defined. Problem reported by Ken Brown in: http://bugs.gnu.org/23640 * doc/posix-headers/stdnoreturn.texi (stdnoreturn.h): Document problem with lint and _Noreturn. * lib/diffseq.h (IF_LINT, IF_LINT2): * lib/fts.c (sccsid): * lib/getndelim2.c (IF_LINT): * lib/gl_anylinked_list2.h (gl_linked_iterator) (gl_linked_iterator_from_to): * lib/gl_anytree_list2.h (gl_tree_iterator) (gl_tree_iterator_from_to): * lib/gl_anytree_oset.h (gl_tree_iterator): * lib/gl_array_list.c (gl_array_iterator) (gl_array_iterator_from_to): * lib/gl_array_oset.c (gl_array_iterator): * lib/gl_carray_list.c (gl_carray_iterator) (gl_carray_iterator_from_to): * lib/idcache.c: * lib/inet_ntop.c (IF_LINT): * lib/regcomp.c (build_charclass_op, create_tree): * lib/regex_internal.c (re_acquire_state) (re_acquire_state_context): * lib/trigl.c (rcsid): * lib/trim.c (IF_LINT): * lib/vasnprintf.c (IF_LINT): * lib/verify.h (assume): Treat GCC_LINT like lint.
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert 4fed9c82 2015-03-03T07:48:40 vasnprintf: pacify clang 3.5.0 Problem reported by Werner Lemberg in: http://lists.gnu.org/archive/html/bug-gnulib/2015-03/msg00000.html * lib/vasnprintf.c (VASNPRINTF): Omit casts that clang objects to. The casts aren't needed, since the characters in question are ASCII.
Paul Eggert b9bfe784 2015-01-01T01:38:23 version-etc: new year * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
Pádraig Brady ec6a60bf 2014-12-08T09:46:38 vasnprintf: fix potential incorrect errno An adjustment of the previous commit c5c4f53b. * lib/vasnprintf.c (VASNPRINTF): free() generally doesn't set errno, but it can potentially in certain edge cases. Reported by Eric Blake.
Pádraig Brady c5c4f53b 2014-12-06T01:14:02 vasnprintf: fix potential use after free * lib/vasnprintf.c (VASNPRINTF): Fix free-memory read, flagged by clang-analyzer 3.4.2.
Paul Eggert 1f5bc60c 2014-08-31T19:19:44 vasnprintf: fix bugs in width computation * lib/vasnprintf.c (VASNPRINTF): Rework previous change, which introduced a bug, to avoid the warning in a different way. Avoid undefined behavior if the width arg is less than -INT_MAX. Avoid unnecessary use of HAS_WIDTH local.
Thien-Thi Nguyen c8842e6a 2014-08-31T10:27:36 vasnprintf: Avoid signed/unsigned comparison warning. * lib/vasnprintf.c (VASNPRINTF): To calculate padding, compare end addr of generated string w/ maximum end addr.
Eric Blake 1276a2c5 2014-01-01T00:04:40 maint: update copyright I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 96bdcc14 2013-05-29T17:47:50 vasnprintf: silence mingw compiler warning On mingw, vasnprintf is able to use snprintf, but not its return value; this led to a situation where gcc warns: vasnprintf.c: In function 'vasnprintf': vasnprintf.c:4609:21: error: variable 'has_width' set but not used [-Werror=unused-but-set-variable] Rather than hacking through a bunch of #ifdefs, where some used both variables and others only used one, I changed the lone use of just 'width' to also use 'has_width'. * lib/vasnprintf.c (VASNPRINTF): Avoid unused variable warning. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 9fc81090 2013-01-01T00:50:58 maint: update all copyright year number ranges Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert bdaf232d 2012-11-20T22:25:09 dup, execute, fatal-signal, etc.: no 'static inline' * lib/dup.c (dup_nothrow): * lib/execute.c (nonintr_close, nonintr_open): * lib/fatal-signal.c (uninstall_handlers, install_handlers): * lib/fopen.c (orig_fopen): * lib/freadseek.c (freadptrinc): * lib/freopen.c (orig_freopen): * lib/fstat.c (orig_fstat, fstat_nothrow): * lib/get-rusage-as.c (get_rusage_as_via_setrlimit) (get_rusage_as_via_iterator): * lib/get-rusage-data.c (get_rusage_data_via_setrlimit): * lib/getdtablesize.c (_setmaxstdio_nothrow): * lib/isatty.c (_isatty_nothrow): * lib/open.c (orig_open): * lib/read.c (read_nothrow): * lib/sigprocmask.c (signal_nothrow): * lib/spawn-pipe.c (nonintr_close, nonintr_open): * lib/vasnprintf.c (MAX_ROOM_NEEDED): * lib/wait-process.c (unregister_slave_subprocess): * lib/write.c (write_nothrow): Now static, not static inline. * lib/spawn-pipe.c (nonintr_open): Define only if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__. * m4/dup.m4 (gl_PREREQ_DUP): * m4/execute.m4 (gl_EXECUTE): * m4/fatal-signal.m4 (gl_FATAL_SIGNAL): * m4/fopen.m4 (gl_PREREQ_FOPEN): * m4/freadseek.m4 (gl_FUNC_FREADSEEK): * m4/freopen.m4 (gl_PREREQ_FREOPEN): * m4/fstat.m4 (gl_PREREQ_FSTAT): * m4/getdtablesize.m4 (gl_PREREQ_GETDTABLESIZE): * m4/isatty.m4 (gl_PREREQ_ISATTY): * m4/open.m4 (gl_PREREQ_OPEN): * m4/read.m4 (gl_PREREQ_READ): * m4/signalblocking.m4 (gl_PREREQ_SIGPROCMASK): * m4/spawn-pipe.m4 (gl_SPAWN_PIPE): * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF): * m4/wait-process.m4 (gl_WAIT_PROCESS): * m4/write.m4 (gl_PREREQ_WRITE): * modules/get-rusage-as, modules/get-rusage-data (configure.ac): Do not require AC_C_INLINE.
Bruno Haible 06b335ad 2012-06-22T13:26:07 Write "Mac OS X" instead of "MacOS X". * README: Write "Mac OS X" instead of "MacOS X". * build-aux/bootstrap: Likewise. * build-aux/install-reloc: Likewise. * lib/acl-internal.h: Likewise. * lib/acl_entries.c: Likewise. * lib/argp-ba.c: Likewise. * lib/argp-pv.c: Likewise. * lib/config.charset: Likewise. * lib/copy-acl.c: Likewise. * lib/csharpexec.c: Likewise. * lib/euidaccess.c: Likewise. * lib/fbufmode.c: Likewise. * lib/fflush.c: Likewise. * lib/file-has-acl.c: Likewise. * lib/filemode.h: Likewise. * lib/fpurge.c: Likewise. * lib/freadable.c: Likewise. * lib/freadahead.c: Likewise. * lib/freading.c: Likewise. * lib/freadptr.c: Likewise. * lib/freadseek.c: Likewise. * lib/fseeko.c: Likewise. * lib/fseterr.c: Likewise. * lib/fsusage.c: Likewise. * lib/fwritable.c: Likewise. * lib/fwriting.c: Likewise. * lib/get-rusage-as.c: Likewise. * lib/get-rusage-data.c: Likewise. * lib/getdomainname.c: Likewise. * lib/idpriv-drop.c: Likewise. * lib/idpriv-droptemp.c: Likewise. * lib/localcharset.c: Likewise. * lib/locale.in.h: Likewise. * lib/localename.c: Likewise. * lib/mbsrtowcs-state.c: Likewise. * lib/nproc.c: Likewise. * lib/passfd.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/printf-parse.c: Likewise. * lib/progreloc.c: Likewise. * lib/safe-read.h: Likewise. * lib/safe-write.h: Likewise. * lib/sched.in.h: Likewise. * lib/set-mode-acl.c: Likewise. * lib/signal.in.h: Likewise. * lib/stdint.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdlib.in.h: Likewise. * lib/strtod.c: Likewise. * lib/sys_select.in.h: Likewise. * lib/tcgetsid.c: Likewise. * lib/unistd.in.h: Likewise. * lib/unlockpt.c: Likewise. * lib/vasnprintf.c: Likewise. * lib/vma-iter.c: Likewise. * lib/wcsrtombs-state.c: Likewise. * m4/acl.m4: Likewise. * m4/acosl.m4: Likewise. * m4/asinl.m4: Likewise. * m4/atanl.m4: Likewise. * m4/c-stack.m4: Likewise. * m4/cosl.m4: Likewise. * m4/expl.m4: Likewise. * m4/extensions.m4: Likewise. * m4/fdatasync.m4: Likewise. * m4/fmal.m4: Likewise. * m4/frexp.m4: Likewise. * m4/frexpf.m4: Likewise. * m4/frexpl.m4: Likewise. * m4/fsusage.m4: Likewise. * m4/getdomainname.m4: Likewise. * m4/getloadavg.m4: Likewise. * m4/getopt.m4: Likewise. * m4/gettext.m4: Likewise. * m4/gnulib-common.m4: Likewise. * m4/intdiv0.m4: Likewise. * m4/intlmacosx.m4: Likewise. * m4/largefile.m4: Likewise. * m4/ldexpl.m4: Likewise. * m4/link-follow.m4: Likewise. * m4/locale-ar.m4: Likewise. * m4/locale-fr.m4: Likewise. * m4/locale-ja.m4: Likewise. * m4/locale-tr.m4: Likewise. * m4/locale-zh.m4: Likewise. * m4/locale_h.m4: Likewise. * m4/lock.m4: Likewise. * m4/logl.m4: Likewise. * m4/mathfunc.m4: Likewise. * m4/minus-zero.m4: Likewise. * m4/mktime.m4: Likewise. * m4/mmap-anon.m4: Likewise. * m4/multiarch.m4: Likewise. * m4/nanosleep.m4: Likewise. * m4/nocrash.m4: Likewise. * m4/poll.m4: Likewise. * m4/printf-frexpl.m4: Likewise. * m4/printf.m4: Likewise. * m4/signbit.m4: Likewise. * m4/sinl.m4: Likewise. * m4/sqrtl.m4: Likewise. * m4/strerror_r.m4: Likewise. * m4/tanl.m4: Likewise. * m4/threadlib.m4: Likewise. * m4/ttyname_r.m4: Likewise. * m4/unlink.m4: Likewise. * m4/visibility.m4: Likewise. * m4/wcwidth.m4: Likewise. * tests/minus-zero.h: Likewise. * tests/test-alloca-opt.c: Likewise. * tests/test-copy-acl.sh: Likewise. * tests/test-copy-file.sh: Likewise. * tests/test-fdatasync.c: Likewise. * tests/test-file-has-acl.sh: Likewise. * tests/test-flock.c: Likewise. * tests/test-fsync.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-malloca.c: Likewise. * tests/test-nonblocking-pipe.h: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-openpty.c: Likewise. * tests/test-posix_openpt.c: Likewise. * tests/test-ptsname.c: Likewise. * tests/test-ptsname_r.c: Likewise. * tests/test-sameacls.c: Likewise. * tests/test-select.h: Likewise. * tests/test-set-mode-acl.sh: Likewise. * tests/test-snprintf-posix.h: Likewise. * tests/test-sprintf-posix.h: Likewise. * tests/test-strtod.c: Likewise. * tests/test-time.c: Likewise. * tests/test-vasnprintf-posix.c: Likewise. * tests/test-vasprintf-posix.c: Likewise. * doc/acl-resources.txt: Likewise. * doc/**/*.texi: Likewise. Reported by Max Horn <max@quendi.de>.