From: Jarkko Hietaniemi Date: Sun, 19 Nov 2000 06:42:22 +0000 (+0000) Subject: Make hex scanning warn on "\x{x}" and "\xx". X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cfd3e6cc939d8bde13484fe44765049dcaa49dc2;p=p5sagit%2Fp5-mst-13.2.git Make hex scanning warn on "\x{x}" and "\xx". "\x" and and hex("x") are still valid. p4raw-id: //depot/perl@7746 --- diff --git a/util.c b/util.c index 2168d55..02d0ed5 100644 --- a/util.c +++ b/util.c @@ -3094,10 +3094,20 @@ Perl_scan_hex(pTHX_ char *start, STRLEN len, STRLEN *retlen) register char *s = start; register NV rnv = 0.0; register UV ruv = 0; - register bool seenx = FALSE; register bool overflowed = FALSE; char *hexdigit; + if (len > 2) { + if (s[0] == 'x') { + s++; + len--; + } + else if (len > 3 && s[0] == '0' && s[1] == 'x') { + s+=2; + len-=2; + } + } + for (; len-- && *s; s++) { hexdigit = strchr((char *) PL_hexdigit, *s); if (!hexdigit) { @@ -3107,11 +3117,6 @@ Perl_scan_hex(pTHX_ char *start, STRLEN len, STRLEN *retlen) --len; ++s; } - else if (seenx == FALSE && *s == 'x' && ruv == 0) { - /* Disallow 0xxx0x0xxx... */ - seenx = TRUE; - continue; - } else { dTHR; if (ckWARN(WARN_DIGIT))