From: Vincent Pit Date: Mon, 6 Apr 2015 19:53:16 +0000 (-0300) Subject: Turn indirect_loaded into a signed integer X-Git-Tag: v0.35~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=02b7cccfd6bf78523a2ab6e10ab3a2aa15da6144;p=perl%2Fmodules%2Findirect.git Turn indirect_loaded into a signed integer And add some related asserts, just in case. --- diff --git a/indirect.xs b/indirect.xs index 0de84e5..9e6fb61 100644 --- a/indirect.xs +++ b/indirect.xs @@ -214,7 +214,7 @@ static void indirect_ck_restore(pTHX_ OPCODE type, indirect_ck_t *old_ck_p) { /* ... Check if the module is loaded ....................................... */ -static U32 indirect_loaded = 0; +static I32 indirect_loaded = 0; #if I_THREADSAFE @@ -246,6 +246,7 @@ static int indirect_set_loaded_locked(pTHX_ void *cxt) { int global_setup = 0; if (indirect_loaded <= 0) { + assert(indirect_loaded == 0); assert(!indirect_loaded_cxts); indirect_loaded_cxts = ptable_new(); global_setup = 1; @@ -266,6 +267,7 @@ static int indirect_clear_loaded_locked(pTHX_ void *cxt) { ptable_loaded_delete(indirect_loaded_cxts, cxt); --indirect_loaded; } else if (indirect_loaded_cxts) { + assert(indirect_loaded == 1); ptable_loaded_free(indirect_loaded_cxts); indirect_loaded_cxts = NULL; indirect_loaded = 0;