From: SADAHIRO Tomoyuki Date: Sun, 4 Dec 2005 16:24:29 +0000 (+0900) Subject: Better variable names make code clearer X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=680c470ce925e5af5a9ca87f342016c7363e36fd;p=p5sagit%2Fp5-mst-13.2.git Better variable names make code clearer Subject: Re: XS-assisted SWASHGET (esp. for t/uni/class.t speedup) Message-Id: <20051204162412.D720.BQW10602@nifty.com> p4raw-id: //depot/perl@26257 --- diff --git a/embed.fnc b/embed.fnc index e92201d..f23dc98 100644 --- a/embed.fnc +++ b/embed.fnc @@ -833,7 +833,7 @@ Apd |void |sv_vsetpvfn |NN SV* sv|NN const char* pat|STRLEN patlen \ |NULLOK bool *maybe_tainted ApR |NV |str_to_version |NN SV *sv Ap |SV* |swash_init |NN const char* pkg|NN const char* name|NN SV* listsv|I32 minbits|I32 none -Ap |UV |swash_fetch |NN SV *sv|NN const U8 *ptr|bool do_utf8 +Ap |UV |swash_fetch |NN SV *swash|NN const U8 *ptr|bool do_utf8 Ap |void |taint_env Ap |void |taint_proper |NULLOK const char* f|NN const char* s Apd |UV |to_utf8_case |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp \ diff --git a/proto.h b/proto.h index f46b045..6ebd968 100644 --- a/proto.h +++ b/proto.h @@ -2296,7 +2296,7 @@ PERL_CALLCONV SV* Perl_swash_init(pTHX_ const char* pkg, const char* name, SV* l __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); -PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8) +PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); diff --git a/utf8.c b/utf8.c index bb8a67c..9387434 100644 --- a/utf8.c +++ b/utf8.c @@ -1626,11 +1626,18 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits * the lower-level routine, and it is similarly broken for returning * multiple values. --jhi */ /* Now SWASHGET is recasted into S_swash_get in this file. */ + +/* Note: + * Returns the value of property/mapping C for the first character + * of the string C. If C is true, the string C is + * assumed to be in utf8. If C is false, the string C is + * assumed to be in native 8-bit encoding. Caches the swatch in C. + */ UV -Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8) +Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8) { dVAR; - HV* const hv = (HV*)SvRV(sv); + HV* const hv = (HV*)SvRV(swash); U32 klen; U32 off; STRLEN slen; @@ -1696,7 +1703,7 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8) const UV code_point = utf8n_to_uvuni(ptr, UTF8_MAXBYTES, 0, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); - swatch = swash_get(sv, + swatch = swash_get(swash, /* On EBCDIC & ~(0xA0-1) isn't a useful thing to do */ (klen) ? (code_point & ~(needents - 1)) : 0, needents);