diff options
-rw-r--r-- | av.c | 36 | ||||
-rw-r--r-- | dist/Data-Dumper/Dumper.xs | 13 | ||||
-rw-r--r-- | dist/ExtUtils-ParseXS/lib/perlxstut.pod | 4 | ||||
-rw-r--r-- | dist/Math-BigInt-FastCalc/FastCalc.xs | 20 | ||||
-rw-r--r-- | dump.c | 2 | ||||
-rw-r--r-- | embed.fnc | 27 | ||||
-rw-r--r-- | ext/mro/mro.xs | 2 | ||||
-rw-r--r-- | inline.h | 2 | ||||
-rw-r--r-- | op.c | 2 | ||||
-rw-r--r-- | op.h | 2 | ||||
-rw-r--r-- | perl.c | 4 | ||||
-rw-r--r-- | pod/perlembed.pod | 10 | ||||
-rw-r--r-- | pod/perlguts.pod | 12 | ||||
-rw-r--r-- | pp.c | 38 | ||||
-rw-r--r-- | pp.h | 4 | ||||
-rw-r--r-- | pp_ctl.c | 32 | ||||
-rw-r--r-- | pp_hot.c | 14 | ||||
-rw-r--r-- | pp_sort.c | 2 | ||||
-rw-r--r-- | proto.h | 26 | ||||
-rw-r--r-- | scope.c | 24 | ||||
-rw-r--r-- | scope.h | 4 | ||||
-rw-r--r-- | toke.c | 2 | ||||
-rw-r--r-- | universal.c | 10 | ||||
-rw-r--r-- | utf8.c | 4 | ||||
-rw-r--r-- | util.c | 10 | ||||
-rw-r--r-- | vms/vms.c | 2 |
26 files changed, 160 insertions, 148 deletions
@@ -27,7 +27,7 @@ void Perl_av_reify(pTHX_ AV *av) { dVAR; - I32 key; + SSize_t key; PERL_ARGS_ASSERT_AV_REIFY; assert(SvTYPE(av) == SVt_PVAV); @@ -190,7 +190,7 @@ The rough perl equivalent is C<$myarray[$idx]>. */ static bool -S_adjust_index(pTHX_ AV *av, const MAGIC *mg, I32 *keyp) +S_adjust_index(pTHX_ AV *av, const MAGIC *mg, SSize_t *keyp) { bool adjust_index = 1; if (mg) { @@ -215,7 +215,7 @@ S_adjust_index(pTHX_ AV *av, const MAGIC *mg, I32 *keyp) } SV** -Perl_av_fetch(pTHX_ AV *av, I32 key, I32 lval) +Perl_av_fetch(pTHX_ AV *av, SSize_t key, I32 lval) { dVAR; @@ -286,7 +286,7 @@ more information on how to use this function on tied arrays. */ SV** -Perl_av_store(pTHX_ AV *av, I32 key, SV *val) +Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val) { dVAR; SV** ary; @@ -372,7 +372,7 @@ Perl equivalent: C<my @new_array = ($scalar1, $scalar2, $scalar3...);> */ AV * -Perl_av_make(pTHX_ I32 size, SV **strp) +Perl_av_make(pTHX_ SSize_t size, SV **strp) { AV * const av = MUTABLE_AV(newSV_type(SVt_PVAV)); /* sv_upgrade does AvREAL_only() */ @@ -381,7 +381,7 @@ Perl_av_make(pTHX_ I32 size, SV **strp) if (size) { /* "defined" was returning undef for size==0 anyway. */ SV** ary; - I32 i; + SSize_t i; Newx(ary,size,SV*); AvALLOC(av) = ary; AvARRAY(av) = ary; @@ -425,7 +425,7 @@ void Perl_av_clear(pTHX_ AV *av) { dVAR; - I32 extra; + SSize_t extra; bool real; PERL_ARGS_ASSERT_AV_CLEAR; @@ -454,7 +454,7 @@ Perl_av_clear(pTHX_ AV *av) if ((real = !!AvREAL(av))) { SV** const ary = AvARRAY(av); - I32 index = AvFILLp(av) + 1; + SSize_t index = AvFILLp(av) + 1; ENTER; SAVEFREESV(SvREFCNT_inc_simple_NN(av)); while (index) { @@ -497,7 +497,7 @@ Perl_av_undef(pTHX_ AV *av) av_fill(av, -1); if ((real = !!AvREAL(av))) { - I32 key = AvFILLp(av) + 1; + SSize_t key = AvFILLp(av) + 1; ENTER; SAVEFREESV(SvREFCNT_inc_simple_NN(av)); while (key) @@ -638,10 +638,10 @@ Perl equivalent: C<unshift @myarray, ( (undef) x $n );> */ void -Perl_av_unshift(pTHX_ AV *av, I32 num) +Perl_av_unshift(pTHX_ AV *av, SSize_t num) { dVAR; - I32 i; + SSize_t i; MAGIC* mg; PERL_ARGS_ASSERT_AV_UNSHIFT; @@ -672,9 +672,9 @@ Perl_av_unshift(pTHX_ AV *av, I32 num) } if (num) { SV **ary; - const I32 i = AvFILLp(av); + const SSize_t i = AvFILLp(av); /* Create extra elements */ - const I32 slide = i > 0 ? i : 0; + const SSize_t slide = i > 0 ? i : 0; num += slide; av_extend(av, i + num); AvFILLp(av) += num; @@ -752,7 +752,7 @@ meaning from what the similarly named L</sv_len> returns. =cut */ -I32 +SSize_t Perl_av_len(pTHX_ AV *av) { PERL_ARGS_ASSERT_AV_LEN; @@ -775,7 +775,7 @@ the same as C<av_clear(av)>. =cut */ void -Perl_av_fill(pTHX_ AV *av, I32 fill) +Perl_av_fill(pTHX_ AV *av, SSize_t fill) { dVAR; MAGIC *mg; @@ -793,7 +793,7 @@ Perl_av_fill(pTHX_ AV *av, I32 fill) return; } if (fill <= AvMAX(av)) { - I32 key = AvFILLp(av); + SSize_t key = AvFILLp(av); SV** const ary = AvARRAY(av); if (AvREAL(av)) { @@ -827,7 +827,7 @@ C<G_DISCARD> version. =cut */ SV * -Perl_av_delete(pTHX_ AV *av, I32 key, I32 flags) +Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags) { dVAR; SV *sv; @@ -905,7 +905,7 @@ Perl equivalent: C<exists($myarray[$key])>. =cut */ bool -Perl_av_exists(pTHX_ AV *av, I32 key) +Perl_av_exists(pTHX_ AV *av, SSize_t key) { dVAR; PERL_ARGS_ASSERT_AV_EXISTS; diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 3fdc71fcf6..31524289d4 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -393,7 +393,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, int use_sparse_seen_hash, I32 useqq) { char tmpbuf[128]; - U32 i; + Size_t i; char *c, *r, *realpack; #ifdef DD_USE_OLD_ID_FORMAT char id[128]; @@ -641,8 +641,8 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } else if (realtype == SVt_PVAV) { SV *totpad; - I32 ix = 0; - const I32 ixmax = av_len((AV *)ival); + SSize_t ix = 0; + const SSize_t ixmax = av_len((AV *)ival); SV * const ixsv = newSViv(0); /* allowing for a 24 char wide array index */ @@ -819,7 +819,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, bool do_utf8 = FALSE; if (sortkeys) { - if (!(keys && (I32)i <= av_len(keys))) break; + if (!(keys && (SSize_t)i <= av_len(keys))) break; } else { if (!(entry = hv_iternext((HV *)ival))) break; } @@ -1209,7 +1209,8 @@ Data_Dumper_Dumpxs(href, ...) HV *seenhv = NULL; AV *postav, *todumpav, *namesav; I32 level = 0; - I32 indent, terse, useqq, i, imax, postlen; + I32 indent, terse, useqq; + SSize_t i, imax, postlen; SV **svp; SV *val, *name, *pad, *xpad, *apad, *sep, *pair, *varname; SV *freezer, *toaster, *bless, *sortkeys; @@ -1395,7 +1396,7 @@ Data_Dumper_Dumpxs(href, ...) sv_catsv(retval, valstr); sv_catsv(retval, sep); if (postlen >= 0) { - I32 i; + SSize_t i; sv_catsv(retval, pad); for (i = 0; i <= postlen; ++i) { SV *elem; diff --git a/dist/ExtUtils-ParseXS/lib/perlxstut.pod b/dist/ExtUtils-ParseXS/lib/perlxstut.pod index 403b8da7a3..829e714b17 100644 --- a/dist/ExtUtils-ParseXS/lib/perlxstut.pod +++ b/dist/ExtUtils-ParseXS/lib/perlxstut.pod @@ -1089,8 +1089,8 @@ Mytest.xs: SV * paths INIT: AV * results; - I32 numpaths = 0; - int i, n; + SSize_t numpaths = 0, n; + int i; struct statfs buf; SvGETMAGIC(paths); diff --git a/dist/Math-BigInt-FastCalc/FastCalc.xs b/dist/Math-BigInt-FastCalc/FastCalc.xs index a8247c9508..a045c7172e 100644 --- a/dist/Math-BigInt-FastCalc/FastCalc.xs +++ b/dist/Math-BigInt-FastCalc/FastCalc.xs @@ -108,7 +108,7 @@ _copy(class, x) INIT: AV* a; AV* a2; - I32 elems; + SSize_t elems; CODE: a = (AV*)SvRV(x); /* ref to aray, don't check ref */ @@ -144,8 +144,8 @@ __strip_zeros(x) INIT: AV* a; SV* temp; - I32 elems; - I32 index; + SSize_t elems; + SSize_t index; CODE: a = (AV*)SvRV(x); /* ref to aray, don't check ref */ @@ -189,8 +189,8 @@ _dec(class,x) INIT: AV* a; SV* temp; - I32 elems; - I32 index; + SSize_t elems; + SSize_t index; NV MAX; CODE: @@ -233,8 +233,8 @@ _inc(class,x) INIT: AV* a; SV* temp; - I32 elems; - I32 index; + SSize_t elems; + SSize_t index; NV BASE; CODE: @@ -347,13 +347,13 @@ _acmp(class, cx, cy); INIT: AV* array_x; AV* array_y; - I32 elemsx, elemsy, diff; + SSize_t elemsx, elemsy, diff; SV* tempx; SV* tempy; STRLEN lenx; STRLEN leny; NV diff_nv; - I32 diff_str; + SSize_t diff_str; CODE: array_x = (AV*)SvRV(cx); /* ref to aray, don't check ref */ @@ -376,7 +376,7 @@ _acmp(class, cx, cy); tempy = *av_fetch(array_y, elemsx, 0); /* fetch last element */ SvPV(tempx, lenx); /* convert to string & store length */ SvPV(tempy, leny); /* convert to string & store length */ - diff_str = (I32)lenx - (I32)leny; + diff_str = (SSize_t)lenx - (SSize_t)leny; if (diff_str > 0) { RETURN_MORTAL_INT(1); /* same len, but first elems differs in len */ @@ -1755,7 +1755,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX_const(d) + 1 : ""); if (nest < maxnest && av_len(MUTABLE_AV(sv)) >= 0) { - int count; + SSize_t count; for (count = 0; count <= av_len(MUTABLE_AV(sv)) && count < maxnest; count++) { SV** const elt = av_fetch(MUTABLE_AV(sv),count,0); @@ -207,28 +207,28 @@ Apd |OP* |op_prepend_elem|I32 optype|NULLOK OP* first|NULLOK OP* last p |I32 |apply |I32 type|NN SV** mark|NN SV** sp ApM |void |apply_attrs_string|NN const char *stashpv|NN CV *cv|NN const char *attrstr|STRLEN len Apd |void |av_clear |NN AV *av -Apd |SV* |av_delete |NN AV *av|I32 key|I32 flags -ApdR |bool |av_exists |NN AV *av|I32 key +Apd |SV* |av_delete |NN AV *av|SSize_t key|I32 flags +ApdR |bool |av_exists |NN AV *av|SSize_t key Apd |void |av_extend |NN AV *av|SSize_t key p |void |av_extend_guts |NULLOK AV *av|SSize_t key \ |NN SSize_t *maxp \ |NN SV ***allocp|NN SV ***arrayp -ApdR |SV** |av_fetch |NN AV *av|I32 key|I32 lval -Apd |void |av_fill |NN AV *av|I32 fill -ApdR |I32 |av_len |NN AV *av -ApdR |AV* |av_make |I32 size|NN SV **strp +ApdR |SV** |av_fetch |NN AV *av|SSize_t key|I32 lval +Apd |void |av_fill |NN AV *av|SSize_t fill +ApdR |SSize_t|av_len |NN AV *av +ApdR |AV* |av_make |SSize_t size|NN SV **strp Apd |SV* |av_pop |NN AV *av ApdoxM |void |av_create_and_push|NN AV **const avp|NN SV *const val Apd |void |av_push |NN AV *av|NN SV *val : Used in scope.c, and by Data::Alias EXp |void |av_reify |NN AV *av ApdR |SV* |av_shift |NN AV *av -Apd |SV** |av_store |NN AV *av|I32 key|NULLOK SV *val -AidR |I32 |av_top_index |NN AV *av -AmpdR |I32 |av_tindex |NN AV *av +Apd |SV** |av_store |NN AV *av|SSize_t key|NULLOK SV *val +AidR |SSize_t|av_top_index |NN AV *av +AmpdR |SSize_t|av_tindex |NN AV *av Apd |void |av_undef |NN AV *av ApdoxM |SV** |av_create_and_unshift_one|NN AV **const avp|NN SV *const val -Apd |void |av_unshift |NN AV *av|I32 num +Apd |void |av_unshift |NN AV *av|SSize_t num Apo |SV** |av_arylen_p |NN AV *av Apo |IV* |av_iter_p |NN AV *av #if defined(PERL_IN_AV_C) @@ -1184,8 +1184,9 @@ Apda |char* |savesharedsvpv |NN SV *sv Apda |char* |savesvpv |NN SV* sv Ap |void |savestack_grow Ap |void |savestack_grow_cnt |I32 need -Amp |void |save_aelem |NN AV* av|I32 idx|NN SV **sptr -Ap |void |save_aelem_flags|NN AV* av|I32 idx|NN SV **sptr|const U32 flags +Amp |void |save_aelem |NN AV* av|SSize_t idx|NN SV **sptr +Ap |void |save_aelem_flags|NN AV* av|SSize_t idx|NN SV **sptr \ + |const U32 flags Ap |I32 |save_alloc |I32 size|I32 pad Ap |void |save_aptr |NN AV** aptr Ap |AV* |save_ary |NN GV* gv @@ -1193,7 +1194,7 @@ Ap |void |save_bool |NN bool* boolp Ap |void |save_clearsv |NN SV** svp Ap |void |save_delete |NN HV *hv|NN char *key|I32 klen Ap |void |save_hdelete |NN HV *hv|NN SV *keysv -Ap |void |save_adelete |NN AV *av|I32 key +Ap |void |save_adelete |NN AV *av|SSize_t key Ap |void |save_destructor|DESTRUCTORFUNC_NOCONTEXT_t f|NN void* p Ap |void |save_destructor_x|DESTRUCTORFUNC_t f|NULLOK void* p Apmb |void |save_freesv |NULLOK SV* sv diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs index a786025d9d..78fa8df0e6 100644 --- a/ext/mro/mro.xs +++ b/ext/mro/mro.xs @@ -77,7 +77,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level) The members of @seqs are the MROs of the members of @ISA, followed by @ISA itself. */ - I32 items = AvFILLp(isa) + 1; + SSize_t items = AvFILLp(isa) + 1; SV** isa_ptr = AvARRAY(isa); while(items--) { SV* const isa_item = *isa_ptr++; @@ -14,7 +14,7 @@ /* ------------------------------- av.h ------------------------------- */ -PERL_STATIC_INLINE I32 +PERL_STATIC_INLINE SSize_t S_av_top_index(pTHX_ AV *av) { PERL_ARGS_ASSERT_AV_TOP_INDEX; @@ -5729,7 +5729,7 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o) /* this line can have a breakpoint - store the cop in IV */ AV *av = CopFILEAVx(PL_curcop); if (av) { - SV * const * const svp = av_fetch(av, (I32)CopLINE(cop), FALSE); + SV * const * const svp = av_fetch(av, CopLINE(cop), FALSE); if (svp && *svp != &PL_sv_undef ) { (void)SvIOK_on(*svp); SvIV_set(*svp, PTR2IV(cop)); @@ -829,7 +829,7 @@ preprocessing token; the type of I<arg> depends on I<which>. #define CALL_BLOCK_HOOKS(which, arg) \ STMT_START { \ if (PL_blockhooks) { \ - I32 i; \ + SSize_t i; \ for (i = av_len(PL_blockhooks); i >= 0; i--) { \ SV *sv = AvARRAY(PL_blockhooks)[i]; \ BHK *hk; \ @@ -4778,9 +4778,9 @@ S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags) /* finally add this lib directory at the end of @INC */ if (unshift) { #ifdef PERL_IS_MINIPERL - const U32 extra = 0; + const Size_t extra = 0; #else - U32 extra = av_len(av) + 1; + Size_t extra = av_len(av) + 1; #endif av_unshift(inc, extra + push_basedir); if (push_basedir) diff --git a/pod/perlembed.pod b/pod/perlembed.pod index b06a242c16..979c944670 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -391,7 +391,7 @@ C<s/bob/robert/g> or C<tr[A-Z][a-z]>), substitute() modifies the string within the C<SV> as according to the operation, returning the number of substitutions made. - int matches(SV *string, char *pattern, AV **matches); + SSize_t matches(SV *string, char *pattern, AV **matches); Given an C<SV>, a pattern, and a pointer to an empty C<AV>, matches() evaluates C<$string =~ $pattern> in a list context, and @@ -478,10 +478,10 @@ been wrapped here): ** and fills in **matches with the matching substrings **/ - I32 matches(SV *string, char *pattern, AV **match_list) + SSize_t matches(SV *string, char *pattern, AV **match_list) { SV *command = newSV(0); - I32 num_matches; + SSize_t num_matches; sv_setpvf(command, "my $string = '%s'; @array = ($string =~ %s)", SvPV_nolen(string), pattern); @@ -541,8 +541,8 @@ been wrapped here): /** Remove all vowels from text **/ num_matches = substitute(&text, "s/[aeiou]//gi"); if (num_matches) { - printf("substitute: s/[aeiou]//gi...%d substitutions made.\n", - num_matches); + printf("substitute: s/[aeiou]//gi...%lu substitutions made.\n", + (unsigned long)num_matches); printf("Now text is: %s\n\n", SvPV_nolen(text)); } diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 29a30bf2ee..ac9224cb70 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -332,7 +332,7 @@ empty AV: The second method both creates the AV and initially populates it with SVs: - AV* av_make(I32 num, SV **ptr); + AV* av_make(SSize_t num, SV **ptr); The second argument points to an array containing C<num> C<SV*>'s. Once the AV has been created, the SVs can be destroyed, if so desired. @@ -342,7 +342,7 @@ Once the AV has been created, the following operations are possible on it: void av_push(AV*, SV*); SV* av_pop(AV*); SV* av_shift(AV*); - void av_unshift(AV*, I32 num); + void av_unshift(AV*, SSize_t num); These should be familiar operations, with the exception of C<av_unshift>. This routine adds C<num> elements at the front of the array with the C<undef> @@ -351,9 +351,9 @@ to these new elements. Here are some other functions: - I32 av_top_index(AV*); - SV** av_fetch(AV*, I32 key, I32 lval); - SV** av_store(AV*, I32 key, SV* val); + SSize_t av_top_index(AV*); + SV** av_fetch(AV*, SSize_t key, I32 lval); + SV** av_store(AV*, SSize_t key, SV* val); The C<av_top_index> function returns the highest index value in an array (just like $#array in Perl). If the array is empty, -1 is returned. The @@ -370,7 +370,7 @@ A few more: void av_clear(AV*); void av_undef(AV*); - void av_extend(AV*, I32 key); + void av_extend(AV*, SSize_t key); The C<av_clear> function deletes all the elements in the AV* array, but does not actually delete the array itself. The C<av_undef> function will @@ -88,11 +88,11 @@ PP(pp_padav) gimme = GIMME_V; if (gimme == G_ARRAY) { /* XXX see also S_pushav in pp_hot.c */ - const I32 maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; + const Size_t maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; EXTEND(SP, maxarg); if (SvMAGICAL(TARG)) { - U32 i; - for (i=0; i < (U32)maxarg; i++) { + Size_t i; + for (i=0; i < maxarg; i++) { SV * const * const svp = av_fetch(MUTABLE_AV(TARG), i, FALSE); SP[i+1] = (svp) ? *svp : &PL_sv_undef; } @@ -104,7 +104,7 @@ PP(pp_padav) } else if (gimme == G_SCALAR) { SV* const sv = sv_newmortal(); - const I32 maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; + const SSize_t maxarg = AvFILL(MUTABLE_AV(TARG)) + 1; sv_setiv(sv, maxarg); PUSHs(sv); } @@ -4305,9 +4305,9 @@ PP(pp_aslice) if (lval && localizing) { SV **svp; - I32 max = -1; + SSize_t max = -1; for (svp = MARK + 1; svp <= SP; svp++) { - const I32 elem = SvIV(*svp); + const SSize_t elem = SvIV(*svp); if (elem > max) max = elem; } @@ -4317,7 +4317,7 @@ PP(pp_aslice) while (++MARK <= SP) { SV **svp; - I32 elem = SvIV(*MARK); + SSize_t elem = SvIV(*MARK); bool preeminent = TRUE; if (localizing && can_preserve) { @@ -4541,7 +4541,7 @@ S_do_delete_local(pTHX) if (PL_op->op_flags & OPf_SPECIAL) { AV * const av = MUTABLE_AV(osv); while (++MARK <= end) { - I32 idx = SvIV(*MARK); + SSize_t idx = SvIV(*MARK); SV *sv = NULL; bool preeminent = TRUE; if (can_preserve) @@ -4899,12 +4899,12 @@ PP(pp_splice) AV *ary = DEREF_PLAIN_ARRAY(MUTABLE_AV(*++MARK)); SV **src; SV **dst; - I32 i; - I32 offset; - I32 length; - I32 newlen; - I32 after; - I32 diff; + SSize_t i; + SSize_t offset; + SSize_t length; + SSize_t newlen; + SSize_t after; + SSize_t diff; const MAGIC * const mg = SvTIED_mg((const SV *)ary, PERL_MAGIC_tied); if (mg) { @@ -5164,7 +5164,7 @@ PP(pp_unshift) SPAGAIN; } else { - I32 i = 0; + SSize_t i = 0; av_unshift(ary, SP - MARK); while (MARK < SP) { SV * const sv = newSVsv(*++MARK); @@ -5195,7 +5195,7 @@ PP(pp_reverse) SP = MARK; if (SvMAGICAL(av)) { - I32 i, j; + SSize_t i, j; SV *tmp = sv_newmortal(); /* For SvCANEXISTDELETE */ HV *stash; @@ -5323,11 +5323,11 @@ PP(pp_split) REGEXP *rx; SV *dstr; const char *m; - I32 iters = 0; + SSize_t iters = 0; const STRLEN slen = do_utf8 ? utf8_length((U8*)s, (U8*)strend) : (STRLEN)(strend - s); - I32 maxiters = slen + 10; + SSize_t maxiters = slen + 10; I32 trailing_empty = 0; const char *orig; const I32 origlimit = limit; @@ -5719,7 +5719,7 @@ PP(pp_split) LEAVE_with_name("call_PUSH"); SPAGAIN; if (gimme == G_ARRAY) { - I32 i; + SSize_t i; /* EXTEND should not be needed - we just popped them */ EXTEND(SP, iters); for (i=0; i < iters; i++) { @@ -435,8 +435,8 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. (void)POPs; /* XXX ??? */ \ } \ else if (gimme == G_ARRAY) { \ - int i; \ - I32 len; \ + SSize_t i; \ + SSize_t len; \ assert(SvTYPE(tmpsv) == SVt_PVAV); \ len = av_len((AV *)tmpsv) + 1; \ (void)POPs; /* get rid of the arg */ \ @@ -1908,7 +1908,7 @@ PP(pp_caller) && CopSTASH_eq(PL_curcop, PL_debstash)) { AV * const ary = cx->blk_sub.argarray; - const int off = AvARRAY(ary) - AvALLOC(ary); + const SSize_t off = AvARRAY(ary) - AvALLOC(ary); Perl_init_dbargs(aTHX); @@ -3788,7 +3788,7 @@ PP(pp_require) } if (!tryrsfp && !(errno == EACCES && !path_searchable)) { AV * const ar = GvAVn(PL_incgv); - I32 i; + SSize_t i; #ifdef VMS if (vms_unixname) #endif @@ -4001,7 +4001,7 @@ PP(pp_require) } else { if (namesv) { /* did we lookup @INC? */ AV * const ar = GvAVn(PL_incgv); - I32 i; + SSize_t i; SV *const msg = newSVpvs_flags("", SVs_TEMP); SV *const inc = newSVpvs_flags("", SVs_TEMP); for (i = 0; i <= AvFILL(ar); i++) { @@ -4568,7 +4568,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVAV) { /* Test sub truth for each element */ - I32 i; + SSize_t i; bool andedresults = TRUE; AV *av = (AV*) SvRV(d); const I32 len = av_len(av); @@ -4683,8 +4683,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVAV) { AV * const other_av = MUTABLE_AV(SvRV(d)); - const I32 other_len = av_len(other_av) + 1; - I32 i; + const SSize_t other_len = av_len(other_av) + 1; + SSize_t i; HV *hv = MUTABLE_HV(SvRV(e)); DEBUG_M(Perl_deb(aTHX_ " applying rule Array-Hash\n")); @@ -4735,8 +4735,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVHV) { AV * const other_av = MUTABLE_AV(SvRV(e)); - const I32 other_len = av_len(other_av) + 1; - I32 i; + const SSize_t other_len = av_len(other_av) + 1; + SSize_t i; DEBUG_M(Perl_deb(aTHX_ " applying rule Hash-Array\n")); for (i = 0; i < other_len; ++i) { @@ -4756,8 +4756,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) if (av_len(MUTABLE_AV(SvRV(e))) != av_len(other_av)) RETPUSHNO; else { - I32 i; - const I32 other_len = av_len(other_av); + SSize_t i; + const SSize_t other_len = av_len(other_av); if (NULL == seen_this) { seen_this = newHV(); @@ -4812,8 +4812,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) sm_regex_array: { PMOP * const matcher = make_matcher((REGEXP*) SvRV(d)); - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); - I32 i; + const SSize_t this_len = av_len(MUTABLE_AV(SvRV(e))); + SSize_t i; for(i = 0; i <= this_len; ++i) { SV * const * const svp = av_fetch(MUTABLE_AV(SvRV(e)), i, FALSE); @@ -4829,8 +4829,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) } else if (!SvOK(d)) { /* undef ~~ array */ - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); - I32 i; + const SSize_t this_len = av_len(MUTABLE_AV(SvRV(e))); + SSize_t i; DEBUG_M(Perl_deb(aTHX_ " applying rule Undef-Array\n")); for (i = 0; i <= this_len; ++i) { @@ -4844,8 +4844,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other, const bool copied) else { sm_any_array: { - I32 i; - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); + SSize_t i; + const SSize_t this_len = av_len(MUTABLE_AV(SvRV(e))); DEBUG_M(Perl_deb(aTHX_ " applying rule Any-Array\n")); for (i = 0; i <= this_len; ++i) { @@ -326,11 +326,11 @@ STATIC void S_pushav(pTHX_ AV* const av) { dSP; - const I32 maxarg = AvFILL(av) + 1; + const SSize_t maxarg = AvFILL(av) + 1; EXTEND(SP, maxarg); if (SvRMAGICAL(av)) { - U32 i; - for (i=0; i < (U32)maxarg; i++) { + PADOFFSET i; + for (i=0; i < (PADOFFSET)maxarg; i++) { SV ** const svp = av_fetch(av, i, FALSE); /* See note in pp_helem, and bug id #27839 */ SP[i+1] = svp @@ -339,8 +339,8 @@ S_pushav(pTHX_ AV* const av) } } else { - U32 i; - for (i=0; i < (U32)maxarg; i++) { + PADOFFSET i; + for (i=0; i < (PADOFFSET)maxarg; i++) { SV * const sv = AvARRAY(av)[i]; SP[i+1] = sv ? sv : &PL_sv_undef; } @@ -924,7 +924,7 @@ PP(pp_rv2av) } else if (gimme == G_SCALAR) { dTARGET; - const I32 maxarg = AvFILL(av) + 1; + const SSize_t maxarg = AvFILL(av) + 1; SETi(maxarg); } } else { @@ -994,7 +994,7 @@ PP(pp_aassign) I32 gimme; HV *hash; - I32 i; + SSize_t i; int magic; U32 lval = 0; @@ -1474,7 +1474,7 @@ PP(pp_sort) { dVAR; dSP; dMARK; dORIGMARK; SV **p1 = ORIGMARK+1, **p2; - I32 max, i; + SSize_t max, i; AV* av = NULL; HV *stash; GV *gv; @@ -149,12 +149,12 @@ PERL_CALLCONV SV** Perl_av_create_and_unshift_one(pTHX_ AV **const avp, SV *cons #define PERL_ARGS_ASSERT_AV_CREATE_AND_UNSHIFT_ONE \ assert(avp); assert(val) -PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV *av, I32 key, I32 flags) +PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_DELETE \ assert(av) -PERL_CALLCONV bool Perl_av_exists(pTHX_ AV *av, I32 key) +PERL_CALLCONV bool Perl_av_exists(pTHX_ AV *av, SSize_t key) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_EXISTS \ @@ -172,13 +172,13 @@ PERL_CALLCONV void Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, #define PERL_ARGS_ASSERT_AV_EXTEND_GUTS \ assert(maxp); assert(allocp); assert(arrayp) -PERL_CALLCONV SV** Perl_av_fetch(pTHX_ AV *av, I32 key, I32 lval) +PERL_CALLCONV SV** Perl_av_fetch(pTHX_ AV *av, SSize_t key, I32 lval) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_FETCH \ assert(av) -PERL_CALLCONV void Perl_av_fill(pTHX_ AV *av, I32 fill) +PERL_CALLCONV void Perl_av_fill(pTHX_ AV *av, SSize_t fill) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_FILL \ assert(av) @@ -188,13 +188,13 @@ PERL_CALLCONV IV* Perl_av_iter_p(pTHX_ AV *av) #define PERL_ARGS_ASSERT_AV_ITER_P \ assert(av) -PERL_CALLCONV I32 Perl_av_len(pTHX_ AV *av) +PERL_CALLCONV SSize_t Perl_av_len(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_LEN \ assert(av) -PERL_CALLCONV AV* Perl_av_make(pTHX_ I32 size, SV **strp) +PERL_CALLCONV AV* Perl_av_make(pTHX_ SSize_t size, SV **strp) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_AV_MAKE \ @@ -222,16 +222,16 @@ PERL_CALLCONV SV* Perl_av_shift(pTHX_ AV *av) #define PERL_ARGS_ASSERT_AV_SHIFT \ assert(av) -PERL_CALLCONV SV** Perl_av_store(pTHX_ AV *av, I32 key, SV *val) +PERL_CALLCONV SV** Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_STORE \ assert(av) -/* PERL_CALLCONV I32 Perl_av_tindex(pTHX_ AV *av) +/* PERL_CALLCONV SSize_t Perl_av_tindex(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); */ -PERL_STATIC_INLINE I32 S_av_top_index(pTHX_ AV *av) +PERL_STATIC_INLINE SSize_t S_av_top_index(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_TOP_INDEX \ @@ -242,7 +242,7 @@ PERL_CALLCONV void Perl_av_undef(pTHX_ AV *av) #define PERL_ARGS_ASSERT_AV_UNDEF \ assert(av) -PERL_CALLCONV void Perl_av_unshift(pTHX_ AV *av, I32 num) +PERL_CALLCONV void Perl_av_unshift(pTHX_ AV *av, SSize_t num) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_UNSHIFT \ assert(av) @@ -3506,16 +3506,16 @@ PERL_CALLCONV void Perl_save_I8(pTHX_ I8* bytep) #define PERL_ARGS_ASSERT_SAVE_I8 \ assert(bytep) -PERL_CALLCONV void Perl_save_adelete(pTHX_ AV *av, I32 key) +PERL_CALLCONV void Perl_save_adelete(pTHX_ AV *av, SSize_t key) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SAVE_ADELETE \ assert(av) -/* PERL_CALLCONV void Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr) +/* PERL_CALLCONV void Perl_save_aelem(pTHX_ AV* av, SSize_t idx, SV **sptr) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); */ -PERL_CALLCONV void Perl_save_aelem_flags(pTHX_ AV* av, I32 idx, SV **sptr, const U32 flags) +PERL_CALLCONV void Perl_save_aelem_flags(pTHX_ AV* av, SSize_t idx, SV **sptr, const U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS \ @@ -597,14 +597,18 @@ Perl_save_hdelete(pTHX_ HV *hv, SV *keysv) } void -Perl_save_adelete(pTHX_ AV *av, I32 key) +Perl_save_adelete(pTHX_ AV *av, SSize_t key) { dVAR; + dSS_ADD; PERL_ARGS_ASSERT_SAVE_ADELETE; SvREFCNT_inc_void(av); - save_pushi32ptr(key, av, SAVEt_ADELETE); + SS_ADD_UV(key); + SS_ADD_PTR(av); + SS_ADD_IV(SAVEt_ADELETE); + SS_ADD_END(3); } void @@ -661,16 +665,20 @@ S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2, } void -Perl_save_aelem_flags(pTHX_ AV *av, I32 idx, SV **sptr, const U32 flags) +Perl_save_aelem_flags(pTHX_ AV *av, SSize_t idx, SV **sptr, + const U32 flags) { - dVAR; + dVAR; dSS_ADD; SV *sv; PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS; SvGETMAGIC(*sptr); - save_pushptri32ptr(SvREFCNT_inc_simple(av), idx, SvREFCNT_inc(*sptr), - SAVEt_AELEM); + SS_ADD_PTR(SvREFCNT_inc_simple(av)); + SS_ADD_IV(idx); + SS_ADD_PTR(SvREFCNT_inc(*sptr)); + SS_ADD_UV(SAVEt_AELEM); + SS_ADD_END(4); /* The array needs to hold a reference count on its new element, so it must be AvREAL. */ if (!AvREAL(av) && AvREIFY(av)) @@ -1107,7 +1115,7 @@ Perl_leave_scope(pTHX_ I32 base) Safefree(arg2.any_ptr); break; case SAVEt_ADELETE: - (void)av_delete(ARG0_AV, ARG1_I32, G_DISCARD); + (void)av_delete(ARG0_AV, arg1.any_iv, G_DISCARD); SvREFCNT_dec(ARG0_AV); break; case SAVEt_DESTRUCTOR_X: @@ -1122,7 +1130,7 @@ Perl_leave_scope(pTHX_ I32 base) PL_stack_sp = PL_stack_base + arg0.any_i32; break; case SAVEt_AELEM: /* array element */ - svp = av_fetch(ARG2_AV, ARG1_I32, 1); + svp = av_fetch(ARG2_AV, arg1.any_iv, 1); if (!AvREAL(ARG2_AV) && AvREIFY(ARG2_AV)) /* undo reify guard */ SvREFCNT_dec(ARG0_SV); if (svp) { @@ -123,7 +123,7 @@ #define dSS_ADD \ I32 ix = PL_savestack_ix; \ - ANY *ssp = &PL_savestack[ix]; + ANY *ssp = &PL_savestack[ix] #define SS_ADD_END(need) \ assert((need) <= SS_MAXPUSH); \ @@ -254,7 +254,7 @@ scope has the given name. Name must be a literal string. #define SAVEHDELETE(h,s) \ save_hdelete(MUTABLE_HV(h), (s)) #define SAVEADELETE(a,k) \ - save_adelete(MUTABLE_AV(a), (I32)(k)) + save_adelete(MUTABLE_AV(a), (SSize_t)(k)) #define SAVEDESTRUCTOR(f,p) \ save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), (void*)(p)) @@ -1906,7 +1906,7 @@ S_update_debugger_info(pTHX_ SV *orig_sv, const char *const buf, STRLEN len) sv_setpvn(sv, buf, len); (void)SvIOK_on(sv); SvIV_set(sv, 0); - av_store(av, (I32)CopLINE(PL_curcop), sv); + av_store(av, CopLINE(PL_curcop), sv); } } diff --git a/universal.c b/universal.c index 10fefe1e61..847de55b03 100644 --- a/universal.c +++ b/universal.c @@ -1042,9 +1042,9 @@ XS(XS_PerlIO_get_layers) if (gv && (io = GvIO(gv))) { AV* const av = PerlIO_get_layers(aTHX_ input ? IoIFP(io) : IoOFP(io)); - I32 i; - const I32 last = av_len(av); - I32 nitem = 0; + SSize_t i; + const SSize_t last = av_len(av); + SSize_t nitem = 0; for (i = last; i >= 0; i -= 3) { SV * const * const namsvp = av_fetch(av, i - 2, FALSE); @@ -1186,8 +1186,8 @@ XS(XS_re_regnames) U32 flags; SV *ret; AV *av; - I32 length; - I32 i; + SSize_t length; + SSize_t i; SV **entry; if (items > 1) @@ -3886,12 +3886,12 @@ Perl__swash_inversion_hash(pTHX_ SV* const swash) &char_to, &to_len))) { if (av_len(from_list) > 0) { - int i; + SSize_t i; /* We iterate over all combinations of i,j to place each code * point on each list */ for (i = 0; i <= av_len(from_list); i++) { - int j; + SSize_t j; AV* i_list = newAV(); SV** entryp = av_fetch(from_list, i, FALSE); if (entryp == NULL) { @@ -4299,7 +4299,7 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) } } if ( qv ) { /* quoted versions always get at least three terms*/ - I32 len = av_len(av); + SSize_t len = av_len(av); /* This for loop appears to trigger a compiler bug on OS X, as it loops infinitely. Yes, len is negative. No, it makes no sense. Compiler in question is: @@ -4364,7 +4364,7 @@ Perl_new_version(pTHX_ SV *ver) if ( sv_isobject(ver) && sv_derived_from(ver, "version") ) /* can just copy directly */ { - I32 key; + SSize_t key; AV * const av = newAV(); AV *sav; /* This will get reblessed later if a derived class*/ @@ -4608,7 +4608,8 @@ The SV returned has a refcount of 1. SV * Perl_vnumify(pTHX_ SV *vs) { - I32 i, len, digit; + SSize_t i, len; + I32 digit; int width; bool alpha = FALSE; SV *sv; @@ -4785,7 +4786,8 @@ converted into version objects. int Perl_vcmp(pTHX_ SV *lhv, SV *rhv) { - I32 i,l,m,r,retval; + I32 i,l,m,r; + I32 retval; bool lalpha = FALSE; bool ralpha = FALSE; I32 left = 0; @@ -12941,7 +12941,7 @@ mod2fname(pTHX_ CV *cv) dXSARGS; char ultimate_name[NAM$C_MAXRSS+1], work_name[NAM$C_MAXRSS*8 + 1], workbuff[NAM$C_MAXRSS*1 + 1]; - int counter, num_entries; + SSize_t counter, num_entries; /* ODS-5 ups this, but we want to be consistent, so... */ int max_name_len = 39; AV *in_array = (AV *)SvRV(ST(0)); |