diff options
author | Stephen Kitt <skitt@debian.org> | 2016-05-27 10:11:04 +0200 |
---|---|---|
committer | Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> | 2016-05-27 14:28:33 +0100 |
commit | 752fd7247bc223bcea35bd89cf56d1c08ead9ba6 (patch) | |
tree | b4a428f847a963738faaf24c8eff070fdb03a3a5 /lib/unistr | |
parent | 9f7d4fa477ff2a51d7c932b13d57ac22dc033105 (diff) | |
parent | a9a31b1de5776a3b08a82101a4fa711294f0dd1d (diff) |
Imported Debian patch 0.9.6+really0.9.3-0.1debian/0.9.6+really0.9.3-0.1
Diffstat (limited to 'lib/unistr')
151 files changed, 432 insertions, 1145 deletions
diff --git a/lib/unistr/u-cmp2.h b/lib/unistr/u-cmp2.h index 6ee062d..6058c4a 100644 --- a/lib/unistr/u-cmp2.h +++ b/lib/unistr/u-cmp2.h @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-cpy-alloc.h b/lib/unistr/u-cpy-alloc.h index 5e3ad56..f36a8d0 100644 --- a/lib/unistr/u-cpy-alloc.h +++ b/lib/unistr/u-cpy-alloc.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u-cpy.h b/lib/unistr/u-cpy.h index 2f9f997..6dad952 100644 --- a/lib/unistr/u-cpy.h +++ b/lib/unistr/u-cpy.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-endswith.h b/lib/unistr/u-endswith.h index cd366c1..094a87f 100644 --- a/lib/unistr/u-endswith.h +++ b/lib/unistr/u-endswith.h @@ -1,5 +1,5 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-move.h b/lib/unistr/u-move.h index 13332a0..d8d58b0 100644 --- a/lib/unistr/u-move.h +++ b/lib/unistr/u-move.h @@ -1,5 +1,5 @@ /* Copy piece of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-set.h b/lib/unistr/u-set.h index 8cb2737..de78a8e 100644 --- a/lib/unistr/u-set.h +++ b/lib/unistr/u-set.h @@ -1,5 +1,5 @@ /* Fill UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-startswith.h b/lib/unistr/u-startswith.h index 393dad5..1696651 100644 --- a/lib/unistr/u-startswith.h +++ b/lib/unistr/u-startswith.h @@ -1,5 +1,5 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-stpcpy.h b/lib/unistr/u-stpcpy.h index bbb3623..483f3c2 100644 --- a/lib/unistr/u-stpcpy.h +++ b/lib/unistr/u-stpcpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-stpncpy.h b/lib/unistr/u-stpncpy.h index 545e102..4d6dd3c 100644 --- a/lib/unistr/u-stpncpy.h +++ b/lib/unistr/u-stpncpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strcat.h b/lib/unistr/u-strcat.h index 4119d39..84430fc 100644 --- a/lib/unistr/u-strcat.h +++ b/lib/unistr/u-strcat.h @@ -1,5 +1,5 @@ /* Concatenate UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strcoll.h b/lib/unistr/u-strcoll.h index 014e11b..9ec5c60 100644 --- a/lib/unistr/u-strcoll.h +++ b/lib/unistr/u-strcoll.h @@ -1,6 +1,6 @@ /* Compare UTF-8/UTF-16/UTF-32 strings using the collation rules of the current locale. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -23,19 +23,14 @@ FUNC (const UNIT *s1, const UNIT *s2) When it fails, it sets errno, but also returns a meaningful return value, for the sake of callers which ignore errno. */ int final_errno = errno; - const char *encoding = locale_charset (); char *sl1; char *sl2; int result; - /* Pass iconveh_error here, not iconveh_question_mark. Otherwise the - conversion to locale encoding can do transliteration or map some - characters to question marks, leading to results that depend on the - iconv() implementation and are not obvious. */ - sl1 = U_STRCONV_TO_ENCODING (s1, encoding, iconveh_error); + sl1 = U_STRCONV_TO_LOCALE (s1); if (sl1 != NULL) { - sl2 = U_STRCONV_TO_ENCODING (s2, encoding, iconveh_error); + sl2 = U_STRCONV_TO_LOCALE (s2); if (sl2 != NULL) { /* Compare sl1 and sl2. */ @@ -46,10 +41,10 @@ FUNC (const UNIT *s1, const UNIT *s2) /* strcoll succeeded. */ free (sl1); free (sl2); - /* The conversion to locale encoding can drop Unicode TAG - characters. Therefore sl1 and sl2 may be equal when s1 - and s2 were in fact different. Return a nonzero result - in this case. */ + /* The conversion to locale encoding can do transliteration or + map some characters to question marks. Therefore sl1 and sl2 + may be equal when s1 and s2 were in fact different. Return a + nonzero result in this case. */ if (result == 0) result = U_STRCMP (s1, s2); } @@ -73,7 +68,7 @@ FUNC (const UNIT *s1, const UNIT *s2) else { final_errno = errno; - sl2 = U_STRCONV_TO_ENCODING (s2, encoding, iconveh_error); + sl2 = U_STRCONV_TO_LOCALE (s2); if (sl2 != NULL) { /* s2 could be converted to locale encoding, s1 not. */ diff --git a/lib/unistr/u-strcpy.h b/lib/unistr/u-strcpy.h index aca6847..b059aea 100644 --- a/lib/unistr/u-strcpy.h +++ b/lib/unistr/u-strcpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strcspn.h b/lib/unistr/u-strcspn.h index bb287d8..77b9550 100644 --- a/lib/unistr/u-strcspn.h +++ b/lib/unistr/u-strcspn.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strdup.h b/lib/unistr/u-strdup.h index 80cb454..a92e1ef 100644 --- a/lib/unistr/u-strdup.h +++ b/lib/unistr/u-strdup.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u-strlen.h b/lib/unistr/u-strlen.h index 11d9831..a54d614 100644 --- a/lib/unistr/u-strlen.h +++ b/lib/unistr/u-strlen.h @@ -1,5 +1,5 @@ /* Determine length of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strncat.h b/lib/unistr/u-strncat.h index f202d32..e5c9a04 100644 --- a/lib/unistr/u-strncat.h +++ b/lib/unistr/u-strncat.h @@ -1,5 +1,5 @@ /* Concatenate UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strncpy.h b/lib/unistr/u-strncpy.h index 8354d0c..55a4f67 100644 --- a/lib/unistr/u-strncpy.h +++ b/lib/unistr/u-strncpy.h @@ -1,5 +1,5 @@ /* Copy UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strnlen.h b/lib/unistr/u-strnlen.h index bcf1e03..9bcc3da 100644 --- a/lib/unistr/u-strnlen.h +++ b/lib/unistr/u-strnlen.h @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strpbrk.h b/lib/unistr/u-strpbrk.h index 60653ab..34aabc5 100644 --- a/lib/unistr/u-strpbrk.h +++ b/lib/unistr/u-strpbrk.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strspn.h b/lib/unistr/u-strspn.h index d15c46e..d6669af 100644 --- a/lib/unistr/u-strspn.h +++ b/lib/unistr/u-strspn.h @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u-strstr.h b/lib/unistr/u-strstr.h index 459215e..df32be8 100644 --- a/lib/unistr/u-strstr.h +++ b/lib/unistr/u-strstr.h @@ -1,6 +1,6 @@ /* Substring test for UTF-8/UTF-16/UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2010-2015 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2002, 2005. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -24,108 +24,26 @@ FUNC (const UNIT *haystack, const UNIT *needle) if (first == 0) return (UNIT *) haystack; - /* Is needle nearly empty (only one unit)? */ + /* Is needle nearly empty? */ if (needle[1] == 0) return U_STRCHR (haystack, first); -#ifdef U_STRMBTOUC - /* Is needle nearly empty (only one character)? */ - { - ucs4_t first_uc; - int count = U_STRMBTOUC (&first_uc, needle); - if (count > 0 && needle[count] == 0) - return U_STRCHR (haystack, first_uc); - } -#endif - -#if UNIT_IS_UINT8_T - return (uint8_t *) strstr ((const char *) haystack, (const char *) needle); -#else - { - /* Minimizing the worst-case complexity: - Let n = U_STRLEN(haystack), m = U_STRLEN(needle). - The naïve algorithm is O(n*m) worst-case. - The Knuth-Morris-Pratt algorithm is O(n) worst-case but it needs a - memory allocation. - To achieve linear complexity and yet amortize the cost of the - memory allocation, we activate the Knuth-Morris-Pratt algorithm - only once the naïve algorithm has already run for some time; more - precisely, when - - the outer loop count is >= 10, - - the average number of comparisons per outer loop is >= 5, - - the total number of comparisons is >= m. - But we try it only once. If the memory allocation attempt failed, - we don't retry it. */ - bool try_kmp = true; - size_t outer_loop_count = 0; - size_t comparison_count = 0; - size_t last_ccount = 0; /* last comparison count */ - const UNIT *needle_last_ccount = needle; /* = needle + last_ccount */ - - /* Speed up the following searches of needle by caching its first - character. */ - UNIT b = *needle++; - - for (;; haystack++) + /* Search for needle's first unit. */ + for (; *haystack != 0; haystack++) + if (*haystack == first) { - if (*haystack == 0) - /* No match. */ - return NULL; - - /* See whether it's advisable to use an asymptotically faster - algorithm. */ - if (try_kmp - && outer_loop_count >= 10 - && comparison_count >= 5 * outer_loop_count) + /* Compare with needle's remaining units. */ + const UNIT *hptr = haystack + 1; + const UNIT *nptr = needle + 1; + for (;;) { - /* See if needle + comparison_count now reaches the end of - needle. */ - if (needle_last_ccount != NULL) - { - needle_last_ccount += - U_STRNLEN (needle_last_ccount, - comparison_count - last_ccount); - if (*needle_last_ccount == 0) - needle_last_ccount = NULL; - last_ccount = comparison_count; - } - if (needle_last_ccount == NULL) - { - /* Try the Knuth-Morris-Pratt algorithm. */ - const UNIT *result; - bool success = - knuth_morris_pratt (haystack, - needle - 1, U_STRLEN (needle - 1), - &result); - if (success) - return (UNIT *) result; - try_kmp = false; - } - } - - outer_loop_count++; - comparison_count++; - if (*haystack == b) - /* The first character matches. */ - { - const UNIT *rhaystack = haystack + 1; - const UNIT *rneedle = needle; - - for (;; rhaystack++, rneedle++) - { - if (*rneedle == 0) - /* Found a match. */ - return (UNIT *) haystack; - if (*rhaystack == 0) - /* No match. */ - return NULL; - comparison_count++; - if (*rhaystack != *rneedle) - /* Nothing in this round. */ - break; - } + if (*hptr != *nptr) + break; + hptr++; nptr++; + if (*nptr == 0) + return (UNIT *) haystack; } } - } -#endif + + return NULL; } diff --git a/lib/unistr/u-strtok.h b/lib/unistr/u-strtok.h index edafa1b..7fdef57 100644 --- a/lib/unistr/u-strtok.h +++ b/lib/unistr/u-strtok.h @@ -1,5 +1,5 @@ /* Tokenize UTF-8/UTF-16/UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -40,9 +40,9 @@ FUNC (UNIT *str, const UNIT *delim, UNIT **ptr) UNIT *token_end = U_STRPBRK (str, delim); if (token_end) { - *ptr = token_end + U_STRMBLEN (token_end); /* NUL-terminate the token. */ *token_end = 0; + *ptr = token_end + 1; } else *ptr = NULL; diff --git a/lib/unistr/u16-check.c b/lib/unistr/u16-check.c index ef6e334..4f18383 100644 --- a/lib/unistr/u16-check.c +++ b/lib/unistr/u16-check.c @@ -1,5 +1,5 @@ /* Check UTF-16 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-chr.c b/lib/unistr/u16-chr.c index cbf8dd2..13deef4 100644 --- a/lib/unistr/u16-chr.c +++ b/lib/unistr/u16-chr.c @@ -1,5 +1,5 @@ /* Search character in piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-cmp.c b/lib/unistr/u16-cmp.c index 01059f8..b71c1c3 100644 --- a/lib/unistr/u16-cmp.c +++ b/lib/unistr/u16-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-cmp2.c b/lib/unistr/u16-cmp2.c index 687356f..8c2a8d6 100644 --- a/lib/unistr/u16-cmp2.c +++ b/lib/unistr/u16-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-16 strings. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-cpy-alloc.c b/lib/unistr/u16-cpy-alloc.c index 567855d..33984f9 100644 --- a/lib/unistr/u16-cpy-alloc.c +++ b/lib/unistr/u16-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-cpy.c b/lib/unistr/u16-cpy.c index cdcf6af..614d24c 100644 --- a/lib/unistr/u16-cpy.c +++ b/lib/unistr/u16-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-endswith.c b/lib/unistr/u16-endswith.c index ee7c392..27dcd5a 100644 --- a/lib/unistr/u16-endswith.c +++ b/lib/unistr/u16-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mblen.c b/lib/unistr/u16-mblen.c index 6fab7e8..9e7a93a 100644 --- a/lib/unistr/u16-mblen.c +++ b/lib/unistr/u16-mblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-mbsnlen.c b/lib/unistr/u16-mbsnlen.c index 68f8d67..601d81d 100644 --- a/lib/unistr/u16-mbsnlen.c +++ b/lib/unistr/u16-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-16 string. - Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mbtouc-aux.c b/lib/unistr/u16-mbtouc-aux.c index e4fb94b..bee77fc 100644 --- a/lib/unistr/u16-mbtouc-aux.c +++ b/lib/unistr/u16-mbtouc-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-16 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mbtouc-unsafe-aux.c b/lib/unistr/u16-mbtouc-unsafe-aux.c index d616096..f2d7225 100644 --- a/lib/unistr/u16-mbtouc-unsafe-aux.c +++ b/lib/unistr/u16-mbtouc-unsafe-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-16 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mbtouc-unsafe.c b/lib/unistr/u16-mbtouc-unsafe.c index fef8911..a5a3638 100644 --- a/lib/unistr/u16-mbtouc-unsafe.c +++ b/lib/unistr/u16-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mbtouc.c b/lib/unistr/u16-mbtouc.c index 7855ed4..26b6089 100644 --- a/lib/unistr/u16-mbtouc.c +++ b/lib/unistr/u16-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-mbtoucr.c b/lib/unistr/u16-mbtoucr.c index 65b33b7..00b7b70 100644 --- a/lib/unistr/u16-mbtoucr.c +++ b/lib/unistr/u16-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string, returning an error code. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-move.c b/lib/unistr/u16-move.c index 39a6fdd..f6efb88 100644 --- a/lib/unistr/u16-move.c +++ b/lib/unistr/u16-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-next.c b/lib/unistr/u16-next.c index 1621b68..8245f11 100644 --- a/lib/unistr/u16-next.c +++ b/lib/unistr/u16-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-16 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-prev.c b/lib/unistr/u16-prev.c index e1a6854..4c902ad 100644 --- a/lib/unistr/u16-prev.c +++ b/lib/unistr/u16-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-16 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-set.c b/lib/unistr/u16-set.c index 58644b4..7bad3d6 100644 --- a/lib/unistr/u16-set.c +++ b/lib/unistr/u16-set.c @@ -1,5 +1,5 @@ /* Fill UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-startswith.c b/lib/unistr/u16-startswith.c index feb1ebd..22a5d5f 100644 --- a/lib/unistr/u16-startswith.c +++ b/lib/unistr/u16-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-stpcpy.c b/lib/unistr/u16-stpcpy.c index d49737f..59467f7 100644 --- a/lib/unistr/u16-stpcpy.c +++ b/lib/unistr/u16-stpcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-stpncpy.c b/lib/unistr/u16-stpncpy.c index 315dad7..49c616e 100644 --- a/lib/unistr/u16-stpncpy.c +++ b/lib/unistr/u16-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcat.c b/lib/unistr/u16-strcat.c index 9d933e1..8b35868 100644 --- a/lib/unistr/u16-strcat.c +++ b/lib/unistr/u16-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strchr.c b/lib/unistr/u16-strchr.c index c89c174..1f8719f 100644 --- a/lib/unistr/u16-strchr.c +++ b/lib/unistr/u16-strchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-strcmp.c b/lib/unistr/u16-strcmp.c index f9033ef..b781211 100644 --- a/lib/unistr/u16-strcmp.c +++ b/lib/unistr/u16-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcoll.c b/lib/unistr/u16-strcoll.c index 2a6d757..5a504bf 100644 --- a/lib/unistr/u16-strcoll.c +++ b/lib/unistr/u16-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings using the collation rules of the current locale. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -29,5 +29,5 @@ #define FUNC u16_strcoll #define UNIT uint16_t #define U_STRCMP u16_strcmp -#define U_STRCONV_TO_ENCODING u16_strconv_to_encoding +#define U_STRCONV_TO_LOCALE u16_strconv_to_locale #include "u-strcoll.h" diff --git a/lib/unistr/u16-strcpy.c b/lib/unistr/u16-strcpy.c index 5deb766..ecde75d 100644 --- a/lib/unistr/u16-strcpy.c +++ b/lib/unistr/u16-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strcspn.c b/lib/unistr/u16-strcspn.c index 52309b3..b18bb37 100644 --- a/lib/unistr/u16-strcspn.c +++ b/lib/unistr/u16-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strdup.c b/lib/unistr/u16-strdup.c index 61144d7..4a94451 100644 --- a/lib/unistr/u16-strdup.c +++ b/lib/unistr/u16-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strlen.c b/lib/unistr/u16-strlen.c index 6a96c91..da613c2 100644 --- a/lib/unistr/u16-strlen.c +++ b/lib/unistr/u16-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strmblen.c b/lib/unistr/u16-strmblen.c index 1004ef1..f07ca0b 100644 --- a/lib/unistr/u16-strmblen.c +++ b/lib/unistr/u16-strmblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-strmbtouc.c b/lib/unistr/u16-strmbtouc.c index 89661e7..9aa5d43 100644 --- a/lib/unistr/u16-strmbtouc.c +++ b/lib/unistr/u16-strmbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-16 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-strncat.c b/lib/unistr/u16-strncat.c index cf1c4f9..7082716 100644 --- a/lib/unistr/u16-strncat.c +++ b/lib/unistr/u16-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strncmp.c b/lib/unistr/u16-strncmp.c index c76e7b7..3ed59c3 100644 --- a/lib/unistr/u16-strncmp.c +++ b/lib/unistr/u16-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strncpy.c b/lib/unistr/u16-strncpy.c index da7ebb8..bd2eb6f 100644 --- a/lib/unistr/u16-strncpy.c +++ b/lib/unistr/u16-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strnlen.c b/lib/unistr/u16-strnlen.c index 4940e02..49e6d58 100644 --- a/lib/unistr/u16-strnlen.c +++ b/lib/unistr/u16-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strpbrk.c b/lib/unistr/u16-strpbrk.c index 60ec122..45353fa 100644 --- a/lib/unistr/u16-strpbrk.c +++ b/lib/unistr/u16-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strrchr.c b/lib/unistr/u16-strrchr.c index 3179a8d..3cf3de2 100644 --- a/lib/unistr/u16-strrchr.c +++ b/lib/unistr/u16-strrchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u16-strspn.c b/lib/unistr/u16-strspn.c index 4a0194f..ab812eb 100644 --- a/lib/unistr/u16-strspn.c +++ b/lib/unistr/u16-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-strstr.c b/lib/unistr/u16-strstr.c index 5b87e81..54a74d6 100644 --- a/lib/unistr/u16-strstr.c +++ b/lib/unistr/u16-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-16 strings. - Copyright (C) 1999, 2002, 2006, 2010-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -20,18 +20,9 @@ /* Specification. */ #include "unistr.h" -#include "malloca.h" - /* FIXME: Maybe walking the string via u16_mblen is a win? */ -#define UNIT uint16_t - -#define CANON_ELEMENT(c) c -#include "str-kmp.h" - #define FUNC u16_strstr +#define UNIT uint16_t #define U_STRCHR u16_strchr -#define U_STRMBTOUC u16_strmbtouc -#define U_STRLEN u16_strlen -#define U_STRNLEN u16_strnlen #include "u-strstr.h" diff --git a/lib/unistr/u16-strtok.c b/lib/unistr/u16-strtok.c index df36cf7..f84c465 100644 --- a/lib/unistr/u16-strtok.c +++ b/lib/unistr/u16-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-16 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -24,5 +24,4 @@ #define UNIT uint16_t #define U_STRSPN u16_strspn #define U_STRPBRK u16_strpbrk -#define U_STRMBLEN u16_strmblen #include "u-strtok.h" diff --git a/lib/unistr/u16-to-u32.c b/lib/unistr/u16-to-u32.c index 8acee50..3544cde 100644 --- a/lib/unistr/u16-to-u32.c +++ b/lib/unistr/u16-to-u32.c @@ -1,5 +1,5 @@ /* Convert UTF-16 string to UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-to-u8.c b/lib/unistr/u16-to-u8.c index 3e93a94..f92cc93 100644 --- a/lib/unistr/u16-to-u8.c +++ b/lib/unistr/u16-to-u8.c @@ -1,5 +1,5 @@ /* Convert UTF-16 string to UTF-8 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-uctomb-aux.c b/lib/unistr/u16-uctomb-aux.c index 55d7a14..e2acc9e 100644 --- a/lib/unistr/u16-uctomb-aux.c +++ b/lib/unistr/u16-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-16. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u16-uctomb.c b/lib/unistr/u16-uctomb.c index b93fa6f..cbc1abc 100644 --- a/lib/unistr/u16-uctomb.c +++ b/lib/unistr/u16-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-16 string. - Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-check.c b/lib/unistr/u32-check.c index 53b722b..8c5f518 100644 --- a/lib/unistr/u32-check.c +++ b/lib/unistr/u32-check.c @@ -1,5 +1,5 @@ /* Check UTF-32 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-chr.c b/lib/unistr/u32-chr.c index 1470c22..1900288 100644 --- a/lib/unistr/u32-chr.c +++ b/lib/unistr/u32-chr.c @@ -1,5 +1,5 @@ /* Search character in piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cmp.c b/lib/unistr/u32-cmp.c index 7799e38..36496f7 100644 --- a/lib/unistr/u32-cmp.c +++ b/lib/unistr/u32-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cmp2.c b/lib/unistr/u32-cmp2.c index b4e0a1b..3247602 100644 --- a/lib/unistr/u32-cmp2.c +++ b/lib/unistr/u32-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-32 strings. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cpy-alloc.c b/lib/unistr/u32-cpy-alloc.c index 3e94298..b9ebefe 100644 --- a/lib/unistr/u32-cpy-alloc.c +++ b/lib/unistr/u32-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-cpy.c b/lib/unistr/u32-cpy.c index ab5a451..747430b 100644 --- a/lib/unistr/u32-cpy.c +++ b/lib/unistr/u32-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-endswith.c b/lib/unistr/u32-endswith.c index 3960c8a..cee0d93 100644 --- a/lib/unistr/u32-endswith.c +++ b/lib/unistr/u32-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mblen.c b/lib/unistr/u32-mblen.c index 45a9f49..4530fe4 100644 --- a/lib/unistr/u32-mblen.c +++ b/lib/unistr/u32-mblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbsnlen.c b/lib/unistr/u32-mbsnlen.c index 371959e..0a71293 100644 --- a/lib/unistr/u32-mbsnlen.c +++ b/lib/unistr/u32-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-32 string. - Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtouc-unsafe.c b/lib/unistr/u32-mbtouc-unsafe.c index 3244811..8dbbfe4 100644 --- a/lib/unistr/u32-mbtouc-unsafe.c +++ b/lib/unistr/u32-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtouc.c b/lib/unistr/u32-mbtouc.c index 5d4de51..05f7c77 100644 --- a/lib/unistr/u32-mbtouc.c +++ b/lib/unistr/u32-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-mbtoucr.c b/lib/unistr/u32-mbtoucr.c index faa5695..83f7782 100644 --- a/lib/unistr/u32-mbtoucr.c +++ b/lib/unistr/u32-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string, returning an error code. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-move.c b/lib/unistr/u32-move.c index fc2aab1..6362d85 100644 --- a/lib/unistr/u32-move.c +++ b/lib/unistr/u32-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-next.c b/lib/unistr/u32-next.c index 8be330e..987fb02 100644 --- a/lib/unistr/u32-next.c +++ b/lib/unistr/u32-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-prev.c b/lib/unistr/u32-prev.c index 127029d..f20b1b7 100644 --- a/lib/unistr/u32-prev.c +++ b/lib/unistr/u32-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-set.c b/lib/unistr/u32-set.c index a60f5a8..5c517cd 100644 --- a/lib/unistr/u32-set.c +++ b/lib/unistr/u32-set.c @@ -1,5 +1,5 @@ /* Fill UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-startswith.c b/lib/unistr/u32-startswith.c index 817310f..7fcb597 100644 --- a/lib/unistr/u32-startswith.c +++ b/lib/unistr/u32-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-stpcpy.c b/lib/unistr/u32-stpcpy.c index fdd5f5e..3cbfa92 100644 --- a/lib/unistr/u32-stpcpy.c +++ b/lib/unistr/u32-stpcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-stpncpy.c b/lib/unistr/u32-stpncpy.c index 124101e..e55891e 100644 --- a/lib/unistr/u32-stpncpy.c +++ b/lib/unistr/u32-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcat.c b/lib/unistr/u32-strcat.c index 5e51c58..4e26bb4 100644 --- a/lib/unistr/u32-strcat.c +++ b/lib/unistr/u32-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strchr.c b/lib/unistr/u32-strchr.c index 355ad27..b5df7b7 100644 --- a/lib/unistr/u32-strchr.c +++ b/lib/unistr/u32-strchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcmp.c b/lib/unistr/u32-strcmp.c index 16f9b1e..5f336ce 100644 --- a/lib/unistr/u32-strcmp.c +++ b/lib/unistr/u32-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcoll.c b/lib/unistr/u32-strcoll.c index 7865f4c..9748855 100644 --- a/lib/unistr/u32-strcoll.c +++ b/lib/unistr/u32-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings using the collation rules of the current locale. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -29,5 +29,5 @@ #define FUNC u32_strcoll #define UNIT uint32_t #define U_STRCMP u32_strcmp -#define U_STRCONV_TO_ENCODING u32_strconv_to_encoding +#define U_STRCONV_TO_LOCALE u32_strconv_to_locale #include "u-strcoll.h" diff --git a/lib/unistr/u32-strcpy.c b/lib/unistr/u32-strcpy.c index 9f325bc..f3c70e6 100644 --- a/lib/unistr/u32-strcpy.c +++ b/lib/unistr/u32-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strcspn.c b/lib/unistr/u32-strcspn.c index 963c732..595d32e 100644 --- a/lib/unistr/u32-strcspn.c +++ b/lib/unistr/u32-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strdup.c b/lib/unistr/u32-strdup.c index 3af4622..da4cc5a 100644 --- a/lib/unistr/u32-strdup.c +++ b/lib/unistr/u32-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strlen.c b/lib/unistr/u32-strlen.c index b87f55d..95d32ab 100644 --- a/lib/unistr/u32-strlen.c +++ b/lib/unistr/u32-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strmblen.c b/lib/unistr/u32-strmblen.c index 362ea48..54b78d7 100644 --- a/lib/unistr/u32-strmblen.c +++ b/lib/unistr/u32-strmblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strmbtouc.c b/lib/unistr/u32-strmbtouc.c index cfa89d0..4c067b9 100644 --- a/lib/unistr/u32-strmbtouc.c +++ b/lib/unistr/u32-strmbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strncat.c b/lib/unistr/u32-strncat.c index 4758f4d..c9260b0 100644 --- a/lib/unistr/u32-strncat.c +++ b/lib/unistr/u32-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strncmp.c b/lib/unistr/u32-strncmp.c index f4222f6..dcbb935 100644 --- a/lib/unistr/u32-strncmp.c +++ b/lib/unistr/u32-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strncpy.c b/lib/unistr/u32-strncpy.c index 1f4c31b..9a54f97 100644 --- a/lib/unistr/u32-strncpy.c +++ b/lib/unistr/u32-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strnlen.c b/lib/unistr/u32-strnlen.c index df3601f..8102ac7 100644 --- a/lib/unistr/u32-strnlen.c +++ b/lib/unistr/u32-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strpbrk.c b/lib/unistr/u32-strpbrk.c index c9cca79..2c4b6bc 100644 --- a/lib/unistr/u32-strpbrk.c +++ b/lib/unistr/u32-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strrchr.c b/lib/unistr/u32-strrchr.c index 242d4b8..f0030e5 100644 --- a/lib/unistr/u32-strrchr.c +++ b/lib/unistr/u32-strrchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strspn.c b/lib/unistr/u32-strspn.c index 2541e79..e2571d5 100644 --- a/lib/unistr/u32-strspn.c +++ b/lib/unistr/u32-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-strstr.c b/lib/unistr/u32-strstr.c index c8abe5b..cad06fc 100644 --- a/lib/unistr/u32-strstr.c +++ b/lib/unistr/u32-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-32 strings. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -20,15 +20,7 @@ /* Specification. */ #include "unistr.h" -#include "malloca.h" - -#define UNIT uint32_t - -#define CANON_ELEMENT(c) c -#include "str-kmp.h" - #define FUNC u32_strstr +#define UNIT uint32_t #define U_STRCHR u32_strchr -#define U_STRLEN u32_strlen -#define U_STRNLEN u32_strnlen #include "u-strstr.h" diff --git a/lib/unistr/u32-strtok.c b/lib/unistr/u32-strtok.c index f8ef999..067122f 100644 --- a/lib/unistr/u32-strtok.c +++ b/lib/unistr/u32-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-32 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -24,5 +24,4 @@ #define UNIT uint32_t #define U_STRSPN u32_strspn #define U_STRPBRK u32_strpbrk -#define U_STRMBLEN u32_strmblen #include "u-strtok.h" diff --git a/lib/unistr/u32-to-u16.c b/lib/unistr/u32-to-u16.c index e02e782..be32770 100644 --- a/lib/unistr/u32-to-u16.c +++ b/lib/unistr/u32-to-u16.c @@ -1,5 +1,5 @@ /* Convert UTF-32 string to UTF-16 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-to-u8.c b/lib/unistr/u32-to-u8.c index 0c4f4cb..36710d3 100644 --- a/lib/unistr/u32-to-u8.c +++ b/lib/unistr/u32-to-u8.c @@ -1,5 +1,5 @@ /* Convert UTF-32 string to UTF-8 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u32-uctomb.c b/lib/unistr/u32-uctomb.c index 18b2f0d..3ac58b4 100644 --- a/lib/unistr/u32-uctomb.c +++ b/lib/unistr/u32-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-32 string. - Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-check.c b/lib/unistr/u8-check.c index 53ece76..368042b 100644 --- a/lib/unistr/u8-check.c +++ b/lib/unistr/u8-check.c @@ -1,5 +1,5 @@ /* Check UTF-8 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -27,7 +27,7 @@ u8_check (const uint8_t *s, size_t n) while (s < s_end) { - /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + /* Keep in sync with unistr.h and utf8-ucs4.c. */ uint8_t c = *s; if (c < 0x80) diff --git a/lib/unistr/u8-chr.c b/lib/unistr/u8-chr.c index c7779d2..435d1be 100644 --- a/lib/unistr/u8-chr.c +++ b/lib/unistr/u8-chr.c @@ -1,5 +1,5 @@ /* Search character in piece of UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -21,181 +21,68 @@ /* Specification. */ #include "unistr.h" -#include <string.h> - uint8_t * u8_chr (const uint8_t *s, size_t n, ucs4_t uc) { + uint8_t c[6]; + if (uc < 0x80) { uint8_t c0 = uc; - return (uint8_t *) memchr ((const char *) s, c0, n); + for (; n > 0; s++, n--) + { + if (*s == c0) + return (uint8_t *) s; + } } - - { - uint8_t c[6]; - size_t uc_size; - uc_size = u8_uctomb_aux (c, uc, 6); - - if (n < uc_size) - return NULL; - - /* For multibyte character matching we use a Boyer-Moore like - algorithm that searches for the last byte, skipping multi-byte - jumps, and matches back from there. - - Instead of using a table as is usual for Boyer-Moore, we compare - the candidate last byte s[UC_SIZE-1] with each of the possible - bytes in the UTF-8 representation of UC. If the final byte does - not match, we will perform up to UC_SIZE comparisons per memory - load---but each comparison lets us skip one byte in the input! - - If the final byte matches, the "real" Boyer-Moore algorithm - is approximated. Instead, u8_chr just looks for other cN that - are equal to the final byte and uses those to try realigning to - another possible match. For example, when searching for 0xF0 - 0xAA 0xBB 0xAA it will always skip forward by two bytes, even if - the character in the string was for example 0xF1 0xAA 0xBB 0xAA. - The advantage of this scheme is that the skip count after a failed - match can be computed outside the loop, and that it keeps the - complexity low for a pretty rare case. In particular, since c[0] - is never between 0x80 and 0xBF, c[0] is never equal to c[UC_SIZE-1] - and this is optimal for two-byte UTF-8 characters. */ - switch (uc_size) + else + switch (u8_uctomb_aux (c, uc, 6)) { case 2: - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - const uint8_t *end = s + n - 1; - - do - { - /* Here s < end. - Test whether s[0..1] == { c0, c1 }. */ - uint8_t s1 = s[1]; - if (s1 == c1) - { - if (*s == c0) - return (uint8_t *) s; - else - /* Skip the search at s + 1, because s[1] = c1 < c0. */ - s += 2; - } - else - { - if (s1 == c0) - s++; - else - /* Skip the search at s + 1, because s[1] != c0. */ - s += 2; - } - } - while (s < end); - break; - } + if (n > 1) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + + for (n--; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1) + return (uint8_t *) s; + } + } + break; case 3: - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; - const uint8_t *end = s + n - 2; - size_t skip; - - if (c2 == c1) - skip = 1; - else - skip = 3; - - do - { - /* Here s < end. - Test whether s[0..2] == { c0, c1, c2 }. */ - uint8_t s2 = s[2]; - if (s2 == c2) - { - if (s[1] == c1 && *s == c0) - return (uint8_t *) s; - else - /* If c2 != c1: - Skip the search at s + 1, because s[2] == c2 != c1. - Skip the search at s + 2, because s[2] == c2 < c0. */ - s += skip; - } - else - { - if (s2 == c1) - s++; - else if (s2 == c0) - /* Skip the search at s + 1, because s[2] != c1. */ - s += 2; - else - /* Skip the search at s + 1, because s[2] != c1. - Skip the search at s + 2, because s[2] != c0. */ - s += 3; - } - } - while (s < end); - break; - } + if (n > 2) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; + + for (n -= 2; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1 && s[2] == c2) + return (uint8_t *) s; + } + } + break; case 4: - { - uint8_t c0 = c[0]; - uint8_t c1 = c[1]; - uint8_t c2 = c[2]; - uint8_t c3 = c[3]; - const uint8_t *end = s + n - 3; - size_t skip; - - if (c3 == c2) - skip = 1; - else if (c3 == c1) - skip = 2; - else - skip = 4; - - do - { - /* Here s < end. - Test whether s[0..3] == { c0, c1, c2, c3 }. */ - uint8_t s3 = s[3]; - if (s3 == c3) - { - if (s[2] == c2 && s[1] == c1 && *s == c0) - return (uint8_t *) s; - else - /* If c3 != c2: - Skip the search at s + 1, because s[3] == c3 != c2. - If c3 != c1: - Skip the search at s + 2, because s[3] == c3 != c1. - Skip the search at s + 3, because s[3] == c3 < c0. */ - s += skip; - } - else - { - if (s3 == c2) - s++; - else if (s3 == c1) - /* Skip the search at s + 1, because s[3] != c2. */ - s += 2; - else if (s3 == c0) - /* Skip the search at s + 1, because s[3] != c2. - Skip the search at s + 2, because s[3] != c1. */ - s += 3; - else - /* Skip the search at s + 1, because s[3] != c2. - Skip the search at s + 2, because s[3] != c1. - Skip the search at s + 3, because s[3] != c0. */ - s += 4; - } - } - while (s < end); - break; - } + if (n > 3) + { + uint8_t c0 = c[0]; + uint8_t c1 = c[1]; + uint8_t c2 = c[2]; + uint8_t c3 = c[3]; + + for (n -= 3; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) + return (uint8_t *) s; + } + } + break; } - return NULL; - } + return NULL; } diff --git a/lib/unistr/u8-cmp.c b/lib/unistr/u8-cmp.c index 402de81..d021b1a 100644 --- a/lib/unistr/u8-cmp.c +++ b/lib/unistr/u8-cmp.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cmp2.c b/lib/unistr/u8-cmp2.c index dbbc8ed..8a97db4 100644 --- a/lib/unistr/u8-cmp2.c +++ b/lib/unistr/u8-cmp2.c @@ -1,5 +1,5 @@ /* Compare pieces of UTF-8 strings. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cpy-alloc.c b/lib/unistr/u8-cpy-alloc.c index 1e3910a..1884516 100644 --- a/lib/unistr/u8-cpy-alloc.c +++ b/lib/unistr/u8-cpy-alloc.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-cpy.c b/lib/unistr/u8-cpy.c index 683200c..2f29200 100644 --- a/lib/unistr/u8-cpy.c +++ b/lib/unistr/u8-cpy.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-endswith.c b/lib/unistr/u8-endswith.c index a835dc4..833b3e1 100644 --- a/lib/unistr/u8-endswith.c +++ b/lib/unistr/u8-endswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-mblen.c b/lib/unistr/u8-mblen.c index 131149b..f6a2027 100644 --- a/lib/unistr/u8-mblen.c +++ b/lib/unistr/u8-mblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -26,7 +26,7 @@ u8_mblen (const uint8_t *s, size_t n) { if (n > 0) { - /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + /* Keep in sync with unistr.h and utf8-ucs4.c. */ uint8_t c = *s; if (c < 0x80) diff --git a/lib/unistr/u8-mbsnlen.c b/lib/unistr/u8-mbsnlen.c index ce13c38..9ddc42e 100644 --- a/lib/unistr/u8-mbsnlen.c +++ b/lib/unistr/u8-mbsnlen.c @@ -1,5 +1,5 @@ /* Count characters in UTF-8 string. - Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2007. This program is free software: you can redistribute it and/or modify it @@ -33,9 +33,7 @@ u8_mbsnlen (const uint8_t *s, size_t n) characters++; if (count == -2) break; - if (count < 0) - count = u8_mbtouc (&uc, s, n); - else if (count == 0) + if (count <= 0) count = 1; s += count; n -= count; diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c index 834725f..c997589 100644 --- a/lib/unistr/u8-mbtouc-aux.c +++ b/lib/unistr/u8-mbtouc-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -45,32 +45,21 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - return 1; + return n; } } else if (c < 0xf0) { if (n >= 3) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; } /* invalid multibyte character */ } @@ -78,45 +67,26 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else - return 2; + return n; } } else if (c < 0xf8) { if (n >= 4) { - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + ) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; } /* invalid multibyte character */ } @@ -124,12 +94,7 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else if (n == 2 || (s[2] ^ 0x80) >= 0x40) - return 2; - else - return 3; + return n; } } #if 0 @@ -137,37 +102,16 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) { if (n >= 5) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if (c >= 0xf9 || s[1] >= 0x88) - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; } /* invalid multibyte character */ } @@ -182,44 +126,18 @@ u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n) { if (n >= 6) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if ((s[5] ^ 0x80) < 0x40) - { - if (c >= 0xfd || s[1] >= 0x84) - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; } /* invalid multibyte character */ } diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c index b406d3e..47590e3 100644 --- a/lib/unistr/u8-mbtouc-unsafe-aux.c +++ b/lib/unistr/u8-mbtouc-unsafe-aux.c @@ -1,5 +1,5 @@ /* Conversion UTF-8 to UCS-4. - Copyright (C) 2001-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -41,15 +41,13 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) | (unsigned int) (s[1] ^ 0x80); return 2; } -#if CONFIG_UNICODE_SAFETY /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - return 1; + return n; } } else if (c < 0xf0) @@ -57,39 +55,23 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 3) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #endif - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; } /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else - return 2; + return n; } } else if (c < 0xf8) @@ -97,51 +79,28 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 4) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #endif - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; } /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else if (n == 2 || (s[2] ^ 0x80) >= 0x40) - return 2; - else - return 3; + return n; } } #if 0 @@ -150,42 +109,19 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 5) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if (c >= 0xf9 || s[1] >= 0x88) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #endif - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; } /* invalid multibyte character */ -#endif } else { @@ -199,49 +135,21 @@ u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 6) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if ((s[5] ^ 0x80) < 0x40) - { - if (c >= 0xfd || s[1] >= 0x84) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #endif - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; } /* invalid multibyte character */ -#endif } else { diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c index 01d12dc..41583f9 100644 --- a/lib/unistr/u8-mbtouc-unsafe.c +++ b/lib/unistr/u8-mbtouc-unsafe.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -52,15 +52,13 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) | (unsigned int) (s[1] ^ 0x80); return 2; } -#if CONFIG_UNICODE_SAFETY /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - return 1; + return n; } } else if (c < 0xf0) @@ -68,39 +66,23 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 3) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) #endif - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; } /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else - return 2; + return n; } } else if (c < 0xf8) @@ -108,51 +90,28 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 4) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) + ) #endif - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; } /* invalid multibyte character */ -#endif } else { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else if (n == 2 || (s[2] ^ 0x80) >= 0x40) - return 2; - else - return 3; + return n; } } #if 0 @@ -161,42 +120,19 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 5) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if (c >= 0xf9 || s[1] >= 0x88) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) #endif - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; } /* invalid multibyte character */ -#endif } else { @@ -210,49 +146,21 @@ u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) if (n >= 6) { #if CONFIG_UNICODE_SAFETY - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if ((s[5] ^ 0x80) < 0x40) - { - if (c >= 0xfd || s[1] >= 0x84) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) #endif - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } -#if CONFIG_UNICODE_SAFETY - /* invalid multibyte character */ - *puc = 0xfffd; - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; } /* invalid multibyte character */ -#endif } else { diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c index dc4607f..96cd5b7 100644 --- a/lib/unistr/u8-mbtouc.c +++ b/lib/unistr/u8-mbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it @@ -55,32 +55,21 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - return 1; + return n; } } else if (c < 0xf0) { if (n >= 3) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((c >= 0xe1 || s[1] >= 0xa0) - && (c != 0xed || s[1] < 0xa0)) - { - *puc = ((unsigned int) (c & 0x0f) << 12) - | ((unsigned int) (s[1] ^ 0x80) << 6) - | (unsigned int) (s[2] ^ 0x80); - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; } /* invalid multibyte character */ } @@ -88,45 +77,26 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else - return 2; + return n; } } else if (c < 0xf8) { if (n >= 4) { - if ((s[1] ^ 0x80) < 0x40) - { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((c >= 0xf1 || s[1] >= 0x90) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) #if 1 - && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) #endif - ) - { - *puc = ((unsigned int) (c & 0x07) << 18) - | ((unsigned int) (s[1] ^ 0x80) << 12) - | ((unsigned int) (s[2] ^ 0x80) << 6) - | (unsigned int) (s[3] ^ 0x80); - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 2; + ) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; } /* invalid multibyte character */ } @@ -134,12 +104,7 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { /* incomplete multibyte character */ *puc = 0xfffd; - if (n == 1 || (s[1] ^ 0x80) >= 0x40) - return 1; - else if (n == 2 || (s[2] ^ 0x80) >= 0x40) - return 2; - else - return 3; + return n; } } #if 0 @@ -147,37 +112,16 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { if (n >= 5) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if (c >= 0xf9 || s[1] >= 0x88) - { - *puc = ((unsigned int) (c & 0x03) << 24) - | ((unsigned int) (s[1] ^ 0x80) << 18) - | ((unsigned int) (s[2] ^ 0x80) << 12) - | ((unsigned int) (s[3] ^ 0x80) << 6) - | (unsigned int) (s[4] ^ 0x80); - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; } /* invalid multibyte character */ } @@ -192,44 +136,18 @@ u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) { if (n >= 6) { - if ((s[1] ^ 0x80) < 0x40) + if ((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) { - if ((s[2] ^ 0x80) < 0x40) - { - if ((s[3] ^ 0x80) < 0x40) - { - if ((s[4] ^ 0x80) < 0x40) - { - if ((s[5] ^ 0x80) < 0x40) - { - if (c >= 0xfd || s[1] >= 0x84) - { - *puc = ((unsigned int) (c & 0x01) << 30) - | ((unsigned int) (s[1] ^ 0x80) << 24) - | ((unsigned int) (s[2] ^ 0x80) << 18) - | ((unsigned int) (s[3] ^ 0x80) << 12) - | ((unsigned int) (s[4] ^ 0x80) << 6) - | (unsigned int) (s[5] ^ 0x80); - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 6; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 5; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 4; - } - /* invalid multibyte character */ - *puc = 0xfffd; - return 3; - } - /* invalid multibyte character */ - return 2; + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; } /* invalid multibyte character */ } diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c index 3d8c05f..a749c48 100644 --- a/lib/unistr/u8-mbtoucr.c +++ b/lib/unistr/u8-mbtoucr.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string, returning an error code. - Copyright (C) 1999-2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-move.c b/lib/unistr/u8-move.c index 5c872ca..5c48411 100644 --- a/lib/unistr/u8-move.c +++ b/lib/unistr/u8-move.c @@ -1,5 +1,5 @@ /* Copy piece of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-next.c b/lib/unistr/u8-next.c index 8c218a2..34249aa 100644 --- a/lib/unistr/u8-next.c +++ b/lib/unistr/u8-next.c @@ -1,5 +1,5 @@ /* Iterate over next character in UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c index e01551e..97a27f5 100644 --- a/lib/unistr/u8-prev.c +++ b/lib/unistr/u8-prev.c @@ -1,5 +1,5 @@ /* Iterate over previous character in UTF-8 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -23,7 +23,7 @@ const uint8_t * u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start) { - /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + /* Keep in sync with unistr.h and utf8-ucs4.c. */ if (s != start) { uint8_t c_1 = s[-1]; diff --git a/lib/unistr/u8-set.c b/lib/unistr/u8-set.c index 5f9e5e6..3cca23b 100644 --- a/lib/unistr/u8-set.c +++ b/lib/unistr/u8-set.c @@ -1,5 +1,5 @@ /* Fill UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-startswith.c b/lib/unistr/u8-startswith.c index b22fed4..4cc436a 100644 --- a/lib/unistr/u8-startswith.c +++ b/lib/unistr/u8-startswith.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-stpcpy.c b/lib/unistr/u8-stpcpy.c index 8fb3ca5..0faba41 100644 --- a/lib/unistr/u8-stpcpy.c +++ b/lib/unistr/u8-stpcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-stpncpy.c b/lib/unistr/u8-stpncpy.c index 62d4972..a456bea 100644 --- a/lib/unistr/u8-stpncpy.c +++ b/lib/unistr/u8-stpncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* Specification. */ #include "unistr.h" -#if __GLIBC__ >= 2 && !defined __UCLIBC__ +#if __GLIBC__ >= 2 # include <string.h> diff --git a/lib/unistr/u8-strcat.c b/lib/unistr/u8-strcat.c index b689201..2b54bad 100644 --- a/lib/unistr/u8-strcat.c +++ b/lib/unistr/u8-strcat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strchr.c b/lib/unistr/u8-strchr.c index dd1cb84..3be14c7 100644 --- a/lib/unistr/u8-strchr.c +++ b/lib/unistr/u8-strchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -21,8 +21,6 @@ /* Specification. */ #include "unistr.h" -#include <string.h> - uint8_t * u8_strchr (const uint8_t *s, ucs4_t uc) { @@ -32,209 +30,72 @@ u8_strchr (const uint8_t *s, ucs4_t uc) { uint8_t c0 = uc; - if (false) - { - /* Unoptimized code. */ - for (;;) - { - uint8_t s0 = *s; - if (s0 == c0) - return (uint8_t *) s; - s++; - if (s0 == 0) - break; - } - } - else + for (;; s++) { - /* Optimized code. - strchr() is often so well optimized, that it's worth the - added function call. */ - return (uint8_t *) strchr ((const char *) s, c0); + if (*s == c0) + break; + if (*s == 0) + goto notfound; } + return (uint8_t *) s; } else - /* Loops equivalent to strstr, optimized for a specific length (2, 3, 4) - of the needle. We use an algorithm similar to Boyer-Moore which - is documented in lib/unistr/u8-chr.c. There is additional - complication because we need to check after every byte for - a NUL byte, but the idea is the same. */ switch (u8_uctomb_aux (c, uc, 6)) { case 2: - if (*s == 0 || s[1] == 0) - break; + if (*s == 0) + goto notfound; { uint8_t c0 = c[0]; uint8_t c1 = c[1]; - /* Search for { c0, c1 }. */ - uint8_t s1 = s[1]; - for (;;) + for (;; s++) { - /* Here s[0] != 0, s[1] != 0. - Test whether s[0..1] == { c0, c1 }. */ - if (s1 == c1) - { - if (*s == c0) - return (uint8_t *) s; - else - /* Skip the search at s + 1, because s[1] = c1 < c0. */ - goto case2_skip2; - } - else - { - if (s1 == c0) - goto case2_skip1; - else - /* Skip the search at s + 1, because s[1] != c0. */ - goto case2_skip2; - } - case2_skip2: - s++; - s1 = s[1]; - if (s[1] == 0) - break; - case2_skip1: - s++; - s1 = s[1]; if (s[1] == 0) + goto notfound; + if (*s == c0 && s[1] == c1) break; } + return (uint8_t *) s; } - break; case 3: - if (*s == 0 || s[1] == 0 || s[2] == 0) - break; + if (*s == 0 || s[1] == 0) + goto notfound; { uint8_t c0 = c[0]; uint8_t c1 = c[1]; uint8_t c2 = c[2]; - /* Search for { c0, c1, c2 }. */ - uint8_t s2 = s[2]; - for (;;) + for (;; s++) { - /* Here s[0] != 0, s[1] != 0, s[2] != 0. - Test whether s[0..2] == { c0, c1, c2 }. */ - if (s2 == c2) - { - if (s[1] == c1 && *s == c0) - return (uint8_t *) s; - else - /* If c2 != c1: - Skip the search at s + 1, because s[2] == c2 != c1. - Skip the search at s + 2, because s[2] == c2 < c0. */ - if (c2 == c1) - goto case3_skip1; - else - goto case3_skip3; - } - else - { - if (s2 == c1) - goto case3_skip1; - else if (s2 == c0) - /* Skip the search at s + 1, because s[2] != c1. */ - goto case3_skip2; - else - /* Skip the search at s + 1, because s[2] != c1. - Skip the search at s + 2, because s[2] != c0. */ - goto case3_skip3; - } - case3_skip3: - s++; - s2 = s[2]; - if (s[2] == 0) - break; - case3_skip2: - s++; - s2 = s[2]; - if (s[2] == 0) - break; - case3_skip1: - s++; - s2 = s[2]; if (s[2] == 0) + goto notfound; + if (*s == c0 && s[1] == c1 && s[2] == c2) break; } + return (uint8_t *) s; } - break; case 4: - if (*s == 0 || s[1] == 0 || s[2] == 0 || s[3] == 0) - break; + if (*s == 0 || s[1] == 0 || s[2] == 0) + goto notfound; { uint8_t c0 = c[0]; uint8_t c1 = c[1]; uint8_t c2 = c[2]; uint8_t c3 = c[3]; - /* Search for { c0, c1, c2, c3 }. */ - uint8_t s3 = s[3]; - for (;;) + for (;; s++) { - /* Here s[0] != 0, s[1] != 0, s[2] != 0, s[3] != 0. - Test whether s[0..3] == { c0, c1, c2, c3 }. */ - if (s3 == c3) - { - if (s[2] == c2 && s[1] == c1 && *s == c0) - return (uint8_t *) s; - else - /* If c3 != c2: - Skip the search at s + 1, because s[3] == c3 != c2. - If c3 != c1: - Skip the search at s + 2, because s[3] == c3 != c1. - Skip the search at s + 3, because s[3] == c3 < c0. */ - if (c3 == c2) - goto case4_skip1; - else if (c3 == c1) - goto case4_skip2; - else - goto case4_skip4; - } - else - { - if (s3 == c2) - goto case4_skip1; - else if (s3 == c1) - /* Skip the search at s + 1, because s[3] != c2. */ - goto case4_skip2; - else if (s3 == c0) - /* Skip the search at s + 1, because s[3] != c2. - Skip the search at s + 2, because s[3] != c1. */ - goto case4_skip3; - else - /* Skip the search at s + 1, because s[3] != c2. - Skip the search at s + 2, because s[3] != c1. - Skip the search at s + 3, because s[3] != c0. */ - goto case4_skip4; - } - case4_skip4: - s++; - s3 = s[3]; - if (s[3] == 0) - break; - case4_skip3: - s++; - s3 = s[3]; - if (s[3] == 0) - break; - case4_skip2: - s++; - s3 = s[3]; - if (s[3] == 0) - break; - case4_skip1: - s++; - s3 = s[3]; if (s[3] == 0) + goto notfound; + if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3) break; } + return (uint8_t *) s; } - break; } - +notfound: return NULL; } diff --git a/lib/unistr/u8-strcmp.c b/lib/unistr/u8-strcmp.c index 93f06ad..82a4414 100644 --- a/lib/unistr/u8-strcmp.c +++ b/lib/unistr/u8-strcmp.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcoll.c b/lib/unistr/u8-strcoll.c index 8a2a307..9ffa135 100644 --- a/lib/unistr/u8-strcoll.c +++ b/lib/unistr/u8-strcoll.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings using the collation rules of the current locale. - Copyright (C) 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2009. This program is free software: you can redistribute it and/or modify it @@ -29,5 +29,5 @@ #define FUNC u8_strcoll #define UNIT uint8_t #define U_STRCMP u8_strcmp -#define U_STRCONV_TO_ENCODING u8_strconv_to_encoding +#define U_STRCONV_TO_LOCALE u8_strconv_to_locale #include "u-strcoll.h" diff --git a/lib/unistr/u8-strcpy.c b/lib/unistr/u8-strcpy.c index 40d544e..9662de5 100644 --- a/lib/unistr/u8-strcpy.c +++ b/lib/unistr/u8-strcpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strcspn.c b/lib/unistr/u8-strcspn.c index 357f480..4b5b8e0 100644 --- a/lib/unistr/u8-strcspn.c +++ b/lib/unistr/u8-strcspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strdup.c b/lib/unistr/u8-strdup.c index 1ac590f..58a3077 100644 --- a/lib/unistr/u8-strdup.c +++ b/lib/unistr/u8-strdup.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strlen.c b/lib/unistr/u8-strlen.c index 08f011e..b8bebf0 100644 --- a/lib/unistr/u8-strlen.c +++ b/lib/unistr/u8-strlen.c @@ -1,5 +1,5 @@ /* Determine length of UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strmblen.c b/lib/unistr/u8-strmblen.c index 09b876b..52242c5 100644 --- a/lib/unistr/u8-strmblen.c +++ b/lib/unistr/u8-strmblen.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -24,7 +24,7 @@ int u8_strmblen (const uint8_t *s) { - /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + /* Keep in sync with unistr.h and utf8-ucs4.c. */ uint8_t c = *s; if (c < 0x80) diff --git a/lib/unistr/u8-strmbtouc.c b/lib/unistr/u8-strmbtouc.c index abfb179..67016c6 100644 --- a/lib/unistr/u8-strmbtouc.c +++ b/lib/unistr/u8-strmbtouc.c @@ -1,5 +1,5 @@ /* Look at first character in UTF-8 string. - Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2015 Free Software + Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -24,7 +24,7 @@ int u8_strmbtouc (ucs4_t *puc, const uint8_t *s) { - /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ + /* Keep in sync with unistr.h and utf8-ucs4.c. */ uint8_t c = *s; if (c < 0x80) diff --git a/lib/unistr/u8-strncat.c b/lib/unistr/u8-strncat.c index 533355b..4780350 100644 --- a/lib/unistr/u8-strncat.c +++ b/lib/unistr/u8-strncat.c @@ -1,5 +1,5 @@ /* Concatenate UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strncmp.c b/lib/unistr/u8-strncmp.c index 1b0d0f4..286450b 100644 --- a/lib/unistr/u8-strncmp.c +++ b/lib/unistr/u8-strncmp.c @@ -1,5 +1,5 @@ /* Compare UTF-8 strings. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strncpy.c b/lib/unistr/u8-strncpy.c index 306b02f..5ef757b 100644 --- a/lib/unistr/u8-strncpy.c +++ b/lib/unistr/u8-strncpy.c @@ -1,5 +1,5 @@ /* Copy UTF-8 string. - Copyright (C) 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strnlen.c b/lib/unistr/u8-strnlen.c index 5ae8b71..e732ea2 100644 --- a/lib/unistr/u8-strnlen.c +++ b/lib/unistr/u8-strnlen.c @@ -1,5 +1,5 @@ /* Determine bounded length of UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* Specification. */ #include "unistr.h" -#if __GLIBC__ >= 2 || defined __UCLIBC__ +#if __GLIBC__ >= 2 # include <string.h> diff --git a/lib/unistr/u8-strpbrk.c b/lib/unistr/u8-strpbrk.c index e7a8ad2..ec6dc27 100644 --- a/lib/unistr/u8-strpbrk.c +++ b/lib/unistr/u8-strpbrk.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strrchr.c b/lib/unistr/u8-strrchr.c index 4efd42d..6d8e297 100644 --- a/lib/unistr/u8-strrchr.c +++ b/lib/unistr/u8-strrchr.c @@ -1,5 +1,5 @@ /* Search character in UTF-8 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. diff --git a/lib/unistr/u8-strspn.c b/lib/unistr/u8-strspn.c index 23ab7b4..7747815 100644 --- a/lib/unistr/u8-strspn.c +++ b/lib/unistr/u8-strspn.c @@ -1,5 +1,5 @@ /* Search for some characters in UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-strstr.c b/lib/unistr/u8-strstr.c index 59d35e7..cce37ad 100644 --- a/lib/unistr/u8-strstr.c +++ b/lib/unistr/u8-strstr.c @@ -1,5 +1,5 @@ /* Substring test for UTF-8 strings. - Copyright (C) 1999, 2002, 2006, 2010-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -20,13 +20,9 @@ /* Specification. */ #include "unistr.h" -#include <string.h> - /* FIXME: Maybe walking the string via u8_mblen is a win? */ #define FUNC u8_strstr #define UNIT uint8_t #define U_STRCHR u8_strchr -#define U_STRMBTOUC u8_strmbtouc -#define UNIT_IS_UINT8_T 1 #include "u-strstr.h" diff --git a/lib/unistr/u8-strtok.c b/lib/unistr/u8-strtok.c index 1e4e6ef..e5c7203 100644 --- a/lib/unistr/u8-strtok.c +++ b/lib/unistr/u8-strtok.c @@ -1,5 +1,5 @@ /* Tokenize UTF-8 string. - Copyright (C) 1999, 2002, 2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it @@ -24,5 +24,4 @@ #define UNIT uint8_t #define U_STRSPN u8_strspn #define U_STRPBRK u8_strpbrk -#define U_STRMBLEN u8_strmblen #include "u-strtok.h" diff --git a/lib/unistr/u8-to-u16.c b/lib/unistr/u8-to-u16.c index cb0f298..3745c2b 100644 --- a/lib/unistr/u8-to-u16.c +++ b/lib/unistr/u8-to-u16.c @@ -1,5 +1,5 @@ /* Convert UTF-8 string to UTF-16 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-to-u32.c b/lib/unistr/u8-to-u32.c index 1b3cbc4..de2a35e 100644 --- a/lib/unistr/u8-to-u32.c +++ b/lib/unistr/u8-to-u32.c @@ -1,5 +1,5 @@ /* Convert UTF-8 string to UTF-32 string. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c index cc9c544..695921d 100644 --- a/lib/unistr/u8-uctomb-aux.c +++ b/lib/unistr/u8-uctomb-aux.c @@ -1,5 +1,5 @@ /* Conversion UCS-4 to UTF-8. - Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c index 43ef23d..fd33c05 100644 --- a/lib/unistr/u8-uctomb.c +++ b/lib/unistr/u8-uctomb.c @@ -1,5 +1,5 @@ /* Store a character in UTF-8 string. - Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. This program is free software: you can redistribute it and/or modify it |