From: Nicholas Clark Date: Sun, 2 May 2004 17:57:12 +0000 (+0000) Subject: Save some repeated strlen()s in Perl_swash_init X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=71bed85a8e466f6c3e557b1ecdc84ea0b18975ee;p=p5sagit%2Fp5-mst-13.2.git Save some repeated strlen()s in Perl_swash_init p4raw-id: //depot/perl@22764 --- diff --git a/utf8.c b/utf8.c index 984cd14..6f201a2 100644 --- a/utf8.c +++ b/utf8.c @@ -1564,13 +1564,16 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none) SV* retval; SV* tokenbufsv = sv_2mortal(NEWSV(0,0)); dSP; - HV *stash = gv_stashpvn(pkg, strlen(pkg), FALSE); + size_t pkg_len = strlen(pkg); + size_t name_len = strlen(name); + HV *stash = gv_stashpvn(pkg, pkg_len, FALSE); SV* errsv_save; if (!gv_fetchmeth(stash, "SWASHNEW", 8, -1)) { /* demand load utf8 */ ENTER; errsv_save = newSVsv(ERRSV); - Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpv(pkg,0), Nullsv); + Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn(pkg,pkg_len), + Nullsv); if (!SvTRUE(ERRSV)) sv_setsv(ERRSV, errsv_save); SvREFCNT_dec(errsv_save); @@ -1580,8 +1583,8 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none) PUSHSTACKi(PERLSI_MAGIC); PUSHMARK(SP); EXTEND(SP,5); - PUSHs(sv_2mortal(newSVpvn(pkg, strlen(pkg)))); - PUSHs(sv_2mortal(newSVpvn(name, strlen(name)))); + PUSHs(sv_2mortal(newSVpvn(pkg, pkg_len))); + PUSHs(sv_2mortal(newSVpvn(name, name_len))); PUSHs(listsv); PUSHs(sv_2mortal(newSViv(minbits))); PUSHs(sv_2mortal(newSViv(none)));