summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-11-17 22:31:07 +0000
committerNicholas Clark <nick@ccl4.org>2008-11-17 22:31:07 +0000
commite389bba906c384f4fc3f3ad5e721e737cbd5d54e (patch)
tree11bce851f63eeb9c9a3ea2a24fa05bd0155ec80a /pp_ctl.c
parentaac018bb00282d5a72a5c5b4d95935b9eb667bcc (diff)
downloadperl-e389bba906c384f4fc3f3ad5e721e737cbd5d54e.tar.gz
No need to str*cpy() a string of known fixed length ("_<(eval )") when
a simple 1 byte write has the same desired effect. Clearly the Campaign for the Elimination of strlen() needs to branch out into str*cat() and str*cpy(). p4raw-id: //depot/perl@34874
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index b2cbbde365..cd5c1c1c86 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3662,9 +3662,7 @@ PP(pp_entereval)
CV* runcv;
U32 seq;
HV *saved_hh = NULL;
- const char * const fakestr = "_<(eval )";
- const int fakelen = 9 + 1;
-
+
if (PL_op->op_private & OPpEVAL_HAS_HH) {
saved_hh = MUTABLE_HV(SvREFCNT_inc(POPs));
}
@@ -3735,8 +3733,13 @@ PP(pp_entereval)
if ((PERLDB_LINE || PERLDB_SAVESRC)
&& was != (I32)PL_sub_generation /* Some subs defined here. */
&& ok) {
- /* Copy in anything fake and short. */
- my_strlcpy(safestr, fakestr, fakelen);
+ /* Just need to change the string in our writable scratch buffer that
+ will be used at scope exit to delete this eval's "file" name, to
+ something safe. The key names are of the form "_<(eval 1)" upwards,
+ so the 8th char is the first digit, which will not have a leading
+ zero. So give it a leading zero, and it can't match anything, but
+ still sits within the pattern space "reserved" for evals. */
+ safestr[8] = '0';
}
return ok ? DOCATCH(PL_eval_start) : PL_op->op_next;
}