# New Ticket Created by NotFound # Please include the string: [perl #55012] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55012 >
The function intlist_dump in src/intlist.c is never used. If defined LIST_DEBUG, it calls list_dump. That function is present in src/list.c but is static, and is also never used. The attached patch gets rid of both functions and the LIST_DEBUG usage. -- Salu2
Index: src/list.c =================================================================== --- src/list.c (revisión: 27893) +++ src/list.c (copia de trabajo) @@ -238,9 +238,6 @@ __attribute__nonnull__(2) FUNC_MODIFIES(*list); -static void list_dump(ARGIN(const List *list), INTVAL type) - __attribute__nonnull__(1); - PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static void * list_item(PARROT_INTERP, @@ -339,58 +336,8 @@ return chunk; } -#ifdef LIST_DEBUG - /* -=item C<static void list_dump> - -Only char and int are supported currently. - -=cut - -*/ - -static void -list_dump(ARGIN(const List *list), INTVAL type) -{ - const List_chunk *chunk = list->first; - UINTVAL idx = 0; - - for (; chunk; chunk = chunk->next) { - printf(chunk->flags & no_power_2 ? "(" : "["); - if (chunk->flags & sparse) - printf(INTVAL_FMT " x ''", chunk->items); - else { - UINTVAL i; - for (i = 0; i < chunk->items; i++) { - if (idx++ >= list->start && idx <= list->length + list->start) { - switch (list->item_type) { - case enum_type_int: - case enum_type_short: - printf("%d", (int)((int *) - PObj_bufstart(&chunk->data))[i]); - break; - case enum_type_char: - printf("%c", (char)((char *) - PObj_bufstart(&chunk->data))[i]); - break; - } - } - if (i < chunk->items - 1) - printf(","); - } - } - printf(chunk->flags & no_power_2 ? ")" : "]"); - if (chunk->next) - printf(" -> "); - } - printf("\n"); -} -#endif - -/* - =item C<static void rebuild_chunk_ptrs> Rebuild chunk_list and update/optimize chunk usage, helper functions. Index: src/intlist.c =================================================================== --- src/intlist.c (revisión: 27893) +++ src/intlist.c (copia de trabajo) @@ -314,28 +314,6 @@ /* -=item C<void intlist_dump> - -Prints out the list in human-readable form. - -=cut - -*/ - -void -intlist_dump(ARGMOD(FILE *fp), ARGMOD(IntList *list), int verbose) -{ -#ifdef LIST_DEBUG - list_dump(fp, (List *)list, verbose); -#else - UNUSED(fp); - UNUSED(list); - UNUSED(verbose); -#endif -} - -/* - =back =head1 SEE ALSO Index: include/parrot/list.h =================================================================== --- include/parrot/list.h (revisión: 27893) +++ include/parrot/list.h (copia de trabajo) @@ -128,11 +128,6 @@ __attribute__nonnull__(2) FUNC_MODIFIES(*list); -PARROT_WARN_UNUSED_RESULT -PARROT_PURE_FUNCTION -INTVAL list_length(SHIM_INTERP, ARGIN(const List *list)) - __attribute__nonnull__(2); - PARROT_API void list_mark(PARROT_INTERP, ARGMOD(List *list)) __attribute__nonnull__(1) @@ -224,6 +219,11 @@ __attribute__nonnull__(3) FUNC_MODIFIES(*pinfo); +PARROT_WARN_UNUSED_RESULT +PARROT_PURE_FUNCTION +INTVAL list_length(SHIM_INTERP, ARGIN(const List *list)) + __attribute__nonnull__(2); + /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ /* HEADERIZER END: src/list.c */ Index: include/parrot/intlist.h =================================================================== --- include/parrot/intlist.h (revisión: 27893) +++ include/parrot/intlist.h (copia de trabajo) @@ -55,12 +55,6 @@ __attribute__nonnull__(1) __attribute__nonnull__(2); -void intlist_dump(ARGMOD(FILE *fp), ARGMOD(IntList *list), int verbose) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - FUNC_MODIFIES(*fp) - FUNC_MODIFIES(*list); - PARROT_WARN_UNUSED_RESULT INTVAL intlist_get(PARROT_INTERP, ARGMOD(IntList *list), INTVAL idx) __attribute__nonnull__(1)