X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=map%2Flist.c;h=04bfd2d02f23c3fae4808665b4d4cd377e22d777;hp=992de5215ed43846c8061feb9794b84a70e15757;hb=86fd9c8abfbacea2902b4fe42a8a4664b2a531cf;hpb=778b8c8ca708b082a1192acfb114a6751b2ad7c9 diff --git a/map/list.c b/map/list.c index 992de52..04bfd2d 100644 --- a/map/list.c +++ b/map/list.c @@ -329,22 +329,25 @@ map_val_t ll_remove (list_t *ll, map_key_t key) { return val; } -void ll_print (list_t *ll) { - markable_t next = ll->head->next; - int i = 0; - while (next != DOES_NOT_EXIST) { - node_t *item = STRIP_MARK(next); - if (item == NULL) - break; - printf("%s%p:0x%llx ", HAS_MARK(item->next) ? "*" : "", item, (uint64_t)item->key); - fflush(stdout); - if (i++ > 30) { - printf("..."); - break; +void ll_print (list_t *ll, int verbose) { + if (verbose) { + markable_t next = ll->head->next; + int i = 0; + while (next != DOES_NOT_EXIST) { + node_t *item = STRIP_MARK(next); + if (item == NULL) + break; + printf("%s%p:0x%llx ", HAS_MARK(item->next) ? "*" : "", item, (uint64_t)item->key); + fflush(stdout); + if (i++ > 30) { + printf("..."); + break; + } + next = item->next; } - next = item->next; + printf("\n"); } - printf("\n"); + printf("count:%llu\n", (uint64_t)ll_count(ll)); } ll_iter_t *ll_iter_begin (list_t *ll, map_key_t key) {