From a3c8390d19593b1e5277d95bfb4ab206d4785150 Mon Sep 17 00:00:00 2001 From: Nikolai Kondrashov Date: Wed, 12 Feb 2014 10:12:04 -0500 Subject: Make DEBUG macro invocations variadic Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek Reviewed-by: Stephen Gallagher Reviewed-by: Simo Sorce --- src/providers/ldap/sdap_sudo_cache.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/providers/ldap/sdap_sudo_cache.c') diff --git a/src/providers/ldap/sdap_sudo_cache.c b/src/providers/ldap/sdap_sudo_cache.c index c57082c1a..27203c227 100644 --- a/src/providers/ldap/sdap_sudo_cache.c +++ b/src/providers/ldap/sdap_sudo_cache.c @@ -41,7 +41,7 @@ static errno_t sdap_sudo_get_usn(TALLOC_CTX *mem_ctx, ret = sysdb_attrs_get_string(attrs, map[SDAP_AT_SUDO_USN].sys_name, &usn); if (ret != EOK) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to retrieve USN value: [%s]\n", strerror(ret))); + "Failed to retrieve USN value: [%s]\n", strerror(ret)); return ret; } @@ -69,33 +69,33 @@ sdap_save_native_sudorule(TALLOC_CTX *mem_ctx, ret = sysdb_attrs_get_string(attrs, map[SDAP_AT_SUDO_NAME].sys_name, &rule_name); if (ret == ERANGE) { - DEBUG(SSSDBG_OP_FAILURE, ("Warning: found rule that contains none " - "or multiple CN values. It will be skipped.\n")); + DEBUG(SSSDBG_OP_FAILURE, "Warning: found rule that contains none " + "or multiple CN values. It will be skipped.\n"); return ret; } else if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not get rule name [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Could not get rule name [%d]: %s\n", + ret, strerror(ret)); return ret; } ret = sysdb_attrs_add_time_t(attrs, SYSDB_CACHE_EXPIRE, (cache_timeout ? (now + cache_timeout) : 0)); if (ret) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not set sysdb cache expire [%d]: %s\n", - ret, strerror(ret))); + DEBUG(SSSDBG_OP_FAILURE, "Could not set sysdb cache expire [%d]: %s\n", + ret, strerror(ret)); return ret; } ret = sdap_sudo_get_usn(mem_ctx, attrs, map, rule_name, _usn); if (ret != EOK) { - DEBUG(SSSDBG_MINOR_FAILURE, ("Could not read USN from %s\n", rule_name)); + DEBUG(SSSDBG_MINOR_FAILURE, "Could not read USN from %s\n", rule_name); *_usn = NULL; /* but we will store the rule anyway */ } ret = sysdb_save_sudorule(domain, rule_name, attrs); if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, ("Could not save sudorule %s\n", rule_name)); + DEBUG(SSSDBG_OP_FAILURE, "Could not save sudorule %s\n", rule_name); return ret; } @@ -121,13 +121,13 @@ sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - DEBUG(SSSDBG_FATAL_FAILURE, ("talloc_new() failed\n")); + DEBUG(SSSDBG_FATAL_FAILURE, "talloc_new() failed\n"); return ENOMEM; } ret = sysdb_transaction_start(domain->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not start transaction\n"); goto fail; } in_transaction = true; @@ -137,8 +137,8 @@ sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx, ret = sdap_save_native_sudorule(tmp_ctx, domain, map, replies[i], cache_timeout, now, &usn_value); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to save sudo rule, " - "will continue with next...\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to save sudo rule, " + "will continue with next...\n"); continue; } @@ -160,7 +160,7 @@ sdap_save_native_sudorule_list(TALLOC_CTX *mem_ctx, ret = sysdb_transaction_commit(domain->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to commit transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to commit transaction\n"); goto fail; } in_transaction = false; @@ -174,7 +174,7 @@ fail: if (in_transaction) { tret = sysdb_transaction_cancel(domain->sysdb); if (tret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not cancel transaction\n"); } } -- cgit