bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new modules vasnwprintf, vasnwprintf-posix


From: Bruno Haible
Subject: new modules vasnwprintf, vasnwprintf-posix
Date: Fri, 17 Mar 2023 13:15:53 +0100

The libintl of GNU gettext contains a copy of vasnprintf.c, compiled with
'#define WIDE_CHAR_VERSION 1', that is the basis of *wprintf functions.

Before extending vasnprintf to be ISO C 23 compliant, it's useful to move
this vasnwprintf function to Gnulib. Reasons:
  - It makes maintenance easier to have all the *printf code in one place,
    not 80% in Gnulib and 20% in libintl.
  - The unit tests of Gnulib can be ported to the vasnwprintf case. And
    indeed, this shows that the code in libintl was buggy: Since _snwprintf
    has a different return value convention than snprintf, the WIDE_CHAR_VERSION
    instantiation did not work right when the provided buffer was too small.

This set of patches fixes that, and prepares for a more POSIX + ISO C compliant
variant of *printf in libintl.


2023-03-17  Bruno Haible  <bruno@clisp.org>

        vasnprintf, vasnwprintf: Include all necessary workarounds in libintl.
        * lib/vasnprintf.c: Remove IN_LIBINTL special-casing.

2023-03-17  Bruno Haible  <bruno@clisp.org>

        vasnwprintf-posix: Add tests.
        * tests/test-vasnwprintf-posix.c: New file, based on
        tests/test-vasnprintf-posix.c.
        * tests/test-vasnwprintf-posix2.sh: New file, based on
        tests/test-vasnprintf-posix2.sh.
        * tests/test-vasnwprintf-posix2.c: New file, based on
        tests/test-vasnprintf-posix2.c.
        * tests/test-vasnwprintf-posix3.c: New file, based on
        tests/test-vasnprintf-posix3.c.
        * modules/vasnwprintf-posix-tests: New file, based on
        modules/vasnprintf-posix-tests.

        vasnwprintf-posix: New module.
        * m4/vasnwprintf-posix.m4: New file.
        * modules/vasnwprintf-posix: New file, based on
        modules/vasnprintf-posix.

2023-03-17  Bruno Haible  <bruno@clisp.org>

        vasnprintf-posix: Relicense under LGPLv2+.
        * modules/vasnprintf-posix (License): Change to LGPLv2+.

2023-03-17  Bruno Haible  <bruno@clisp.org>

        vasnwprintf: Add tests.
        * tests/test-vasnwprintf.c: New file, based on tests/test-vasnprintf.c.
        * modules/vasnwprintf-tests: New file, based on
        modules/vasnprintf-tests.

        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.

Attachment: 0001-vasnwprintf-New-module.patch
Description: Text Data

Attachment: 0002-vasnwprintf-Add-tests.patch
Description: Text Data

Attachment: 0003-vasnprintf-posix-Relicense-under-LGPLv2.patch
Description: Text Data

Attachment: 0004-vasnwprintf-posix-New-module.patch
Description: Text Data

Attachment: 0005-vasnwprintf-posix-Add-tests.patch
Description: Text Data

Attachment: 0006-vasnprintf-vasnwprintf-Include-all-necessary-workaro.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]