diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-09 19:18:32 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-09 19:18:32 +0000 |
commit | d5cefff9a50376f4dad17a00e206b5748a29f116 (patch) | |
tree | fd50e9405837d7ed63fb9717882b7b3a77bcaac2 /sv.c | |
parent | ab1e7f954de0531c104e9628076d0ac3e768f895 (diff) | |
download | perl-d5cefff9a50376f4dad17a00e206b5748a29f116.tar.gz |
An alternative way of structuring ptr_table_clear so that the variables
can be assigned to at declaration time.
p4raw-id: //depot/perl@26313
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -9127,27 +9127,22 @@ Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl) void Perl_ptr_table_clear(pTHX_ PTR_TBL_t *tbl) { - register PTR_TBL_ENT_t **array; - UV riter = 0; + if (tbl && tbl->tbl_items) { + register PTR_TBL_ENT_t **array = tbl->tbl_ary; + UV riter = tbl->tbl_max; - if (!tbl || !tbl->tbl_items) { - return; - } - - array = tbl->tbl_ary; - riter = tbl->tbl_max; - - do { - PTR_TBL_ENT_t *entry = array[riter]; + do { + PTR_TBL_ENT_t *entry = array[riter]; - while (entry) { - PTR_TBL_ENT_t *oentry = entry; - entry = entry->next; - del_pte(oentry); - } - } while (riter--); + while (entry) { + PTR_TBL_ENT_t *oentry = entry; + entry = entry->next; + del_pte(oentry); + } + } while (riter--); - tbl->tbl_items = 0; + tbl->tbl_items = 0; + } } /* clear and free a ptr table */ |