summaryrefslogtreecommitdiff
path: root/lib/quotearg.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: run 'make update-copyright'Simon Josefsson2023-01-011-1/+1
|
* Rely on new stdbool behaviorPaul Eggert2022-09-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefer the C23 style to the C99 style, since the stdbool module now supports C23. * lib/acl-internal.h, lib/acl.h, lib/argmatch.c, lib/argmatch.h: * lib/argp-help.c, lib/argv-iter.h, lib/asyncsafe-spin.c: * lib/backup-internal.h, lib/backupfile.c, lib/base32.h: * lib/base64.h, lib/basename-lgpl.c, lib/bitset/base.h: * lib/c-ctype.h, lib/c-strcasestr.c, lib/canonicalize-lgpl.c: * lib/canonicalize.c, lib/chdir-long.c, lib/chown.c: * lib/classpath.h, lib/clean-temp-private.h: * lib/clean-temp-simple.c, lib/clean-temp-simple.h: * lib/clean-temp.c, lib/clean-temp.h, lib/cloexec.h: * lib/close-stream.c, lib/closein.c, lib/closeout.c, lib/closeout.h: * lib/csharpcomp.h, lib/csharpexec.h, lib/cycle-check.c: * lib/cycle-check.h, lib/des.h, lib/dfa.h, lib/diffseq.h: * lib/dirname.h, lib/exclude.c, lib/exclude.h, lib/execute.c: * lib/execute.h, lib/execvpe.c, lib/fatal-signal.c, lib/fchdir.c: * lib/file-set.h, lib/filevercmp.c, lib/findprog-in.c: * lib/findprog.c, lib/findprog.h, lib/fma.c, lib/fnmatch.c: * lib/fopen.c, lib/freadable.h, lib/freading.h, lib/freopen-safer.c: * lib/fstrcmp.c, lib/fsusage.h, lib/fts.c, lib/fwritable.h: * lib/fwriteerror.c, lib/fwriting.h, lib/gen-uni-tables.c: * lib/getaddrinfo.c, lib/getcwd.c, lib/getloadavg.c: * lib/getndelim2.c, lib/getpass.c, lib/getrandom.c: * lib/git-merge-changelog.c, lib/gl_list.h, lib/gl_map.h: * lib/gl_omap.h, lib/gl_oset.h, lib/gl_set.h, lib/glob.c: * lib/glthread/cond.h, lib/hamt.h, lib/hard-locale.h: * lib/hash-triple.h, lib/hash.h, lib/human.h, lib/i-ring.h: * lib/isapipe.c, lib/javacomp.h, lib/javaexec.h, lib/javaversion.c: * lib/lchown.c, lib/localeinfo.h, lib/localename.c: * lib/long-options.h, lib/malloc/dynarray.h, lib/mbchar.h: * lib/mbfile.h, lib/mbiter.h, lib/mbmemcasecoll.h, lib/mbscasestr.c: * lib/mbsstr.c, lib/mbuiter.h, lib/mkdir-p.h, lib/modechange.h: * lib/mountlist.h, lib/nanosleep.c, lib/nonblocking.h: * lib/nstrftime.c, lib/openat.c, lib/openat.h, lib/os2-spawn.c: * lib/parse-datetime.h, lib/pipe-filter-aux.c, lib/pipe-filter-gi.c: * lib/pipe-filter-ii.c, lib/pipe-filter.h, lib/posixtm.h: * lib/priv-set.c, lib/progreloc.c, lib/propername.c: * lib/pthread-spin.c, lib/quotearg.c, lib/readtokens.c: * lib/readtokens0.h, lib/readutmp.c, lib/regex-quote.h: * lib/regex_internal.h, lib/relocwrapper.c, lib/rename.c: * lib/renameatu.c, lib/rpmatch.c, lib/same.c, lib/same.h: * lib/save-cwd.c, lib/savewd.c, lib/savewd.h, lib/spawn-pipe.h: * lib/spawni.c, lib/stack.h, lib/stat.c, lib/stdckdint.in.h: * lib/strcasestr.c, lib/strfmon_l.c, lib/striconveh.c: * lib/striconveha.h, lib/string-buffer.h, lib/strptime.c: * lib/strstr.c, lib/strtod.c, lib/supersede.h, lib/system-quote.c: * lib/tempname.c, lib/term-style-control.c: * lib/term-style-control.h, lib/textstyle.in.h, lib/time_rz.c: * lib/tmpdir.c, lib/tmpdir.h, lib/tmpfile.c, lib/unicase.in.h: * lib/unicase/caseprop.h, lib/unicase/invariant.h: * lib/unicase/u16-casemap.c, lib/unicase/u16-ct-totitle.c: * lib/unicase/u16-is-invariant.c, lib/unicase/u32-casemap.c: * lib/unicase/u32-ct-totitle.c, lib/unicase/u32-is-invariant.c: * lib/unicase/u8-casemap.c, lib/unicase/u8-ct-totitle.c: * lib/unicase/u8-is-invariant.c, lib/unictype.in.h: * lib/unigbrk.in.h, lib/unigbrk/u16-grapheme-breaks.c: * lib/unigbrk/u32-grapheme-breaks.c: * lib/unigbrk/u8-grapheme-breaks.c: * lib/unigbrk/uc-grapheme-breaks.c, lib/uniname/uniname.c: * lib/unistr.in.h, lib/unlinkdir.h, lib/userspec.h, lib/utime.c: * lib/utimecmp.c, lib/utimens.c, lib/wait-process.h: * lib/windows-cond.c, lib/windows-spawn.c, lib/windows-spawn.h: * lib/windows-timedrwlock.c, lib/write-any-file.h, lib/xbinary-io.c: * lib/xstrtod.h, lib/yesno.h: * tests/nap.h, tests/qemu.h, tests/test-areadlink-with-size.c: * tests/test-areadlink.c, tests/test-areadlinkat-with-size.c: * tests/test-areadlinkat.c, tests/test-base32.c: * tests/test-base64.c, tests/test-ceil2.c, tests/test-ceilf2.c: * tests/test-chown.c, tests/test-dirname.c, tests/test-dup-safer.c: * tests/test-dup3.c, tests/test-exclude.c: * tests/test-execute-child.c, tests/test-execute-main.c: * tests/test-execute-script.c, tests/test-explicit_bzero.c: * tests/test-fchownat.c, tests/test-fcntl-safer.c: * tests/test-fcntl.c, tests/test-fdutimensat.c: * tests/test-filenamecat.c, tests/test-floor2.c: * tests/test-floorf2.c, tests/test-fstatat.c, tests/test-fstrcmp.c: * tests/test-futimens.c, tests/test-getlogin.h, tests/test-getopt.h: * tests/test-hard-locale.c, tests/test-hash.c: * tests/test-idpriv-drop.c, tests/test-idpriv-droptemp.c: * tests/test-immutable.c, tests/test-intprops.c: * tests/test-lchown.c, tests/test-link.c, tests/test-linkat.c: * tests/test-lstat.c, tests/test-mbmemcasecmp.c: * tests/test-mbmemcasecoll.c, tests/test-mkdir.c: * tests/test-mkdirat.c, tests/test-mkfifo.c, tests/test-mkfifoat.c: * tests/test-mknod.c, tests/test-nonblocking-pipe-child.c: * tests/test-nonblocking-pipe-main.c: * tests/test-nonblocking-socket-child.c: * tests/test-nonblocking-socket-main.c, tests/test-open.c: * tests/test-openat.c, tests/test-pipe.c, tests/test-pipe2.c: * tests/test-poll.c, tests/test-posix_spawn-chdir.c: * tests/test-posix_spawn-dup2-stdin.c: * tests/test-posix_spawn-dup2-stdout.c: * tests/test-posix_spawn-fchdir.c, tests/test-posix_spawn-open1.c: * tests/test-posix_spawn-open2.c, tests/test-quotearg-simple.c: * tests/test-quotearg.c, tests/test-readlink.c: * tests/test-readlinkat.c, tests/test-readtokens.c: * tests/test-rename.c, tests/test-renameat.c: * tests/test-renameatu.c, tests/test-rmdir.c, tests/test-round2.c: * tests/test-select.h, tests/test-spawn-pipe-child.c: * tests/test-spawn-pipe-main.c, tests/test-spawn-pipe-script.c: * tests/test-stack.c, tests/test-stat.c, tests/test-supersede.c: * tests/test-symlink.c, tests/test-symlinkat.c: * tests/test-system-quote-main.c: * tests/test-term-style-control-hello.c: * tests/test-term-style-control-yes.c, tests/test-timespec.c: * tests/test-trunc2.c, tests/test-truncf2.c, tests/test-unlink.c: * tests/test-unlinkat.c, tests/test-userspec.c, tests/test-utime.c: * tests/test-utimens.c, tests/test-utimensat.c: * tests/unictype/test-categ_byname.c: * tests/unigbrk/test-uc-is-grapheme-break.c: Don’t include stdbool.h. * modules/acl, modules/xgetcwd: Don’t depend on stdbool, as these modules don’t use bool. * modules/argp, modules/bitset, modules/diffseq, modules/file-has-acl: * modules/gen-uni-tables, modules/getrandom: * modules/hash-triple-simple, modules/posix_spawn-internal: * modules/strcasestr, modules/supersede, modules/system-quote: * modules/uniconv/base, modules/uniname/uniname, modules/utime: * modules/windows-timedrwlock: Depend on stdbool, as these modules use bool.
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051-1/+1
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* maint: run 'make update-copyright'Paul Eggert2022-01-011-1/+1
|
* * lib/quotarg.c: remove wrong, unneeded commentPaul Eggert2021-08-011-1/+0
|
* quotearg: avoid undefined and/or O(N**2)Paul Eggert2021-04-031-9/+9
| | | | | | | | | Avoid undefined and O(N**2) behavior in some very unlikely cases. * lib/quotearg.c (quotearg_n_options): Document that N must be less than MIN (INT_MAX, IDX_MAX), and add this to the abort test; this also avoids a conditional branch. Use xpalloc instead of xrealloc, to avoid O(N**2) behavior in very-unlikely cases.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* attribute: new modulePaul Eggert2020-05-031-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: Add encoding marker for Emacs to non-ASCII sources.Bruno Haible2018-01-051-0/+7
| | | | | | | | | | | | | | | | | | | Similar to commit f406941a8a2ec5fbf3eacc386b9be09d6593d53b from Paul Eggert <eggert@cs.ucla.edu> 2015-09-24. To determine the file list that need the marker, I used the command: for f in `find . -type f | grep -v '^\./\.git/' | grep -v '^\./tests/'`; do if iconv -f ASCII -t ASCII < $f > /dev/null 2>&1 ; then : ; else if iconv -f UTF-8 -t UTF-8 < $f > /dev/null 2>&1 ; then if grep 'The GNU C Library is' $f > /dev/null; then :; else if grep 'coding: utf-8' $f > /dev/null; then :; else echo $f fi fi fi fi done | LC_ALL=C sort
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* quotearg: pacify compiler re unsignedPaul Eggert2017-10-191-1/+2
| | | | | | | * lib/quotearg.c (quotearg_n_options): Rewrite to avoid diagnostic from overly-picky compiler. Problem reported by Sami Kerola in: https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00060.html
* all: Replace many more http URLs by https URLs. Update stale URLs.Bruno Haible2017-09-141-1/+1
| | | | | * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* quotearg: fix compilation failure due to FALLTHROUGH misuseJim Meyering2017-05-251-1/+1
| | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Revert one FALLTHROUGH macro back to /* fall through */ comment. The macro can apply only to a following case statement. Reported by Assaf Gordon.
* fallthrough: reinstate a FALLTHROUGH instance in quoteargBernhard Voelker2017-05-221-0/+1
| | | | | quotearg.c: Reinstate this instance which is significant when the if branch is not taken.
* fallthrough: update for GCC 7/8Jim Meyering2017-05-191-8/+15
| | | | | | | | | | | | | | | | * lib/quotearg.c (FALLTHROUGH): New macro. Use it whenever one switch case falls through into the next, replacing "/* Fall through */" comments. This exposed one instance of an unwarranted "fall through" comment: unwarranted because it preceded a "goto" label not a case statement. * lib/freopen-safer.c (freopen_safer): Likewise. * lib/fts.c (leaf_optimization_applies): Likewise. * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise. * tests/test-getopt_long.h (getopt_long_loop): Likewise. * tests/test-tsearch.c (mangle_tree): Likewise. Also include tests/macros.h for the definition. * tests/test-argp.c (group1_parser): Likewise. * tests/test-getopt.h (getopt_loop): Likewise.
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * 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'.
* quotearg: pacify GCC betterPaul Eggert2016-12-151-14/+9
| | | | | | | | | | * modules/quotearg (Depends-on): Add minmax, stdint. * lib/quotearg.c: Include minmax.h, stdint.h. (nslots): Now int, as there seems little point to going to extra work merely to support the INT_MAX slot, which nobody ever uses. (quotearg_n_options): Redo size-overflow checks to pacify GCC and to catch (mostly-theoretical) ptrdiff_t problems too. This can be done via one comparison.
* quotearg: never write beyond the returned lengthPádraig Brady2016-10-191-5/+28
| | | | | | | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Switch to a read-only scan of the string when we initially encounter a single quote when shell quoting, so that if we then switch to a more concise quoting method we will not have written beyond that returned length. This is significant for sh-quote, which has separate routines to determine the length and do the actual quoting. * tests/test-quotearg.h: Reinstate the buffer bounds checking now that we never write more than the returned length.
* quotearg: minimize shell quoting using double quotesPádraig Brady2016-10-031-0/+24
| | | | | | | | | | | I.E. 'it'\''s awkward like this'; "it's better like this" * lib/quotearg.c (quotearg_buffer_restyled): If an ASCII single quote in encountered then use double quotes (c style quoting) when possible, as it simplifies the quoting. * tests/test-quotearg-simple.c: Add test cases. * tests/test-quotearg.h (use_quotearg_buffer): Adjust to account for the fact we now may write beyond the returned length.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * 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'.
* quotearg: add quotearg_n_style_colon()Pádraig Brady2015-11-041-0/+9
| | | | | | | | | | | | | This quotes with default options of the specified style, but with quoting enabled for instances of ':'. While this can be simulated by temporarily modifying the default quoting style, this is a little awkward, and care must be taken with such an implementation to avoid inlining leading to bloated text. * lib/quotearg.h (quotearg_n_style_colon): Description and declaration. * lib/quotearg.c (quotearg_n_style_colon): New function implementation.
* quotearg: constify get_quoting_style parametersPádraig Brady2015-11-031-1/+1
| | | | | * lib/quotearg.h (get_quoting_style): Mark parameter as const. * lib/quotearg.c (get_quoting_style): Likewise.
* quotearg: add support for $'' shell escapingPádraig Brady2015-11-021-13/+67
| | | | | | | | | | * lib/quotearg.h: Add "shell-escape" and "shell-escape-always" items and descriptions. * lib/quotearg.c (quotearg_buffer_restyled): Add support for the above types by quoting like "shell", but using $'...' syntax for non printable characters, which should provide unambiguous printable output for any input. * tests/test-quotearg-simple.c: Update accordingly.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* mbsstr, quotearg, xstrtol: pacify IRIX 6.5 ccPaul Eggert2014-05-111-1/+1
| | | | | | | | | | These were found when building the latest grep snapshot on IRIX 6.5. * lib/mbsstr.c (knuth_morris_pratt_multibyte): Break "a=b=c;" into "b=c; a=b;", since IRIX 6.5 cc complains about the former if b is never used later. * lib/quotearg.c (quoting_options_from_style): * lib/xstrtol.c (__xstrtol): Use enum instead of 0, to pacify IRIX 6.5 cc.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* quotearg: don't attempt to store 1 << 31 into an "int"Jim Meyering2013-11-221-1/+1
| | | | | | | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Building coreutils with gcc's new -fsanitize=undefined and running its tests triggered some new test failures due to undefined behavior, all with this diagnostic: lib/quotearg.c:629:62: runtime error: left shift of 1 by 31 places \ cannot be represented in type int Rather than shifting "1" left to form a mask, shift the bits right and simply use "1" as the mask. Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
* quotearg: do not read beyond end of bufferJim Meyering2013-05-141-1/+6
| | | | | | | | | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Do not read beyond the end of an ARG for which no length was specified. With an N-byte quote string, (e.g., N is 3 in the fr_FR.UTF-8 locale), this function would read N-2 bytes beyond ARG's trailing NUL. This was triggered via coreutils' misc/sort-debug-keys.sh test and detected by running the test against a binary compiled with gcc-4.8.0's -fsanitize=address. * tests/test-quotearg-simple.c (main): Add a test to trigger the bug. * modules/quotearg-simple-tests (Files): Add tests/zerosize-ptr.h. Introduced via the 2000-01-15 commit, c4b7f3f8, "Quote multibyte characters correctly."
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* quote: provide a means to escape strings with nul charactersAkim Demaille2012-11-011-5/+17
| | | | | | * lib/quote.h, lib/quotearg.c (quote_mem, quote_n_mem): New functions. (quote, quote_n): Rename formal arguments for consistency with quotearg.
* quote: fuse into quoteargAkim Demaille2012-03-061-1/+24
| | | | | | | | | | | | | | | | This patch is made for the benefit of Bison. quote does not leave the choice of the quoting style to the user. quoting_style provides poor customizability, yet quoting_options, which is very rich, is hidden inside quotearg.c. So in order to allow quote customization, move its implementation to quotearg.c. * lib/quote.c: Remove. * modules/quote: Adjust. * lib/quotearg.c (quoting_options_from_style): Fix a compiler warning: provide all the members of literal structs. (quote_quoting_options): New. (quote, quote_n): Import implementation from quote.c. * lib/quote.h: Import the comments from quote.c. (quote_quoting_options): New.
* quotearg: do not use grave accent for left quotePaolo Bonzini2012-01-071-5/+2
| | | | | | * lib/quotearg.c (gettext_quote): Map "`" to "'" for locale_quoting_style. (quotearg_buffer_restyled): Fix example. * tests/test-quotearg-simple.c (results_g): Adjust test vectors.
* quotearg: fall back to Unicode single quotes in UTF-8 and GB-18030 localesPaolo Bonzini2012-01-071-14/+50
| | | | | | | | | | | | | | | | | | | Most programs do not have translation catalogs for English and much less separate catalogs for British and American English. Drop the suggestion to translators about these two, and provide it automatically for Unicode locales. Like most programs, even those using American English, we use single quotation marks. This conflicts with the American typographic convention, but works better when you cite the entire error message within double quotes. It also tries not to clash with established practice and with what non-gnulib programs will usually do. * lib/quotearg.c (gettext_quote): Hard-code U+2018 and U+2019 when using an UTF-8 or GB-18030 locale. The list of other locales with quotes was provided by Bruno Haible. (quotearg_buffer_restyled): Adjust instructions to translators. * lib/quotearg.h (locale_quoting_style): Do not put an example in the text, since this would be wrong when using Unicode. * modules/quotearg: Depend on c-strcaseeq.
* quotearg: fix Wikipedia linkPaolo Bonzini2012-01-071-1/+1
| | | | * lib/quotearg.c (quotearg_buffer_restyled): Fix link to Wikipedia.
* In commentary, do not use ` to quote.Paul Eggert2012-01-051-1/+1
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* quotearg, propername: correct pragma guard expressionJim Meyering2011-11-291-1/+1
| | | | | * lib/quotearg.c: Enable pragma for gcc-4.6 and newer, not 4.3 and newer. * lib/propername.c: Likewise. Reported by Bernhard Voelker.
* mark functions with const and pure attributesJim Meyering2011-11-281-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark functions per suggestions from gcc-4.6 when using these options: -Wsuggest-attribute=pure -Wsuggest-attribute=const. Use gnulib's _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST macros. Follow these guidelines: when possible, apply the attribute to an extern declaration, not to its definition. Apply it to the definition only when the definition is static. * lib/argmatch.h (argmatch, argmatch_to_argument): Mark. * lib/argv-iter.h (argv_iter_n_args): Likewise. * lib/base64.h (isbase64): Likewise. * lib/basename-lgpl.c (last_component, base_len): Likewise. * lib/c-ctype.h (c_isascii, c_isalnum, c_isalpha): Likewise. (c_isblank, c_iscntrl, c_isdigit, c_islower, c_isgraph): Likewise. (c_isprint, c_ispunct, c_isspace, c_isupper, c_isxdigit): Likewise. (c_tolower, c_toupper): Likewise. * lib/c-strcase.h (c_strcasecmp, c_strncasecmp): Likewise. * lib/chdir-long.c (find_non_slash): Likewise. * lib/dirname.h (base_len, dir_len, last_component): Likewise. * lib/exclude.h (fnmatch_pattern_has_wildcards): Likewise. * lib/file-type.h (file_type): Likewise. * lib/filenamecat-lgpl.c (longest_relative_suffix): Likewise. * lib/filevercmp.c (verrevcmp): Likewise. * lib/freadahead.h (freadahead): Likewise. * lib/fts.c (fts_maxarglen): Likewise. * lib/hash-pjw.h (hash_pjw): Likewise. * lib/hash-triple.h (triple_hash_no_name, triple_compare_ino_str): * lib/hash.c (is_prime, next_prime): Likewise. * lib/hash.c (hash_get_n_buckets, hash_get_n_buckets_used): Likewise. (hash_get_n_entries, hash_get_max_bucket_length): Likewise. (hash_table_ok, hash_get_first, hash_string): Likewise. (compute_bucket_size): Likewise. * lib/i-ring.h (i_ring_empty): Likewise. * lib/isnan.c (isnanl): Likewise. * lib/math.h (isnanl, rpl_isnanl): Likewise. * lib/memcasecmp.h (memcasecmp): Likewise. * lib/memchr2.h (memchr2): Likewise. * lib/memcmp2.h (memcmp2): Likewise. * lib/parse-datetime.y (lookup_zone): Likewise. * lib/sockets.h (gl_sockets_startup, gl_sockets_cleanup) [!WINDOWS_SOCKETS]: Likewise. * lib/strnlen1.h (strnlen1): Likewise. * lib/uniwidth.in.h (uc_width): Likewise, but since this is installed as a public header by libunistring, it cannot depend on the macro definitions of gnulib-common.m4, so open-code the __attribute__... * lib/quotearg.c: Add pragma to avoid unwarranted suggestion from gcc's -Wsuggest-attribute=pure for quoting_options_from_style. (quoting_options_from_style): Add a comment. * lib/propername.h (proper_name): Add a comment.
* quotearg: avoid uninitialized variable useEric Blake2011-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity correctly deduced: Error: UNINIT: m4-1.4.16/lib/quotearg.c:171: var_decl: Declaring variable "o" without initializer. m4-1.4.16/lib/quotearg.c:175: uninit_use: Using uninitialized value "o": field "o".right_quote is uninitialized. When custom_quoting_style was introduced in commit 12247f77, this method was not updated, and any caller that passed the new enum value to any of the existing quotearg_*style functions could trigger a crash from the uninitialized memory. That was already documented as unspecified behavior, though, so changing to an abort makes it easier to spot bad code that passes the wrong enum value, rather than waiting for the eventual bad memory dereference later on. Most callers of quotearg_*style were using quoting_style_args and quoting_style_vals to map strings to particular enum values, and custom_quoting_style is (intentionally) not covered by these arrays, so the pre-patch bug/post-patch abort are not possible with those callers. * lib/quotearg.c (quoting_options_from_style): Initialize remaining fields, and ensure that custom styles are only used via quoting_options rather than quoting_style. Signed-off-by: Eric Blake <eblake@redhat.com>
* Revert "use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE"Jim Meyering2011-04-251-9/+1
| | | | | This reverts commit 349d7fe0e307d59d508b3579317ee8d4eacfeb9c. Revert accidentally-pushed patch. Not yet ready.
* use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PUREJim Meyering2011-04-251-1/+9
|
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-2/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-2/+2
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-355/+355
|
* quotearg: document limitations of quote_these_tooJoel E. Denny2009-08-231-1/+7
| | | | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Add comments where those limitations are created. * lib/quotearg.h (set_char_quoting): Document that digits and letters that are special after backslash are not permitted. (quotearg_char): Cross-reference set_char_quoting documentation.
* quotearg: implement custom_quoting_styleJoel E. Denny2009-08-231-32/+109
| | | | | | | | | | | | | | | | | | | | | | * lib/quotearg.c: (struct quoting_options): Add left_quote and right_quote fields. (set_custom_quoting): New public function. (quotearg_buffer_restyled): Add left_quote and right_quote arguments, handle them very much like locale quoting, and update all uses. (quotearg_n_custom): New public function. (quotearg_n_custom_mem): New public function. (quotearg_custom): New public function. (quotearg_custom_mem): New public function. * lib/quotearg.h: Prototype and document new public functions. (enum quoting_style): For escape_quoting_style and clocale_quoting_style, comment that QA_SPLIT_TRIGRAPHS is ignored even though they're otherwise like c_quoting_style. Add custom_quoting_style member and document with comparison to clocale_quoting_style. * tests/test-quotearg.c (custom_quotes): New array. (custom_results): New array. (main): Extend to test custom quoting.