This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years ago[perl #77496] tied gets scalars and globs confused
Father Chrysostomos [Mon, 25 Oct 2010 01:14:47 +0000 (18:14 -0700)]
[perl #77496] tied gets scalars and globs confused

Make pp_tied use the SvFAKE flag to distinguish between tied scalars
and tied handles. This is now possible as of change 2acc3314.

This fixes the problem of tied($scalar) ignoring the tie if the last
thing returned or assigned happened to be a glob.

11 years agouse compatible types in a conditional expression
Tony Cook [Mon, 25 Oct 2010 00:04:23 +0000 (11:04 +1100)]
use compatible types in a conditional expression

With some compilers NULL is ((void *)0) which isn't type compatible
with the integer returned by hv_exists_ent().

11 years ago[perl #77810] Scalars vs globs
Father Chrysostomos [Sun, 24 Oct 2010 22:50:23 +0000 (15:50 -0700)]
[perl #77810] Scalars vs globs

Stop *{} from returning globs with the SVf_FAKE flag on.

It removes three tests from t/op/gv.t (that I added) that test buggy
edge cases that can no longer occur.

It also modifies tests in t/io/defout.t to keep them passing. I am not
sure that test script serves any purpose any more.

11 years agoUpdate Locale-Maketext to CPAN version 1.17
Todd Rinaldo [Sun, 24 Oct 2010 23:01:31 +0000 (00:01 +0100)]
Update Locale-Maketext to CPAN version 1.17

  [DELTA]

  2010-10-20
    * Release 1.17

    Test release of 1.16_01, versioning even deprecated Guts modules.
    This prevents CPAN upgrade circular heck. Thanks BinGOs

    Tested version fix for CPAN by BinGOs. Bump to stable version and release to public

Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
11 years agoUpdate Maintainers.pl with the latest version of Module::CoreList
Chris 'BinGOs' Williams [Sun, 24 Oct 2010 21:02:21 +0000 (22:02 +0100)]
Update Maintainers.pl with the latest version of Module::CoreList

11 years agoIn B.xs, use newSVpvn_flags() instead of sv_newmortal() and sv_setpvn().
Nicholas Clark [Sun, 24 Oct 2010 18:13:10 +0000 (19:13 +0100)]
In B.xs, use newSVpvn_flags() instead of sv_newmortal() and sv_setpvn().

11 years agodon't rely on ghost contexts being unmolested
Zefram [Sun, 24 Oct 2010 13:57:21 +0000 (14:57 +0100)]
don't rely on ghost contexts being unmolested

Dying and returning from a format both relied on the state of a
just-popped context frame being preserved across a LEAVE.  Don't rely
on it.  Test using an operator ripped off from Scope::Cleanup, which makes
it easy to run arbitrary Perl code during cleanup, without isolating it
on a separate context stack as the DESTROY mechanism does.

11 years agoMath::BigRat has blead as its upstream
Florian Ragwitz [Sun, 24 Oct 2010 00:18:25 +0000 (17:18 -0700)]
Math::BigRat has blead as its upstream

11 years agoMake mro_package_moved use a mortal in case mro_isa_changed_in3 croaks
Father Chrysostomos [Sun, 24 Oct 2010 17:42:33 +0000 (10:42 -0700)]
Make mro_package_moved use a mortal in case mro_isa_changed_in3 croaks

11 years agoFix SV leak in Perl_emulate_cop_io(), present since 8b850bd54aa90bd3.
Nicholas Clark [Sun, 24 Oct 2010 16:23:17 +0000 (17:23 +0100)]
Fix SV leak in Perl_emulate_cop_io(), present since 8b850bd54aa90bd3.

11 years agoIn B.xs, tidy up make_*_object().
Nicholas Clark [Sun, 24 Oct 2010 16:02:25 +0000 (17:02 +0100)]
In B.xs, tidy up make_*_object().

All callers to make_temp_object, make_warnings_object and make_cop_io_object
pass in a new mortal, so remove the first argument from all 3 and generate the
mortal within them.

Allow a NULL first argument for make_sv_object - generate a new mortal in this
case.

Ideally we'd remove its first argument too, but currently the output typemap
causes code to be generated that first assigns a new mortal to ST(0), then
passes that to make_sv_object(), and it's not obvious how to trivially fix
that.

11 years agoB::hash() should only work on byte sequences.
Nicholas Clark [Sun, 24 Oct 2010 15:00:23 +0000 (17:00 +0200)]
B::hash() should only work on byte sequences.

11 years agoRefactor B::hash to use Perl_newSVpvf() instead of my_sprintf() and new_SVpvn*.
Nicholas Clark [Sun, 24 Oct 2010 14:23:05 +0000 (16:23 +0200)]
Refactor B::hash to use Perl_newSVpvf() instead of my_sprintf() and new_SVpvn*.

11 years agoMore tests for B::hash().
Nicholas Clark [Sun, 24 Oct 2010 14:05:55 +0000 (16:05 +0200)]
More tests for B::hash().

11 years agoB::cchar can be implemented as an ALIAS of B::cstring.
Nicholas Clark [Sun, 24 Oct 2010 13:51:05 +0000 (15:51 +0200)]
B::cchar can be implemented as an ALIAS of B::cstring.

11 years agoRefactor B::cchar() to create a temporary directly, and use Perl_sv_catpvf().
Nicholas Clark [Sun, 24 Oct 2010 12:23:43 +0000 (14:23 +0200)]
Refactor B::cchar() to create a temporary directly, and use Perl_sv_catpvf().

11 years agoTests for B::cchar().
Nicholas Clark [Sun, 24 Oct 2010 12:07:26 +0000 (14:07 +0200)]
Tests for B::cchar().

11 years agoIn B.xs, refactor cstring() to return a mortal, which simplifies the XS code.
Nicholas Clark [Sun, 24 Oct 2010 11:50:52 +0000 (13:50 +0200)]
In B.xs, refactor cstring() to return a mortal, which simplifies the XS code.

11 years agoTest NUL bytes with B::cstring() and B::perlstring().
Nicholas Clark [Sun, 24 Oct 2010 11:49:12 +0000 (13:49 +0200)]
Test NUL bytes with B::cstring() and B::perlstring().

11 years agoB::perlstring can be implemented as an ALIAS of B::cstring.
Nicholas Clark [Sun, 24 Oct 2010 11:35:06 +0000 (13:35 +0200)]
B::perlstring can be implemented as an ALIAS of B::cstring.

11 years agoIn cstring() in B.xs, use Perl_sv_catpvf(), instead of a temporary buffer.
Nicholas Clark [Sun, 24 Oct 2010 10:26:43 +0000 (12:26 +0200)]
In cstring() in B.xs, use Perl_sv_catpvf(), instead of a temporary buffer.

11 years agoMore comprehensive tests for B::cstring() and B::perlstring().
Nicholas Clark [Sun, 24 Oct 2010 10:13:23 +0000 (12:13 +0200)]
More comprehensive tests for B::cstring() and B::perlstring().

11 years agoIn pp_getlogin, use sv_setpv_mg() to avoid needing an explicit strlen() call.
Nicholas Clark [Sun, 24 Oct 2010 08:59:08 +0000 (09:59 +0100)]
In pp_getlogin, use sv_setpv_mg() to avoid needing an explicit strlen() call.

It was using PUSHp() here, meaning local object code for a call to strlen(),
and for SvSETMAGIC().

11 years agopermit labels to appear before declarations
Zefram [Sat, 16 Oct 2010 21:22:57 +0000 (22:22 +0100)]
permit labels to appear before declarations

Include <label> in productions before <decl> and <package_block>.  This
means that labels can now appear at the beginning of all statement-like
things.  There was no technical reason for the restriction of labels
to substantive statements, and that restriction in any case couldn't be
applied to PLUGSTMT-based plugged-in declarations.

11 years agoPerl_hv_name_add needs to set xhv_name_count in one other place.
Father Chrysostomos [Sun, 24 Oct 2010 01:55:29 +0000 (18:55 -0700)]
Perl_hv_name_add needs to set xhv_name_count in one other place.

Perl_hv_name_add was not setting the name count when upgrading a HEK*
to an array of HEK*s.

11 years ago.gitignore some extra ext/B build products
Tony Cook [Sun, 24 Oct 2010 00:37:25 +0000 (11:37 +1100)]
.gitignore some extra ext/B build products

11 years agoremove ; so the conditional actually controls some code
Tony Cook [Sun, 24 Oct 2010 00:35:02 +0000 (11:35 +1100)]
remove ; so the conditional actually controls some code

11 years agomake the definition of sv_catpv_flags match the declaration
Tony Cook [Sun, 24 Oct 2010 00:26:50 +0000 (11:26 +1100)]
make the definition of sv_catpv_flags match the declaration

This was warning on Win32

11 years agosv_setsv_flags was also using a potentially freed HV
Father Chrysostomos [Sun, 24 Oct 2010 00:04:42 +0000 (17:04 -0700)]
sv_setsv_flags was also using a potentially freed HV

11 years agoTels doesn't want to maintain math stuff anymore
Florian Ragwitz [Sat, 23 Oct 2010 22:50:46 +0000 (15:50 -0700)]
Tels doesn't want to maintain math stuff anymore

11 years agoConvert B to use ExtUtils::Constant::ProxySubs for its constants.
Nicholas Clark [Sat, 23 Oct 2010 18:26:53 +0000 (19:26 +0100)]
Convert B to use ExtUtils::Constant::ProxySubs for its constants.

Previously it was using a Perl script to generate C code with pairs of
 newCONSTSUB(stash,"Foo_BAR",newSViv(Foo_BAR));
 av_push(export_ok,newSVpvn("Foo_BAR",7));
for each constant it exported from C to Perl.

Now it uses a loop to process a table. Object code is size reduced by about 42K
on this system (almost 20%)

11 years agoFor PROXYSUBS, add an option to push all constants' names onto an array.
Nicholas Clark [Sat, 23 Oct 2010 18:00:49 +0000 (19:00 +0100)]
For PROXYSUBS, add an option to push all constants' names onto an array.

Typically this would be 'EXPORT_OK', to add all constants to the @EXPORT_OK
array for this package.

11 years agoFor PROXYSUBS, allow an explicit XS_SUBNAME of undef to suppress its generation.
Nicholas Clark [Sat, 23 Oct 2010 17:41:04 +0000 (18:41 +0100)]
For PROXYSUBS, allow an explicit XS_SUBNAME of undef to suppress its generation.

11 years agoChange concise.t to use Storable to test stash/src rendering of constant subs.
Nicholas Clark [Sat, 23 Oct 2010 17:06:42 +0000 (18:06 +0100)]
Change concise.t to use Storable to test stash/src rendering of constant subs.

This allows B to be refactored to change the implementation of its constants.
Storable strives to main compatibility with 5.004 (or so), so unlikely to be
refactored soon.

11 years agoS_glob_assign_glob was using a potentially freed HV
Father Chrysostomos [Sat, 23 Oct 2010 16:48:31 +0000 (09:48 -0700)]
S_glob_assign_glob was using a potentially freed HV

11 years agoperlipc: Convert tabs to spaces.
Shlomi Fish [Wed, 21 Jul 2010 18:31:50 +0000 (21:31 +0300)]
perlipc: Convert tabs to spaces.

Signed-off-by: David Golden <dagolden@cpan.org>
11 years agoperlipc: fix bug in example
David Golden [Sat, 23 Oct 2010 11:13:49 +0000 (07:13 -0400)]
perlipc: fix bug in example

11 years agoAdd functions for adding and deleting stash names
Father Chrysostomos [Sat, 23 Oct 2010 06:56:29 +0000 (23:56 -0700)]
Add functions for adding and deleting stash names

11 years agoFor PROXYSUBS, also avoid calling get_missing_hash() in the XS constant code.
Nicholas Clark [Sat, 23 Oct 2010 06:36:53 +0000 (07:36 +0100)]
For PROXYSUBS, also avoid calling get_missing_hash() in the XS constant code.

(Follow on from 4639bd9c727433ad)
For modules such as File::Glob and I18N::Langinfo, which always define all
constants on all platforms, this saves about 700 bytes of object code.

11 years agoClarify and correct description of comma operator in scalar context
Ian Goodacre [Sat, 23 Oct 2010 04:42:55 +0000 (17:42 +1300)]
Clarify and correct description of comma operator in scalar context

The guarantee that in scalar context the comma operator evaluates its
arguments in scalar context is overstated.

In perl 5.10.0

print "Scalar assignment:\n";
$x = ( context(1), context(2), context(3) );

print "Scalar assignment in sub:\n";
sub list { ( context(1), context(2), context(3) ) }
$x = list();

sub context {

    if(wantarray) {
        print "list context\n";
    } elsif(defined(wantarray)) {
        print "scalar context\n";
    } else {
        print "void context\n";
    }
}

prints:

scalar assignment:
void context
void context
scalar context
Scalar assignment in sub:
scalar context
scalar context
scalar context

This leaves only the right argument of the last comma operator in a list as
the only one that might always be evaluated in scalar context.

The comments on the sample outputs were at best ambiguous if not misleading
or false, and also unnecessarily pejorative of perl4. The revised comments
less ambiguously refer to the last expression in the list (@y in the example)
rather than to the literal list that is the argument of the assignment
operator.

11 years agoCorrected Perl5 example of Formatted output and significant digits
Ian Goodacre [Sat, 23 Oct 2010 03:46:02 +0000 (16:46 +1300)]
Corrected Perl5 example of Formatted output and significant digits

The following note says "Your results may vary...", so maybe some perls
did give the value in the example as it was, but perl v5.10.0 on Intel
Pentium based system gives the more accurate revised output.

I am also dubious about the values given for perl4 as the error is quite
large, but I don't have perl4 easily available to test.

11 years agoAdded missing variable name in example code
Ian Goodacre [Sat, 23 Oct 2010 00:38:52 +0000 (13:38 +1300)]
Added missing variable name in example code

11 years agoRemove cruft from B's Makefile.PL
Nicholas Clark [Fri, 22 Oct 2010 20:10:15 +0000 (21:10 +0100)]
Remove cruft from B's Makefile.PL

$noecho is unused since 70c68212ed57a5a0 (in 2005)
$e and $exeout_flag are unused since e8edd1e67bd80dbb (in 1999)
All the clean FILES apart from 'defsubs.h' are vestigial or duplicate defaults.
The rule for LIBS created by post_constants() seems superfluous.

11 years agoFor PROXYSUBS, get the hash from the fetch to pass to the subsequent store.
Nicholas Clark [Fri, 22 Oct 2010 17:59:36 +0000 (19:59 +0200)]
For PROXYSUBS, get the hash from the fetch to pass to the subsequent store.

This saves the store having to (re)compute the hash.

11 years agoFor PROXYSUBS, loop with do {} not while, as there is always at least 1 entry.
Nicholas Clark [Fri, 22 Oct 2010 14:58:36 +0000 (15:58 +0100)]
For PROXYSUBS, loop with do {} not while, as there is always at least 1 entry.

11 years agoFor PROXYSUBS, avoid calling get_missing_hash() if all symbols are present.
Nicholas Clark [Fri, 22 Oct 2010 12:03:09 +0000 (14:03 +0200)]
For PROXYSUBS, avoid calling get_missing_hash() if all symbols are present.

For modules such as File::Glob and I18N::Langinfo, which always define all
constants on all platforms, this saves about 1K of object code, plus 1 (empty)
anonymous hash (per process or thread) in
%ExtUtils::Constant::ProxySubs::Missing.

11 years agoFor PROXYSUBS, give the notfound struct file scope.
Nicholas Clark [Fri, 22 Oct 2010 10:15:17 +0000 (12:15 +0200)]
For PROXYSUBS, give the notfound struct file scope.

All others remain within the scope of the BOOT block.

11 years agoMinor refactor of ExtUtils::Constant::ProxySubs.
Nicholas Clark [Fri, 22 Oct 2010 08:36:44 +0000 (10:36 +0200)]
Minor refactor of ExtUtils::Constant::ProxySubs.

Use a lexical in place of repeated lc()'s in WriteConstants.
Require ExtUtils::Constant::ProxySubs early, to avoid leaving empty files if it
fails for any reason.

11 years agoFix on doc patch from Moritz Lenz (from IRC)
H.Merijn Brand [Fri, 22 Oct 2010 10:40:26 +0000 (12:40 +0200)]
Fix on doc patch from Moritz Lenz (from IRC)

11 years agoMerge the implementation of B::CV::{ROOT,START}.
Nicholas Clark [Fri, 22 Oct 2010 07:47:09 +0000 (08:47 +0100)]
Merge the implementation of B::CV::{ROOT,START}.

11 years agoNote the U8-sized space in intrpvar.h created by 737c24fc85ea612b.
Nicholas Clark [Fri, 22 Oct 2010 07:37:29 +0000 (08:37 +0100)]
Note the U8-sized space in intrpvar.h created by 737c24fc85ea612b.

11 years agoBetter diagnostics for XS::APItest::test_cv_getset_call_checker().
Nicholas Clark [Fri, 22 Oct 2010 07:24:18 +0000 (08:24 +0100)]
Better diagnostics for XS::APItest::test_cv_getset_call_checker().

11 years agoS_tokeq()'s fast scan loop should terminate on \\ not \
Nicholas Clark [Fri, 22 Oct 2010 06:41:39 +0000 (07:41 +0100)]
S_tokeq()'s fast scan loop should terminate on \\ not \

As-was, it would drop out of the scanner into the backslashed-backslash
processing loop earlier than need be, and hence would be copying the octets
of strings (in place) as soon as any backslash had been seen. Now it defers
copying until copying is actually unavoidable.

11 years agoperldelta: fix typo and POD syntax
Father Chrysostomos [Fri, 22 Oct 2010 04:49:33 +0000 (21:49 -0700)]
perldelta: fix typo and POD syntax

11 years agoperldelta for things I committed recently
Father Chrysostomos [Fri, 22 Oct 2010 04:42:35 +0000 (21:42 -0700)]
perldelta for things I committed recently

11 years agoBump re’s version
Father Chrysostomos [Fri, 22 Oct 2010 04:41:47 +0000 (21:41 -0700)]
Bump re’s version

11 years agoBump charnames’ version
Father Chrysostomos [Fri, 22 Oct 2010 03:42:47 +0000 (20:42 -0700)]
Bump charnames’ version

11 years ago[perl #78488] Bleadperl 304474c3 breaks GFUJI/Test-LeakTrace-0.13.tar.gz
Father Chrysostomos [Fri, 22 Oct 2010 01:18:42 +0000 (18:18 -0700)]
[perl #78488] Bleadperl 304474c3 breaks GFUJI/Test-LeakTrace-0.13.tar.gz

This commit restores an SvREFCNT_dec that was inadvertently removed.

c8bbf67 removed the SvREFCNT_dec(HeVAL(entry)), adding
SvREFCNT_dec(old_val) instead.

304474c3 reverted that block, but failed to restore the
SvREFCNT_dec(HeVAL(entry)).

The result was that the %INC entry created by do "file" was leaking.

(Y’know, giving out commit bits to just *anyone* who comes along
with a few patches seems dangerous. Has anybody been looking at what
I’m doing?)

11 years agoFix calling conventions in malloc_ctl.h
Jan Dubois [Fri, 22 Oct 2010 01:00:14 +0000 (18:00 -0700)]
Fix calling conventions in malloc_ctl.h

The Perl_malloc() etc. functions are *also* declared in
proto.h, so the declarations need to match.  The inclusion
of malloc_ctl.h into perl.h had to be moved down until
after the point where PERL_CALLCONV was completely defined.

11 years agoregcomp.c: /d not overriding /u
Karl Williamson [Wed, 20 Oct 2010 19:21:04 +0000 (13:21 -0600)]
regcomp.c: /d not overriding /u

The setting of the charset regex modifiers was wrong.  /d didn't
override /u nor /l, and similarly /u and /l didn't properly override
each other.

11 years agoregcomp.c: Fix typo in comment
Karl Williamson [Sun, 17 Oct 2010 16:38:37 +0000 (10:38 -0600)]
regcomp.c: Fix typo in comment

11 years agoFix ext/XS-APItest/t/multicall.t warning
Jerry D. Hedden [Thu, 21 Oct 2010 21:47:50 +0000 (14:47 -0700)]
Fix ext/XS-APItest/t/multicall.t warning

'make test' produces the following warning:

ext/XS-APItest/t/multicall.....................................Useless
use of private variable in void context at t/multicall.t line 37.
ok

The attached patch fixes this by adding a "no warnings 'void';"
statement to the test file.

11 years agoMY_CXT_INIT happens to contain a variable declaration, so give it its own block
Nicholas Clark [Thu, 21 Oct 2010 19:32:31 +0000 (20:32 +0100)]
MY_CXT_INIT happens to contain a variable declaration, so give it its own block

Without this, Glob.xs won't build on any compiler which enforces this part of
C89.

11 years agoSys::Hostname::ghname should use newSVpv(s, 0), not newSVpvn(s, strlen(s))
Nicholas Clark [Thu, 21 Oct 2010 16:58:42 +0000 (17:58 +0100)]
Sys::Hostname::ghname should use newSVpv(s, 0), not newSVpvn(s, strlen(s))

Whilst functionally identical, the latter will produce more object code.
Also, avoid the strlen() entirely for the case of HAS_PHOSTNAME, where we know
the length.

11 years agoAvoid using #ifdef inside a function call that may itself actually be a macro.
Nicholas Clark [Thu, 21 Oct 2010 16:43:31 +0000 (17:43 +0100)]
Avoid using #ifdef inside a function call that may itself actually be a macro.

A tweak to 20439bc77dfeec46. Hopefully this fixes the build on Win32.

11 years agobuildtoc needs to preserve the mode of any file it updates.
Nicholas Clark [Thu, 21 Oct 2010 15:18:11 +0000 (16:18 +0100)]
buildtoc needs to preserve the mode of any file it updates.

Makefile.SH should be +x, and t/porting/exe-bit.t rightly gets upset when it is
not.

11 years agoAllow stashes to have multiple names
Father Chrysostomos [Thu, 21 Oct 2010 04:33:53 +0000 (21:33 -0700)]
Allow stashes to have multiple names

This commits modifies the HvAUX structure as follows: A new field is
added, named xhv_name_count, indicating the number of names. If it is
zero (the default and most common case), then xhv_name is a HEK * as
usual. If it is non-zero, then xhv_name actually holds a pointer to an
array of HEK*s, the first being the default or ‘canonical’ name.

This code is a little repetitious, but more refactorings are to come,
so it is too soon to turn these repetitions into macros.

This is yet another commit in preparation for fixing [perl #75176].

Basically, whenever a stash is deleted from its containing stash, if
it has an alias elsewhere, it needs to assume the new name (of that
alias; so it needs to know its other names already) and update isarev
entries. Forthcoming commits will do that.

11 years agoAdd single-term prototype
David Golden [Mon, 13 Sep 2010 00:26:43 +0000 (20:26 -0400)]
Add single-term prototype

The C<+> prototype is a special alternative to C<$> that will act like
C<\[@%]> when given a literal array or hash variable, but will otherwise
force scalar context on the argument.  This is useful for functions which
should accept either a literal array or an array reference as the argument:

    sub smartpush (+@) {
        my $aref = shift;
        die "Not an array or arrayref" unless ref $aref eq 'ARRAY';
        push @$aref, @_;
    }

When using the C<+> prototype, your function must check that the argument
is of an acceptable type.

11 years agoFix the test count in t/re/pat.t
Father Chrysostomos [Wed, 20 Oct 2010 18:27:28 +0000 (11:27 -0700)]
Fix the test count in t/re/pat.t

11 years agoregexec.c: utf8 doesn't match /i nonutf8 self
Karl Williamson [Wed, 20 Oct 2010 17:11:13 +0000 (11:11 -0600)]
regexec.c: utf8 doesn't match /i nonutf8 self

This is a continuation of [perl #78464].  It fixes it also for the /i
flag.  After this, a character should match itself in the regrepeat
function, even if one is in utf8 and the other isn't, for both /i and
not.

The solution is to move the code for handling /i into the non-i
structure so that the decisions about utf8 are all in one place.  When
the string is in utf8, it uses the utf8-fold function.

This has the added effect of fixing a few cases where a utf8 string did
not match a fold in a non-utf8 pattern.  I haven't added tests for
these, as it only fixes a few cases where this is a problem, and I'm
working on a comprehensive solution to the problem, accompanied by
extensive tests.

11 years agoFix a nested package deletion bug
Father Chrysostomos [Wed, 20 Oct 2010 06:50:07 +0000 (23:50 -0700)]
Fix a nested package deletion bug

In mro_package_moved, I was calling mro_isa_changed_in, instead
of mro_package_moved, for a deleted package. So its subpackages
were ignored.

Exempli gratia, delete $::{'Cur::'} would call mro_isa_changed_in on
Cur::Cur, but ignore Cur::Cur::Cur.

I probably added this bug (or reinstated it, as it was in 5.13.5) in
d056e33c1.

11 years agoregexec.c: utf8 doesn't match non-utf8 self
Karl Williamson [Wed, 20 Oct 2010 16:20:29 +0000 (10:20 -0600)]
regexec.c: utf8 doesn't match non-utf8 self

Some regex patterns don't match a character with itself when the target
string is in utf8 and the pattern isn't, and the character is variant
under utf8.  (This means only Latin1-range characters in the pattern are
affected.)

The solution is to test for this case and use the utf8 representation of
the pattern character for the comparison.

11 years agoregcomp.c: Get rid of compiler warning.
Karl Williamson [Mon, 18 Oct 2010 04:32:07 +0000 (22:32 -0600)]
regcomp.c: Get rid of compiler warning.

This patch should remove a compiler warning that is currently only
showing up in one compiler.  It declares a debug-only variable to be
volatile, so should silence the warning that it is getting clobbered.
Since this variable is only used for debugging purposes, when DEBUGGING
is defined, performance should not be an issue.

11 years agomark cophh API as experimental
Zefram [Mon, 4 Oct 2010 23:20:57 +0000 (00:20 +0100)]
mark cophh API as experimental

11 years agofull API for cop hint hashes
Zefram [Tue, 19 Oct 2010 16:31:46 +0000 (09:31 -0700)]
full API for cop hint hashes

Expose cop hint hashes as a type COPHH, with a cophh_* API which is a
macro layer over the refcounted_he_* API.  The documentation for cophh_*
describes purely API-visible behaviour, whereas the refcounted_he_*
documentation describes the functions mainly in terms of the
implementation.  Revise the cop_hints_* API, using the flags parameter
consistently and reimplementing in terms of cophh_*.  Use the cophh_*
and cop_hints_* functions consistently where appropriate.

[Modified by the committer to update two calls to
Perl_refcounted_he_fetch recently added to newPMOP.]

11 years agocharnames::viacode returning less correct name
Karl Williamson [Fri, 15 Oct 2010 01:36:04 +0000 (19:36 -0600)]
charnames::viacode returning less correct name

There are several cases where more than one name is valid for a code
point.  This happens usually when the original name was published with a
typo in it.  It's best for viacode to return the revised name, though
the original remains valid.

The names data is in a table generated by mktables exclusively for
charnames, including vianame (and its kin) and viacode.  The fix is to
mktables to put the more correct name first in the table, so that it is
found first and returned by viacode().

When I originally designed this code, I thought the correct name should
come last in the tables, so someone looping and reading it could just
overwrite the less correct one with the more correct one.

But to save memory  we have the same table shared by viacode and
vianame, and vianame has to recognize both names, so both entries
are needed.  viacode could do an rindex to find the more correct name,
but experiments show that that was twice as slow as going the other
direction.  Therefore, this patch is for speed.

If the tables for vianame and viacode were ever to be split, this patch
could be reverted, if desired, to put things back to the reverse order.

11 years agomktables: Complement variable meaning for clarity
Karl Williamson [Thu, 14 Oct 2010 23:29:12 +0000 (17:29 -0600)]
mktables: Complement variable meaning for clarity

When I was designing this code, I struggled for a long time in how to
name the concept the $cdm variable meant.  I was never very happy with
it.  Coming back to it after a year, I realized immediately that the
complement was much easier to understand, so this patch does that and
rewrites the comments to match

11 years agofunction to parse Perl code block
Zefram [Fri, 15 Oct 2010 12:11:54 +0000 (13:11 +0100)]
function to parse Perl code block

New API function parse_block() parses a code block, including surrounding
braces.  The block is a lexical scope, but not inherently a dynamic scope.

11 years agofix and test PL_expect in recdescent parsing
Zefram [Thu, 14 Oct 2010 16:02:36 +0000 (17:02 +0100)]
fix and test PL_expect in recdescent parsing

Set PL_expect at the start of parse_fullstmt() as well as at the start
of parse_stmtseq().  Test both.

11 years ago[perl #78072] use re '/xism';
Father Chrysostomos [Tue, 19 Oct 2010 00:59:50 +0000 (17:59 -0700)]
[perl #78072] use re '/xism';

11 years agohandle bracket stack better in recdescent parsing
Zefram [Thu, 14 Oct 2010 00:52:59 +0000 (01:52 +0100)]
handle bracket stack better in recdescent parsing

When recursing into the parser for recursive-descent parsing, put
a special entry on the bracket stack that generates a fake EOF if a
closing bracket belonging to an outer parser frame is seen.  This keeps
the bracket stack balanced across a parse_stmtseq() frame, fixing
[perl #78222].

If a recursive-descent parser frame ends by yyunlex()ing an opening
bracket, pop its entry off the bracket stack and stash it in the
forced-token queue, to be revived when the token is re-lexed.  This keeps
the bracket stack balanced across a parse_fullstmt() frame.

11 years ago[perl #33752] B::Deparse fails with utf8 and our
Father Chrysostomos [Tue, 19 Oct 2010 00:57:25 +0000 (17:57 -0700)]
[perl #33752] B::Deparse fails with utf8 and our
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit makes B::Deparse support code like ‘our $ḟōō’. Currently,
an ‘our’ variable whose name is an octet sequence that does not consist
of (\w|::)+ can only be a UTF8 variable name.

When the pad is made to support UTF8 properly, this may need to
be changed.

11 years agoadd lex_start to the API
Zefram [Wed, 13 Oct 2010 20:48:49 +0000 (21:48 +0100)]
add lex_start to the API

lex_start() is added to the API, marked experimental, and documented.
It also gains a flags parameter for foreseeable future use.

11 years agoavoid side-effecting source held in scalar
Zefram [Wed, 13 Oct 2010 20:05:54 +0000 (21:05 +0100)]
avoid side-effecting source held in scalar

Syntax plugins can modify the source being parsed.  It's fine for
them to modify the lexer buffer, but this must not be the same scalar
that was supplied to lex_start() and may be in use outside.  Therefore
always copy the scalar in lex_start() rather than just referencing it.
Fixes [perl #78358].

11 years agoremove redundant lex_end
Zefram [Wed, 13 Oct 2010 19:33:41 +0000 (20:33 +0100)]
remove redundant lex_end

The lex_end() function is redundant, because the lexer context object
is actually finalised by parser_free(), triggered by the save stack.
The lex_end() function has historically been empty, except when the
PL_doextract global was being misused to store lexer state.

11 years agoreplace PL_doextract with better kinds of variable
Zefram [Wed, 13 Oct 2010 18:59:23 +0000 (19:59 +0100)]
replace PL_doextract with better kinds of variable

PL_doextract had two unrelated jobs, neither best served by an interpreter
global variable.  The first was to track the -x command-line switch.
That is replaced with a local variable in S_parse_body().  The second
was to track whether the lexer is in the middle of a =pod section.
That is replaced with an element in PL_parser.

11 years agoremove filter inheritance option from lex_start
Zefram [Wed, 13 Oct 2010 18:05:19 +0000 (19:05 +0100)]
remove filter inheritance option from lex_start

The only uses of lex_start that had the new_filter parameter false,
to make the new lexer context share source filters with the previous
lexer context, were uses with rsfp null, which therefore never invoked
source filters.  Inheriting source filters from a logically unrelated
file seems like a silly idea anyway.

11 years ago[perl #72062] Untaint DATA after it's reopened
Lubomir Rintel [Mon, 18 Oct 2010 23:40:18 +0000 (16:40 -0700)]
[perl #72062] Untaint DATA after it's reopened

DATA handle is untainted on startup, but as we close and reopen it it
gets the taint flag. It's safe to untaint it though, since we still hold
the file descriptor open and don't reassign it to another file.

This was probably broken by changeset 29606, (c96b2385 in perl git).

11 years agoSDBM_File::{error,clearerr} can be implemented as XS ALIASes.
Nicholas Clark [Thu, 21 Oct 2010 11:18:35 +0000 (12:18 +0100)]
SDBM_File::{error,clearerr} can be implemented as XS ALIASes.

11 years agodocument slices in scalar context
Moritz Lenz [Thu, 21 Oct 2010 09:45:20 +0000 (11:45 +0200)]
document slices in scalar context

11 years agoIn [GNO]DBM_File.xs, store the 4 filter functions as 1 array in the struct.
Nicholas Clark [Thu, 21 Oct 2010 10:27:54 +0000 (12:27 +0200)]
In [GNO]DBM_File.xs, store the 4 filter functions as 1 array in the struct.

Previously they were 1 distinct members. Using an array allows the use of a
in *_DESTROY, and merging of the 4 XS functions filter_{fetch,store}_{key,value}
into 1 body with ALIASes.

11 years agoIn SDBM_File.xs, store the 4 filter functions as 1 array in the struct.
Nicholas Clark [Wed, 20 Oct 2010 19:28:30 +0000 (21:28 +0200)]
In SDBM_File.xs, store the 4 filter functions as 1 array in the struct.

Previously they were 1 distinct members. Using an array allows the use of a loop
in sdbm_DESTROY, and merging of the 4 XS functions
filter_{fetch,store}_{key,value} into 1 body with ALIASes.

11 years agoConvert [GNOS]DBM_File::TIEHASH to safecalloc() from safemalloc() then Zero().
Nicholas Clark [Wed, 20 Oct 2010 19:08:37 +0000 (21:08 +0200)]
Convert [GNOS]DBM_File::TIEHASH to safecalloc() from safemalloc() then Zero().

11 years agoMerge the XS code for Hash::Util::{hidden,legal}_ref_keys.
Nicholas Clark [Wed, 20 Oct 2010 17:17:51 +0000 (19:17 +0200)]
Merge the XS code for Hash::Util::{hidden,legal}_ref_keys.

Express Hash::Util::all_keys more tersely.

11 years agoConvert Hash::Util's XS code to use typemaps for dereferencing.
Nicholas Clark [Wed, 20 Oct 2010 16:41:57 +0000 (18:41 +0200)]
Convert Hash::Util's XS code to use typemaps for dereferencing.

This will subtly change the text of the parameter mismatch errors.

11 years agoStandardise Hash::Util::hv_store's error message.
Nicholas Clark [Wed, 20 Oct 2010 14:41:14 +0000 (16:41 +0200)]
Standardise Hash::Util::hv_store's error message.

Previously it was inconsistent with the messages of the other XS routines, which
used all-uppercase for HASH and ARRAY.

11 years agoConvert Hash::Util, XS::APItest and XS::Typemap to XSLoader.
Nicholas Clark [Wed, 20 Oct 2010 14:13:47 +0000 (16:13 +0200)]
Convert Hash::Util, XS::APItest and XS::Typemap to XSLoader.

None are using any DynaLoader specific functionality.

11 years agoConvert GDBM_File to an XS AUTOLOAD.
Nicholas Clark [Wed, 20 Oct 2010 13:34:48 +0000 (15:34 +0200)]
Convert GDBM_File to an XS AUTOLOAD.

11 years agoUse inlineable proxy constant subs for GDBM_File.
Nicholas Clark [Wed, 20 Oct 2010 12:17:09 +0000 (14:17 +0200)]
Use inlineable proxy constant subs for GDBM_File.

11 years agoConvert File::Glob::bsd_glob to XS.
Nicholas Clark [Wed, 20 Oct 2010 09:21:45 +0000 (11:21 +0200)]
Convert File::Glob::bsd_glob to XS.

Unlike doglob, it has no prototype, so it's not possible to use a simple ALIAS
directive to make it and doglob aliases.