From: Emil Velikov Date: Sun, 8 Sep 2024 09:41:16 +0000 (+0100) Subject: libkmod: remove internal kmod_list iterators X-Git-Tag: v34~363 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aac871a6172f8d0c24ccee29ffe4dc87af17fef7;p=thirdparty%2Fkmod.git libkmod: remove internal kmod_list iterators These were introduced to workaround since the compiler cannot properly optimise things, since the symbols have external linkage. These days this is not so much an issue. For example comparing a gcc 14 build, with -O2 shows 24 bytes growth with this reverted. Although in practise anyone looking for extreme optimisations - be that speed or size - should be using LTO and/or PGO. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/117 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-internal.h b/libkmod/libkmod-internal.h index db25f371..a3528cd5 100644 --- a/libkmod/libkmod-internal.h +++ b/libkmod/libkmod-internal.h @@ -78,20 +78,6 @@ _nonnull_(2) struct kmod_list *kmod_list_insert_after(struct kmod_list *list, co _nonnull_(2) struct kmod_list *kmod_list_insert_before(struct kmod_list *list, const void *data); _must_check_ struct kmod_list *kmod_list_append_list(struct kmod_list *list1, struct kmod_list *list2); -#undef kmod_list_foreach -#define kmod_list_foreach(list_entry, first_entry) \ - for (list_entry = ((first_entry) == NULL) ? NULL : (first_entry); \ - list_entry != NULL; \ - list_entry = (list_entry->node.next == &((first_entry)->node)) ? NULL : \ - container_of(list_entry->node.next, struct kmod_list, node)) - -#undef kmod_list_foreach_reverse -#define kmod_list_foreach_reverse(list_entry, first_entry) \ - for (list_entry = (((first_entry) == NULL) ? NULL : container_of(first_entry->node.prev, struct kmod_list, node)); \ - list_entry != NULL; \ - list_entry = ((list_entry == first_entry) ? NULL : \ - container_of(list_entry->node.prev, struct kmod_list, node))) - /* libkmod.c */ _nonnull_all_ int kmod_lookup_alias_from_config(struct kmod_ctx *ctx, const char *name, struct kmod_list **list); _nonnull_all_ int kmod_lookup_alias_from_symbols_file(struct kmod_ctx *ctx, const char *name, struct kmod_list **list);