platform/upstream/perl.git
13 years agoAvoid needing to stub B::OPf_KIDS by loading the XS earlier.
Nicholas Clark [Thu, 4 Nov 2010 11:39:19 +0000 (11:39 +0000)]
Avoid needing to stub B::OPf_KIDS by loading the XS earlier.

This will also inline the constant in the code of walkoptree_slow().
Things are complicated by the fact that B's BOOT code needs $VERSION set, and
pushes to @EXPORT_OK.

Move the 'use strict' much earlier.

13 years agoRemove two use of dXSI32; superfluous because xsubpp automatically adds it.
Nicholas Clark [Thu, 4 Nov 2010 09:42:52 +0000 (09:42 +0000)]
Remove two use of dXSI32; superfluous because xsubpp automatically adds it.

13 years agoAdd Marty Pauley’s other e-mail address to checkAUTHORS.pl
Father Chrysostomos [Thu, 4 Nov 2010 07:33:24 +0000 (00:33 -0700)]
Add Marty Pauley’s other e-mail address to checkAUTHORS.pl

13 years agofix for #23790.
Marty Pauley [Sun, 24 Oct 2010 09:02:40 +0000 (18:02 +0900)]
fix for #23790.

padav is leaving an arrayref on the stack when producing the return value for an
lvalue sub.  But when this is in an argument list it really should be a array,
not a ref.  So, in leavesublv I check for this case and expand the arrayref to
an array.

13 years agoInline tryAMAGICunDEREF_var() into its callers and eliminate it.
Nicholas Clark [Wed, 3 Nov 2010 16:54:05 +0000 (16:54 +0000)]
Inline tryAMAGICunDEREF_var() into its callers and eliminate it.

Nothing outside the core was using this macro.

13 years agoAdd Perl_amagic_deref_call() to implement the bulk of tryAMAGICunDEREF_var().
Nicholas Clark [Wed, 3 Nov 2010 14:57:11 +0000 (14:57 +0000)]
Add Perl_amagic_deref_call() to implement the bulk of tryAMAGICunDEREF_var().

This removes around 300 bytes of object code from each place it was previously
inlined. It also provides a better interface - quite a lot of the core
currently bodges things by creating a local variable C<SV **sp = &sv> to use
the macro.

Change the XS::APItest wrapper to amagic_deref_call().

13 years agoAdd tests for tryAMAGICunDEREF_var().
Nicholas Clark [Wed, 3 Nov 2010 12:07:51 +0000 (12:07 +0000)]
Add tests for tryAMAGICunDEREF_var().

13 years agoUpdate Unicode-Collate to CPAN version 0.65
Chris 'BinGOs' Williams [Wed, 3 Nov 2010 11:21:11 +0000 (11:21 +0000)]
Update Unicode-Collate to CPAN version 0.65

  [DELTA]

  0.65  Wed Nov  3 13:10:20 2010
    - U::C::Locale newly supports locale: zh and its some variants.
             (zh__big5han, zh__gb2312han, zh__pinyin, zh__stroke)
    - added Unicode::Collate::CJK::Big5   for zh__big5han.
    - added Unicode::Collate::CJK::GB2312 for zh__gb2312han.
    - added Unicode::Collate::CJK::Pinyin for zh__pinyin.
    - added Unicode::Collate::CJK::Stroke for zh__stroke.

13 years agofix 68564: /g failure with zero-width patterns
Yves Orton [Wed, 3 Nov 2010 09:23:00 +0000 (10:23 +0100)]
fix 68564: /g failure with zero-width patterns

This is based on a patch by Father Chrysostomos <sprout@cpan.org>

The start class optimisation has two modes, "try every valid start
position" (doevery) and "flip flop mode" (!doevery) where it trys
only the first valid start position in a sequence.

Consider /(\d+)X/ and the string "123456Y", now we know that if we fail
to match X after matching "123456" then we will also fail to match after
"23456" (assuming no evil tricks are in place, which disable the
optimisation anyway), so we know we can skip forward until the check
/fails/ and only then start looking for a real match. This is flip-flop
mode.

Now consider the case with zero-width lookahead under /g: /(?=(\d+)X)/.
In this case we have an additional failure mode, that is failure when
we match a zero-width string twice at the same pos(). So now, the
"flip-flop" logic breaks as it /is/ possible that we could match at
"23456" when we couldn't match at "123456" because of the zero-length
twice at the same pos() rule. For instance:

  print $1 for "123"=~/(?=(\d+))/g

should first match "123". Since $& is zero length, pos() is not
incremented. We then match again, successfully, except that the match
is rejected despite technical-success because its $& is also zero
length and pos() has not advanced. If the flip-flop mode is enabled
we wont retry until we find a failing character first.

The point here is that it makes perfect sense to disable the
"flip-flop" mode optimisation when the start class is inside
a lookahead as it really doesnt apply.

13 years agoclarify code and intent of code in a comment
Yves Orton [Tue, 2 Nov 2010 13:26:46 +0000 (14:26 +0100)]
clarify code and intent of code in a comment

13 years agofix incorrect comment
Yves Orton [Tue, 2 Nov 2010 13:26:25 +0000 (14:26 +0100)]
fix incorrect comment

13 years agofix the trie part of rt-78356
Yves Orton [Tue, 2 Nov 2010 13:24:20 +0000 (14:24 +0100)]
fix the trie part of rt-78356

When the jump code was added the case of an empty string followed
by a jump wasnt accounted for. One could argue it should not happen
however that is a matter for a different commit.

13 years agoDocument y///r
Father Chrysostomos [Wed, 3 Nov 2010 04:32:05 +0000 (21:32 -0700)]
Document y///r

13 years agoDocument the ‘Using !~’ errors
Father Chrysostomos [Wed, 3 Nov 2010 03:28:51 +0000 (20:28 -0700)]
Document the ‘Using !~’ errors

13 years agoIncrease B::Concise’s version
Father Chrysostomos [Wed, 3 Nov 2010 03:13:59 +0000 (20:13 -0700)]
Increase B::Concise’s version

13 years agoy///r
Father Chrysostomos [Wed, 3 Nov 2010 03:19:25 +0000 (20:19 -0700)]
y///r

13 years agos///r leaks like a sieve
Father Chrysostomos [Wed, 3 Nov 2010 03:06:08 +0000 (20:06 -0700)]
s///r leaks like a sieve

13 years agoDon’t capitalise words in the middle of an error message
Father Chrysostomos [Tue, 2 Nov 2010 15:38:57 +0000 (08:38 -0700)]
Don’t capitalise words in the middle of an error message

13 years agoAdd transr op type
Father Chrysostomos [Wed, 3 Nov 2010 03:18:15 +0000 (20:18 -0700)]
Add transr op type

for the upcoming y///r feature. There are not enough flag bits,
hence the extra type.

13 years agoAvoid multiple $op->private calls in B::Deaprse::pp_trans
Father Chrysostomos [Tue, 2 Nov 2010 12:53:56 +0000 (05:53 -0700)]
Avoid multiple $op->private calls in B::Deaprse::pp_trans

13 years agoInline RvDEEPCP() into its only caller, Perl_amagic_call().
Nicholas Clark [Tue, 2 Nov 2010 20:06:50 +0000 (20:06 +0000)]
Inline RvDEEPCP() into its only caller, Perl_amagic_call().

Only Perl_amagic_call() was using RvDEEPCP() when it was added in 5.000, and I
believe that it's never had any other users (in the core, on CPAN, or anywhere
else visible to Google codesearch). Hence it seems an ideal candidates to be
inlined and eliminated.

13 years agoImplement the loop in tryAMAGICunDEREF_var() using while, rather than goto.
Nicholas Clark [Tue, 2 Nov 2010 16:40:39 +0000 (16:40 +0000)]
Implement the loop in tryAMAGICunDEREF_var() using while, rather than goto.

Yes, it was a while loop implemented using goto, although this only became
clear by untangling the macros. I believe it need never have been implemented
as goto, given that the other user of tryAMAGICunW_var "broke" out of the
"if"'s block using a return, hence that "if" could have been a "while" all
along.

13 years agoExpand AMG_CALLun_var() into all its users, and eliminate it.
Nicholas Clark [Tue, 2 Nov 2010 15:38:31 +0000 (15:38 +0000)]
Expand AMG_CALLun_var() into all its users, and eliminate it.

Aside from the 2 callers where it can be replaced with AMG_CALLun().
AMG_CALLun_var was only used in core.

13 years agoInline tryAMAGICunW_var() into macros tryAMAGICun{DEREF_var,TARGET}
Nicholas Clark [Tue, 2 Nov 2010 14:52:37 +0000 (14:52 +0000)]
Inline tryAMAGICunW_var() into macros tryAMAGICun{DEREF_var,TARGET}

This also inlines and eliminates FORCE_SETs and setAGAIN.

The three eliminated macros were not referenced from anywhere else. (The core,
CPAN, code visible to Google codesearch.)

13 years agoEliminate tryAMAGICunW() by refactoring tryAMAGICun{DEREF,TARGET}
Nicholas Clark [Tue, 2 Nov 2010 14:09:48 +0000 (14:09 +0000)]
Eliminate tryAMAGICunW() by refactoring tryAMAGICun{DEREF,TARGET}

tryAMAGICunW was only used within pp.h itself, and not referenced from anywhere
else. (The core, CPAN, code visible to Google codesearch.)

13 years agoRemove unused AMAGIC macros from pp.h. Neither core nor CPAN uses any.
Nicholas Clark [Tue, 2 Nov 2010 13:17:58 +0000 (13:17 +0000)]
Remove unused AMAGIC macros from pp.h. Neither core nor CPAN uses any.

Since commit 6f1401dc2acd2a2b, many AMAGIC macros in pp.h are no longer used
in core, nor in modules or CPAN, nor in code visible to Google codesearch.
Specifically:

tryAMAGICbinW_var
tryAMAGICbinW
tryAMAGICbin_var
tryAMAGICbin
tryAMAGICbinSET
tryAMAGICbinSET_var
tryAMAGICbinW_var
AMG_CALLbinL
tryAMAGICun_var
tryAMAGICun
tryAMAGICunSET_var
tryAMAGICunSET
tryAMAGICftest

13 years agoFix RT-70998: qq{\x{30ab}} =~ /\xab|\xa9/ produces warnings
Yves Orton [Tue, 2 Nov 2010 10:29:18 +0000 (11:29 +0100)]
Fix RT-70998: qq{\x{30ab}} =~ /\xab|\xa9/ produces warnings

13 years agoAdd test for rt-70998: qq{\x{30ab}} =~ /\xab|\xa9/ produces warnings
Father Chrysostomos [Tue, 2 Nov 2010 10:28:33 +0000 (11:28 +0100)]
Add test for rt-70998: qq{\x{30ab}} =~ /\xab|\xa9/ produces warnings

13 years agoremove commit bit so that porting tests dont fail
Yves Orton [Tue, 2 Nov 2010 09:44:18 +0000 (10:44 +0100)]
remove commit bit so that porting tests dont fail

13 years agoReorder struct xpvhv_aux to make two I32s adjacent.
Nicholas Clark [Tue, 2 Nov 2010 10:12:38 +0000 (10:12 +0000)]
Reorder struct xpvhv_aux to make two I32s adjacent.

This avoids structure padding on architectures with 64 bit alignment for
pointers. For example, on x86_64 it reduces the structure size from 48 to 40
bytes.

13 years agoFix permissions on lib/overload/numbers.pm, accidentally changed by 0e244b13.
Nicholas Clark [Tue, 2 Nov 2010 09:58:22 +0000 (09:58 +0000)]
Fix permissions on lib/overload/numbers.pm, accidentally changed by 0e244b13.

13 years agoperldelta up to 7fd683ff3c3
Father Chrysostomos [Tue, 2 Nov 2010 04:58:25 +0000 (21:58 -0700)]
perldelta up to 7fd683ff3c3

I cheated by adding more commit IDs to the exception list.

13 years agoIncrease DynaLoader’s version
Father Chrysostomos [Tue, 2 Nov 2010 04:24:25 +0000 (21:24 -0700)]
Increase DynaLoader’s version

13 years agoNote changes to perlvar in perldelta
brian d foy [Tue, 2 Nov 2010 03:43:19 +0000 (22:43 -0500)]
Note changes to perlvar in perldelta

13 years agoWhitespace fixes to perlvar
brian d foy [Tue, 2 Nov 2010 03:26:09 +0000 (22:26 -0500)]
Whitespace fixes to perlvar

13 years agoAdded ${^GLOBAL_PHASE} to perlvar
brian d foy [Tue, 2 Nov 2010 03:23:38 +0000 (22:23 -0500)]
Added ${^GLOBAL_PHASE} to perlvar

13 years agoFix some grammar nits thanks to jnareb
brian d foy [Wed, 27 Oct 2010 04:50:50 +0000 (23:50 -0500)]
Fix some grammar nits thanks to jnareb

13 years agoAdded some missing index entries and fixed some whitespace
brian d foy [Tue, 26 Oct 2010 02:19:57 +0000 (21:19 -0500)]
Added some missing index entries and fixed some whitespace

13 years agoGet rid of spatial references 'above' and 'before' in perlvar
brian d foy [Sun, 24 Oct 2010 23:56:30 +0000 (18:56 -0500)]
Get rid of spatial references 'above' and 'before' in perlvar

   We don't actually know where in space a formatter will put
   any text, or that the text will be there at all (e.g.
   perldoc -v)

13 years agoUse 'four' instead of 4 in body para in perlvar
brian d foy [Sun, 24 Oct 2010 23:47:41 +0000 (18:47 -0500)]
Use 'four' instead of 4 in body para in perlvar

13 years agoMake $^V recommendation the first sentence in $]
brian d foy [Sun, 24 Oct 2010 23:38:27 +0000 (18:38 -0500)]
Make $^V recommendation the first sentence in $]

13 years agoAdd more English equivalents, index all names in perlvar
brian d foy [Sun, 24 Oct 2010 23:37:12 +0000 (18:37 -0500)]
Add more English equivalents, index all names in perlvar

13 years agoI think I have perlvar ordered and proper now
brian d foy [Sun, 24 Oct 2010 06:58:08 +0000 (01:58 -0500)]
I think I have perlvar ordered and proper now

13 years agoPutting the variables in order, mostly, but not completely yet
brian d foy [Wed, 13 Oct 2010 07:26:07 +0000 (02:26 -0500)]
Putting the variables in order, mostly, but not completely yet

13 years ago* mjd rewrites the $", cleans up minor bits
brian d foy [Thu, 16 Sep 2010 16:37:56 +0000 (11:37 -0500)]
* mjd rewrites the $", cleans up minor bits

13 years ago* Add the missing $"
brian d foy [Thu, 16 Sep 2010 07:57:18 +0000 (02:57 -0500)]
* Add the missing $"

13 years ago* The first draft of a perlvar reorganization
brian d foy [Thu, 16 Sep 2010 06:54:53 +0000 (01:54 -0500)]
* The first draft of a perlvar reorganization

13 years agoAvoid buffer overflow in dl_win32.c
Jan Dubois [Tue, 2 Nov 2010 00:25:58 +0000 (17:25 -0700)]
Avoid buffer overflow in dl_win32.c

This fixes the DynaLoader related part of bug 78710
http://rt.perl.org/rt3//Public/Bug/Display.html?id=78710

13 years agoCorrect the return type for B::MAGIC::MOREMAGIC.
Nicholas Clark [Mon, 1 Nov 2010 17:16:29 +0000 (17:16 +0000)]
Correct the return type for B::MAGIC::MOREMAGIC.

b2adfa9b5e1682df accidentally changed the return type from SV to B::SV.
Clearly there aren't enough tests.
However, the code prior to b2adfa9b5e1682df was buggy (now fixed) in that it
could put a NULL on the perl stack. The stack should only be valid SV pointers.

13 years agoTidy B interpreter struct accessors in B.xs
Nicholas Clark [Mon, 1 Nov 2010 16:33:25 +0000 (16:33 +0000)]
Tidy B interpreter struct accessors in B.xs

1: Express B::amagic_generation and B::comppadlist "longhand", rather than
   creating macros solely for the benefit of xsubpp.
2: As no functions remain needing prefix stripping, eliminate the MODULE
   definition for B with the PREFIX of B_.
3: Merge the two BOOK blocks.

13 years agotidy code in Perl_sighandler()
David Mitchell [Mon, 1 Nov 2010 16:15:23 +0000 (16:15 +0000)]
tidy code in Perl_sighandler()

1) compress

    if (...)
flag |= 1
    ...
    if (flag & 1) {
...

into

    if (...) {
flag |= 1
....

2) re-order the flag bits, since over the years some bits have become
redundant.

13 years agoRT #76248: double-freed SV with nested sig-handler
David Mitchell [Mon, 1 Nov 2010 15:36:44 +0000 (15:36 +0000)]
RT #76248: double-freed SV with nested sig-handler

There was some buggy code in Perl_sighandler() related to getting an SV
with the signal name to pass to the perl-level handler function.
`
Basically:

on threaded builds, a sig handler that died leaked PL_psig_name[sig];
on unthreaded builds, in a recursive handler that died, PL_sig_sv was
prematurely freed.

PL_sig_sv was originally just a file static var that was not
recursion-save anyway, and got promoted to perlvars.h when it should
instead have been done away with. So I've got rid of it now, and
rationalised the code, which fixed the two issues listed above.

Also added an assert which makes the dodgy manual popping of the save
stack slightly less dodgy.

13 years agoRT 75254: Slow GC after Scalar::Util::weaken
David Mitchell [Sun, 31 Oct 2010 17:01:10 +0000 (17:01 +0000)]
RT 75254: Slow GC after Scalar::Util::weaken

Freeing lots of weak RVs to the same object results in quadratic
search through the backrefs array. This is probably sufficiently rare
that its not worth the expense of replacing the array with a ptr table
(say); but in the meantime, this patch makes the code as tight as
possible, and adds a check for the sv being at element 0, so that
both types of linear create/destroy order are optimised (previously only
created last / deleted first order was quick). It's still slow for random
deletion order. The RT code, modified to give high-res timing for the
return from the sub, and with various types of destruct order, gives the
following timings:

        LIFO   FIFO random
before 0.05s 17.37s 17.28s
now    0.04s  0.04s 12.05s

13 years agoMerge B's interpreter structure accesses for SV* types into intrpvar_sv_common.
Nicholas Clark [Mon, 1 Nov 2010 11:14:27 +0000 (11:14 +0000)]
Merge B's interpreter structure accesses for SV* types into intrpvar_sv_common.

On this platform this reduces the object size by 4.5K.

13 years agoAll callers of get_op_bitspec() in Opcode.xs pass len, so don't call strlen().
Nicholas Clark [Mon, 1 Nov 2010 15:41:53 +0000 (15:41 +0000)]
All callers of get_op_bitspec() in Opcode.xs pass len, so don't call strlen().

This commit brought to you by the campaign for elimination of strlen().

13 years agoSmall refactoring of op_names_init() and put_op_bitspec() in Opcode.xs
Nicholas Clark [Mon, 1 Nov 2010 15:07:45 +0000 (15:07 +0000)]
Small refactoring of op_names_init() and put_op_bitspec() in Opcode.xs

Change op_names_init() to use memset() rather than a longhand loop, and to
call put_op_bitspec() with an explicit length by using STR_WITH_LEN().
As all calls to put_op_bitspec() now pass in a length, remove the code to call
strlen() if the passed-in length is zero.

This commit brought to you by the campaign for elimination of strlen().

13 years agoRefactor Storable::{net_,}pstore to return undef/true, instead of 1 or 0.
Nicholas Clark [Mon, 1 Nov 2010 13:08:07 +0000 (13:08 +0000)]
Refactor Storable::{net_,}pstore to return undef/true, instead of 1 or 0.

This allows their only caller, Storable::_store(), to be simplified, as $ret
will now have the correct values for its documented interface.

Also, replace C<$ret = undef> with C<undef $ret>, as the latter is equivalent,
but uses 1 fewer op.

13 years agoMerge the implementation of B::sv_{undef,no,yes} using ALIAS.
Nicholas Clark [Mon, 1 Nov 2010 09:56:59 +0000 (09:56 +0000)]
Merge the implementation of B::sv_{undef,no,yes} using ALIAS.

On this platform, this reduces the object code size by around .75K.

13 years agoRefactor the error handling logic in Storable::_store().
Nicholas Clark [Mon, 1 Nov 2010 07:47:50 +0000 (07:47 +0000)]
Refactor the error handling logic in Storable::_store().

The logic remains:

1: If the close fails, set $ret to undef, and attempt to unlink the file
2: If the eval set $@, attempt to unlink the file
3: If the unlink is attempted and fails, warn

However, the new code avoids using low-precedence or and a statement modifier,
both for flow control, in the same statement, which I certainly found confusing.
It also now avoids the implicit *three*-state logic for $ret, which previously
was attaching distinct meanings to true, false and undefined.

The new code has (some) flow control inside an if(), and enters a block (which
it seems that the old code strove hard to avoid - blocks are a small runtime
cost). However the block entry is only for the error case, so this should not
matter.

13 years agoRemove S_get_isa_hash
Father Chrysostomos [Mon, 1 Nov 2010 06:47:59 +0000 (23:47 -0700)]
Remove S_get_isa_hash

It no longer serves much purpose, as of 7311f41d6.

13 years agoAllow push/pop/keys/etc to act on references
David Golden [Thu, 9 Sep 2010 21:22:02 +0000 (17:22 -0400)]
Allow push/pop/keys/etc to act on references

All built-in functions that operate directly on array or hash
containers now also accept hard references to arrays or hashes:

  |----------------------------+---------------------------|
  | Traditional syntax         | Terse syntax              |
  |----------------------------+---------------------------|
  | push @$arrayref, @stuff    | push $arrayref, @stuff    |
  | unshift @$arrayref, @stuff | unshift $arrayref, @stuff |
  | pop @$arrayref             | pop $arrayref             |
  | shift @$arrayref           | shift $arrayref           |
  | splice @$arrayref, 0, 2    | splice $arrayref, 0, 2    |
  | keys %$hashref             | keys $hashref             |
  | keys @$arrayref            | keys $arrayref            |
  | values %$hashref           | values $hashref           |
  | values @$arrayref          | values $arrayref          |
  | ($k,$v) = each %$hashref   | ($k,$v) = each $hashref   |
  | ($k,$v) = each @$arrayref  | ($k,$v) = each $arrayref  |
  |----------------------------+---------------------------|

This allows these built-in functions to act on long dereferencing
chains or on the return value of subroutines without needing to wrap
them in C<@{}> or C<%{}>:

  push @{$obj->tags}, $new_tag;  # old way
  push $obj->tags,    $new_tag;  # new way

  for ( keys %{$hoh->{genres}{artists}} ) {...} # old way
  for ( keys $hoh->{genres}{artists}    ) {...} # new way

For C<push>, C<unshift> and C<splice>, the reference will auto-vivify
if it is not defined, just as if it were wrapped with C<@{}>.

Calling C<keys> or C<values> directly on a reference gives a
substantial performance improvement over explicit dereferencing.

For C<keys>, C<values>, C<each>, when overloaded dereferencing is
present, the overloaded dereference is used instead of dereferencing
the underlying reftype.  Warnings are issued about assumptions made in
the following three ambiguous cases:

  (a) If both %{} and @{} overloading exists, %{} is used
  (b) If %{} overloading exists on a blessed arrayref, %{} is used
  (c) If @{} overloading exists on a blessed hashref, @{} is used

13 years ago[perl #78580] Stop a simple *glob from calling get-magic
Father Chrysostomos [Mon, 1 Nov 2010 00:02:44 +0000 (17:02 -0700)]
[perl #78580] Stop a simple *glob from calling get-magic

This also happens to apply to *{ $::{glob} }, but not to *{\*glob} or
*{$thing = *glob}.

In other words, it’s only when the operand is a real glob, and not a
reference or a SVt_FAKE glob.

13 years agoUpdate parent to CPAN version 0.224
Chris 'BinGOs' Williams [Mon, 1 Nov 2010 00:23:12 +0000 (00:23 +0000)]
Update parent to CPAN version 0.224

  [DELTA]

  0.224  20101031
    . Change assignment @ISA = (@ISA, 'new::class')
      to use push @ISA, 'new::class'
      This should make class creation faster from 5.10 onwards
      and reverts a change made in 2.14. If this is critically slow for you
      and you can't upgrade your version of Perl, use the old way.

13 years agoperlunicode.pod: Add detail on utf8/locale conflicts
Karl Williamson [Sun, 31 Oct 2010 20:04:15 +0000 (14:04 -0600)]
perlunicode.pod: Add detail on utf8/locale conflicts

13 years agoregcomp.h: Remove unused #define
Karl Williamson [Sun, 31 Oct 2010 19:37:11 +0000 (13:37 -0600)]
regcomp.h: Remove unused #define

ANYOF_RUNTIME() is no longer used, so can be removed.

I had long tried to figure out what the purpose of this was, and
discovered it really had none.

I think it must have had something to do with locales at one time.  But
locales don't do well with utf8, and I don't know how to make it better.
In any event this wasn't actually accomplishing anything.

13 years agoreginclass: Remove redundant test
Karl Williamson [Sun, 31 Oct 2010 19:31:13 +0000 (13:31 -0600)]
reginclass: Remove redundant test

The previous re-ordering of this function makes it clear that this test
doesn't do anything.  It is testing the charclass bitmap, but that was
already done in the re-ordered block from a previous commit, so if it
didn't succeed there, it won't succeed here.

In fact, trying to understand why this code was here was what led me to
figure out that it wasn't, and that things could be sped up by doing the
reordering.

13 years agoreginclass: Reorder fastest first
Karl Williamson [Sun, 31 Oct 2010 19:17:34 +0000 (13:17 -0600)]
reginclass: Reorder fastest first

This patch simply moves the block of code that does the bitmap tests in
front of the block of code that deals with potential things not in the
bit map.  The reason to do this is that it is faster to find things in
the bitmap, than to have to create a utf8 swash.

The patch also adds some comments, and the first block doesn't have to
test if there has been a match, and the second block does, so if
statements for those two blocks are adjusted accordingly.

The proof that this doesn't break anything stems from the fact that the
routine never stops early.  If there wasn't a match in the first block
of code, it would execute the second block.  Thus swapping the order
doesn't affect the outcome.  The side effects of the first block are
reading in the swash.  These side effects won't happen if it no longer
gets executed, because the other block matched.  And thus an error could
be introduced if there were coding errors elsewhere that didn't
initialize the swash before using it.  But that doesn't appear to be the
case, as all tests pass.

13 years agoreginclass: Remove unnecessary test
Karl Williamson [Sun, 31 Oct 2010 18:45:50 +0000 (12:45 -0600)]
reginclass: Remove unnecessary test

The previous changes have made it clear that this test never was useful,
so remove it.

13 years agoreginclass: Make explicit the length assumptions
Karl Williamson [Sun, 31 Oct 2010 18:36:49 +0000 (12:36 -0600)]
reginclass: Make explicit the length assumptions

reginclass assumes that can match always at least one character.  Make
that explicit, and now that we have that length always saved, don't
recalculate it.

13 years agoreginclass: Rename variable for clarity
Karl Williamson [Sun, 31 Oct 2010 18:31:11 +0000 (12:31 -0600)]
reginclass: Rename variable for clarity

Several other variables in the routine have the previous name

13 years agoregcomp.h: Clean up some comments
Karl Williamson [Sun, 31 Oct 2010 18:07:43 +0000 (12:07 -0600)]
regcomp.h: Clean up some comments

13 years agoANYOF_LARGE is now the same as ANYOF_CLASS
Karl Williamson [Sun, 31 Oct 2010 18:05:23 +0000 (12:05 -0600)]
ANYOF_LARGE is now the same as ANYOF_CLASS

These two #defines now mean the same thing.  Free up bit used by
ANYOF_LARGE

13 years agoregexec.c: reorder statements for speed
Karl Williamson [Sun, 31 Oct 2010 17:50:08 +0000 (11:50 -0600)]
regexec.c: reorder statements for speed

The call to reginclass is guaranteed by constness to not change
locinput, so if going to fail don't waste time calling it.

13 years agoregexec.c: Add clarifying comment
Karl Williamson [Sun, 31 Oct 2010 17:20:43 +0000 (11:20 -0600)]
regexec.c: Add clarifying comment

13 years agoreginclass: add some consts to prototype
Karl Williamson [Sun, 31 Oct 2010 16:37:55 +0000 (10:37 -0600)]
reginclass: add some consts to prototype

13 years agoregexec.c: Remove redundant line.
Karl Williamson [Sun, 31 Oct 2010 16:33:50 +0000 (10:33 -0600)]
regexec.c: Remove redundant line.

Now that reginclass is guaranteed to return the match length upon
success, the caller need not do it again.

13 years agoreginclass: Return matched length even if not utf8
Karl Williamson [Sun, 31 Oct 2010 16:21:14 +0000 (10:21 -0600)]
reginclass: Return matched length even if not utf8

This also allows for less special case testing

13 years agoreginclass: Change variable name for clarity.
Karl Williamson [Sun, 31 Oct 2010 15:20:41 +0000 (09:20 -0600)]
reginclass: Change variable name for clarity.

13 years agoregexec.c: Document existing reginclass behavior
Karl Williamson [Sun, 31 Oct 2010 15:11:39 +0000 (09:11 -0600)]
regexec.c: Document existing reginclass behavior

13 years agoperldelta up to 7cb18e1b02
Father Chrysostomos [Sun, 31 Oct 2010 21:35:59 +0000 (14:35 -0700)]
perldelta up to 7cb18e1b02

13 years agoMerge Storable::{is_storing,is_retrieving} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 21:20:08 +0000 (21:20 +0000)]
Merge Storable::{is_storing,is_retrieving} using ALIAS.

13 years agoStorable::{last_op_in_netorder,is_storing,is_retrieving} are all boolean.
Nicholas Clark [Sun, 31 Oct 2010 20:52:25 +0000 (20:52 +0000)]
Storable::{last_op_in_netorder,is_storing,is_retrieving} are all boolean.

Hence they can have return type bool, which allows xsubpp to generate slightly
simpler (and smaller) code, and at run time avoids using a temporary for the
return value.

13 years agoMerge Storable::{,net_}pstore and Storable::{,net_}mstore using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 20:32:20 +0000 (20:32 +0000)]
Merge Storable::{,net_}pstore and Storable::{,net_}mstore using ALIAS.

Remove the static functions {,net}[mp]store(), which were trivial wrappers
around do_store(). Instead call do_store() directly, using the ALIAS index
as the flag. Less code.

On this platform, this reduces the object code by over 1K. (Over 1%)

13 years agoAdd l1_char_class_tab.h to Make dependencies
Karl Williamson [Sat, 30 Oct 2010 21:35:00 +0000 (15:35 -0600)]
Add l1_char_class_tab.h to Make dependencies

13 years agoregcomp.c: No longer need _C_C_T_ and variant macro
Karl Williamson [Sat, 30 Oct 2010 22:55:42 +0000 (16:55 -0600)]
regcomp.c: No longer need _C_C_T_ and variant macro

Now, all calls have been converted to the more general case; can remove
the old one, and rename the new one to have the same name as the old one

13 years ago[:posix:] now works under /u
Karl Williamson [Sat, 30 Oct 2010 22:48:55 +0000 (16:48 -0600)]
[:posix:] now works under /u

This patch is part of fixing the Unicode bug.  The /u regex modifier now
applies to posix character classes.  This resolves [perl #18281].

The Todo tests in reg_posicc.t have all been made not todo.

13 years agol1_char_class_tab.h: Wrong for ALNUMC
Karl Williamson [Sat, 30 Oct 2010 21:33:34 +0000 (15:33 -0600)]
l1_char_class_tab.h: Wrong for ALNUMC

The generated table was wrong in the Latin1 range for characters with
the ALNUMC property

13 years agoNits in re pods
Karl Williamson [Sat, 30 Oct 2010 21:23:11 +0000 (15:23 -0600)]
Nits in re pods

13 years agoDOCs: Clarify that \w matches marks and \Pc
Karl Williamson [Sat, 30 Oct 2010 21:20:24 +0000 (15:20 -0600)]
DOCs: Clarify that \w matches marks and \Pc

The previous documentation really didn't specify what \w is.  It matches
the underscore, but also all other connector punctuation, plus any
marks, such as diacritical accents that occur within a word.

13 years agoAdd consistent synonyms for \p{PosxFOO}
Karl Williamson [Sat, 30 Oct 2010 16:13:48 +0000 (10:13 -0600)]
Add consistent synonyms for \p{PosxFOO}

This patch adds a set of synonyms \p{XPosixFOO} for the full extended
Unicode version of \p{PosixFOO}, so only one rule need be remembered.
Similarly, \p{XPerlSpace} is added to preserve the rule for the one
similar class that doesn't have Posix in its name.

Prior to this patch there was no exact equivalent to \p{PosixPunct}
extended beyond ASCII.

13 years agoRevert "Add consistent synonyms for \p{PosxFOO}"
Father Chrysostomos [Sun, 31 Oct 2010 17:23:39 +0000 (10:23 -0700)]
Revert "Add consistent synonyms for \p{PosxFOO}"

This reverts commit d5944336d74c819152158dabfd806d49ad0ecb21.

13 years agoMerge the XS implementation of all B::MG accessors using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 14:10:32 +0000 (14:10 +0000)]
Merge the XS implementation of all B::MG accessors using ALIAS.

On this platform, this reduces the object code size by over 5K.

13 years agoBump Safe's version to 2.29
Rafael Garcia-Suarez [Sun, 31 Oct 2010 13:17:20 +0000 (14:17 +0100)]
Bump Safe's version to 2.29

13 years agoAdd &version::vxs::VCMP to Safe's default share
Rafael Garcia-Suarez [Sun, 31 Oct 2010 13:08:53 +0000 (14:08 +0100)]
Add &version::vxs::VCMP to Safe's default share

This is to accomodate this new function in version.pm 0.85.

13 years agoAdd consistent synonyms for \p{PosxFOO}
Karl Williamson [Sat, 30 Oct 2010 16:13:48 +0000 (10:13 -0600)]
Add consistent synonyms for \p{PosxFOO}

This patch adds a set of synonyms \p{XPosixFOO} for the full extended
Unicode version of \p{PosixFOO}, so only one rule need be remembered.
Similarly, \p{XPerlSpace} is added to preserve the rule for the one
similar class that doesn't have Posix in its name.

13 years agoperlrecharclass: Nits
Karl Williamson [Sat, 30 Oct 2010 16:13:35 +0000 (10:13 -0600)]
perlrecharclass: Nits

13 years agomktables: Clarify \d description for perluniprops
Karl Williamson [Sat, 30 Oct 2010 15:53:06 +0000 (09:53 -0600)]
mktables: Clarify \d description for perluniprops

13 years agomktables: Add tests for wrong equivalence attempts
Karl Williamson [Sat, 30 Oct 2010 15:43:50 +0000 (09:43 -0600)]
mktables: Add tests for wrong equivalence attempts

mktables allows for multiple tables to be made equivalent, which in Unix
terminology means that they are essentially symbolic links.  However
this should happen only when they have the same code points in them to
begin with.  This adds a little more error checking.

13 years agoRT 75082: recv() with MSG_TRUNC flag SEGV
David Mitchell [Sun, 31 Oct 2010 12:44:39 +0000 (12:44 +0000)]
RT 75082: recv() with MSG_TRUNC flag SEGV

The recv() system call, with the MSG_TRUNC flag, returns the
true size of the packet, even if it is larger than the supplied buffer.
Since perl's equivalent recv() function doesn't return the size
(apart from what's implied as the returned length of the buffer), there
doesn't seem to to be any way to return this value to the caller. So
silently ignore it.

Before, we were setting SvCUR to the size, even if it was larger than
the buffer. Which was Bad.

13 years agoMerge the implementation of B::{main_root,main_start} using ALIAS.
Nicholas Clark [Sun, 31 Oct 2010 12:42:52 +0000 (12:42 +0000)]
Merge the implementation of B::{main_root,main_start} using ALIAS.