>From 83656e6f1a78e4c71d233d2cd4592f1383894215 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 23 Sep 2011 08:47:53 +0200 Subject: [PATCH] Multiline macro cleanup This is mostly a cosmetic patch. The purpose of wrapping a multi-line macro in a do { } while(0) is to make the macro usable as a regular statement, not a compound statement. When the while(0) is terminated with a semicolon, the do { } while(0); block becomes a compound statement again. --- src/db/sysdb_ops.c | 2 +- src/krb5_plugin/sssd_krb5_locator_plugin.c | 2 +- src/monitor/monitor.c | 3 ++- src/providers/data_provider.h | 2 +- src/providers/dp_pam_data_util.c | 4 ++-- src/providers/fail_over.c | 3 ++- src/providers/ipa/ipa_hbac_common.c | 2 +- src/providers/ipa/ipa_hbac_rules.c | 2 +- src/providers/krb5/krb5_child.c | 2 +- src/providers/ldap/ldap_auth.c | 4 ++-- src/providers/ldap/sdap_child_helpers.c | 2 +- src/python/pyhbac.c | 2 +- src/tests/krb5_utils-tests.c | 2 +- src/tests/strtonum-tests.c | 2 +- src/tools/sss_debuglevel.c | 2 +- src/util/crypto/nss/nss_obfuscate.c | 2 +- src/util/sss_python.h | 4 ++-- src/util/util.h | 4 ++-- 18 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index ee58342..522bbb0 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -72,7 +72,7 @@ static uint32_t get_attr_as_uint32(struct ldb_message *msg, const char *attr) return l; } -#define ERROR_OUT(v, r, l) do { v = r; goto l; } while(0); +#define ERROR_OUT(v, r, l) do { v = r; goto l; } while(0) /* =Remove-Entry-From-Sysdb=============================================== */ diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c index d6e90a7..3eced04 100644 --- a/src/krb5_plugin/sssd_krb5_locator_plugin.c +++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c @@ -49,7 +49,7 @@ if (ctx->debug) { \ debug_fn body; \ } \ -} while(0); +} while(0) struct sssd_ctx { char *sssd_realm; diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index 67dc775..2d54748 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -2347,7 +2347,8 @@ static void service_startup_handler(struct tevent_context *ev, mt_svc->pid = fork(); if (mt_svc->pid != 0) { if (mt_svc->pid == -1) { - DEBUG(0, ("Could not fork child to start service [%s]. Continuing.\n", mt_svc->name)) + DEBUG(0, ("Could not fork child to start service [%s]. " + "Continuing.\n", mt_svc->name)); return; } diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h index c666072..bf59547 100644 --- a/src/providers/data_provider.h +++ b/src/providers/data_provider.h @@ -141,7 +141,7 @@ #define DEBUG_PAM_DATA(level, pd) do { \ if (DEBUG_IS_SET(debug_get_level(level))) pam_print_data(level, pd); \ -} while(0); +} while(0) struct response_data { diff --git a/src/providers/dp_pam_data_util.c b/src/providers/dp_pam_data_util.c index 7aca559..7ac50c4 100644 --- a/src/providers/dp_pam_data_util.c +++ b/src/providers/dp_pam_data_util.c @@ -33,7 +33,7 @@ goto failed; \ } \ } \ -} while(0); +} while(0) #define PD_MEM_COPY(el, size) do { \ if (old_pd->el != NULL) { \ @@ -43,7 +43,7 @@ goto failed; \ } \ } \ -} while(0); +} while(0) static const char *pamcmd2str(int cmd) { switch (cmd) { diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c index 6b967d4..91d981c 100644 --- a/src/providers/fail_over.c +++ b/src/providers/fail_over.c @@ -224,7 +224,8 @@ collapse_srv_lookup(struct fo_server *server) struct fo_server *tmp, *meta; meta = server->srv_data->meta; - DEBUG(4, ("Need to refresh SRV lookup for domain %s\n", meta->srv_data->dns_domain)) + DEBUG(4, ("Need to refresh SRV lookup for domain %s\n", + meta->srv_data->dns_domain)); if (server != meta) { while (server->prev && server->prev->srv_data == meta->srv_data) { diff --git a/src/providers/ipa/ipa_hbac_common.c b/src/providers/ipa/ipa_hbac_common.c index 2bf4004..be34e84 100644 --- a/src/providers/ipa/ipa_hbac_common.c +++ b/src/providers/ipa/ipa_hbac_common.c @@ -347,7 +347,7 @@ hbac_ctx_to_rules(TALLOC_CTX *mem_ctx, if (ret == EPERM) { goto done; } else if (ret != EOK) { - DEBUG(1, ("Could not construct rules\n")) + DEBUG(1, ("Could not construct rules\n")); goto done; } } diff --git a/src/providers/ipa/ipa_hbac_rules.c b/src/providers/ipa/ipa_hbac_rules.c index 43e1e42..cc502a8 100644 --- a/src/providers/ipa/ipa_hbac_rules.c +++ b/src/providers/ipa/ipa_hbac_rules.c @@ -125,7 +125,7 @@ ipa_hbac_rule_info_send(TALLOC_CTX *mem_ctx, ret = sysdb_attrs_get_string_array(ipa_host, SYSDB_ORIG_MEMBEROF, tmp_ctx, &memberof_list); if (ret != EOK && ret != ENOENT) { - DEBUG(1, ("Could not identify ")) + DEBUG(1, ("Could not identify ")); } if (ret == ENOENT) { /* This host is not a member of any hostgroups */ memberof_list = talloc_array(tmp_ctx, const char *, 1); diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 7f6f936..ec2251e 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -104,7 +104,7 @@ static const char *__krb5_error_msg; __krb5_error_msg = sss_krb5_get_error_message(krb5_error_ctx, krb5_error); \ DEBUG(level, ("%d: [%d][%s]\n", __LINE__, krb5_error, __krb5_error_msg)); \ sss_krb5_free_error_message(krb5_error_ctx, __krb5_error_msg); \ -} while(0); +} while(0) static void sss_krb5_expire_callback_func(krb5_context context, void *data, krb5_timestamp password_expiration, diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c index 390ea8b..df45579 100644 --- a/src/providers/ldap/ldap_auth.c +++ b/src/providers/ldap/ldap_auth.c @@ -263,7 +263,7 @@ static errno_t find_password_expiration_attributes(TALLOC_CTX *mem_ctx, } else if (strcasecmp(pwd_policy, PWD_POL_OPT_MIT) == 0) { mark = ldb_msg_find_attr_as_string(msg, SYSDB_KRBPW_LASTCHANGE, NULL); if (mark != NULL) { - DEBUG(9, ("Found Kerberos password expiration attributes.\n")) + DEBUG(9, ("Found Kerberos password expiration attributes.\n")); val = ldb_msg_find_attr_as_string(msg, SYSDB_KRBPW_EXPIRATION, NULL); if (val != NULL) { @@ -285,7 +285,7 @@ static errno_t find_password_expiration_attributes(TALLOC_CTX *mem_ctx, } else if (strcasecmp(pwd_policy, PWD_POL_OPT_SHADOW) == 0) { mark = ldb_msg_find_attr_as_string(msg, SYSDB_SHADOWPW_LASTCHANGE, NULL); if (mark != NULL) { - DEBUG(9, ("Found shadow password expiration attributes.\n")) + DEBUG(9, ("Found shadow password expiration attributes.\n")); spwd = talloc_zero(mem_ctx, struct spwd); if (spwd == NULL) { DEBUG(1, ("talloc failed.\n")); diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c index d0f6cae..5990fc3 100644 --- a/src/providers/ldap/sdap_child_helpers.c +++ b/src/providers/ldap/sdap_child_helpers.c @@ -479,7 +479,7 @@ int setup_child(struct sdap_id_ctx *ctx) SDAP_KRB5_KEYTAB)); if (ret != EOK) { - DEBUG(0, ("Could not verify keytab\n")) + DEBUG(0, ("Could not verify keytab\n")); return ret; } diff --git a/src/python/pyhbac.c b/src/python/pyhbac.c index 698beca..05938db 100644 --- a/src/python/pyhbac.c +++ b/src/python/pyhbac.c @@ -40,7 +40,7 @@ attrname); \ return -1; \ } \ -} while(0); +} while(0) static PyObject *PyExc_HbacError; diff --git a/src/tests/krb5_utils-tests.c b/src/tests/krb5_utils-tests.c index 4392abd..6993398 100644 --- a/src/tests/krb5_utils-tests.c +++ b/src/tests/krb5_utils-tests.c @@ -52,7 +52,7 @@ struct krb5child_req *kr; ret = rmdir(__dir__); \ fail_unless(ret == EOK, "rmdir [%s] failed, [%d][%s].", __dir__, \ errno, strerror(errno)); \ -} while(0); +} while(0) void setup_create_dir(void) { diff --git a/src/tests/strtonum-tests.c b/src/tests/strtonum-tests.c index 441b262..e7d7036 100644 --- a/src/tests/strtonum-tests.c +++ b/src/tests/strtonum-tests.c @@ -58,7 +58,7 @@ #define CHECK_ZERO_ENDPTR(endptr) \ do { \ fail_unless(endptr && *endptr == '\0', "Invalid endptr"); \ - } while(0); + } while(0) /****************** * strtoint tests * diff --git a/src/tools/sss_debuglevel.c b/src/tools/sss_debuglevel.c index 255e42c..45723ec 100644 --- a/src/tools/sss_debuglevel.c +++ b/src/tools/sss_debuglevel.c @@ -43,7 +43,7 @@ ERROR(msg "\n"); \ goto done; \ } \ -} while(0); +} while(0) struct debuglevel_tool_ctx { struct confdb_ctx *confdb; diff --git a/src/util/crypto/nss/nss_obfuscate.c b/src/util/crypto/nss/nss_obfuscate.c index cbd8984..54cec09 100644 --- a/src/util/crypto/nss/nss_obfuscate.c +++ b/src/util/crypto/nss/nss_obfuscate.c @@ -49,7 +49,7 @@ (sitem)->type = (siBuffer); \ (sitem)->data = (sdata); \ (sitem)->len = (slen); \ -} while(0); +} while(0) struct sss_nss_crypto_ctx { PK11SlotInfo *slot; diff --git a/src/util/sss_python.h b/src/util/sss_python.h index 135c287..8f81bf9 100644 --- a/src/util/sss_python.h +++ b/src/util/sss_python.h @@ -50,7 +50,7 @@ sss_exception_with_doc(char *name, char *doc, PyObject *base, PyObject *dict); PyModule_AddObject(module, \ discard_const_p(char, name), \ (PyObject *) &type); \ -} while(0); \ +} while(0) \ #define SAFE_SET(old, new) do { \ PyObject *__simple_set_tmp = NULL; \ @@ -58,6 +58,6 @@ sss_exception_with_doc(char *name, char *doc, PyObject *base, PyObject *dict); Py_INCREF(new); \ old = new; \ Py_XDECREF(__simple_set_tmp); \ -} while(0); +} while(0) #endif /* __SSS_PYTHON_H__ */ diff --git a/src/util/util.h b/src/util/util.h index 118d70c..6cc8a54 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -139,7 +139,7 @@ errno_t set_debug_file_from_fd(const int fd); } \ debug_fn body; \ } \ -} while(0); +} while(0) /** \def DEBUG_MSG(level, function, message) \brief macro to generate debug messages with message from variable @@ -180,7 +180,7 @@ errno_t set_debug_file_from_fd(const int fd); debug_prg_name, function, __debug_macro_newlevel, message); \ } \ } \ -} while(0); +} while(0) /** \def DEBUG_IS_SET(level) \brief checks whether level (must be in new format) is set in debug_level -- 1.7.6.2