From 7119f0c483049a8850d3075c0b1062f35200a538 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Sun, 12 May 2013 12:29:21 +0200 Subject: 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. --- src/providers/ipa/ipa_common.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/providers/ipa/ipa_common.c') diff --git a/src/providers/ipa/ipa_common.c b/src/providers/ipa/ipa_common.c index 509b2abd0..ec36b57d7 100644 --- a/src/providers/ipa/ipa_common.c +++ b/src/providers/ipa/ipa_common.c @@ -754,11 +754,11 @@ static void ipa_resolve_callback(void *private_data, struct fo_server *server) talloc_free(tmp_ctx); } -errno_t ipa_servers_init(struct be_ctx *ctx, - struct ipa_service *service, - struct ipa_options *options, - const char *servers, - bool primary) +static errno_t _ipa_servers_init(struct be_ctx *ctx, + struct ipa_service *service, + struct ipa_options *options, + const char *servers, + bool primary) { TALLOC_CTX *tmp_ctx; char **list = NULL; @@ -825,6 +825,20 @@ done: return ret; } +static inline errno_t +ipa_primary_servers_init(struct be_ctx *ctx, struct ipa_service *service, + struct ipa_options *options, const char *servers) +{ + return _ipa_servers_init(ctx, service, options, servers, true); +} + +static inline errno_t +ipa_backup_servers_init(struct be_ctx *ctx, struct ipa_service *service, + struct ipa_options *options, const char *servers) +{ + return _ipa_servers_init(ctx, service, options, servers, false); +} + static int ipa_user_data_cmp(void *ud1, void *ud2) { return strcasecmp((char*) ud1, (char*) ud2); @@ -900,13 +914,13 @@ int ipa_service_init(TALLOC_CTX *memctx, struct be_ctx *ctx, primary_servers = BE_SRV_IDENTIFIER; } - ret = ipa_servers_init(ctx, service, options, primary_servers, true); + ret = ipa_primary_servers_init(ctx, service, options, primary_servers); if (ret != EOK) { goto done; } if (backup_servers) { - ret = ipa_servers_init(ctx, service, options, backup_servers, false); + ret = ipa_backup_servers_init(ctx, service, options, backup_servers); if (ret != EOK) { goto done; } -- cgit