diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2012-06-12 01:43:46 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2012-06-12 01:43:46 -0300 |
commit | e7fc2c868e240b280f593934278cc719e33e90f7 (patch) | |
tree | 3d0ea1965bcd7bd46e8ad976e6f1a5512534eafe /libkmod/libkmod-config.c | |
parent | c8c956b1995f53a25d365b67d66204208e496150 (diff) | |
download | kmod-e7fc2c868e240b280f593934278cc719e33e90f7.tar.gz kmod-e7fc2c868e240b280f593934278cc719e33e90f7.tar.bz2 kmod-e7fc2c868e240b280f593934278cc719e33e90f7.zip |
libkmod-config: refactor functions to get config
It makes more sense to have libkmod-config.c deal with the configuration
directly and the others get the config from ctx. As a bonus point we get
a smaller binary. Following numbers are for x86-64, libkmod + kmod:
Before:
text data bss dec hex filename
128840 1496 104 130440 1fd88 tools/modprobe
After:
text data bss dec hex filename
128392 1496 104 129992 1fbc8 tools/modprobe
Diffstat (limited to 'libkmod/libkmod-config.c')
-rw-r--r-- | libkmod/libkmod-config.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c index d0f7848..70044f0 100644 --- a/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c @@ -975,6 +975,7 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx, enum config_type type) { struct kmod_config_iter *iter = calloc(1, sizeof(*iter)); + const struct kmod_config *config = kmod_get_config(ctx); if (iter == NULL) return NULL; @@ -983,31 +984,31 @@ static struct kmod_config_iter *kmod_config_iter_new(const struct kmod_ctx* ctx, switch (type) { case CONFIG_TYPE_BLACKLIST: - iter->list = kmod_get_blacklists(ctx); + iter->list = config->blacklists; iter->get_key = kmod_blacklist_get_modname; break; case CONFIG_TYPE_INSTALL: - iter->list = kmod_get_install_commands(ctx); + iter->list = config->install_commands; iter->get_key = kmod_command_get_modname; iter->get_value = kmod_command_get_command; break; case CONFIG_TYPE_REMOVE: - iter->list = kmod_get_remove_commands(ctx); + iter->list = config->remove_commands; iter->get_key = kmod_command_get_modname; iter->get_value = kmod_command_get_command; break; case CONFIG_TYPE_ALIAS: - iter->list = kmod_get_aliases(ctx); + iter->list = config->aliases; iter->get_key = kmod_alias_get_name; iter->get_value = kmod_alias_get_modname; break; case CONFIG_TYPE_OPTION: - iter->list = kmod_get_options(ctx); + iter->list = config->options; iter->get_key = kmod_option_get_modname; iter->get_value = kmod_option_get_options; break; case CONFIG_TYPE_SOFTDEP: - iter->list = kmod_get_softdeps(ctx); + iter->list = config->softdeps; iter->get_key = kmod_softdep_get_name; iter->get_value = softdep_get_plain_softdep; iter->intermediate = true; |