]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: remove internal kmod_list iterators
authorEmil Velikov <emil.l.velikov@gmail.com>
Sun, 8 Sep 2024 09:41:16 +0000 (10:41 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 13 Sep 2024 16:50:38 +0000 (11:50 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/117
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-internal.h

index db25f371baaa1579448d270f3e9c677a767a015f..a3528cd525a154eb8ef8678ef23461798a786637 100644 (file)
@@ -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);