diff options
author | Nicholas Clark <nick@ccl4.org> | 2001-09-23 00:07:56 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-22 21:22:28 +0000 |
commit | b85d93de80777e72578287d135fa7522521da8e8 (patch) | |
tree | 31cd9a33291e42930c7a074c6968ca7f919dbad4 /pp_pack.c | |
parent | 8f78c13df060827662cfa965c08d7e579573d479 (diff) | |
download | perl-b85d93de80777e72578287d135fa7522521da8e8.tar.gz |
Re: scalar context unpack bugs
Message-ID: <20010922230755.O4971@plum.flirble.org>
p4raw-id: //depot/perl@12144
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 35 |
1 files changed, 8 insertions, 27 deletions
@@ -170,33 +170,6 @@ PP(pp_unpack) #endif bool do_utf8 = DO_UTF8(right); - if (gimme != G_ARRAY) { /* arrange to do first one only */ - /*SUPPRESS 530*/ - /* Skipping spaces will be useful later on. */ - while (isSPACE(*pat)) - pat++; - /* Give up on optimisation of only doing first if the pattern - is getting too complex to parse. */ - if (*pat != '#') { - /* This pre-parser will let through certain invalid patterns - such as rows of !s, but the nothing that would cause multiple - conversions to be attempted. */ - char *here = pat; - bool seen_percent = FALSE; - if (*here == '%') - seen_percent = TRUE; - while (!isALPHA(*here) || *here == 'x') - here++; - if (strchr("aAZbBhHP", *here) || seen_percent) { - here++; - while (isDIGIT(*here) || *here == '*' || *here == '!') - here++; - } - else - here++; - patend = here; - } - } while (pat < patend) { reparse: datumtype = *pat++ & 0xFF; @@ -1161,6 +1134,14 @@ PP(pp_unpack) XPUSHs(sv_2mortal(sv)); checksum = 0; } + if (gimme != G_ARRAY && + SP - PL_stack_base == start_sp_offset + 1) { + /* do first one only unless in list context + / is implmented by unpacking the count, then poping it from the + stack, so must check that we're not in the middle of a / */ + if ((pat >= patend) || *pat != '/') + RETURN; + } } if (SP - PL_stack_base == start_sp_offset && gimme == G_SCALAR) PUSHs(&PL_sv_undef); |