X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=util.c;h=f868645f2face53d26af88b59b78cee8ac1b4f96;hb=74ac850a5ee417afa60a477ea52af7a8f46a7e5a;hp=4976c7517e7f49cf05848937f6f60fa59bd350a6;hpb=f16dd614412ea67a8eb64bb09a88fccdbd9db6b6;p=p5sagit%2Fp5-mst-13.2.git diff --git a/util.c b/util.c index 4976c75..f868645 100644 --- a/util.c +++ b/util.c @@ -1,7 +1,7 @@ /* util.c * * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, - * 2000, 2001, 2002, 2003, 2004, 2005, by Larry Wall and others + * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -139,7 +139,6 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size) where = (Malloc_t)((char*)where-sTHX); size += sTHX; if (((struct perl_memory_debug_header *)where)->interpreter != aTHX) { - /* int *nowhere = NULL; *nowhere = 0; */ Perl_croak_nocontext("panic: realloc from wrong pool"); } # ifdef PERL_POISON @@ -190,7 +189,6 @@ Perl_safesysfree(Malloc_t where) #ifdef PERL_TRACK_MEMPOOL where = (Malloc_t)((char*)where-sTHX); if (((struct perl_memory_debug_header *)where)->interpreter != aTHX) { - /* int *nowhere = NULL; *nowhere = 0; */ Perl_croak_nocontext("panic: free from wrong pool"); } # ifdef PERL_POISON @@ -434,7 +432,7 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags) if (flags & FBMcf_TAIL) { MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL; - sv_catpvn(sv, "\n", 1); /* Taken into account in fbm_instr() */ + sv_catpvs(sv, "\n"); /* Taken into account in fbm_instr() */ if (mg && mg->mg_len >= 0) mg->mg_len++; } @@ -916,7 +914,7 @@ S_mess_alloc(pTHX) XPVMG *any; if (!PL_dirty) - return sv_2mortal(newSVpvn("",0)); + return sv_2mortal(newSVpvs("")); if (PL_mess_sv) return PL_mess_sv; @@ -4310,14 +4308,14 @@ Perl_vnumify(pTHX_ SV *vs) /* attempt to retrieve the version array */ if ( !(av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)) ) ) { - sv_catpvn(sv,"0",1); + sv_catpvs(sv,"0"); return sv; } len = av_len(av); if ( len == -1 ) { - sv_catpvn(sv,"0",1); + sv_catpvs(sv,"0"); return sv; } @@ -4340,12 +4338,12 @@ Perl_vnumify(pTHX_ SV *vs) { digit = SvIV(*av_fetch(av, len, 0)); if ( alpha && width == 3 ) /* alpha version */ - sv_catpvn(sv,"_",1); + sv_catpvs(sv,"_"); Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); } else /* len == 0 */ { - sv_catpvn(sv,"000",3); + sv_catpvs(sv, "000"); } return sv; } @@ -4384,7 +4382,7 @@ Perl_vnormal(pTHX_ SV *vs) len = av_len(av); if ( len == -1 ) { - sv_catpvn(sv,"",0); + sv_catpvs(sv,""); return sv; } digit = SvIV(*av_fetch(av, 0, 0)); @@ -4406,7 +4404,7 @@ Perl_vnormal(pTHX_ SV *vs) if ( len <= 2 ) { /* short version, must be at least three */ for ( len = 2 - len; len != 0; len-- ) - sv_catpvn(sv,".0",2); + sv_catpvs(sv,".0"); } return sv; } @@ -5220,9 +5218,9 @@ Perl_my_cxt_init(pTHX_ int *index, size_t size) } /* make sure the array is big enough */ - if (PL_my_cxt_size < *index + 1) { - if (PL_my_cxt_list) { - while (PL_my_cxt_size < *index + 1) + if (PL_my_cxt_size <= *index) { + if (PL_my_cxt_size) { + while (PL_my_cxt_size <= *index) PL_my_cxt_size *= 2; Renew(PL_my_cxt_list, PL_my_cxt_size, void *); }