bug-gnulib
[Top][All Lists]
Advanced

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

Re: Typo in quote.h


From: Bruno Haible
Subject: Re: Typo in quote.h
Date: Sat, 31 Oct 2020 20:41:15 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Reuben Thomas wrote:
> quote.h says it contains "prototypes for quote.c", but there is no longer
> such a file, so it should probably mention "quotearg.c" instead.

You are right that there is a problem here: On 2012-03-07 this patch [1]
from Akim did a good thing — it made the quote.h functions' effect more
customizable — and a not so good thing: it combined the implementations
of two modules. However, two separate .c files is more maintainable
than a .c files that combines both (due to the time a programmer needs
in order to understand the file, before being able to make a change).

The observation in [1] was that "quoting_options ... is hidden inside
quotearg.c". So, the fix is to let the 'quotearg' module export all that
the 'quote' module (and similar code in applications) needs.

[1] https://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00031.html

Here are three proposed patches. Paul and Akim, is this OK?


2020-10-31  Bruno Haible  <bruno@clisp.org>

        quote: Don't mix with the implementation of module 'quotearg'.
        * lib/quote.c: New file, extracted from lib/quotearg.c.
        * lib/quotearg.c: Don't include quote.h.
        (quote_quoting_options, quote_n_mem, quote_mem, quote_n, quote): Remove.
        * modules/quote (Files): Add lib/quote.c.
        (Depends-on): Add stdint.
        (Makefile.am): Compile quote.c.
        * modules/quotearg (Files): Remove lib/quote.h.

2020-10-31  Bruno Haible  <bruno@clisp.org>

        quotearg: Export quotearg_slot_n_mem.
        * lib/quotearg.h (quotearg_buffer, quotearg_alloc_mem): Write SIZE_MAX
        instead of -1.
        (quotearg_slot_n_mem): New declaration.
        * lib/quotearg.c (quotearg_slot_n_mem): Renamed from quotearg_n_options.
        Use default_quoting_options if the options argument is NULL.

2020-10-31  Bruno Haible  <bruno@clisp.org>

        quotearg: Allow static init of 'struct quoting_options' variables.
        * lib/quotearg.h: Include <limits.h>.
        (struct quoting_options): Move to here from lib/quotearg.c. Use
        INT_WIDTH instead of INT_BITS.
        (QUOTING_OPTIONS_INIT): New macro.
        * lib/quotearg.c (INT_BITS): Remove macro. Use INT_WIDTH instead.
        (default_quoting_options, quote_quoting_options): Use
        QUOTING_OPTIONS_INIT.
        * modules/quotearg (Depends-on): Add limits-h.

Attachment: 0001-quotearg-Allow-static-init-of-struct-quoting_options.patch
Description: Text Data

Attachment: 0002-quotearg-Export-quotearg_slot_n_mem.patch
Description: Text Data

Attachment: 0003-quote-Don-t-mix-with-the-implementation-of-module-qu.patch
Description: Text Data


reply via email to

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