diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2013-05-12 12:29:21 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-06-07 00:14:12 +0200 |
commit | 7119f0c483049a8850d3075c0b1062f35200a538 (patch) | |
tree | 7be03fca0634dda1406df2b9bde387ca7c89877e /src/providers/ldap | |
parent | 7527ec8ab2b79ec576ace2da9e2c158b849adfa6 (diff) | |
download | sssd-7119f0c483049a8850d3075c0b1062f35200a538.tar.gz sssd-7119f0c483049a8850d3075c0b1062f35200a538.tar.bz2 sssd-7119f0c483049a8850d3075c0b1062f35200a538.zip |
Do not obfuscate calls with booleans
Instead of using boolean variables to denote whether the call is adding
a primary or a secondary server, use a function wrapper that tells what
it's doing by its name.
Diffstat (limited to 'src/providers/ldap')
-rw-r--r-- | src/providers/ldap/ldap_common.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c index acb24b19..1e92400d 100644 --- a/src/providers/ldap/ldap_common.c +++ b/src/providers/ldap/ldap_common.c @@ -1194,12 +1194,12 @@ done: return ret; } -errno_t sdap_urls_init(struct be_ctx *ctx, - struct sdap_service *service, - const char *service_name, - const char *dns_service_name, - const char *urls, - bool primary) +static errno_t _sdap_urls_init(struct be_ctx *ctx, + struct sdap_service *service, + const char *service_name, + const char *dns_service_name, + const char *urls, + bool primary) { TALLOC_CTX *tmp_ctx; char *srv_user_data; @@ -1294,6 +1294,25 @@ done: return ret; } + +static inline errno_t +sdap_primary_urls_init(struct be_ctx *ctx, struct sdap_service *service, + const char *service_name, const char *dns_service_name, + const char *urls) +{ + return _sdap_urls_init(ctx, service, service_name, + dns_service_name, urls, true); +} + +static inline errno_t +sdap_backup_urls_init(struct be_ctx *ctx, struct sdap_service *service, + const char *service_name, const char *dns_service_name, + const char *urls) +{ + return _sdap_urls_init(ctx, service, service_name, + dns_service_name, urls, false); +} + static int ldap_user_data_cmp(void *ud1, void *ud2) { return strcasecmp((char*) ud1, (char*) ud2); @@ -1337,15 +1356,15 @@ int sdap_service_init(TALLOC_CTX *memctx, struct be_ctx *ctx, urls = BE_SRV_IDENTIFIER; } - ret = sdap_urls_init(ctx, service, service_name, dns_service_name, - urls, true); + ret = sdap_primary_urls_init(ctx, service, service_name, dns_service_name, + urls); if (ret != EOK) { goto done; } if (backup_urls) { - ret = sdap_urls_init(ctx, service, service_name, dns_service_name, - backup_urls, false); + ret = sdap_backup_urls_init(ctx, service, service_name, + dns_service_name, backup_urls); if (ret != EOK) { goto done; } |