diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-05-02 17:57:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-05-02 17:57:12 +0000 |
commit | 71bed85a8e466f6c3e557b1ecdc84ea0b18975ee (patch) | |
tree | 051f4034bc2d1fcb369ee4f490c0cf431c33dc2b /utf8.c | |
parent | 080ee629b6ee9302728926f5b419db1bf3aa61a0 (diff) | |
download | perl-71bed85a8e466f6c3e557b1ecdc84ea0b18975ee.tar.gz |
Save some repeated strlen()s in Perl_swash_init
p4raw-id: //depot/perl@22764
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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))); |