summaryrefslogtreecommitdiff
path: root/lib/unistr
Commit message (Collapse)AuthorAgeFilesLines
* unistr/u8-strstr: Simplify code.Bruno Haible2023-04-022-147/+23
| | | | | | * lib/unistr/u8-strstr.c: Inline the contents of lib/unistr/u-strstr.h. * lib/unistr/u-strstr.h: Remove file. * modules/unistr/u8-strstr (Files): Remove it.
* unistr/u{16,32}-strstr: Use two-way algorithm (no memory allocation).Bruno Haible2023-04-022-23/+10
| | | | | | | | | | | | | | | | | | | | | | | * lib/wcs-two-way.h: Use UNIT instead of wchar_t. Don't undefine RETURN_TYPE. * lib/wcsstr-impl.h: Move the non-linear implementation away. Use UNIT instead of wchar_t, RETURN_TYPE instead of 'wchar_t *', FUNC instead of wcsstr. (AVAILABLE): Use MEMCHR0 instead of wmemchr. (FUNC): Use STRCHR instead of wcschr. * lib/wcsstr.c: Moved the non-linear implementation to here. (FUNC, UNIT, RETURN_TYPE, MEMCHR0, STRCHR): New macros. * lib/unistr/u16-strstr.c: Don't include malloca.h, str-kmp.h, u-strstr.h. Instead, include wcsstr-impl.h. * lib/unistr/u32-strstr.c: Likewise. * modules/unistr/u16-strstr (Files): Remove u-strstr.h, str-kmp.h. Add wcsstr-impl.h, wcs-two-way.h. (Depends-on): Remove u16-strmbtouc, u16-strlen, u16-strnlen, malloca. Add u16-chr, u16-cmp. * modules/unistr/u32-strstr (Files): Remove u-strstr.h, str-kmp.h. Add wcsstr-impl.h, wcs-two-way.h. (Depends-on): Remove u32-strlen, u32-strnlen, malloca. Add u32-chr, u32-cmp.
* maint: run 'make update-copyright'Simon Josefsson2023-01-01151-151/+151
|
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-05134-134/+134
| | | | | | | | | 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-01151-151/+151
|
* Put "LGPLv3+ or GPLv2+" notices in source files where appropriate.Bruno Haible2021-06-04134-1094/+2166
| | | | | * lib/**.{h,c,gperf}: Use "LGPLv3+ or GPLv2+" notice whenever the module description says so.
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-0417-119/+119
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* maint: run 'make update-copyright'Paul Eggert2020-12-31151-151/+151
|
* unistr/u{8,16,32}-uctomb: Avoid possible trouble with huge strings.Bruno Haible2020-09-055-5/+5
| | | | | | | | | | * lib/unistr.in.h (u8_uctomb_aux, u8_uctomb, u16_uctomb_aux, u16_uctomb, u32_uctomb): Change type of last argument to ptrdiff_t. * lib/unistr/u8-uctomb.c (u8_uctomb): Likewise. * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise. * lib/unistr/u16-uctomb.c (u16_uctomb): Likewise. * lib/unistr/u16-uctomb-aux.c (u16_uctomb_aux): Likewise. * lib/unistr/u32-uctomb.c (u32_uctomb): Likewise.
* strdup: Assume the function exists.Bruno Haible2020-08-141-12/+1
| | | | | | | | | | | | | * m4/strdup.m4 (gl_FUNC_STRDUP, gl_FUNC_STRDUP_POSIX): Don't test whether strdup exists. * modules/strdup (Files): Remove lib/strdup.c. (configure.ac): Don't compile strdup.c. * modules/strdup-posix (Depends-on, configure.ac): Don't test ac_cv_func_strdup. * doc/posix-functions/strdup.texi: Update. * lib/unistr/u8-strdup.c: Assume HAVE_STRDUP is 1. * modules/unistr/u8-strdup (Files): Remove lib/unistr/u-strdup.h. (Depends-on): Remove unistr/u8-strlen.
* Optimize three-valued comparison between integers.Bruno Haible2020-07-241-6/+1
| | | | | | | | | | | | | | | | | | | (a > b ? 1 : a < b ? -1 : 0) is the same as (a > b) - (a < b). * m4/gnulib-common.m4 (gl_COMMON): Define _GL_CMP. * lib/c-strcasecmp.c (c_strcasecmp): Use _GL_CMP. * lib/c-strncasecmp.c (c_strncasecmp): Likewise. * lib/dfa.c (compare): Likewise. * lib/fts.c (fts_compare_ino): Likewise. * lib/mbmemcasecmp.c (mbmemcasecmp): Likewise. * lib/mbscasecmp.c (mbscasecmp): Likewise. * lib/mbsncasecmp.c (mbsncasecmp): Likewise. * lib/memcasecmp.c (memcasecmp): Likewise. * lib/memcmp2.c (memcmp2): Likewise. * lib/savedir.c (direntry_cmp_inode): Likewise. * lib/strcasecmp.c (strcasecmp): Likewise. * lib/strncasecmp.c (strncasecmp): Likewise. * lib/unistr/u-cmp2.h (FUNC): Likewise.
* attribute: new modulePaul Eggert2020-05-032-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* unistr/u8-uctomb: Fix warning.Bruno Haible2020-01-201-0/+10
| | | | | | | | Reported by Andreas Schwab <schwab@suse.de> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-01/msg00127.html>. * lib/unistr/u8-uctomb.c (FALLTHROUGH): New macro. (u8_uctomb): Add FALLTHROUGH markers.
* maint: Run 'make update-copyright'Paul Eggert2019-12-31151-151/+151
|
* unistr/*, uniconv/*: Fix undefined behaviour.Bruno Haible2019-03-092-2/+4
| | | | | | | | | Reported by Jeffrey Walton <noloader@gmail.com>. * lib/unistr/u-cpy.h (FUNC): Don't invoke memcpy with a zero size. * lib/unistr/u-cpy-alloc.h (FUNC): Likewise. * lib/uniconv/u8-conv-from-enc.c (u8_conv_from_encoding): Likewise. * lib/uniconv/u8-conv-to-enc.c (u8_conv_to_encoding): Likewise.
* unistr/u8-cmp: Fix undefined behaviour.Bruno Haible2019-03-091-1/+1
| | | | | | Reported by Jeffrey Walton <noloader@gmail.com>. * lib/unistr/u8-cmp.c (u8_cmp): Don't invoke memcmp if n is zero.
* maint: Run 'make update-copyright'Paul Eggert2019-01-01151-151/+151
|
* maint: Run 'make update-copyright'Paul Eggert2018-01-01151-151/+151
|
* all: prefer https: URLsPaul Eggert2017-09-13151-151/+151
|
* fallthrough: update for GCC 7/8Jim Meyering2017-05-191-2/+10
| | | | | | | | | | | | | | | | * 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-01151-151/+151
| | | | | | | | | | * 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'.
* Enable Unicode decoder safety unconditionally.Bruno Haible2016-11-1925-849/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/unistr.in.h (u32_mbtouc_unsafe): Assume CONFIG_UNICODE_SAFETY. * lib/unistr/u8-mblen.c (u8_mblen): Likewise. * lib/unistr/u8-mbtouc-unsafe.c (u8_mbtouc_unsafe): Likewise. * lib/unistr/u8-mbtouc-unsafe-aux.c (u8_mbtouc_unsafe_aux): Likewise. * lib/unistr/u8-prev.c (u8_prev): Likewise. * lib/unistr/u8-strmblen.c (u8_strmblen): Likewise. * lib/unistr/u8-strmbtouc.c (u8_strmbtouc): Likewise. * lib/unistr/u16-mblen.c (u16_mblen): Likewise. * lib/unistr/u16-mbtouc-unsafe.c (u16_mbtouc_unsafe): Likewise. * lib/unistr/u16-mbtouc-unsafe-aux.c (u16_mbtouc_unsafe_aux): Likewise. * lib/unistr/u16-prev.c (u16_prev): Likewise. * lib/unistr/u16-strmblen.c (u16_strmblen): Likewise. * lib/unistr/u16-strmbtouc.c (u16_strmbtouc): Likewise. * lib/unistr/u32-mblen.c (u32_mblen): Likewise. * lib/unistr/u32-mbtouc-unsafe.c (u32_mbtouc_unsafe): Likewise. * lib/unistr/u32-prev.c (u32_prev): Likewise. * lib/unistr/u32-next.c (u32_next): Likewise. * lib/unistr/u32-strmblen.c (u32_strmblen): Likewise. * lib/unistr/u32-strmbtouc.c (u32_strmbtouc): Likewise. * lib/uniconv/u8-conv-to-enc.c (u8_conv_to_encoding): Likewise. * lib/uniconv/u8-strconv-to-enc.c (u8_strconv_to_encoding): Likewise. * tests/unistr/test-u16-prev.c (check_invalid): Enable the CONFIG_UNICODE_SAFETY tests unconditionally. * tests/unistr/test-u32-mblen.c (main): Likewise. * tests/unistr/test-u32-mbtouc.h (test_function): Likewise. * tests/unistr/test-u32-prev.c (check_invalid): Likewise. * tests/unistr/test-u32-next.c (main): Likewise. * tests/unistr/test-u32-strmblen.c (main): Likewise. * tests/unistr/test-u32-strmbtouc.c (main): Likewise. * tests/unistr/test-u32-mbtouc.c (FULL_SAFETY): Remove macro. * lib/unistr/u8-check.c (u8_check): Remove old dead code. * lib/unistr/u8-mbtouc.c (u8_mbtouc): Likewise. * lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Likewise. * lib/unistr/u8-mbtoucr.c (u8_mbtoucr): Likewise. * lib/unistr/u8-uctomb.c (u8_uctomb): Likewise. * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Likewise. * lib/unistr/u16-check.c (u16_check): Update comment. * NEWS: Mention the changes that callers should be aware of.
* u8-uctomb-aux.c: build: placate GCC 7's new -Wimplicit-fallthroughJim Meyering2016-09-281-0/+2
| | | | | * lib/unistr/u8-uctomb-aux.c (u8_uctomb_aux): Mark each end of fall-through case with a /* fallthrough */ comment.
* version-etc: new yearPaul Eggert2016-01-01151-151/+151
| | | | | | | | | | * 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'.
* maint: add coding cookies to non-ASCII sourcesPaul Eggert2015-09-241-1/+1
| | | | | | | | | | | | Otherwise, Emacs might do the wrong thing if run in an he_IL.ISO-8859-8 locale, which an Emacs developer does on occasion. Problem reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00966.html Don't bother with test files, as they aren't copied to the Emacs source directory. If this problem affects test files in some other GNU project, we can add coding cookies to the non-ASCII test files later.
* unistr/uN-strtok: handle multibyte delimitersSeiya Kawashima2015-07-034-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, uN_strtok moved PTR to the next unit to the token end. When DELIM contained a multibyte character, the new position could be a middle of a multibyte character. * lib/unistr/u-strtok.h (FUNC): Place PTR at the next character after the token. * lib/unistr/u8-strtok.c (U_STRMBLEN): New macro. * lib/unistr/u16-strtok.c (U_STRMBLEN): New macro. * lib/unistr/u32-strtok.c (U_STRMBLEN): New macro. * modules/unistr/u8-strtok (Depends-on): Depend on unistr/u8-strmblen. * modules/unistr/u16-strtok (Depends-on): Depend on unistr/u16-strmblen. * modules/unistr/u32-strtok (Depends-on): Depend on unistr/u32-strmblen. * tests/unistr/test-u-strtok.h: New file. * tests/unistr/test-u8-strtok.c: New file. * tests/unistr/test-u16-strtok.c: New file. * tests/unistr/test-u32-strtok.c: New file. * modules/unistr/u8-strtok-tests: New file. * modules/unistr/u32-strtok-tests: New file. * modules/unistr/u16-strtok-tests: New file. Copyright-paperwork-exempt: yes Co-authored-by: Daiki Ueno <ueno@gnu.org>
* version-etc: new yearPaul Eggert2014-12-31151-151/+151
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-01151-151/+151
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesEric Blake2013-01-01151-151/+151
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* maint: update all copyright year number rangesJim Meyering2012-01-01151-151/+151
| | | | Run "make update-copyright".
* Make uN_strstr functions O(n) worst-case.Bruno Haible2011-01-214-17/+108
| | | | | | | | | | | | | | | | | | | | | | * lib/unistr/u-strstr.h (FUNC): In the 8-bit case, use strstr. In the 16-bit and 32-bit unit cases, use the unibyte algorithm from lib/mbsstr.c. * lib/unistr/u8-strstr.c: Include <string.h>. (UNIT_IS_UINT8_T): New macro. * lib/unistr/u16-strstr.c: Include malloca.h and str-kmp.h. (U_STRLEN, U_STRNLEN): New macros. * lib/unistr/u32-strstr.c: Include malloca.h and str-kmp.h. (U_STRLEN, U_STRNLEN): New macros. * modules/unistr/u8-strstr (Depends-on): Add strstr. (configure.ac): Update required libunistring version. * modules/unistr/u16-strstr (Files): Add lib/str-kmp.h. (Depends-on): Add unistr/u16-strlen, unistr/u16-strnlen, stdbool, malloca. (configure.ac): Update required libunistring version. * modules/unistr/u32-strstr (Files): Add lib/str-kmp.h. (Depends-on): Add unistr/u32-strlen, unistr/u32-strnlen, stdbool, malloca. (configure.ac): Update required libunistring version.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-01151-151/+151
| | | | Run the new "make update-copyright" rule.
* Port to uClibc.Bruno Haible2010-11-202-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/relocatable.c (find_shared_library_fullname): Treat uClibc like glibc. * lib/strerror_r.c: Likewise. * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise. * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Likewise. * m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise. * m4/glibc21.m4 (gl_GLIBC21): Likewise. * tests/test-sigaction.c (handler, main): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, HAVE_LOCALE_NULL): Treat uClibc like a non-glibc platform. * lib/propername.c (proper_name_utf8): Likewise. * lib/spawn.in.h: Likewise. * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): Likewise. * lib/striconveh.c (iconveh_open, iconv_carefully, iconv_carefully_1, mem_cd_iconveh_internal): Likewise. * lib/striconveha.c (mem_iconveha, str_iconveha): Likewise. * lib/string.in.h (memchr, memrchr, rawmemchr, strchrnul, strpbrk, strstr, strcasestr): Likewise. * lib/unicodeio.c (unicode_to_mb): Likewise. * m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise. * m4/getline.m4 (gl_FUNC_GETLINE): Likewise. * m4/glibc2.m4 (gt_GLIBC2): Likewise. * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Likewise. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Likewise. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE, gl_FUNC_STRCASESTR): Likewise. * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise. * m4/strtod.m4 (gl_FUNC_STRTOD): Likewise. * m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise. * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. * m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. * m4/wchar_h.m4 (gl_WCHAR_H): Likewise. * tests/test-getopt.h (OPTIND_MIN): Likewise. * tests/test-striconveha.c (main): Likewise. * doc/posix-functions/getdelim.texi: Mention an uClibc bug. * doc/posix-functions/getline.texi: Likewise. Reported by Mike Frysinger <vapier@gentoo.org>.
* unistr/u8-mbtouc: Improve handling of ill-formed UTF-8 input.Bruno Haible2010-11-135-171/+521
| | | | | | | | | | | | | | | | | | | | * lib/unistr/u8-mbtouc.c (u8_mbtouc): For an invalid multibyte character, return the number of bytes that belong together, not always 1. * lib/unistr/u8-mbtouc-unsafe.c (u8_mbtouc_unsafe): Likewise. * lib/unistr/u8-mbtouc-aux.c (u8_mbtouc_aux): Likewise. * lib/unistr/u8-mbtouc-unsafe-aux.c (u8_mbtouc_unsafe_aux): Likewise. * lib/unistr/u8-mbsnlen.c (u8_mbsnlen): Use u8_mbtouc to determine the number of bytes of an invalid character. * tests/unistr/test-u8-mbtouc.c (test_safe_function): New function. (main): Invoke it. * tests/unistr/test-u8-mbtouc.h (test_function): Update two test results. * tests/unistr/test-u8-mbsnlen.c (main): Test various kinds of malformed byte sequences. * modules/unistr/u8-mbtouc (configure.ac): Bump version number. * modules/unistr/u8-mbtouc-unsafe (configure.ac): Likewise. * modules/unistr/u8-mbsnlen (configure.ac): Likewise. Reported by Ben Pfaff and Paolo Bonzini.
* Update comments.Bruno Haible2010-11-135-5/+5
| | | | | | | | * lib/unistr/u8-check.c: Update file name in comments. * lib/unistr/u8-mblen.c: Likewise. * lib/unistr/u8-prev.c: Likewise. * lib/unistr/u8-strmblen.c: Likewise. * lib/unistr/u8-strmbtouc.c: Likewise.
* unistr/u8-strstr, unistr/u16-strstr: Optimize the one-character case.Bruno Haible2010-07-313-4/+16
|
* unistr/u8-chr, unistr/u8-strchr: Optimize and add comments.Bruno Haible2010-07-312-11/+71
|
* unistr/u8-strchr: Fix several bugs.Bruno Haible2010-07-311-4/+4
|
* unistr/u*-chr, unistr/u*-strchr: Fix link errors and warnings.Bruno Haible2010-07-281-0/+2
|
* Use spaces for indentation, not tabs.Bruno Haible2010-07-282-9/+9
|
* unistr/u8-chr, unistr/u8-strchr: use Boyer-Moore like algorithm.Paolo Bonzini2010-07-232-71/+246
| | | | | * lib/unistr/u8-chr.c, lib/unistr/u8-strchr.c: Add Boyer-Moore like operation. * modules/unistr/u8-chr: Depend on memchr.
* unistr/u8-strchr: Optimize non-ASCII argument case.Bruno Haible2010-07-181-3/+3
|
* unistr/u8-strchr: Optimize ASCII argument case.Pádraig Brady2010-07-111-6/+21
|
* Don't use conversion with transliteration in u{8,16,32}_strcoll.Bruno Haible2010-05-244-10/+15
|
* unistr/u*-strcoll: Try harder to distinguish different strings.Bruno Haible2010-01-101-0/+6
|
* unistr/u*-stpncpy: Fix the return value.Bruno Haible2010-01-101-3/+7
|
* unistr/u8-mbsnlen: Fix return value for incomplete character.Bruno Haible2010-01-102-4/+10
|
* unistr/u16-to-u32: Reject invalid input.Bruno Haible2010-01-091-1/+1
|
* unistr/u16-to-u8: Reject invalid input.Bruno Haible2010-01-091-1/+1
|
* unistr/u8-to-u32: Reject invalid input.Bruno Haible2010-01-091-1/+1
|