From fa4b39d4aa2ac98c66dcf7b49260fecc2e44d88a Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 26 May 2023 14:39:01 +0200 Subject: [PATCH] Fix "function returns an aggregate" to make GCC happy. Actually I don't think this was really wrong as this is an enum, which is probably why clang does not complain... but still... whatever.... --- include/h.h | 2 +- src/conf.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/h.h b/include/h.h index d71344dbe..bf7f9c578 100644 --- a/include/h.h +++ b/include/h.h @@ -1410,7 +1410,7 @@ extern void init_dynamic_set_block(DynamicSetBlock *s); extern void free_dynamic_set_block(DynamicSetBlock *s); extern int test_dynamic_set_block_item(ConfigFile *conf, const char *security_group, ConfigEntry *cep); extern int config_set_dynamic_set_block_item(ConfigFile *conf, DynamicSetBlock *s, ConfigEntry *cep); -extern DynamicSetOption get_setting_for_user(Client *client, SetOption opt); +extern DynamicSetOption *get_setting_for_user(Client *client, SetOption opt); extern long long get_setting_for_user_number(Client *client, SetOption opt); extern const char *get_setting_for_user_string(Client *client, SetOption opt); extern void dynamic_set_string(DynamicSetBlock *s, int settingname, const char *value); diff --git a/src/conf.c b/src/conf.c index babc0a225..ba8cbbc9e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -11359,7 +11359,7 @@ int config_set_security_group(ConfigFile *conf, ConfigEntry *ce) * @param opt The flood option we are interested in * @returns The FloodSettings for this user, never returns NULL. */ -DynamicSetOption get_setting_for_user(Client *client, SetOption opt) +DynamicSetOption *get_setting_for_user(Client *client, SetOption opt) { SecurityGroup *sg; int in_known_users = 0; @@ -11382,13 +11382,13 @@ DynamicSetOption get_setting_for_user(Client *client, SetOption opt) if (in_known_users) { if (sg->settings.isset[opt]) - return sg->settings.settings[opt]; + return &sg->settings.settings[opt]; } } else if (user_allowed_by_security_group(client, sg) && sg->settings.isset[opt]) { - return sg->settings.settings[opt]; + return &sg->settings.settings[opt]; } } @@ -11396,22 +11396,22 @@ DynamicSetOption get_setting_for_user(Client *client, SetOption opt) * Use the caching info from above. */ if (!in_known_users && unknown_users_set.isset[opt]) - return unknown_users_set.settings[opt]; + return &unknown_users_set.settings[opt]; /* If we are still here, then fallback to the generic set:: setting */ - return dynamic_set.settings[opt]; + return &dynamic_set.settings[opt]; } /** Get configuration that applies to the user - a number value */ long long get_setting_for_user_number(Client *client, SetOption opt) { - return get_setting_for_user(client, opt).number; + return get_setting_for_user(client, opt)->number; } /** Get configuration that applies to the user - a string config value */ const char *get_setting_for_user_string(Client *client, SetOption opt) { - return get_setting_for_user(client, opt).string; + return get_setting_for_user(client, opt)->string; } /*** END OF DYNAMIC SET CONFIG STUFF (that can be overridden by security group) ***/