From c62df97fd6a0ef53562060054f04dfeadb67f5f8 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 15 Nov 2014 09:31:46 -0800 Subject: [PATCH] =?UTF-8?q?Revert=20the=20=E2=80=98return=E2=80=99=20part?= =?UTF-8?q?=20of=206edcbed6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gotos were jumping over initializations, causing C+++threads+debugging to fail. --- util.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/util.c b/util.c index 4ee17c2a447b..49faf9bb136e 100644 --- a/util.c +++ b/util.c @@ -172,17 +172,14 @@ Perl_safesysmalloc(MEM_SIZE size) #endif ptr = (Malloc_t)((char*)ptr+PERL_MEMORY_DEBUG_HEADER_SIZE); DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) malloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size)); - ret: return ptr; } else { #ifndef ALWAYS_NEED_THX dTHX; #endif - if (PL_nomemok){ - ptr = NULL; - goto ret; - } + if (PL_nomemok) + return NULL; else { croak_no_mem(); } @@ -210,14 +207,11 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size) if (!size) { safesysfree(where); - ptr = NULL; - goto ret; + return NULL; } - if (!where) { - ptr = safesysmalloc(size); - goto ret; - } + if (!where) + return safesysmalloc(size); #ifdef USE_MDH where = (Malloc_t)((char*)where-PERL_MEMORY_DEBUG_HEADER_SIZE); size += PERL_MEMORY_DEBUG_HEADER_SIZE; @@ -299,17 +293,14 @@ Perl_safesysrealloc(Malloc_t where,MEM_SIZE size) if (ptr != NULL) { - ret: return ptr; } else { #ifndef ALWAYS_NEED_THX dTHX; #endif - if (PL_nomemok){ - ptr = NULL; - goto ret; - } + if (PL_nomemok) + return NULL; else { croak_no_mem(); }