diff options
author | John Peacock <jpeacock@rowman.com> | 2002-08-10 11:56:22 -0400 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-08-20 14:51:16 +0000 |
commit | 92f0c2656233063d579e19d8c63f7cbf6ce7b9a2 (patch) | |
tree | de9b1657ee61c55fe0efcd69d94f058b776800ae /util.c | |
parent | 464b080a310708e7a2a4f76cfdc5ca4039ba758d (diff) | |
download | perl-92f0c2656233063d579e19d8c63f7cbf6ce7b9a2.tar.gz |
[REVISED PATCH] Magic v-strings
Message-id: <3D556FE6.6000404@rowman.com>
plus a bit of cleanup
p4raw-id: //depot/perl@17742
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 37 |
1 files changed, 18 insertions, 19 deletions
@@ -325,7 +325,7 @@ S_xstat(pTHX_ int flag) PerlIO_printf(Perl_debug_log, " . "); } } - PerlIO_printf(Perl_debug_log, "\n"); + PerlIO_printf(Perl_debug_log, "\n"); } } @@ -2861,7 +2861,7 @@ Perl_find_script(pTHX_ char *scriptname, bool dosearch, char **search_ext, I32 f #endif { bool seen_dot = 0; - + PL_bufend = s + strlen(s); while (s < PL_bufend) { #ifdef MACOS_TRADITIONAL @@ -4087,21 +4087,20 @@ Perl_new_vstring(pTHX_ char *s, SV *sv) for (;;) { rev = 0; { - /* this is atoi() that tolerates underscores */ - char *end = pos; - UV mult = 1; - if ( s > pos && *(s-1) == '_') { - mult = 10; - } - while (--end >= s) { - UV orev; - orev = rev; - rev += (*end - '0') * mult; - mult *= 10; - if (orev > rev && ckWARN_d(WARN_OVERFLOW)) - Perl_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in decimal number"); - } + /* this is atoi() that tolerates underscores */ + char *end = pos; + UV mult = 1; + while (--end >= s) { + UV orev; + if (*end == '_') + continue; + orev = rev; + rev += (*end - '0') * mult; + mult *= 10; + if (orev > rev && ckWARN_d(WARN_OVERFLOW)) + Perl_warner(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in decimal number"); + } } #ifdef EBCDIC if (rev > 0x7FFFFFFF) @@ -4112,13 +4111,13 @@ Perl_new_vstring(pTHX_ char *s, SV *sv) sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf); if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(rev))) SvUTF8_on(sv); - if ( (*pos == '.' || *pos == '_') && isDIGIT(pos[1])) + if (*pos == '.' && isDIGIT(pos[1])) s = ++pos; else { s = pos; break; } - while (isDIGIT(*pos) ) + while (isDIGIT(*pos) || *pos == '_') pos++; } SvPOK_on(sv); |