From 814fafa7eb0f558ee6baaa3044451757580d60bf Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 30 Oct 2005 17:49:27 +0000 Subject: [PATCH] Replace is_utf8_string_loc() with a macro that passes the extra 0 argument to is_utf8_string_loc(). Correct the description of its parameters in its POD. p4raw-id: //depot/perl@25903 --- embed.fnc | 2 +- embed.h | 2 -- mathoms.c | 6 ++++++ proto.h | 4 ++-- utf8.c | 27 ++++++++++----------------- utf8.h | 4 +++- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/embed.fnc b/embed.fnc index 0de7804..819163f 100644 --- a/embed.fnc +++ b/embed.fnc @@ -349,7 +349,7 @@ ApPR |bool |is_uni_punct_lc|UV c ApPR |bool |is_uni_xdigit_lc|UV c Apd |STRLEN |is_utf8_char |NN const U8 *p Apd |bool |is_utf8_string |NN const U8 *s|STRLEN len -Apd |bool |is_utf8_string_loc|NN const U8 *s|STRLEN len|NULLOK const U8 **p +Apdmb |bool |is_utf8_string_loc|NN const U8 *s|STRLEN len|NULLOK const U8 **p Apd |bool |is_utf8_string_loclen|NN const U8 *s|STRLEN len|NULLOK const U8 **ep|NULLOK STRLEN *el ApR |bool |is_utf8_alnum |NN const U8 *p ApR |bool |is_utf8_alnumc |NN const U8 *p diff --git a/embed.h b/embed.h index 0111652..bd52baf 100644 --- a/embed.h +++ b/embed.h @@ -338,7 +338,6 @@ #define is_uni_xdigit_lc Perl_is_uni_xdigit_lc #define is_utf8_char Perl_is_utf8_char #define is_utf8_string Perl_is_utf8_string -#define is_utf8_string_loc Perl_is_utf8_string_loc #define is_utf8_string_loclen Perl_is_utf8_string_loclen #define is_utf8_alnum Perl_is_utf8_alnum #define is_utf8_alnumc Perl_is_utf8_alnumc @@ -2326,7 +2325,6 @@ #define is_uni_xdigit_lc(a) Perl_is_uni_xdigit_lc(aTHX_ a) #define is_utf8_char(a) Perl_is_utf8_char(aTHX_ a) #define is_utf8_string(a,b) Perl_is_utf8_string(aTHX_ a,b) -#define is_utf8_string_loc(a,b,c) Perl_is_utf8_string_loc(aTHX_ a,b,c) #define is_utf8_string_loclen(a,b,c,d) Perl_is_utf8_string_loclen(aTHX_ a,b,c,d) #define is_utf8_alnum(a) Perl_is_utf8_alnum(aTHX_ a) #define is_utf8_alnumc(a) Perl_is_utf8_alnumc(aTHX_ a) diff --git a/mathoms.c b/mathoms.c index 08b90d8..307915c 100644 --- a/mathoms.c +++ b/mathoms.c @@ -782,6 +782,12 @@ PP(pp_mapstart) DIE(aTHX_ "panic: mapstart"); /* uses grepstart */ } +bool +Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep) +{ + return is_utf8_string_loclen(s, len, ep, 0); +} + /* * Local variables: * c-indentation-style: bsd diff --git a/proto.h b/proto.h index cc0df9f..c048db8 100644 --- a/proto.h +++ b/proto.h @@ -883,8 +883,8 @@ PERL_CALLCONV STRLEN Perl_is_utf8_char(pTHX_ const U8 *p) PERL_CALLCONV bool Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **p) - __attribute__nonnull__(pTHX_1); +/* PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **p) + __attribute__nonnull__(pTHX_1); */ PERL_CALLCONV bool Perl_is_utf8_string_loclen(pTHX_ const U8 *s, STRLEN len, const U8 **ep, STRLEN *el) __attribute__nonnull__(pTHX_1); diff --git a/utf8.c b/utf8.c index d6e54ba..be4a2e9 100644 --- a/utf8.c +++ b/utf8.c @@ -307,6 +307,16 @@ Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len) } /* +Implemented as a macro in utf8.h + +=for apidoc A|bool|is_utf8_string_loc|const U8 *s|STRLEN len|const U8 **ep + +Like is_utf8_string() but stores the location of the failure (in the +case of "utf8ness failure") or the location s+len (in the case of +"utf8ness success") in the C. + +See also is_utf8_string_loclen() and is_utf8_string(). + =for apidoc A|bool|is_utf8_string_loclen|const U8 *s|STRLEN len|const U8 **ep|const STRLEN *el Like is_utf8_string() but stores the location of the failure (in the @@ -368,24 +378,7 @@ Perl_is_utf8_string_loclen(pTHX_ const U8 *s, STRLEN len, const U8 **ep, STRLEN } /* -=for apidoc A|bool|is_utf8_string_loc|const U8 *s|STRLEN len|const U8 **ep|const STRLEN *el - -Like is_utf8_string() but stores the location of the failure (in the -case of "utf8ness failure") or the location s+len (in the case of -"utf8ness success") in the C. - -See also is_utf8_string_loclen() and is_utf8_string(). - -=cut -*/ -bool -Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep) -{ - return is_utf8_string_loclen(s, len, ep, 0); -} - -/* =for apidoc A|UV|utf8n_to_uvuni|const U8 *s|STRLEN curlen|STRLEN *retlen|U32 flags Bottom level UTF-8 decode routine. diff --git a/utf8.h b/utf8.h index 4599407..9546fe8 100644 --- a/utf8.h +++ b/utf8.h @@ -1,6 +1,6 @@ /* utf8.h * - * Copyright (C) 2000, 2001, 2002, by Larry Wall and others + * Copyright (C) 2000, 2001, 2002, 2005 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -332,4 +332,6 @@ encoded character. #define IS_UTF8_CHAR_FAST(n) ((n) <= 4) +#define is_utf8_string_loc(s, len, ep) is_utf8_string_loclen(s, len, ep, 0) + #endif /* IS_UTF8_CHAR() for UTF-8 */ -- 2.7.4