diff options
author | Karl Williamson <khw@cpan.org> | 2017-02-19 21:48:40 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-02-19 22:45:00 -0700 |
commit | ec2c235b8da47c613eb6c9cdac160311692ea63a (patch) | |
tree | 699f93ca8e3f57be27bf6348238cbf0cb385232d /util.c | |
parent | 4d2c9c8c6c9a82ad785b57b9e346e202f74a0c66 (diff) | |
download | perl-ec2c235b8da47c613eb6c9cdac160311692ea63a.tar.gz |
Inline foldEQ, foldEQ_latin1, foldEQ_locale
These short functions are called in inner loops and regex backtracking.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 83 |
1 files changed, 0 insertions, 83 deletions
@@ -1022,89 +1022,6 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U } } - -/* -=for apidoc foldEQ - -Returns true if the leading C<len> bytes of the strings C<s1> and C<s2> are the -same -case-insensitively; false otherwise. Uppercase and lowercase ASCII range bytes -match themselves and their opposite case counterparts. Non-cased and non-ASCII -range bytes match only themselves. - -=cut -*/ - - -I32 -Perl_foldEQ(const char *s1, const char *s2, I32 len) -{ - const U8 *a = (const U8 *)s1; - const U8 *b = (const U8 *)s2; - - PERL_ARGS_ASSERT_FOLDEQ; - - assert(len >= 0); - - while (len--) { - if (*a != *b && *a != PL_fold[*b]) - return 0; - a++,b++; - } - return 1; -} -I32 -Perl_foldEQ_latin1(const char *s1, const char *s2, I32 len) -{ - /* Compare non-utf8 using Unicode (Latin1) semantics. Does not work on - * MICRO_SIGN, LATIN_SMALL_LETTER_SHARP_S, nor - * LATIN_SMALL_LETTER_Y_WITH_DIAERESIS, and does not check for these. Nor - * does it check that the strings each have at least 'len' characters */ - - const U8 *a = (const U8 *)s1; - const U8 *b = (const U8 *)s2; - - PERL_ARGS_ASSERT_FOLDEQ_LATIN1; - - assert(len >= 0); - - while (len--) { - if (*a != *b && *a != PL_fold_latin1[*b]) { - return 0; - } - a++, b++; - } - return 1; -} - -/* -=for apidoc foldEQ_locale - -Returns true if the leading C<len> bytes of the strings C<s1> and C<s2> are the -same case-insensitively in the current locale; false otherwise. - -=cut -*/ - -I32 -Perl_foldEQ_locale(const char *s1, const char *s2, I32 len) -{ - dVAR; - const U8 *a = (const U8 *)s1; - const U8 *b = (const U8 *)s2; - - PERL_ARGS_ASSERT_FOLDEQ_LOCALE; - - assert(len >= 0); - - while (len--) { - if (*a != *b && *a != PL_fold_locale[*b]) - return 0; - a++,b++; - } - return 1; -} - /* copy a string to a safe spot */ /* |