summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-12 15:21:14 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-12 15:21:14 +0000
commitcfff97972660a620adf7d1f4616e4a60f0c7dd32 (patch)
tree3fe8e4290e9432fd0df35d507647ebb25de2a825 /op.c
parent144c260c66e91246a2209df42a430484ee2d6ad4 (diff)
downloadperl-cfff97972660a620adf7d1f4616e4a60f0c7dd32.tar.gz
Remove some strlen()s and replace one strlcpy() with memcpy() because
we already know the string length. p4raw-id: //depot/perl@32105
Diffstat (limited to 'op.c')
-rw-r--r--op.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/op.c b/op.c
index 15510b27c4..3b40d3ee1d 100644
--- a/op.c
+++ b/op.c
@@ -7218,6 +7218,8 @@ Perl_ck_require(pTHX_ OP *o)
SV * const sv = kid->op_sv;
U32 was_readonly = SvREADONLY(sv);
char *s;
+ STRLEN len;
+ const char *end;
if (was_readonly) {
if (SvFAKE(sv)) {
@@ -7229,14 +7231,17 @@ Perl_ck_require(pTHX_ OP *o)
}
}
- for (s = SvPVX(sv); *s; s++) {
+ s = SvPVX(sv);
+ len = SvCUR(sv);
+ end = s + len;
+ for (; s < end; s++) {
if (*s == ':' && s[1] == ':') {
- const STRLEN len = strlen(s+2)+1;
*s = '/';
- Move(s+2, s+1, len, char);
- SvCUR_set(sv, SvCUR(sv) - 1);
+ Move(s+2, s+1, end - s, char);
+ --end;
}
}
+ SvEND_set(sv, end);
sv_catpvs(sv, ".pm");
SvFLAGS(sv) |= was_readonly;
}