This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
13 years agoRT ticket 62918: _modpow(x,y,z) with x = 0 and y > 0
Peter John Acklam [Thu, 11 Nov 2010 21:06:59 +0000 (22:06 +0100)]
RT ticket 62918: _modpow(x,y,z) with x = 0 and y > 0

Fix _modpow() method in Math::BigInt::Calc so it correctly returns 0
in the case (0 ** $x) % $y, with $x > 0.

- lib/Math/BigInt/Calc.pm: fix mentioned bug

- t/bigintpm.inc: add a few more test cases

- t/bare_mbi.t: increment test counter

- t/bigintpm.t: increment test counter

- t/sub_mbi.t: increment test counter

13 years agoperldelta up to 4df35a07ff9
Father Chrysostomos [Fri, 12 Nov 2010 06:05:28 +0000 (22:05 -0800)]
perldelta up to 4df35a07ff9

13 years agoUpdate Data::Dumper’s change log
Father Chrysostomos [Fri, 12 Nov 2010 05:49:58 +0000 (21:49 -0800)]
Update Data::Dumper’s change log

13 years agoIncrease Data::Dumper’s version
Father Chrysostomos [Fri, 12 Nov 2010 05:47:54 +0000 (21:47 -0800)]
Increase Data::Dumper’s version

13 years agomro_isa_changed_in3 is no longer necessary
Father Chrysostomos [Fri, 12 Nov 2010 04:39:31 +0000 (20:39 -0800)]
mro_isa_changed_in3 is no longer necessary
as of 80ebaca.

It was nice while it lasted.

This reverts 6f86b615fa.

13 years agoFix package assignment with nested aliased packages
Father Chrysostomos [Fri, 12 Nov 2010 04:29:31 +0000 (20:29 -0800)]
Fix package assignment with nested aliased packages

This commit fixes package assignments like *foo:: = *bar:: when both
foo and bar contain nested stashes that are aliases of each other.

mro_package_moved (actually, its auxiliary routine) need to keep a
list of stashes that have been seen as a separate list from those that
are going to have mro_isa_changed_in called on them. Otherwise, some
stashes will simply not be iterated through.

See the test that this adds and its comments. @ISA = @ISA should never
have any effect visible to Perl (with a capital), but it does in that
test case, prior to this commit.

This also fixes another bug that the test case triggered:
riter was not being reset before the second iteration in
mro_gather_and_rename.

Also, the stashes HV (aka the ‘big list’) now holds refcounts on its
elements, as that makes the code simpler as a result of the changes.

13 years agoIncrease File::stat’s version
Father Chrysostomos [Fri, 12 Nov 2010 02:09:57 +0000 (18:09 -0800)]
Increase File::stat’s version

13 years agoRT 79076: fix File::stat overload tests -x and -X when uid is root
Todd Rinaldo [Thu, 11 Nov 2010 23:08:34 +0000 (17:08 -0600)]
RT 79076: fix File::stat overload tests -x and -X when uid is root

13 years agoUpdate MIME-Base64 to CPAN version 3.10
Chris 'BinGOs' Williams [Fri, 12 Nov 2010 00:03:47 +0000 (00:03 +0000)]
Update MIME-Base64 to CPAN version 3.10

  [DELTA]

  Release 3.10

  Provide functions to calculate the length of encoded and decoded
  base64 strings [RT#62404]

13 years agoIn newSVhek(), use sv_usepvn_flags() to avoid a malloc()/copy/free()
Nicholas Clark [Thu, 11 Nov 2010 21:37:48 +0000 (21:37 +0000)]
In newSVhek(), use sv_usepvn_flags() to avoid a malloc()/copy/free()

The return value of bytes_to_utf8() is a malloc()ed string, which we can donate
to the scalar to use as its buffer. Previously the code free()d this memory,
after using it as a parameter to newSVpvn(), which allocates a new buffer and
copies to it.

13 years ago[perl #79024] Bleadperl 80ebaca breaks OVID/Class-Trait-0.31.tar.gz
Father Chrysostomos [Thu, 11 Nov 2010 14:12:00 +0000 (06:12 -0800)]
[perl #79024] Bleadperl 80ebaca breaks OVID/Class-Trait-0.31.tar.gz

Commit 80ebaca actually exposed an existing bug that Class::Trait was
really close to triggering already:

  undef *ISA; # @ISA no longer magical

Class::Trait’s tests just happened not to call ->isa before making any
changes to @ISA.

Now that the meta->isa cache is created immediately,
Class::Trait fails.

This bug can be reproduced in earlier perls by putting an ->isa call
right after the undef:

  undef *{"Extra::TSpouse::ISA"};
 'Extra::TSpouse'->isa('Class::Trait::Base');
  unshift @{"Extra::TSpouse::ISA"}, Class::Trait::Base;
  warn Extra::TSpouse->isa('Class::Trait::Base'); # something's wrong

This commit modifies gv_fetchpvn_flags to magicalise @ISA whenever it
is fetched.

13 years agoPATCH: [perl #78994]: optimizer loses folding
Karl Williamson [Wed, 10 Nov 2010 05:05:44 +0000 (22:05 -0700)]
PATCH: [perl #78994]: optimizer loses folding

The optimizer works by creating an initial ANYOF node that is supposed
to match anything.  When it finds the first node that it wants to allow
be a first match, it ANDs the anything node with that one, effectively
setting the first node to it.  Subsequent nodes that could match in the
first position are OR'd instead, adding to the possibilities that the
first match could be.

But the optimizer was not dealing with the possibility of folding, so
the first node did not have that as a possibility and hence a match that
relied on the fold would not succeed.

Originally, the patch had an 'if (FOLD)' guarding the initialization of
the match anything node , but it turns out that FOLD is set only if
folding is on globally, and in the example program of the trouble
ticket, it isn't set at the proper time, because the regex is recompiled
when upgraded to utf8, and it doesn't get set then.  So I
unconditionally set ANYOF_FOLD.

13 years agoCorrect comment in mro_isa_changed_in
Father Chrysostomos [Thu, 11 Nov 2010 13:40:43 +0000 (05:40 -0800)]
Correct comment in mro_isa_changed_in

It was describing an intermediate version of what became 80ebaca.

13 years agoAdd Perl_bytes_cmp_utf8() to compare character sequences in different encodings
Nicholas Clark [Thu, 11 Nov 2010 16:08:43 +0000 (16:08 +0000)]
Add Perl_bytes_cmp_utf8() to compare character sequences in different encodings

Convert sv_eq_flags() and sv_cmp_flags() to use it.

Previously, to compare two strings of characters, where was was in UTF-8, and
one was not, you had to either:

1: Upgrade the second to UTF-8
2: Compare the resulting octet sequence
3: Free the temporary UTF-8 string

or:

1: Attempt to downgrade the first to bytes. If it can't be, they aren't equal
2: Else compare the resulting octet sequence
3: Free the temporary byte string

Which for the general case involves a malloc()/free() and at least two O(n)
scans per comparison.

Whereas this approach has no allocation, a single O(n) scan, which terminates
as early as the best case for the second approach.

13 years agoAdd tests for cmp, eq, ne for UTF-8 vs octet representation.
Nicholas Clark [Thu, 11 Nov 2010 13:10:54 +0000 (13:10 +0000)]
Add tests for cmp, eq, ne for UTF-8 vs octet representation.

It turns out that we weren't actually explicitly testing this anywhere.

13 years agoFix errors in the diagnostic output of t/op/cmp.t
Nicholas Clark [Thu, 11 Nov 2010 11:42:38 +0000 (11:42 +0000)]
Fix errors in the diagnostic output of t/op/cmp.t

13 years agoAdjust t/run/switchd-78586.t to work under t/TEST and t/harness.
Nicholas Clark [Thu, 11 Nov 2010 13:45:21 +0000 (13:45 +0000)]
Adjust t/run/switchd-78586.t to work under t/TEST and t/harness.

13 years agoRemove redundant conditional added by e530fb81d
Father Chrysostomos [Thu, 11 Nov 2010 13:12:35 +0000 (05:12 -0800)]
Remove redundant conditional added by e530fb81d

The else is never reached if the assignment in the protasis succeeds.

13 years ago[perl #78964] Fix ext/XS-APItest/t/overload.t
Jerry D. Hedden [Thu, 11 Nov 2010 12:48:45 +0000 (04:48 -0800)]
[perl #78964] Fix ext/XS-APItest/t/overload.t

Attached patch fixes the following warning from 'make test':

ext/XS-APItest/t/overload...................................."my"
variable $got masks earlier declaration in same scope at t/overload.t
line 81.
ok

13 years agoperldelta up to 8ff3250783
Father Chrysostomos [Thu, 11 Nov 2010 12:44:44 +0000 (04:44 -0800)]
perldelta up to 8ff3250783

13 years agoTest for [perl #78586]
Tim Bunce [Thu, 11 Nov 2010 12:13:52 +0000 (04:13 -0800)]
Test for [perl #78586]

13 years agomake regen_perly
Father Chrysostomos [Thu, 11 Nov 2010 06:25:25 +0000 (22:25 -0800)]
make regen_perly

13 years ago[perl #78586] Bleadperl eae48c89 breaks TIMB/Devel-NYTProf-4.05.tar.gz
Zefram [Thu, 11 Nov 2010 06:15:28 +0000 (22:15 -0800)]
[perl #78586] Bleadperl eae48c89 breaks TIMB/Devel-NYTProf-4.05.tar.gz

> $ perl -d:Trace <<END
> warn "1";
> {
>     warn "3";
> }
> warn "5";
> END
> >> -:1: warn "1";
> 1 at - line 1.
> >> -:5: warn "5";      <== wrong
> >> -:3:     warn "3";
> 3 at - line 3.
> >> -:5: warn "5";
> 5 at - line 5.

I believe this is fixed by a one line change (plus `make regen_perly`):

13 years agoundef *glob should update isa(rev)
Father Chrysostomos [Thu, 11 Nov 2010 05:57:15 +0000 (21:57 -0800)]
undef *glob should update isa(rev)

13 years agoIncrease threads’ version
Father Chrysostomos [Wed, 10 Nov 2010 13:39:17 +0000 (05:39 -0800)]
Increase threads’ version

13 years agoCorrect note about dir handles in threads.pm
Father Chrysostomos [Wed, 10 Nov 2010 13:39:00 +0000 (05:39 -0800)]
Correct note about dir handles in threads.pm

13 years agoInline sv_cmp() and sv_cmp_locale() as macros wrapping their flags variants.
Nicholas Clark [Thu, 11 Nov 2010 10:55:27 +0000 (10:55 +0000)]
Inline sv_cmp() and sv_cmp_locale() as macros wrapping their flags variants.

We can't move Perl_sv_cmp() and Perl_sv_cmp_locale() to mathoms.c, as they
are referenced by function pointer in pp_sort.c - pointers which require the
specific current calling signature.

13 years agoConvert the flags argument for Perl_sv_{eq,cmp,cmp_locale}_flags() to U32.
Nicholas Clark [Thu, 11 Nov 2010 10:25:02 +0000 (10:25 +0000)]
Convert the flags argument for Perl_sv_{eq,cmp,cmp_locale}_flags() to U32.

These functions have not yet been in a stable release.
Going forwards, I think that we should consider converting all bitmap flags
arguments to *un*signed types. Most uses of I32 in the core are inappropriate.

13 years agoFix memory leaks in mro_package_moved
Father Chrysostomos [Wed, 10 Nov 2010 17:43:21 +0000 (09:43 -0800)]
Fix memory leaks in mro_package_moved

This commit adds a new HV_FETCH_EMPTY_HE flag for hv_common. It is to
be used in conjunction with HV_FETCH_LVALUE. It just stops the newly-
created HE from having a new undef scalar assigned to it.

This allows code to call hv_common just once instead of an hv_exists/
hv_store pair.

It was such a double hv_common call that I was trying to avoid with
HV_FETCH_LVALUE, without realising that it was leaking.

13 years agoRename PERLIO_BUFSIZ to PERLIOBUF_DEFAULT_BUFSIZ.
Craig A. Berry [Thu, 11 Nov 2010 03:23:48 +0000 (21:23 -0600)]
Rename PERLIO_BUFSIZ to PERLIOBUF_DEFAULT_BUFSIZ.

PERLIO_BUFSIZ was already in use by Encode::Unicode for the
PerlIOEncode_xxx layer, so it makes sense to specify that this
macro is for the PerlIOBuf_xxx layer and that it is a default
value that may eventually be settable at run-time.

13 years agoFix compilation with old xsubpps
Florian Ragwitz [Wed, 10 Nov 2010 13:19:58 +0000 (14:19 +0100)]
Fix compilation with old xsubpps

croak_xs_usage is new in perl 5.10, but some version xsubpp emulate it on older
perls as well. However, really old xsubpps don't do that.

13 years agoRT ticket #43694: as_int/as_number lose precision
Peter John Acklam [Thu, 4 Nov 2010 13:22:12 +0000 (14:22 +0100)]
RT ticket #43694: as_int/as_number lose precision

The as_int/as_number methods lose precision because the wrong library
method is used for converting a library integer object to something that
is processed by Math::BigInt->new(). The method _num() returns a Perl
scalar, with an accuracy limited to the Perl's internal floating point
format. The correct is to use _str() which returns a string with all
digits preserved.

- t/bigfltpm.inc: add test case with more digits than is used in Perl's
  internal floating point format.

- t/bigfltpm.t: increase number of tests by one.

- lib/Math/BigFloat.pm: changed library method from _num() to _str().

13 years agoMake the buffer size for the perlio layer a macro.
Craig A. Berry [Wed, 10 Nov 2010 02:20:12 +0000 (20:20 -0600)]
Make the buffer size for the perlio layer a macro.

The 4K buffer size was chosen way back in bb9950b.  Significant performance
improvements are seen with larger buffer sizes, though the optimum size
likely varies by architecture and workload.  For starters, we'll leave the
default as-is but make the buffer size a macro and thus user-configurable via:

  sh Configure -Accflags=-DPERLIO_BUFSIZ=<number>

Choosing a better (larger) default is still TODO.

13 years agoMove ExtUtils-Command from cpan/ to dist/
Florian Ragwitz [Tue, 9 Nov 2010 20:18:21 +0000 (21:18 +0100)]
Move ExtUtils-Command from cpan/ to dist/

Randy Kobes passed away recently, so let's have p5p maintain it for now.

13 years agoMove ExtUtils-Manifest from cpan/ to dist/
Florian Ragwitz [Tue, 9 Nov 2010 20:18:21 +0000 (21:18 +0100)]
Move ExtUtils-Manifest from cpan/ to dist/

Randy Kobes passed away recently, so let's have p5p maintain it for now.

13 years agoCorrected date of death for Randy Kobes
David Golden [Tue, 9 Nov 2010 18:25:17 +0000 (13:25 -0500)]
Corrected date of death for Randy Kobes

Based on published obituary rather than announcement
from University of Winnipeg.

http://www.passagesmb.com/obituary_details.cfm?ObitID=169229

13 years agoRemove an unused variable
Florian Ragwitz [Tue, 9 Nov 2010 18:07:07 +0000 (19:07 +0100)]
Remove an unused variable

13 years agoDisable bitwise operators
Florian Ragwitz [Tue, 9 Nov 2010 18:01:51 +0000 (19:01 +0100)]
Disable bitwise operators

Some of them used to return wrong results, others just failed horribly. We're
disabling them alltogether, with a useful error message, until maybe someone
figures out how to make them DWIM.

13 years agoIn S_check_type_and_open() call PerlIO_openn() directly if possible.
Nicholas Clark [Tue, 9 Nov 2010 15:58:52 +0000 (15:58 +0000)]
In S_check_type_and_open() call PerlIO_openn() directly if possible.

This saves creating a mortal SV on every file require (and a strlen()).

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

13 years agoChange S_doopen_pm() and S_check_type_and_open() to take an SV parameter.
Nicholas Clark [Tue, 9 Nov 2010 15:40:59 +0000 (15:40 +0000)]
Change S_doopen_pm() and S_check_type_and_open() to take an SV parameter.

Previously S_doopen_pm() took a char */STRLEN pair, but it happened that the
pointer was always from an SV. So pass the SV directly.

13 years agoperldelta: note passing of Randy Kobes
David Golden [Tue, 9 Nov 2010 16:16:14 +0000 (11:16 -0500)]
perldelta: note passing of Randy Kobes

13 years agoOne more typo, reported by H.Merijn Brand
Abigail [Tue, 9 Nov 2010 15:47:11 +0000 (16:47 +0100)]
One more typo, reported by H.Merijn Brand

13 years agoSome typo fixes reported by Tom Christiansen
Abigail [Tue, 9 Nov 2010 14:55:32 +0000 (15:55 +0100)]
Some typo fixes reported by Tom Christiansen

13 years agoTest that Opcode loads without warnings.
Nicholas Clark [Tue, 9 Nov 2010 13:47:10 +0000 (13:47 +0000)]
Test that Opcode loads without warnings.

This will fail if there are untagged ops.

13 years agoTidy up ext/Opcode/t/Opcode.t.
Nicholas Clark [Tue, 9 Nov 2010 13:24:41 +0000 (13:24 +0000)]
Tidy up ext/Opcode/t/Opcode.t.

Convert a loop with a die into regular tests. Don't declare lexicals ahead of
use. Don't even declare a lexical @o3, which isn't used.

13 years agoConvert ext/Opcode/t/Opcode.t to Test::More.
Nicholas Clark [Tue, 9 Nov 2010 13:09:29 +0000 (13:09 +0000)]
Convert ext/Opcode/t/Opcode.t to Test::More.

The tests (including the still-TODO) mostly date from 1996.

13 years agoFix error in tryAMAGICunDEREF() introduced in 25a9ffce153b0e67.
Nicholas Clark [Tue, 9 Nov 2010 10:40:40 +0000 (10:40 +0000)]
Fix error in tryAMAGICunDEREF() introduced in 25a9ffce153b0e67.

tryAMAGICunDEREF() isn't used anywhere in the core. Add tests for it.

13 years agoauthorial perlipc edit
Tom Christiansen [Tue, 9 Nov 2010 06:00:00 +0000 (22:00 -0800)]
authorial perlipc edit

Looking through perlipc to make little fixes, it quickly became clear to me
that it had been patched with code by people with a Perl coding style, and
sometimes with an English language style, both very different to my own.

This made it seem like an old patchwork tattercloth that didn't fit
together very well.  It was confusing and detracted from the overall
message.  I've tried to fix all this.  I started with a recent git pull
and edited.  The result is something that is once again internally
self-consistent.

13 years agoDelete paragraphs from mro.pm’s pod
Father Chrysostomos [Tue, 9 Nov 2010 04:12:52 +0000 (20:12 -0800)]
Delete paragraphs from mro.pm’s pod
which are no longer relevant

13 years ago[perl #75176] Symbol::delete_package does not free certain memory associated with...
Father Chrysostomos [Tue, 9 Nov 2010 03:24:07 +0000 (19:24 -0800)]
[perl #75176] Symbol::delete_package does not free certain memory associated with package::ISA

This commit makes @ISA changes and package aliasing update PL_isarev
properly, removing old, unnecessary entries in addition to adding new
entries. So now it is capable of shrinking, not just growing.

------------
Gory Details
------------

There is a chicken-and-egg problem when it comes to calling
mro_isa_changed_in on the affected classes: When an isa linearisation
is recalculated, it uses the existing linearisations of the super-
classes (if any) (or at least the DFS implementation does). Since an
assigned package (e.g., the *b:: in *a:: = *b::) can contain nested
packages that inherit from each other in any order (b::c isa b::c::d
or b::c::e isa b::c), this means that mro_isa_changed_in *must not* be
called on any stash while another stash contains stale data.

So mro_package_moved has been restructured. It is no longer recurs-
ive. The recursive code for iterating through nested stashes has been
moved into a separate, static routine: mro_gather_and_rename. Instead
of calling mro_isa_changed_in during the iteration, it adds all the
classes to ‘the big hash’, which mro_package_moved holds a pointer to.
When mro_gather_and_rename returns, mro_package_moved iterates through
the big hash twice: the first time to wipe caches; the second to call
mro_isa_changed_in on all the stashes.

This ‘big hash’ is now used in place of the seen_stashes that
mro_package_moved used before.

Both mro_package_moved and mro_isa_changed_in now use the existing
mrometa->isa hash to determine which classes used to be superclasses
of the stash in question. A separate routine, S_mro_clean_isarev,
deletes entries mention in isa, except for those that still exist in
the new isa hash.

mro_isa_changed_in now does two iterations through isarev, just like
mro_package_moved. It has to call get_linear_isa on the subclasses so
that it can see what is in the new meta->isa hash created thereby.
Consequently, it has to make sure that all the subclasses have their
caches deleted before it can update anything. It makes the same
changes to isarev for each subclass that are made further down on the
class for which mro_isa_changed_in was called. Yes, it is repetitive.
But calling mro_isa_changed_in recursively has more overhead and would
do more unnecessary work. (Maybe we could make some macros for this
repetitive code.)

The loop through the superclasses near the end of mro_isa_changed_in
no longer adds the subclasses to all the superclasses’ isarev hashes,
because that is taken care of further up.

------------
Side Effects
------------

One result of this change is that mro::is_universal no longer
returns true for classes that are no longer universal. I consider
that a bug fix.

-------------
Miscellaneous
-------------

This also removes obsolete comments in mro_isa_changed_in, concerning
fake and universal flags on stashes, that have been invalid since
dd69841bebe.

13 years agoUpdate CGI.pm to CPAN version 3.50
Chris 'BinGOs' Williams [Tue, 9 Nov 2010 00:20:53 +0000 (00:20 +0000)]
Update CGI.pm to CPAN version 3.50

  [DELTA]

  Version 3.50

  [SECURITY]
  1. The MIME boundary in multipart_init is now random.
     Thanks to Byron Jones, Masahiro Yamada, Reed Loden, and  Mark Stosberg
  2. Further improvements to handling of newlines embedded in header values.
     An exception is thrown if header values contain invalid newlines.
     Thanks to Michal Zalewski, Max Kanat-Alexander, Yanick Champoux,
     Lincoln Stein, Fr�d�ric Buclin and Mark Stosberg

  [DOCUMENTATION]
  1. Correcting/clarifying documentation for param_fetch(). Thanks to
        Ren�e B�cker. (RT#59132)

  [INTERNALS]
  1. Fixing https test in http.t. (RT#54768)
  2. Tests were added for multipart_init(). Thanks to Mark Stosberg and CGI::Simple.

13 years agoCorrect Math::BigInt::FastCalc version in perldelta
Florian Ragwitz [Mon, 8 Nov 2010 19:48:40 +0000 (20:48 +0100)]
Correct Math::BigInt::FastCalc version in perldelta

13 years agoUpgrade Math::BigInt to version 1.98
Florian Ragwitz [Mon, 8 Nov 2010 19:47:40 +0000 (20:47 +0100)]
Upgrade Math::BigInt to version 1.98

13 years agoAdd Fingle Nark to AUTHORS
Father Chrysostomos [Mon, 8 Nov 2010 17:40:19 +0000 (09:40 -0800)]
Add Fingle Nark to AUTHORS

13 years agoExcluding tests in sub-dirs
Jerry D. Hedden [Tue, 2 Nov 2010 14:47:28 +0000 (10:47 -0400)]
Excluding tests in sub-dirs

For modules that are not built, exclude tests in sub-directories under
/t.  For example: cpan/Module-Build/t/actions/installdeps.t

13 years agotypos in comments/pod
Fingle Nark [Mon, 8 Nov 2010 17:29:56 +0000 (09:29 -0800)]
typos in comments/pod

13 years agoAvoid a declaration after statement, accidentally added by 6079961fee8cf49c.
Nicholas Clark [Mon, 8 Nov 2010 14:43:29 +0000 (14:43 +0000)]
Avoid a declaration after statement, accidentally added by 6079961fee8cf49c.

Code in ext/ isn't subject to the same compiler warnings regime as the
top-level core files, hence why this was missed.

13 years agoIn B.xs, remove the now unused first argument from make_sv_object().
Nicholas Clark [Mon, 8 Nov 2010 14:18:54 +0000 (14:18 +0000)]
In B.xs, remove the now unused first argument from make_sv_object().

After the previous change, all callers were passing in NULL and letting it
generate a new mortal SV for them.

13 years agoIn B.xs, use PPCODE rather than a typemap for output of T_SV_OBJ
Nicholas Clark [Mon, 8 Nov 2010 13:53:53 +0000 (13:53 +0000)]
In B.xs, use PPCODE rather than a typemap for output of T_SV_OBJ

This actually reduces both source code size and object code size (the latter
by almost 1K on this platform).

13 years agoB::MAGIC::LENGTH(), not B::MAGIC::LEN(). Fixes #78864
Nicholas Clark [Mon, 8 Nov 2010 13:03:13 +0000 (13:03 +0000)]
B::MAGIC::LENGTH(), not B::MAGIC::LEN(). Fixes #78864

b2adfa9b5e1682df inadvertently changed the name of the accessor for
mg->mg_len to B::MAGIC::LENGTH. Fix this.

13 years agoIn B.xs refactor cc_opclassname() to make_op_object().
Nicholas Clark [Mon, 8 Nov 2010 11:54:25 +0000 (11:54 +0000)]
In B.xs refactor cc_opclassname() to make_op_object().

All bar one of the callers to cc_opclassname() were using it in the same way -
to pass as the second argument of newSVrv(), whose first argument was a new
mortal, and return value was used with sv_setiv() and PTR2IV(). So clearly
*that* is the common code needed.

Inline the existing code (all 1 line of it) in the other location that called
cc_opclassname(). As the typemap was using cc_opclassname(), replace the 4
implicit uses of it with explicit PPCODE sections. Curiously, removing the use
of this typemap actually reduces the line count of B.xs

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

13 years agoMerge the implementation of B::COP::{io,warnings} using ALIAS.
Nicholas Clark [Mon, 8 Nov 2010 09:31:39 +0000 (09:31 +0000)]
Merge the implementation of B::COP::{io,warnings} using ALIAS.

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

13 years agoIn B.xs, refactor make_warnings_object() to take a COP * instead of STRLEN *.
Nicholas Clark [Mon, 8 Nov 2010 09:13:27 +0000 (09:13 +0000)]
In B.xs, refactor make_warnings_object() to take a COP * instead of STRLEN *.

13 years agoMerge the implementation of B::COP::{filegv,stash} using ALIAS.
Nicholas Clark [Mon, 8 Nov 2010 08:12:39 +0000 (08:12 +0000)]
Merge the implementation of B::COP::{filegv,stash} using ALIAS.

On this platform, this reduces the object size by about 400 bytes for a threaded
build.

13 years agoMerge the implementation of B::COP::{file,stashpv} using ALIAS.
Nicholas Clark [Sun, 7 Nov 2010 22:00:20 +0000 (22:00 +0000)]
Merge the implementation of B::COP::{file,stashpv} using ALIAS.

On this platform, this reduces the object size by about .5K, for an unthreaded
build.

13 years agoMerge the implementation of B::BM::TABLE with B::PV::{PV,PVX,PVBM} using ALIAS.
Nicholas Clark [Sun, 7 Nov 2010 17:33:42 +0000 (17:33 +0000)]
Merge the implementation of B::BM::TABLE with B::PV::{PV,PVX,PVBM} using ALIAS.

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

13 years agoRemove unneeded PREFIXes from B.xs.
Nicholas Clark [Sun, 7 Nov 2010 17:17:06 +0000 (17:17 +0000)]
Remove unneeded PREFIXes from B.xs.

13 years agoMerge the implementation of B::PV::PVBM with PVX and PV, using ALIAS.
Nicholas Clark [Sun, 7 Nov 2010 16:47:45 +0000 (16:47 +0000)]
Merge the implementation of B::PV::PVBM with PVX and PV, using ALIAS.

13 years agoMerge the implementation of B::PV::{PVX,PV} using ALIAS.
Nicholas Clark [Sun, 7 Nov 2010 16:14:17 +0000 (16:14 +0000)]
Merge the implementation of B::PV::{PVX,PV} using ALIAS.

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

13 years agoRefactor B::PV::PV to use newSVpvn_flags() for both arms of the if.
Nicholas Clark [Sun, 7 Nov 2010 15:19:15 +0000 (15:19 +0000)]
Refactor B::PV::PV to use newSVpvn_flags() for both arms of the if.

newSVpvn_flags(NULL, whatever, SVs_TEMP) is equivalent to sv_newmortal().

13 years agoMerge the implementation of B::REGEXP::{REGEXP,precomp} using ALIAS.
Nicholas Clark [Sun, 7 Nov 2010 15:03:43 +0000 (15:03 +0000)]
Merge the implementation of B::REGEXP::{REGEXP,precomp} using ALIAS.

13 years agoIn B::REGEX::precomp, use newSVpvn_flags() instead of newSVpvn().
Nicholas Clark [Sun, 7 Nov 2010 10:36:57 +0000 (10:36 +0000)]
In B::REGEX::precomp, use newSVpvn_flags() instead of newSVpvn().

Using newSVpvn_flags() and SVt_TEMP and an explicit push is one API call.
newSVpvn() and RETVAL results in a second API call, sv_2mortal(), in the return
typemap.

13 years agoIn B.xs, move the version dependant regexp code to be adjacent.
Nicholas Clark [Sun, 7 Nov 2010 10:20:36 +0000 (10:20 +0000)]
In B.xs, move the version dependant regexp code to be adjacent.

13 years agoMove the aliasing of B::IV::RV as B::PV::RV from XS to Perl code.
Nicholas Clark [Sun, 7 Nov 2010 09:56:50 +0000 (09:56 +0000)]
Move the aliasing of B::IV::RV as B::PV::RV from XS to Perl code.

This results in the same CV being used twice, rather than two CVs being created
that point to the same XS code implementation, shrinking the memory usage of B
slightly (168 bytes on this platform). It also is fewer source lines. :-)

13 years agoregexec.c: Don't give up on fold matching early
Karl Williamson [Sun, 7 Nov 2010 22:25:31 +0000 (15:25 -0700)]
regexec.c: Don't give up on fold matching early

As noted in the comments of the code, "a" =~ /[A]/i doesn't work currently
(except that regcomp.c knows about the ASCII characters and corrects for
it, but not always, for example in cases like "a" =~ /\p{Upper}/i.  This
patch catches all those).

It works by computing a list of all characters that (singly) fold to
another one, and then checking each of those.  The maximum length of
the list is 3 in the current Unicode standard.

I believe that a better long-term solution is to do this at compile
rather than execution time, by generating a closure of everything
matched.  But this can't be done now because the data structure would
need to be extensively revamped to list all non-byte characters, and
user-defined \p{} matches are not known at compile-time.

And it doesn't handle the multi-char folds.  There is a separate ticket
for those.

13 years agoregexec.c: change variable name to its purpose
Karl Williamson [Sun, 7 Nov 2010 21:17:27 +0000 (14:17 -0700)]
regexec.c: change variable name to its purpose

13 years agoutf8.c: Add function to create inversion of swash
Karl Williamson [Sun, 7 Nov 2010 22:40:40 +0000 (15:40 -0700)]
utf8.c: Add function to create inversion of swash

This adds _swash_inversion_hash() which takes a mapping swash and returns
a hash that is the inverse relation.  That is, given a code point, it
allows quick lookup of all code points that map to it.

The function is not for public use, as it will likely be revised, so is
not in the public API, and it's name begins with underscore.

It does not deal with multi-char mappings at this time, nor other swash
complications.

13 years agoutf8.c: extract code into separate subroutine
Karl Williamson [Sat, 6 Nov 2010 18:53:23 +0000 (12:53 -0600)]
utf8.c: extract code into separate subroutine

This patch moves the code that reads a single line from the main body of
an input Unicode property table into a separate subroutine.  This is in
preparation for using it from another place

13 years agoutf8.c: Add comments
Karl Williamson [Sat, 6 Nov 2010 16:24:42 +0000 (10:24 -0600)]
utf8.c: Add comments

I added comments as I was reading the code trying to understand it

13 years agoUpdate File-Fetch to CPAN version 0.28
Chris 'BinGOs' Williams [Sun, 7 Nov 2010 23:36:01 +0000 (23:36 +0000)]
Update File-Fetch to CPAN version 0.28

  [DELTA]

  Changes for 0.28        Sun Nov  7 21:22:26 2010
  =================================================
  * Added support for FreeBSDs 'fetch' command for
    both http and ftp schemes.

13 years agorefactor GRAMPROG grammar slightly
Zefram [Tue, 26 Oct 2010 19:47:51 +0000 (20:47 +0100)]
refactor GRAMPROG grammar slightly

Shift the structure of the GRAMPROG production (whole-file grammar)
to more closely match that of the other top-level productions.

13 years agoFix an out of bounds write in Data-Dumper with malformed utf8 input
Niko Tyni [Sat, 6 Nov 2010 19:44:35 +0000 (21:44 +0200)]
Fix an out of bounds write in Data-Dumper with malformed utf8 input

When warnings are enabled and Dumper() is called with an invalid utf8
string that still has the UTF8 flag on, esc_q_utf8() miscounts the size
of the escaped string.

13 years agoCorrect grouping in S_reginclass
Florian Ragwitz [Sun, 7 Nov 2010 15:41:53 +0000 (16:41 +0100)]
Correct grouping in S_reginclass

As pointed out by Karl Williamson.

Apparently the wrong grouping only introduced an inefficiency, not any bugs, so
the tests still passed.

13 years agoAdd Peter John Acklam to AUTHORS
Florian Ragwitz [Sun, 7 Nov 2010 15:21:58 +0000 (16:21 +0100)]
Add Peter John Acklam to AUTHORS

13 years agoRT ticket #61812: digit($n) with $n "out of range"
Peter John Acklam [Thu, 4 Nov 2010 17:08:56 +0000 (18:08 +0100)]
RT ticket #61812: digit($n) with $n "out of range"

The _digit($n) method in Math::BigInt::Calc should return 0 when $n
refers to a leading zero digit. E.g., the number '314' is just the
same as '000314', except that the leading zeros omitted, so _digit($n)
should return '0' when $n refers to a leading zero digit.

- lib/Math/BigInt/Calc.pm: Improve comments in source code. Add code
  returning zero when input refers to a leading zero digit. Removed
  redundant zero padding in temporary string argument to substr().

- t/bigintc.t: Add four test cases verifying the behaviour. Increment
  number of test by four.

13 years agoRT ticket #62643: typos in POD and code comments
Peter John Acklam [Thu, 4 Nov 2010 18:12:49 +0000 (19:12 +0100)]
RT ticket #62643: typos in POD and code comments

Fix lots of typos and spelling errors in the documentation (POD)
and the comments in the code, without changing any of the actual
(executed) code.

- BUGS: Fixed typos.

- CHANGES: Fixed typos.

- HISTORY: Fixed typos.

- TODO: Fixed typos.

- examples/bigprimes.pl: Fixed typos.

- lib/Math/BigFloat.pm: Fixed typos.

- lib/Math/BigInt/Calc.pm: Fixed typos.

- lib/Math/BigInt.pm: Fixed typos.

- t/bigintpm.inc: Fixed typos.

- t/inf_nan.t: Fixed typos.

- t/mbimbf.inc: Fixed typos.

- t/mbimbf.t: Fixed typos.

13 years agoRT ticket #62101: as_int() returns NaN for inf
Peter John Acklam [Fri, 5 Nov 2010 10:52:14 +0000 (11:52 +0100)]
RT ticket #62101: as_int() returns NaN for inf

Math::BigFloat -> binf() -> as_int() returns NaN, but should return
inf. In other words, if $x is a Math::BigFloat, then $x -> as_int()
shall return the same as Math::BigInt -> new($x). The bug appears both
for +inf and -inf.

-lib/Math/BigFloat.pm: Add two lines to catch the cases when the input
 is +/-inf and NaN, respectively.

-t/bare_mbf.t: incremented test count by 3

-t/bigfltpm.inc: add 3 tests, for +inf, -inf, and NaN

-t/bigfltpm.t: incremented test count by 3

-t/sub_mbf.t: incremented test count by 3

-t/with_sub.t: incremented test count by 3

13 years agoRT ticket #61845: from_bin() documentation error
Peter John Acklam [Thu, 4 Nov 2010 17:32:20 +0000 (18:32 +0100)]
RT ticket #61845: from_bin() documentation error

The documentation (POD) for the from_bin() method has a small error.
Binary numbers are prefixed by '0b', not '0x'.

- lib/Math/BigInt.pm: Fix documentation (POD) error.

13 years agoStructure dist/Math-BigInt-FastCalc like the CPAN dist
Florian Ragwitz [Sun, 7 Nov 2010 14:59:24 +0000 (15:59 +0100)]
Structure dist/Math-BigInt-FastCalc like the CPAN dist

This makes applying patches between them easier.

13 years agoUpdate Unicode-Collate to CPAN version 0.66
Chris 'BinGOs' Williams [Sun, 7 Nov 2010 13:31:59 +0000 (13:31 +0000)]
Update Unicode-Collate to CPAN version 0.66

  [DELTA]

  0.66  Sun Nov  7 10:47:30 2010
    - U::C::Locale newly supports locale: ko.
    - added Unicode::Collate::CJK::Korean for ko.
    - added t/loc_ko.t.
    - 12 compat. ideographs (e.g. U+FA0E) are treated as unified ideographs.
     (though DUCET also does it, now Unicode::Collate does it without DUCET.)
    - added t/compatui.t.
    ! Ideographs Ext.B (U+20000..U+2A6D6) can be overrided with UCA_Version 8.
      This is a long-standing behavior from Unicode::Collate 0.11 to 0.63.
      A wrong fix at 0.64 should be abandoned.

13 years agoSynchronise Math::BigInt{,::FastCalc} with CPAN
Florian Ragwitz [Sun, 7 Nov 2010 11:21:04 +0000 (12:21 +0100)]
Synchronise Math::BigInt{,::FastCalc} with CPAN

13 years agoUpdate File-Fetch to CPAN version 0.26
Chris 'BinGOs' Williams [Sun, 7 Nov 2010 11:19:44 +0000 (11:19 +0000)]
Update File-Fetch to CPAN version 0.26

  [DELTA]

  Changes for 0.26        Sat Nov  6 23:30:59 2010
  =================================================
  * Added support for HTTP::Lite
  * Resolved issue with '-l' switch and iosock fetch

13 years agoFix a compiler warning
Florian Ragwitz [Sat, 6 Nov 2010 20:33:51 +0000 (21:33 +0100)]
Fix a compiler warning

gcc said:
  regexec.c: In function ‘S_reginclass’:
  regexec.c:6305: warning: suggest parentheses around ‘&&’ within ‘||’

13 years agolocalize $@ during binmode (RT#78844)
David Golden [Sat, 6 Nov 2010 20:00:18 +0000 (16:00 -0400)]
localize $@ during binmode (RT#78844)

13 years agoAdd Nicolas Kaiser to AUTHORS.
Craig A. Berry [Sat, 6 Nov 2010 19:13:11 +0000 (14:13 -0500)]
Add Nicolas Kaiser to AUTHORS.

13 years agoRT 78836: vms/vms.c: dubious expressions
Nicolas Kaiser [Sat, 6 Nov 2010 16:54:52 +0000 (11:54 -0500)]
RT 78836: vms/vms.c: dubious expressions

I noticed two dubious expressions that look as if they were
intended to be assignments. The comment above the code says
it's broken.

13 years agoAdd new ops in Opcode, so it does not warn at compilation
Rafael Garcia-Suarez [Sat, 6 Nov 2010 15:06:34 +0000 (16:06 +0100)]
Add new ops in Opcode, so it does not warn at compilation

The ops are the recently-introduced reach, rvalues, rkeys and transr.

13 years agoG_VOID, G_SCALAR, and G_ARRAY are not separate bits anymore
Niko Tyni [Sat, 6 Nov 2010 13:18:15 +0000 (06:18 -0700)]
G_VOID, G_SCALAR, and G_ARRAY are not separate bits anymore

Commit 2f8edad0d37e91319b6ba10b3745327ea49c179 made G_ARRAY
equal to G_SCALAR | G_VOID, contrary to perlcall.pod.

Bring the documentation up to date and add a test to prevent a similar
(although unlikely) accident in the future.

13 years agoAdded test for RT#78844
David Golden [Sat, 6 Nov 2010 11:54:03 +0000 (07:54 -0400)]
Added test for RT#78844

13 years agoEliminate a few more $op->private calls in Deparse
Father Chrysostomos [Sat, 6 Nov 2010 07:06:51 +0000 (00:06 -0700)]
Eliminate a few more $op->private calls in Deparse