diff options
-rw-r--r-- | pod/perldiag.pod | 2 | ||||
-rw-r--r-- | toke.c | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index fe9be7632d..30971c6442 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1452,7 +1452,7 @@ there are neither package declarations nor a C<$VERSION>. long for Perl to handle. You have to be seriously twisted to write code that triggers this error. -=item Deprecated character(s) in \\N{...} starting at '%s' +=item Deprecated character in \\N{...}; marked by <-- HERE in \\N{%s<-- HERE %s (D deprecated) Just about anything is legal for the C<...> in C<\N{...}>. But starting in 5.12, non-reasonable ones that don't look like names are @@ -3264,14 +3264,11 @@ S_scan_const(pTHX_ char *start) } } if (problematic) { - char *string; - Newx(string, e - i + 1, char); - Copy(i, string, e - i, char); - string[e - i] = '\0'; + /* The e-i passed to the final %.*s makes sure that + * should the trailing NUL be missing that this + * print won't run off the end of the string */ Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), - "Deprecated character(s) in \\N{...} starting at '%s'", - string); - Safefree(string); + "Deprecated character in \\N{...}; marked by <-- HERE in \\N{%.*s<-- HERE %.*s", i - s + 1, s, e - i, i + 1); } } } /* End \N{NAME} */ |