From: Vincent Pit Date: Thu, 28 Oct 2010 22:19:32 +0000 (+0200) Subject: Skip NULL values when walking a table X-Git-Tag: v0.45~7 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=76d754dafff8d105c23ed0cac71c68a625ff6df0 Skip NULL values when walking a table ptable_fetch already returns NULL for nonexistent entries, so NULL can't possibly have any other meaning than "this node is not currently in use". --- diff --git a/ptable.h b/ptable.h index 055f0a5..e6e2fd4 100644 --- a/ptable.h +++ b/ptable.h @@ -206,7 +206,8 @@ STATIC void ptable_walk(pTHX_ ptable * const t, void (*cb)(pTHX_ ptable_ent *ent do { ptable_ent *entry; for (entry = array[i]; entry; entry = entry->next) - cb(aTHX_ entry, userdata); + if (entry->val) + cb(aTHX_ entry, userdata); } while (i--); } }