Simplify the non-printable name error reporting code in Perl_allocmy().
authorNicholas Clark <nick@ccl4.org>
Tue, 9 May 2006 20:42:03 +0000 (20:42 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 9 May 2006 20:42:03 +0000 (20:42 +0000)
p4raw-id: //depot/perl@28145

op.c

diff --git a/op.c b/op.c
index 30231d3..dac36a9 100644 (file)
--- a/op.c
+++ b/op.c
@@ -245,30 +245,11 @@ Perl_allocmy(pTHX_ char *name)
     {
        /* name[2] is true if strlen(name) > 2  */
        if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
-           /* 1999-02-27 mjd@plover.com */
-           char *p;
-           p = strchr(name, '\0');
-           assert(p);
-           /* The next block assumes the buffer is at least 205 chars
-              long.  At present, it's always at least 256 chars. */
-           if (p - name > 200) {
-#ifdef HAS_STRLCPY
-               strlcpy(name + 200, "...", 4);
-#else
-               strcpy(name + 200, "...");
-#endif
-               p = name + 199;
-           }
-           else {
-               p[1] = '\0';
-           }
-           /* Move everything else down one character */
-           for (; p-name > 2; p--)
-               *p = *(p-1);
-           name[2] = toCTRL(name[1]);
-           name[1] = '^';
+           yyerror(Perl_form(aTHX_ "Can't use global %c^%c%s in \"my\"",
+                             name[0], toCTRL(name[1]), name + 2));
+       } else {
+           yyerror(Perl_form(aTHX_ "Can't use global %s in \"my\"",name));
        }
-       yyerror(Perl_form(aTHX_ "Can't use global %s in \"my\"",name));
     }
 
     /* check for duplicate declaration */