summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-19 09:22:03 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-19 09:22:03 +0000
commita075176614b5ba61bbee8cc5336ddfbd48f21998 (patch)
tree6a178d63dc3aebc41ae313572848e580e04974f6 /op.c
parent640af7f1c049ab83d4ea0840bc5fa3e1973e991f (diff)
downloadperl-a075176614b5ba61bbee8cc5336ddfbd48f21998.tar.gz
Avoid temporarily writing over the prototype when reporting an error.
(And beef up the relevant tests to really check that it all works). p4raw-id: //depot/perl@27898
Diffstat (limited to 'op.c')
-rw-r--r--op.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/op.c b/op.c
index 86d01d4b85..8efe3b250c 100644
--- a/op.c
+++ b/op.c
@@ -7231,7 +7231,7 @@ Perl_ck_subr(pTHX_ OP *o)
? cUNOPo : ((UNOP*)cUNOPo->op_first))->op_first;
OP *o2 = prev->op_sibling;
OP *cvop;
- char *proto = NULL;
+ const char *proto = NULL;
const char *proto_end = NULL;
CV *cv = NULL;
GV *namegv = NULL;
@@ -7381,15 +7381,13 @@ Perl_ck_subr(pTHX_ OP *o)
break;
case ']':
if (contextclass) {
- /* XXX We shouldn't be modifying proto, so we can const proto */
- char *p = proto;
- const char s = *p;
+ const char *p = proto;
+ const char *const end = proto;
contextclass = 0;
- *p = '\0';
while (*--p != '[');
- bad_type(arg, Perl_form(aTHX_ "one of %s", p),
- gv_ename(namegv), o3);
- *proto = s;
+ bad_type(arg, Perl_form(aTHX_ "one of %.*s",
+ (int)(end - p), p),
+ gv_ename(namegv), o3);
} else
goto oops;
break;