summaryrefslogtreecommitdiff
path: root/universal.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove S_get_isa_hashFather Chrysostomos2010-10-311-15/+6
| | | | It no longer serves much purpose, as of 7311f41d6.
* Move the meta->isa code from UNIVERSAL::isa to mro_get_linear_isaFather Chrysostomos2010-10-301-23/+1
| | | | | | | | This is so that it can be used for PL_isarev bookkeeping as well. This will have no effect on the speed of DFS classes. C3 classes on which ->isa is never called will have a slight slowdown. (We could always add an API for setting meta->isa if we want to avoid that.)
* Switch UNIVERSAL::isa over to HvENAMEFather Chrysostomos2010-10-301-3/+6
|
* Move remaining Tie::Hash::NamedCapture XS code to NamedCapture.xsNicholas Clark2010-10-141-78/+0
| | | | Now all the support code for %+ and %- is contained in the module in ext/
* Move Tie::Hash::NamedCapture::{FIRST,NEXT}KEY to NamedCapture.xsNicholas Clark2010-10-141-42/+0
|
* Convert lib/Tie/Hash/NamedCapture.pm to an XS module in ext/Nicholas Clark2010-10-141-15/+0
| | | | Initially move only Tie::Hash::NamedCapture::flags from universal.c to it.
* Merge XS_Tie_Hash_NamedCapture_{FIRSTK,NEXTK} into S_named_capture_iter_common.Nicholas Clark2010-10-141-27/+13
|
* Merge XS_Tie_Hash_NamedCapture_STORE into S_named_capture_common.Nicholas Clark2010-10-141-30/+4
|
* Merge XS_Tie_Hash_NamedCapture_CLEAR into S_named_capture_common.Nicholas Clark2010-10-141-31/+13
|
* Merge XS_Tie_Hash_NamedCapture_DELETE into S_named_capture_common.Nicholas Clark2010-10-141-27/+12
|
* Merge XS_Tie_Hash_NamedCapture_SCALAR into S_named_capture_common.Nicholas Clark2010-10-141-29/+8
|
* Merge XS_Tie_Hash_NamedCapture_{FETCH,EXISTS} into S_named_capture_common.Nicholas Clark2010-10-141-25/+9
|
* Expand CALLREG_NAMED_BUFF* macros in XS_Tie_Hash_NamedCapture_*Nicholas Clark2010-10-141-8/+8
| | | | This reveals even more similarity between the routines' bodies.
* Consistent stack handling for XS_re_regnames_*Nicholas Clark2010-10-131-17/+8
| | | | | This may also fix bugs for the (untested) cases where the called routine returns NULL, and the calling routine attempted XSRETURN_UNDEF.
* Consistent usage messages for XS_Tie_Hash_NamedCapture_*Nicholas Clark2010-10-131-5/+5
| | | | The $flags argument is actually the object, so should not be mentioned.
* In XS_Tie_Hash_NamedCapture_{CLEAR,STORE}, free any returned value.Nicholas Clark2010-10-131-2/+13
| | | | | | The calling convention for CALLREG_NAMED_BUFF_*() is to return NULL, or a reference to a scalar. For CLEAR and STORE we return no values, so if we're erroneously passed a reference, we should free it to stop it being leaked.
* Consistent stack handling for XS_Tie_Hash_NamedCapture_*Nicholas Clark2010-10-131-34/+19
| | | | | | | | This may also fix bugs for the (untested) cases where CALLREG_NAMED_BUFF_* returned NULL, and the calling routine attempted XSRETURN_UNDEF. It's fine to call sv_2mortal() on the immortals returned by CALLREG_NAMED_BUFF_EXISTS()
* XS_Tie_Hash_NamedCapture_DELETE should return a value.Nicholas Clark2010-10-131-1/+11
| | | | | | | | The core's regexp implementation will always croak, but other pluggable engines may have read/write semantics, and hence return from their delete call. Note that STORE and EXISTS are called in void context, hence their return stack is discarded.
* XS_Tie_Hash_NamedCapture_STORE should always croak on invalid parameters.Nicholas Clark2010-10-121-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it would return undef instead of calling Perl_croak_no_modify() if PL_localizing was true. However, that case can never be reached. PL_localizing is set non-zero for 1: Perl_mg_localize and PL_save_scalar, for the duration of executing the local 2: Perl_leave_scope for the duration of unwinding the local However, XS_Tie_Hash_NamedCapture_STORE can't be reached in either case, with PL_curpm NULL (or otherwise invalid) || !SvROK(ST(0)). Case 1 would be the call to save_helem_flags() in pp_helem. However, this is only reached if preeminent is TRUE, which will only hold if hv_exists_ent() has already returned TRUE, which will only be possible if PL_curpm and ST(0) are valid. Case 2 would be the case SAVEt_HELEM in Perl_leave_scope(). However, this case is only reached as part of the unwinding from Case 1 above, so again PL_curpm and ST(0) will be valid, for this dynamic scope. This commit is the patch proposed in RT ##77610. It does not resolve all issues in that ticket. Currently C<local $1> is legal - it's a runtime no-op, which neither errors *nor* resets $1 to undef. Clearly C<local $+{k}> is inconsistent with this, (as it errors at scope exit for all cases, and additionally errors at local time if $+{k} exists) but I consider it not worth fixing until we decide whether C<local $1>'s current behaviour is a "bug" or a "feature".
* Fix code-before-declaration problem in universal.cSteve Hay2010-09-231-3/+6
|
* Add /d, /l, /u (infixed) regex modifiersKarl Williamson2010-09-221-2/+9
| | | | | | | | | | | | This patch adds recognition of these modifiers, with appropriate action for d and l. u does nothing useful yet. This allows for the interpolation of a regex into another one without losing the character set semantics that it was compiled with, as for the first time, the semantics is now specified in the stringification as one of these modifiers. To this end, it allocates an unused bit in the structures. The off- sets change so as to not disturb other bits.
* Back out the mauve module and related changesFlorian Ragwitz2010-09-161-110/+0
| | | | | | | | | | | | | | | | | | | | | It's was intended as a temporary namespace only, and we really don't want to ship it in any release until we've figured out what it should really look like. This reverts commit 05c0d6bbe3ec5cc9af99d105b8648ad02ed7cc95, "add sv_reftype_len() and make sv_reftype() be a wrapper for it" commit 792477b9c2e4c75cb03d07bd6d25dc7e1fdf448e, "create the "mauve" temporary namespace for things like reftype" commit 8df6b97c1de8326d50ac9c8cae4bf716393b45bb, "mauve.t needs access to %Config, make sure it's available" commit cfe9162d0d593cd12a979c73df82c7509b324343, "use more efficient sv_reftype_len() interface" and commit 47b13905e23c2a72acdde8bb4669e25e5eaefec4 "add more tests to lib/mauve.t so it tests also that mauve::reftype can return "LVALUE"" There's a `mauve' branch still containing all the code for the temporary mauve namespace. That should be used to work on it until it's mostly ready to be released, and only then merged to blead. Alternatively, it should be deleted if another way to provide mauve's features in the core is found.
* segfault on &Internals::* due to missing SvROK()Ævar Arnfjörð Bjarmason2010-09-111-3/+17
| | | | | | | | | | | | | | | | | | | | Change the &Internals::* functions that use references in their prototypes to check if the argument is SvROK() before calling SvRV(). If the function is called as Internals::FOO() perl does this check for us, but prototypes are bypassed on &Internals::FOO() so we still have to check this manually. This fixes [perl #77776], this bug was present in 5.10.x, 5.12.x, and probably all earlier perl versions that had these functions, but I haven't tested that. I'm adding a new test file (t/lib/universal.t) to test universal.c functions as part of this patch. The testing for Internal::* in t/ was and is very sparse, but before universal.t there was no obvious place to put these tests. Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
* Remove unneeded use of INT2PTR() in the XS for Tie::Hash::NamedCapture.Nicholas Clark2010-08-311-8/+8
|
* create the "mauve" temporary namespace for things like reftypeYves Orton2010-08-301-0/+110
| | | | | | | | | | | | | | | | | | | | | | Scalar::Util::reftype(), refaddr() and blessed() are all a bit less useful than they could be as they all return C<undef> when their argument is not a reference. While this is logical, it also means that using these routines has to be guarded, and normally guarded in such a way that the internal logic is called twice. Additionally these routines are quite commonly used and having to load an additional DLL and XS code every program is inefficient. Therefore we introduce the "mauve" namespace for to hold the "fixed" equivalents, this namespace is /always/ loaded (like the 're' or 'utf8' namespaces), and thus these routines can be accessed easily at any time. We also provide a new module wrapper in t/lib which allows these routines to be exported into other namespaces if the user so chooses. At Jesse's request I have included weaken() and as it seemed logical to do so I have also added isweak(). Once we have a good name for the namespace we can s/mauve/whatever/g
* Stop leaking temporary version objects from XSgfx2010-06-281-6/+7
|
* Prevent object methods called as class methodsJohn Peacock2010-06-281-16/+16
| | | | | | | | | | There are a number of object methods which make absolutely no sense when called as class methods. In addition, with Perl 5.11.5/5.12.0, there are asserts which will trigger SEGV's when you do that. So we check in the XS code and refuse to continue if an object method is called as a class method.
* Add Perl_croak_no_modify() to implement Perl_croak("%s", PL_no_modify).Nicholas Clark2010-06-271-3/+3
| | | | | This reduces object code size, reducing CPU cache pressure on the non-exception paths.
* PATCH: teach diag.t new warning function namesKarl Williamson2010-06-011-1/+1
| | | | | | | | | | | | | | | | | A number of function names that do warnings have been added, but diag.t hasn't kept up. This patch changes it to look for likely function names in embed.fnc, so it will automatically keep up in the future. There's no need to worry about it looking for inappropriate functions, as the syntax of messages that it looks for is so restrictive, that there won't be false positives. Instead there are still many messages it fails to catch. As a result of it's falling behind several issues have crept in. I resolved the couple I thought were clear (including one in a comment; diag.t doesn't strip comments, but mostly it doesn't matter), and added the others to the <DATA> section to ignore. are
* Use sizeof instead of hard-coded array sizeKarl Williamson2010-05-291-1/+1
| | | | The array should be declared with its actual size.
* TypoKarl Williamson2010-05-291-1/+1
|
* InPerl_boot_core_UNIVERSAL() use a data structure for calls to newXS{,proto}Nicholas Clark2010-05-281-118/+81
| | | | | Replacing the longhand list of calls to newXS{,proto} with loop over a data structure reduces the object size by over 1K.
* Fix utf8::is_utf8 to respect GMAGIC (e.g. $1)gfx2010-04-251-1/+2
|
* initialize undefined version objects with zero, not 'undef'David Golden2010-01-211-2/+2
|
* Omnibus strict and lax version parsingDavid Golden2010-01-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Authors: John Peacock, David Golden and Zefram The goal of this mega-patch is to enforce strict rules for version numbers provided to 'package NAME VERSION' while formalizing the prior, lax rules used for version object creation. Parsing for use() is unchanged. version.pm adds two globals, $STRICT and $LAX, containing regular expressions that define the rules. There are two additional functions -- version::is_strict and version::is_lax -- that test an argument against these rules. However, parsing of strings that might contain version numbers is done in core via the Perl_scan_version function, which may be called during compilation or may be called later when version objects are created by Perl_new_version or Perl_upg_version. A new helper function, Perl_prescan_version, has been added to validate a string under either strict or lax rules. This is used in toke.c for 'package NAME VERSION' in strict mode and by Perl_scan_version in lax mode. It matches the behavior of the verison.pm regular expressions, but does not use them directly. A new test file, comp/packagev.t, validates strict and lax behaviors of 'package NAME VERSION' and 'version->new(VERSION)' respectively and verifies their behavior against the $STRICT and $LAX regular expressions, as well. Validating these two implementation should help ensure they each work as intended. Other files and tests have been modified as necessary to support these changes. There is remaining work to be done in a few areas: * documenting all changes in behavior and new functions * determining proper treatment of "," as decimal separators in various locales * updating diagnostics for new error messages * porting changes back to the version.pm distribution on CPAN, including pure-Perl versions
* Tie::Hash::NamedCapture::* shouldn't abort if passed bad input [RT #71828]Nicholas Clark2010-01-051-8/+8
|
* Add missing LEAVE to universal.c sv_doesGerard Goossen2009-11-121-2/+6
|
* Unused 'cv'Jerry D. Hedden2009-07-021-0/+1
|
* Integrate version.pm-0.77 into bleadperlJohn Peacock2009-06-281-9/+41
|
* Note why we need a seemingly useless empty &Regexp::DESTROYNicholas Clark2009-03-311-0/+1
|
* Change Regexp::DESTROY to be a constant subroutine, removing XS_Regexp_DESTROY.Nicholas Clark2009-03-291-8/+2
| | | | A constant subroutine is now optimised away at DESTROY time.
* Remove declaration of XS_Internals_inc_sub_generationRafael Garcia-Suarez2009-03-081-1/+0
| | | | | The function Internals::inc_sub_generation() was removed in commit 41892db1963e88b547da12808d8e5630cc1edb59
* Make PerlIO::get_layers really test flgok before reading *flgsvpVincent Pit2009-03-071-1/+1
|
* get_isa_hash() is only used in S_isa_lookup(), so it can be static. Also, it hasNicholas Clark2009-01-031-3/+3
| | | | | never been in a released version of perl, so this change has no compatibility implications.
* Following change 34356, which decoupled get_isa_hash() fromNicholas Clark2009-01-031-0/+35
| | | | S_mro_get_linear_isa_dfs(), we can move get_isa_hash() to any other source file.
* PATCH: Large omnibus patch to clean up the JRRT quotesTom Christiansen2008-11-021-3/+5
| | | | | | Message-ID: <25940.1225611819@chthon> Date: Sun, 02 Nov 2008 01:43:39 -0600 p4raw-id: //depot/perl@34698
* Explicitly specify some printf formats for constant strings.Rafael Garcia-Suarez2008-11-021-3/+3
| | | | | | This is mostly to silence gcc's warning, "format not a string literal and no format arguments". p4raw-id: //depot/perl@34694
* Add MUTABLE_GV(), and eliminate (V *) casts in *.c.Nicholas Clark2008-10-311-2/+2
| | | | | | Can't easily do gv.h, as GvGP() (at least) needs to split into two macros - one const for reading, one non-const for writing. p4raw-id: //depot/perl@34679
* Eliminate (SV *) casts from sv.c and [tu]*.c, except for the cast inNicholas Clark2008-10-301-13/+13
| | | | | Perl_sv_magicext(), which is documented. p4raw-id: //depot/perl@34671
* Use pvs macros instead of pvn where possible.Marcus Holland-Moritz2008-10-291-1/+1
| | | p4raw-id: //depot/perl@34653