From: Dave Mitchell Date: Sat, 31 Dec 2005 21:36:05 +0000 (+0000) Subject: tidy index arrangements in new MY_CXT code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4c901e72a9a1fb951bea802158d49869bfdb0dbe;p=p5sagit%2Fp5-mst-13.2.git tidy index arrangements in new MY_CXT code p4raw-id: //depot/perl@26554 --- diff --git a/intrpvar.h b/intrpvar.h index 931ac46..aa0f0c3 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -519,7 +519,7 @@ PERLVARI(Idumper_fd, int, -1) #endif #ifdef PERL_IMPLICIT_CONTEXT -PERLVARI(Imy_cxt_size, int, -1) /* size of PL_my_cxt_list */ +PERLVARI(Imy_cxt_size, int, 0) /* size of PL_my_cxt_list */ PERLVARI(Imy_cxt_list, void **, NULL) /* per-module array of MY_CXT pointers */ #endif diff --git a/sv.c b/sv.c index 5372215..b707a73 100644 --- a/sv.c +++ b/sv.c @@ -10480,7 +10480,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_exitlist = (PerlExitListEntry*)NULL; PL_my_cxt_size = proto_perl->Imy_cxt_size; - if (PL_my_cxt_size != -1) { + if (PL_my_cxt_size) { Newx(PL_my_cxt_list, PL_my_cxt_size, void *); Copy(proto_perl->Imy_cxt_list, PL_my_cxt_list, PL_my_cxt_size, void *); } diff --git a/util.c b/util.c index 4976c75..c4fddee 100644 --- a/util.c +++ b/util.c @@ -5220,9 +5220,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 *); }