>From 68300c2c7b1f788322c41f897c01b26327a21d41 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 31 Oct 2020 20:39:50 +0100 Subject: [PATCH 3/3] 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. --- ChangeLog | 11 +++++++++++ lib/quote.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/quotearg.c | 29 ----------------------------- modules/quote | 3 +++ modules/quotearg | 1 - 5 files changed, 68 insertions(+), 30 deletions(-) create mode 100644 lib/quote.c diff --git a/ChangeLog b/ChangeLog index e7ecf39..87dff6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2020-10-31 Bruno Haible + 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 + quotearg: Export quotearg_slot_n_mem. * lib/quotearg.h (quotearg_buffer, quotearg_alloc_mem): Write SIZE_MAX instead of -1. diff --git a/lib/quote.c b/lib/quote.c new file mode 100644 index 0000000..dfe4930 --- /dev/null +++ b/lib/quote.c @@ -0,0 +1,54 @@ +/* quote.c - quote arguments for output + + Copyright (C) 1998-2020 Free Software Foundation, Inc. + + This 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 . */ + +/* Written by Paul Eggert */ + +#include + +#include "quote.h" + +#include + +#include "quotearg.h" + +/* The quoting option used by the functions of quote.h. */ +struct quoting_options quote_quoting_options = + QUOTING_OPTIONS_INIT (locale_quoting_style, 0); + +char const * +quote_n_mem (int n, char const *arg, size_t argsize) +{ + return quotearg_slot_n_mem (n, arg, argsize, "e_quoting_options); +} + +char const * +quote_mem (char const *arg, size_t argsize) +{ + return quote_n_mem (0, arg, argsize); +} + +char const * +quote_n (int n, char const *arg) +{ + return quote_n_mem (n, arg, SIZE_MAX); +} + +char const * +quote (char const *arg) +{ + return quote_n (0, arg); +} diff --git a/lib/quotearg.c b/lib/quotearg.c index 2954b12..674b2b2 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -27,7 +27,6 @@ #include #include "quotearg.h" -#include "quote.h" #include "attribute.h" #include "minmax.h" @@ -1016,34 +1015,6 @@ quotearg_custom_mem (char const *left_quote, char const *right_quote, } -/* The quoting option used by the functions of quote.h. */ -struct quoting_options quote_quoting_options = - QUOTING_OPTIONS_INIT (locale_quoting_style, 0); - -char const * -quote_n_mem (int n, char const *arg, size_t argsize) -{ - return quotearg_slot_n_mem (n, arg, argsize, "e_quoting_options); -} - -char const * -quote_mem (char const *arg, size_t argsize) -{ - return quote_n_mem (0, arg, argsize); -} - -char const * -quote_n (int n, char const *arg) -{ - return quote_n_mem (n, arg, SIZE_MAX); -} - -char const * -quote (char const *arg) -{ - return quote_n (0, arg); -} - /* * Hey Emacs! * Local Variables: diff --git a/modules/quote b/modules/quote index 35c30ce..5599b18 100644 --- a/modules/quote +++ b/modules/quote @@ -3,15 +3,18 @@ Quote arguments for use in error messages. Files: lib/quote.h +lib/quote.c m4/quote.m4 Depends-on: quotearg +stdint configure.ac: gl_QUOTE Makefile.am: +lib_SOURCES += quote.c Include: "quote.h" diff --git a/modules/quotearg b/modules/quotearg index 28b5353..8db40f5 100644 --- a/modules/quotearg +++ b/modules/quotearg @@ -4,7 +4,6 @@ Quote arguments for use in error messages. Files: lib/quotearg.h lib/quotearg.c -lib/quote.h m4/mbstate_t.m4 m4/mbrtowc.m4 m4/quotearg.m4 -- 2.7.4