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/db/sysdb_idmap.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/db/sysdb_idmap.c') diff --git a/src/db/sysdb_idmap.c b/src/db/sysdb_idmap.c index 05f9d90e2..7d342671b 100644 --- a/src/db/sysdb_idmap.c +++ b/src/db/sysdb_idmap.c @@ -37,7 +37,7 @@ sysdb_idmap_dn(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, return NULL; } - DEBUG(SSSDBG_TRACE_ALL, (SYSDB_TMPL_IDMAP"\n", clean_sid, domain->name)); + DEBUG(SSSDBG_TRACE_ALL, SYSDB_TMPL_IDMAP"\n", clean_sid, domain->name); dn = ldb_dn_new_fmt(mem_ctx, domain->sysdb->ldb, SYSDB_TMPL_IDMAP, clean_sid, domain->name); @@ -82,7 +82,7 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, ret = sysdb_transaction_start(domain->sysdb); if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to start transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); goto done; } @@ -101,8 +101,8 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, } else if (ret == ENOENT) { /* Create a new mapping */ DEBUG(SSSDBG_CONF_SETTINGS, - ("Adding new ID mapping [%s][%s][%lu]\n", - dom_name, dom_sid, (unsigned long)slice_num)); + "Adding new ID mapping [%s][%s][%lu]\n", + dom_name, dom_sid, (unsigned long)slice_num); /* Add the objectClass */ lret = ldb_msg_add_empty(update_msg, SYSDB_OBJECTCLASS, @@ -169,8 +169,8 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, lret = ldb_add(domain->sysdb->ldb, update_msg); if (lret != LDB_SUCCESS) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to add mapping: [%s]\n", - ldb_strerror(lret))); + "Failed to add mapping: [%s]\n", + ldb_strerror(lret)); ret = sysdb_error_to_errno(lret); goto done; } @@ -186,17 +186,17 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, -1); if (old_slice == -1) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not identify original slice for SID [%s]\n", - dom_sid)); + "Could not identify original slice for SID [%s]\n", + dom_sid); ret = ENOENT; goto done; } if (slice_num != old_slice) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Detected attempt to change slice value for sid [%s] " + "Detected attempt to change slice value for sid [%s] " "This will break existing users. Refusing to perform.\n", - dom_sid)); + dom_sid); ret = EINVAL; goto done; } @@ -208,8 +208,8 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, old_name = ldb_msg_find_attr_as_string(msgs[0], SYSDB_NAME, NULL); if (!old_name) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not identify original domain name of SID [%s]\n", - dom_sid)); + "Could not identify original domain name of SID [%s]\n", + dom_sid); ret = ENOENT; goto done; } @@ -219,14 +219,14 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, * make any changes here. Just return success. */ DEBUG(SSSDBG_TRACE_LIBS, - ("No changes needed, canceling transaction\n")); + "No changes needed, canceling transaction\n"); ret = EOK; goto done; } else { /* The name has changed. Replace it */ DEBUG(SSSDBG_CONF_SETTINGS, - ("Changing domain name of SID [%s] from [%s] to [%s]\n", - dom_sid, old_name, dom_name)); + "Changing domain name of SID [%s] from [%s] to [%s]\n", + dom_sid, old_name, dom_name); /* Set the new name */ lret = ldb_msg_add_empty(update_msg, SYSDB_NAME, @@ -247,8 +247,8 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, lret = ldb_modify(domain->sysdb->ldb, update_msg); if (lret != LDB_SUCCESS) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Failed to update mapping: [%s]\n", - ldb_strerror(lret))); + "Failed to update mapping: [%s]\n", + ldb_strerror(lret)); ret = sysdb_error_to_errno(lret); goto done; } @@ -257,7 +257,7 @@ sysdb_idmap_store_mapping(struct sss_domain_info *domain, ret = sysdb_transaction_commit(domain->sysdb); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not commit transaction: [%s]\n", strerror(ret))); + "Could not commit transaction: [%s]\n", strerror(ret)); goto done; } in_transaction = false; @@ -267,7 +267,7 @@ done: sret = sysdb_transaction_cancel(domain->sysdb); if (sret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not cancel transaction\n")); + "Could not cancel transaction\n"); } } talloc_free(tmp_ctx); @@ -289,7 +289,7 @@ sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (!tmp_ctx) return ENOMEM; - DEBUG(SSSDBG_TRACE_ALL, (SYSDB_TMPL_IDMAP_BASE"\n", domain->name)); + DEBUG(SSSDBG_TRACE_ALL, SYSDB_TMPL_IDMAP_BASE"\n", domain->name); base_dn = ldb_dn_new_fmt(tmp_ctx, domain->sysdb->ldb, SYSDB_TMPL_IDMAP_BASE, domain->name); @@ -302,8 +302,8 @@ sysdb_idmap_get_mappings(TALLOC_CTX *mem_ctx, LDB_SCOPE_SUBTREE, attrs, SYSDB_IDMAP_FILTER); if (lret) { DEBUG(SSSDBG_MINOR_FAILURE, - ("Could not locate ID mappings: [%s]\n", - ldb_strerror(lret))); + "Could not locate ID mappings: [%s]\n", + ldb_strerror(lret)); ret = sysdb_error_to_errno(lret); goto done; } -- cgit