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_ssh.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/db/sysdb_ssh.c') diff --git a/src/db/sysdb_ssh.c b/src/db/sysdb_ssh.c index daa4067c7..7dd98cfdb 100644 --- a/src/db/sysdb_ssh.c +++ b/src/db/sysdb_ssh.c @@ -34,7 +34,7 @@ sysdb_update_ssh_host(struct sss_domain_info *domain, attrs); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Error storing host %s [%d]: %s\n", name, ret, strerror(ret))); + "Error storing host %s [%d]: %s\n", name, ret, strerror(ret)); return ret; } @@ -57,7 +57,7 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, struct ldb_message_element *el; unsigned int i; - DEBUG(SSSDBG_TRACE_FUNC, ("Storing host %s\n", name)); + DEBUG(SSSDBG_TRACE_FUNC, "Storing host %s\n", name); tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { @@ -66,7 +66,7 @@ sysdb_store_ssh_host(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; } @@ -80,14 +80,14 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, ret = sysdb_attrs_add_string(attrs, SYSDB_OBJECTCLASS, SYSDB_SSH_HOST_OC); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not set object class [%d]: %s\n", ret, strerror(ret))); + "Could not set object class [%d]: %s\n", ret, strerror(ret)); goto done; } ret = sysdb_attrs_add_string(attrs, SYSDB_NAME, name); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not set name attribute [%d]: %s\n", ret, strerror(ret))); + "Could not set name attribute [%d]: %s\n", ret, strerror(ret)); goto done; } @@ -108,8 +108,8 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, SYSDB_NAME_ALIAS, &el->values[i]); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not add name alias %s [%d]: %s\n", - el->values[i].data, ret, strerror(ret))); + "Could not add name alias %s [%d]: %s\n", + el->values[i].data, ret, strerror(ret)); goto done; } } @@ -121,8 +121,8 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, ret = sysdb_attrs_add_string(attrs, SYSDB_NAME_ALIAS, alias); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not add name alias %s [%d]: %s\n", - alias, ret, strerror(ret))); + "Could not add name alias %s [%d]: %s\n", + alias, ret, strerror(ret)); goto done; } } @@ -133,8 +133,8 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, ret = sysdb_attrs_get_el(attrs, SYSDB_SSH_PUBKEY, &el); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not get sysdb sshPublicKey [%d]: %s\n", - ret, strerror(ret))); + "Could not get sysdb sshPublicKey [%d]: %s\n", + ret, strerror(ret)); goto done; } } @@ -142,8 +142,8 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, ret = sysdb_attrs_add_time_t(attrs, SYSDB_LAST_UPDATE, now); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not set sysdb lastUpdate [%d]: %s\n", - ret, strerror(ret))); + "Could not set sysdb lastUpdate [%d]: %s\n", + ret, strerror(ret)); goto done; } @@ -154,7 +154,7 @@ sysdb_store_ssh_host(struct sss_domain_info *domain, 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 done; } @@ -166,7 +166,7 @@ done: if (in_transaction) { sret = sysdb_transaction_cancel(domain->sysdb); if (sret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, ("Could not cancel transaction\n")); + DEBUG(SSSDBG_CRIT_FAILURE, "Could not cancel transaction\n"); } } @@ -186,7 +186,7 @@ sysdb_update_ssh_known_host_expire(struct sss_domain_info *domain, struct sysdb_attrs *attrs; DEBUG(SSSDBG_TRACE_FUNC, - ("Updating known_hosts expire time of host %s\n", name)); + "Updating known_hosts expire time of host %s\n", name); tmp_ctx = talloc_new(NULL); if (!tmp_ctx) { @@ -203,8 +203,8 @@ sysdb_update_ssh_known_host_expire(struct sss_domain_info *domain, now + known_hosts_timeout); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not set known_hosts expire time [%d]: %s\n", - ret, strerror(ret))); + "Could not set known_hosts expire time [%d]: %s\n", + ret, strerror(ret)); goto done; } @@ -225,7 +225,7 @@ errno_t sysdb_delete_ssh_host(struct sss_domain_info *domain, const char *name) { - DEBUG(SSSDBG_TRACE_FUNC, ("Deleting host %s\n", name)); + DEBUG(SSSDBG_TRACE_FUNC, "Deleting host %s\n", name); return sysdb_delete_custom(domain, name, SSH_HOSTS_SUBDIR); } @@ -252,11 +252,11 @@ sysdb_search_ssh_hosts(TALLOC_CTX *mem_ctx, &num_results, &results); if (ret != EOK && ret != ENOENT) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Error looking up host [%d]: %s\n", - ret, strerror(ret))); + "Error looking up host [%d]: %s\n", + ret, strerror(ret)); goto done; } if (ret == ENOENT) { - DEBUG(SSSDBG_TRACE_FUNC, ("No such host\n")); + DEBUG(SSSDBG_TRACE_FUNC, "No such host\n"); *hosts = NULL; *num_hosts = 0; goto done; @@ -305,7 +305,7 @@ sysdb_get_ssh_host(TALLOC_CTX *mem_ctx, if (num_hosts > 1) { ret = EINVAL; DEBUG(SSSDBG_CRIT_FAILURE, - ("Found more than one host with name %s\n", name)); + "Found more than one host with name %s\n", name); goto done; } -- cgit