]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Turn indirect_loaded into a signed integer
authorVincent Pit <vince@profvince.com>
Mon, 6 Apr 2015 19:53:16 +0000 (16:53 -0300)
committerVincent Pit <vince@profvince.com>
Mon, 6 Apr 2015 19:53:16 +0000 (16:53 -0300)
And add some related asserts, just in case.

indirect.xs

index 0de84e5fba5a465f29166e1270f910b236f8e517..9e6fb61aa3f1609a9df39fae8f9132be496811ec 100644 (file)
@@ -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;