summaryrefslogtreecommitdiff
path: root/universal.c
Commit message (Collapse)AuthorAgeFilesLines
* PERL_GLOBAL_STRUCT_PRIVATE: fix PL_isa_DOESDavid Mitchell2017-03-171-6/+1
| | | | | | | | | I added the global string constant PL_isa_DOES recently. This caused t/porting/libperl.t to fail under -DPERL_GLOBAL_STRUCT_PRIVATE builds. This commit makes PL_isa_DOES be declared and defined in a similar way to other such global constants. This is pure cargo-culting - I have no real idea of the point of all the EXTCONST, INIT and globvar.sym stuff.
* fix some comment typos about PL_isa_DOESDavid Mitchell2017-01-071-3/+4
| | | | ... and expand one of the comments a bit.
* Clean up warnings uncovered by 'clang -Weverything'.Andy Lester2016-12-051-4/+0
| | | | For: RT #130195
* Change white space to avoid C++ deprecation warningKarl Williamson2016-11-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | C++11 requires space between the end of a string literal and a macro, so that a feature can unambiguously be added to the language. Starting in g++ 6.2, the compiler emits a warning when there isn't a space (presumably so that future versions can support C++11). Unfortunately there are many such instances in the perl core. This commit fixes those, including those in ext/, but individual commits will be used for the other modules, those in dist/ and cpan/. This commit also inserts space at the end of a macro before a string literal, even though that is not deprecated, and removes useless "" literals following a macro (instead of inserting a blank). The result is easier to read, making the macro stand out, and be clearer as to the intention. Code and modules included with the Perl core need to be compilable using C++. This is so that perl can be embedded in C++ programs. (Actually, only the hdr files need to be so compilable, but it would be hard to test that just the hdrs are compilable.) So we need to accommodate changes to the C++ language.
* Cleanup PERL_VERSION checks in .c filesNicolas R2016-11-151-5/+0
| | | | | | This commit is removing code not exercised by blead or any later versions using PERL_VERSION. This is a noop, mainly cleaning code.
* remove DOES's usage of SvSCREAMDavid Mitchell2016-11-121-5/+12
| | | | | | | | | | | | | | | | Currently the SvSCREAM flag is set on a temporary SV whose string value is "isa", but where for the purposes of printing Can't call method "XXX" its name is treated as "DOES" rather than "isa". Instead, set the temp SV's PVX buffer to point to a special static string (PL_isa_DOES) whose value is "isa", but the where the error reporting code can compare the address with PL_isa_DOES and if so, print "DOES" instead. This is to reduce the number of odd special cases for the SvSCREAM flag.
* universal.c: use new SvPVCLEAR and constant string friendly macrosYves Orton2016-10-191-3/+3
|
* restore Internals::hv_clear_placeholders for nowYves Orton2016-08-251-0/+15
|
* Move hash introspection routines into Hash::Util/Util.xs and out of universal.cYves Orton2016-08-141-65/+0
|
* s/XS_hash_util_/XS_Hash_Util_/gYves Orton2016-08-141-9/+9
|
* move a declaration so that the Internals:: functions are grouped togetherYves Orton2016-08-141-1/+1
|
* move Internals::hv_clear_placeholders() to Hash::Util::_clear_placeholders()Yves Orton2016-08-141-15/+0
| | | | | | | | There is no reason for this code to be in Internals:: or in universal.c at all, it should only be used from Hash::Util during things like lock_keys(). Moves the function to the XS code in Hash::Util, and renames it as well, along with commented out documentation for what it does.
* universal.c:XS_re_regnames_count: redundant codeFather Chrysostomos2016-08-121-3/+0
| | | | If we croak when items != 0, then SP -= items is a no-op, as is PUTBACK.
* Change scalar(%hash) to be the same as 0+keys(%hash)Yves Orton2016-06-221-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This subject has a long history see [perl #114576] for more discussion. https://rt.perl.org/Public/Bug/Display.html?id=114576 There are a variety of reasons we want to change the return signature of scalar(%hash). One is that it leaks implementation details about our associative array structure. Another is that it requires us to keep track of the used buckets in the hash, which we use for no other purpose but for scalar(%hash). Another is that it is just odd. Almost nothing needs to know these values. Perhaps debugging, but we have several much better functions for introspecting the internals of a hash. By changing the return signature we can remove all the logic related to maintaining and updating xhv_fill_lazy. This should make hot code paths a little faster, and maybe save some memory for traversed hashes. In order to provide some form of backwards compatibility we adds three new functions to the Hash::Util namespace: bucket_ratio(), num_buckets() and used_buckets(). These functions are actually implemented in universal.c, and thus always available even if Hash::Util is not loaded. This simplifies testing. At the same time Hash::Util contains backwards compatible code so that the new functions are available from it should they be needed in older perls. There are many tests in t/op/hash.t that are more or less obsolete after this patch as they test that xhv_fill_lazy is correctly set in various situations. However since we have a backwards compat layer we can just switch them to use bucket_ratio(%hash) instead of scalar(%hash) and keep the tests, just in case they are actually testing something not tested elsewhere.
* make gimme consistently U8David Mitchell2016-02-031-1/+1
| | | | | | | | | | | | | The value of gimme stored in the context stack is U8. Make all other uses in the main core consistent with this. My primary motivation on this was that the new function cx_pushblock(), which I gave a 'U8 gimme' parameter, was generating warnings where callers were passing I32 gimme vars to it. Rather than play whack-a-mole, it seemed simpler to just uniformly use U8 everywhere. Porting/bench.pl shows a consistent reduction of about 2 instructions on the loop and sub benchmarks, so this change isn't harming performance.
* utf8::unicode_to_native() should return UV, not an IVKarl Williamson2015-09-021-2/+2
| | | | | | | | Same for the native_to_unicode() While it is true that UTF-EBCDIC is limited to a a code point of a maximum of 2**31 - 1, in order for the correct code to execute to catch an attempt at a larger one, it needs to be a UV.
* Remove PERL_OLD_COPY_ON_WRITEFather Chrysostomos2015-06-291-6/+0
|
* clean up sv_isobject usageDaniel Dragan2015-06-111-1/+1
| | | | | | | | | -previous usage proves getmagic is unnecessary or ignored or already called S_do_smartmatch Perl_sv_does_sv -in pp_dbmopen dont call sv_isobject twice in a row on the same SV in 1 permutation
* perlapi: Wrap long verbatim lines to 79 columnsKarl Williamson2015-04-231-1/+2
|
* fix some minor compiler warningsDavid Mitchell2015-04-181-1/+1
| | | | | | | S_deb_curcv's first param differed in constness between declaration and definition. GIMME_V can return an I32, so don't assign it to a U8.
* Replace common Emacs file-local variables with dir-localsDagfinn Ilmari Mannsåker2015-03-221-6/+0
| | | | | | | | | | | | | | | | An empty cpan/.dir-locals.el stops Emacs using the core defaults for code imported from CPAN. Committer's work: To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed to be incremented in many files, including throughout dist/PathTools. perldelta entry for module updates. Add two Emacs control files to MANIFEST; re-sort MANIFEST. For: RT #124119.
* universal.c: remove all trace of op_siblingDavid Mitchell2015-03-191-5/+7
| | | | | | | | | | | The OpSIBLING() macro and op_sibling_splice() are a higher-level way of manipulating optrees that ensure portability in the face of PERL_OP_PARENT etc. This commit also helps with the lofty goal of nothing outside of op.c directly accessing the op_sibling field. This is a follow-on/improvement to bac7a184cda7b.
* universal.c: PERL_OP_PARENT supportFather Chrysostomos2015-03-181-3/+3
|
* Optimize out unicode_to_native(), native_to_unicode()Karl Williamson2015-03-121-0/+63
| | | | | | | These just return their argument on ASCII platforms, so can get rid of the function call overhead there. Thanks to Zefram and Matthew Horsfall for their help in this.
* Consistently use NOT_REACHED; /* NOTREACHED */Jarkko Hietaniemi2015-03-041-1/+1
| | | | | | Both needed: the macro is for compilers, the comment for static checkers. (This doesn't address whether each spot is correct and necessary.)
* Add documentation for /n (non-capture) regexp flag.Matthew Horsfall2014-12-301-1/+1
|
* [perl #123458] list cx re::regexp_pattern($nonre)Father Chrysostomos2014-12-191-1/+1
| | | | | It was returning (undef) in list context, though it was documented to return the empty list.
* universal.c:re_regexp_pattern: Mention GIMME_V onceFather Chrysostomos2014-12-191-2/+3
| | | | | | | | | | | While it was only being called once, it occurred in two code paths. Pulling it out of the main if-block reduces the size of universal.o. Before and after: $ ls -l universal.o -rw-r--r-- 1 sprout staff 33700 Dec 19 16:05 universal.o $ ls -l universal.o -rw-r--r-- 1 sprout staff 33692 Dec 19 16:13 universal.o
* make more use of NOT_REACHEDLukas Mai2014-11-291-1/+1
| | | | In particular, remove all instances of 'assert(0);'.
* optimize Perl_boot_core_UNIVERSAL and Perl_nextargvDaniel Dragan2014-11-071-2/+4
| | | | | | | | | | | Perl_nextargv fuse 2 tests into 1 Perl_boot_core_UNIVERSAL reorder instructions to avoid using a non-vol registers (save cv across the Safefree), not reread CV body * after Safefree. Compute address of CvFILE once. for Perl_boot_core_UNIVERSAL on VC 2003 before 0x66 bytes of 32 bit x86 machine code, after 0x61.
* Implement the bipolar read-only systemFather Chrysostomos2014-09-201-2/+2
| | | | | | | | | | | | | | | | | | | | | This fixes bugs related to Hash::Util::unlock accidentally unlocking internal scalars (e.g., that returned by undef()) and allowing them to be modified. Internal read-only values are now marked by two flags, the regular read-only flag, and the new ‘protected’ flag. Before this SvREADONLY served two purposes: 1) The code would use it to protect things that must not be modi- fied, ever (except when the core sees fit to do so). 2) Hash::Util and everybody else would use it to make this unmodifia- ble temporarily when requested by the user. Internals::SvREADONLY serves the latter purpose and only flips the read-only flag, so things that need to stay read-only will remain so, because of the ‘other’ read-only flag, that CPAN doesn’t know about. (If you are a CPAN author, do not read this.)
* universal.c:croak_xs_usage: Don’t fetch context twiceFather Chrysostomos2014-09-151-1/+1
|
* Avoid creating GVs when subs are declaredFather Chrysostomos2014-09-151-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes ‘sub foo {...}’ declarations to store subroutine references in the stash, to save memory. Typeglobs still notionally exist. Accessing CvGV(cv) will reify them. Hence, currently the savings are lost when a sub call is compiled. $ ./miniperl -e 'sub foo{} BEGIN { warn $::{foo} } foo(); BEGIN { warn $::{foo} }' CODE(0x7f8ef082ad98) at -e line 1. *main::foo at -e line 1. This optimisation is skipped if the subroutine declaration contains a package separator. Concerning the changes in caller.t, this code: sub foo { print +(caller(0))[3],"\n" } my $fooref = delete $::{foo}; $fooref -> (); used to crash in 5.7.3 or thereabouts. It was fixed by 16658 (aka 07b8c804e8) to produce ‘(unknown)’ instead. Then in 5.13.3 it was changed (by 803f274) to produce ‘main::__ANON__’ instead. So the tests are really checking that we don’t get a crash. I think it is acceptable that it has now changed to ‘main::foo’.
* For lexical subs, reify CvGV from CvSTASH and CvNAME_HEKFather Chrysostomos2014-09-151-1/+2
| | | | | From now on, the presence of a name hek implies a GV. Any access to CvGV will cause that implicit GV to be reified.
* universal.c gv_stashpv -> gv_stashpvsDaniel Dragan2014-07-031-1/+1
| | | | avoids a strlen()
* Remove or downgrade unnecessary dVAR.Jarkko Hietaniemi2014-06-251-24/+0
| | | | | | | | You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference. (g++ does not do the "post-annotation" form of "unused".) The version code has some of these issues, reported upstream.
* universal.c - utf8::downgrade($x,FAIL_OK) is not supposed to treat FAIL_OK ↵Yves Orton2014-06-021-1/+1
| | | | as an integer
* Insert asserts to paths suspected by Coverity.Jarkko Hietaniemi2014-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity suspects paths like this: (1) p = foo(); if (!p) p = bar(); baz(p->q); since it cannot prove that p is always non-NULL at the dereference. (2) Or simply something like: mg = mg_find(...); foo(mg->blah); Since mg_find() can fail returning NULL. Adding assert() calls before the dereferences. Testing with -DDEBUGGING. Hopefully there are regular smokes doing the same. [perl #121894] Fix for Coverity perl5 CIDs 28950,28952..28955,28964,28967,28970..28795,49921: CID ...: Dereference after null check (FORWARD_NULL) var_deref_op: Dereferencing null pointer p->q (TODO: Coverity perl5 CIDs 28962,28968,28969: the same issue, but would conflict with already in-flight changes, prepare catch-up patch later.) --- dist/Data-Dumper/Dumper.xs | 1 + dump.c | 1 + ext/Devel-Peek/Peek.xs | 1 + ext/XS-APItest/APItest.xs | 1 + mg.c | 2 ++ mro.c | 4 +++- op.c | 4 ++++ perlio.c | 1 + pp_hot.c | 5 +++-- regcomp.c | 3 +++ regexec.c | 5 ++++- universal.c | 2 +- util.c | 4 +++- 13 files changed, 28 insertions(+), 6 deletions(-) diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 12c4ebd..23e0cf4 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -641,6 +641,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, else { sv_pattern = val; } + assert(sv_pattern); rval = SvPV(sv_pattern, rlen); rend = rval+rlen; slash = rval; diff --git a/dump.c b/dump.c index 59be3e0..c2d72fd 100644 --- a/dump.c +++ b/dump.c @@ -471,6 +471,7 @@ Perl_sv_peek(pTHX_ SV *sv) finish: while (unref--) sv_catpv(t, ")"); + /* XXX when is sv ever NULL? */ if (TAINTING_get && SvTAINTED(sv)) sv_catpv(t, " [tainted]"); return SvPV_nolen(t); diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs index 679efa5..b20fa94 100644 --- a/ext/Devel-Peek/Peek.xs +++ b/ext/Devel-Peek/Peek.xs @@ -450,6 +450,7 @@ PPCODE: BOOT: { CV * const cv = get_cvn_flags("Devel::Peek::Dump", 17, 0); + assert(cv); cv_set_call_checker(cv, S_ck_dump, (SV *)cv); XopENTRY_set(&my_xop, xop_name, "Dump"); diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index a51924d..18ba381 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -2096,6 +2096,7 @@ newCONSTSUB(stash, name, flags, sv) break; } EXTEND(SP, 2); + assert(mycv); PUSHs( CvCONST(mycv) ? &PL_sv_yes : &PL_sv_no ); PUSHs((SV*)CvGV(mycv)); diff --git a/mg.c b/mg.c index 76912bd..7f3339a 100644 --- a/mg.c +++ b/mg.c @@ -1675,6 +1675,7 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg) same function. */ mg = mg_find(mg->mg_obj, PERL_MAGIC_isa); + assert(mg); if (SvTYPE(mg->mg_obj) == SVt_PVAV) { /* multiple stashes */ SV **svp = AvARRAY((AV *)mg->mg_obj); I32 items = AvFILLp((AV *)mg->mg_obj) + 1; @@ -3437,6 +3438,7 @@ Perl_magic_copycallchecker(pTHX_ SV *sv, MAGIC *mg, SV *nsv, sv_magic(nsv, &PL_sv_undef, mg->mg_type, NULL, 0); nmg = mg_find(nsv, mg->mg_type); + assert(nmg); if (nmg->mg_flags & MGf_REFCOUNTED) SvREFCNT_dec(nmg->mg_obj); nmg->mg_ptr = mg->mg_ptr; nmg->mg_obj = SvREFCNT_inc_simple(mg->mg_obj); diff --git a/mro.c b/mro.c index 1b37ca7..ccf4bf4 100644 --- a/mro.c +++ b/mro.c @@ -638,12 +638,14 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) hv_storehek(mroisarev, namehek, &PL_sv_yes); } - if((SV *)isa != &PL_sv_undef) + if ((SV *)isa != &PL_sv_undef) { + assert(namehek); mro_clean_isarev( isa, HEK_KEY(namehek), HEK_LEN(namehek), HvMROMETA(revstash)->isa, HEK_HASH(namehek), HEK_UTF8(namehek) ); + } } } } diff --git a/op.c b/op.c index 796cb03..79621ce 100644 --- a/op.c +++ b/op.c @@ -2907,6 +2907,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) S_cant_declare(aTHX_ o); } else if (attrs) { GV * const gv = cGVOPx_gv(cUNOPo->op_first); + assert(PL_parser); PL_parser->in_my = FALSE; PL_parser->in_my_stash = NULL; apply_attrs(GvSTASH(gv), @@ -2929,6 +2930,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) else if (attrs && type != OP_PUSHMARK) { HV *stash; + assert(PL_parser); PL_parser->in_my = FALSE; PL_parser->in_my_stash = NULL; @@ -10229,6 +10231,7 @@ Perl_ck_split(pTHX_ OP *o) op_append_elem(OP_SPLIT, o, newDEFSVOP()); kid = kid->op_sibling; + assert(kid); scalar(kid); if (!kid->op_sibling) @@ -10902,6 +10905,7 @@ Perl_cv_set_call_checker(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj) MAGIC *callmg; sv_magic((SV*)cv, &PL_sv_undef, PERL_MAGIC_checkcall, NULL, 0); callmg = mg_find((SV*)cv, PERL_MAGIC_checkcall); + assert(callmg); if (callmg->mg_flags & MGf_REFCOUNTED) { SvREFCNT_dec(callmg->mg_obj); callmg->mg_flags &= ~MGf_REFCOUNTED; diff --git a/perlio.c b/perlio.c index d4c43d0..e6ff9e4 100644 --- a/perlio.c +++ b/perlio.c @@ -2225,6 +2225,7 @@ PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags) PerlIO_funcs * const self = PerlIOBase(o)->tab; SV *arg = NULL; char buf[8]; + assert(self); PerlIO_debug("PerlIOBase_dup %s f=%p o=%p param=%p\n", self ? self->name : "(Null)", (void*)f, (void*)o, (void*)param); diff --git a/pp_hot.c b/pp_hot.c index 2cccc48..9c9d1e9 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -3078,6 +3078,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp) const HE* const he = hv_fetch_ent(stash, meth, 0, *hashp); if (he) { gv = MUTABLE_GV(HeVAL(he)); + assert(stash); if (isGV(gv) && GvCV(gv) && (!GvCVGEN(gv) || GvCVGEN(gv) == (PL_sub_generation + HvMROMETA(stash)->cache_gen))) @@ -3085,9 +3086,9 @@ S_method_common(pTHX_ SV* meth, U32* hashp) } } + assert(stash || packsv); gv = gv_fetchmethod_sv_flags(stash ? stash : MUTABLE_HV(packsv), - meth, GV_AUTOLOAD | GV_CROAK); - + meth, GV_AUTOLOAD | GV_CROAK); assert(gv); return isGV(gv) ? MUTABLE_SV(GvCV(gv)) : MUTABLE_SV(gv); diff --git a/regcomp.c b/regcomp.c index eaee604..3d49827 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2007,6 +2007,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, }); re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1); + assert(re_trie_maxbuff); if (!SvIOK(re_trie_maxbuff)) { sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT); } @@ -14920,6 +14921,7 @@ S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, av_store(av, 0, (runtime_defns) ? SvREFCNT_inc(runtime_defns) : &PL_sv_undef); if (swash) { + assert(cp_list); av_store(av, 1, swash); SvREFCNT_dec_NN(cp_list); } @@ -16609,6 +16611,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, last= plast; while (PL_regkind[op] != END && (!last || node < last)) { + assert(node); /* While that wasn't END last time... */ NODE_ALIGN(node); op = OP(node); diff --git a/regexec.c b/regexec.c index 362390b..ffab4f2 100644 --- a/regexec.c +++ b/regexec.c @@ -7010,6 +7010,8 @@ no_silent: sv_commit = &PL_sv_yes; sv_yes_mark = &PL_sv_no; } + assert(sv_err); + assert(sv_mrk); sv_setsv(sv_err, sv_commit); sv_setsv(sv_mrk, sv_yes_mark); } @@ -7620,6 +7622,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, *only_utf8_locale_ptr = ary[2]; } else { + assert(only_utf8_locale_ptr); *only_utf8_locale_ptr = NULL; } @@ -7641,7 +7644,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, } else if (doinit && ((si && si != &PL_sv_undef) || (invlist && invlist != &PL_sv_undef))) { - + assert(si); sw = _core_swash_init("utf8", /* the utf8 package */ "", /* nameless */ si, diff --git a/universal.c b/universal.c index a29696d..65e02df 100644 --- a/universal.c +++ b/universal.c @@ -67,7 +67,7 @@ S_isa_lookup(pTHX_ HV *stash, const char * const name, STRLEN len, U32 flags) if (our_stash) { HEK *canon_name = HvENAME_HEK(our_stash); if (!canon_name) canon_name = HvNAME_HEK(our_stash); - + assert(canon_name); if (hv_common(isa, NULL, HEK_KEY(canon_name), HEK_LEN(canon_name), HEK_FLAGS(canon_name), HV_FETCH_ISEXISTS, NULL, HEK_HASH(canon_name))) { diff --git a/util.c b/util.c index b90abe5..cd0afb6 100644 --- a/util.c +++ b/util.c @@ -850,15 +850,17 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U { const MAGIC *const mg = mg_find(littlestr, PERL_MAGIC_bm); - const unsigned char * const table = (const unsigned char *) mg->mg_ptr; const unsigned char *oldlittle; + assert(mg); + --littlelen; /* Last char found by table lookup */ s = big + littlelen; little += littlelen; /* last char */ oldlittle = little; if (s < bigend) { + const unsigned char * const table = (const unsigned char *) mg->mg_ptr; I32 tmp; top2: -- 1.8.5.2 (Apple Git-48)
* Use the C_ARRAY_LENGTH.Jarkko Hietaniemi2014-05-281-2/+1
| | | | | | | | | | | | Use the C_ARRAY_LENGTH instead of sizeof(c_array)/sizeof(c_array[0]) or sizeof(c_array)/sizeof(type_of_element_in_c_array), and C_ARRAY_END for c_array + C_ARRAY_LENGTH(c_array). While doing this found potential off-by-one error in sv.c:Perl_sv_magic: how > C_ARRAY_LENGTH(PL_magic_data) should probably have been how >= C_ARRAY_LENGTH(PL_magic_data) No tests fail, but this seems to be more of an internal sanity check.
* Change av_len calls to av_tindex for clarityKarl Williamson2014-02-201-2/+2
| | | | | | av_tindex is a more clearly named synonym for av_len, available starting in v5.18. This changes the core uses to it, including modules in /ext, which are not dual-lifed.
* Added missing prototypes.Brian Fraser2014-02-051-0/+21
| | | | | This was mostly for XS functions defined in the core, but also for a handful of functions in the :stdio layer.
* universal.c: include vutil.hFather Chrysostomos2014-01-041-0/+1
| | | | Subsequent changes to vxs.inc will require it.
* Extract version routines into two new filesFather Chrysostomos2014-01-041-405/+5
| | | | | | | | | | | | | This is to make synchronisation between the CPAN distribution and the perl core easier. The files have different extensions to match what the CPAN distribu- tion will have. vutil.c is a separate compilation unit that the CPAN dist already has. vxs.inc will be included by vxs.xs (vxs.c is obvi- ously alreday taken, being generated from vxs.xs). In the perl core util.c includes vutil.c and universal.c includes vxs.inc.
* perlapi: Consistent spaces after dotsFather Chrysostomos2013-12-291-1/+1
| | | | plus some typo fixes. I probably changed some things in perlintern, too.
* Purge sfio support, which has been broken for a decade.Nicholas Clark2013-12-271-2/+2
| | | | | | | | | | | The last Perl release that built with -Dusesfio was v5.8.0, and even that failed many regression tests. Every subsequent release fails to build, and in the decade that has passed we have had no bug reports about this. So it's safe to delete all the code. The Configure related code will be purged in a subsequent commit. 2 references to sfio intentionally remain in fakesdio.h and nostdio.h, as these appear to be for using its stdio API-compatibility layer.
* Also build PerlIO_get_layers with -DusesfioNicholas Clark2013-12-271-2/+2
| | | | | | | | | | | | | This extends patch 5fef3b4a7f0c97d3 from April 2003 from fixing the stdio-only build to also fix the sfio build, which was broken when PerlIO_get_layers was added (2 commits previously, 39f7a87036eb8d13). Without this fix, perl would refuse to build with -Dusesfio. Given that 39f7a87036eb8d13 was merged to maint-5.8, this means that the -Dusesfio build was broken for v5.8.1 and later on that branch, as well as for v5.10.0 and all subsequent releases. Given that in the past 10 years, no-one has reported this, it's safe to assume that no-one considers sfio support to be important.
* Remove constant.pm-specific behaviour from Internals::SvREADONLYFather Chrysostomos2013-12-261-9/+32
| | | | | | | Some stuff on CPAN is using this undocumented function, so give constant.pm its own. It is already a core module, depending on functionality provided by the core solely for its sake; so this does not really change its relationship to the core.
* Sprinkle diag_listed_asFather Chrysostomos2013-11-171-0/+3
|
* Make the details array in universal.c staticFather Chrysostomos2013-10-241-1/+1
| | | | | Otherwise we can have linking problems when a global ‘details’ symbol is defined elsewhere. (That happened to me with an XS module.)
* isa should fall back to checking @UNIVERSAL::ISA in all casesJesse Luehrs2013-10-171-4/+8
|