From: Vincent Pit Date: Fri, 31 Jul 2015 18:50:17 +0000 (-0300) Subject: Make sure asserts are only checked on DEBUGGING builds X-Git-Tag: rt107294~6 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=9686f4e3e41ef4f12e2aa812c5f6301e2a169e40;p=perl%2Fmodules%2FVariable-Magic.git Make sure asserts are only checked on DEBUGGING builds --- diff --git a/Magic.xs b/Magic.xs index f7917ab..33fc60e 100644 --- a/Magic.xs +++ b/Magic.xs @@ -133,6 +133,12 @@ # define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) #endif +#ifdef DEBUGGING +# define VMG_ASSERT(C) assert(C) +#else +# define VMG_ASSERT(C) +#endif + /* uvar magic and Hash::Util::FieldHash were commited with 28419, but we only * enable them on 5.10 */ #if VMG_HAS_PERL(5, 10, 0) @@ -1861,7 +1867,7 @@ static void vmg_teardown(pTHX_ void *param) { vmg_sv_magicext((SV *) PL_strtab, NULL, &vmg_global_teardown_vtbl, NULL, 0); } } else { - assert(vmg_loaded > 1); + VMG_ASSERT(vmg_loaded > 1); --vmg_loaded; } @@ -1890,7 +1896,7 @@ static void vmg_setup(pTHX) { MUTEX_INIT(&vmg_op_name_init_mutex); vmg_loaded = 1; } else { - assert(vmg_loaded > 0); + VMG_ASSERT(vmg_loaded > 0); ++vmg_loaded; } @@ -2024,7 +2030,7 @@ PPCODE: MY_CXT.depth = old_depth; MY_CXT.freed_tokens = NULL; VMG_LOADED_LOCK; - assert(vmg_loaded > 0); + VMG_ASSERT(vmg_loaded > 0); ++vmg_loaded; VMG_LOADED_UNLOCK; }