[perl #120544] fix "goto" around var init error in av_extend_guts
authorDaniel Dragan <bulk88@hotmail.com>
Fri, 15 Nov 2013 08:21:53 +0000 (03:21 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 15 Nov 2013 13:39:20 +0000 (05:39 -0800)
This fixes a Win32 Visual C 6 in C++ mode syntax error. See #120544 for
the details.

av.c

diff --git a/av.c b/av.c
index 2a8ccf0..bae7e61 100644 (file)
--- a/av.c
+++ b/av.c
@@ -112,11 +112,6 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
            }
        }
        else {
-#ifdef PERL_MALLOC_WRAP
-           static const char oom_array_extend[] =
-             "Out of memory during array extend"; /* Duplicated in pp_hot.c */
-#endif
-
            if (*allocp) {
 
 #ifdef Perl_safesysmalloc_size
@@ -141,7 +136,13 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
 #endif 
                newmax = key + *maxp / 5;
              resize:
-               MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+               {
+#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */
+                   static const char oom_array_extend[] =
+                       "Out of memory during array extend";
+#endif
+                   MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+               }
                Renew(*allocp,newmax+1, SV*);
 #ifdef Perl_safesysmalloc_size
              resized:
@@ -156,7 +157,13 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
            }
            else {
                newmax = key < 3 ? 3 : key;
-               MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+               {
+#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */
+                   static const char oom_array_extend[] =
+                       "Out of memory during array extend";
+#endif
+                   MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
+               }
                Newx(*allocp, newmax+1, SV*);
                ary = *allocp + 1;
                tmp = newmax;