Repository: qpid-proton
Updated Branches:
  refs/heads/master d042c4ed0 -> c0abbe528


PROTON-772: Avoid use of GNU extension ## command deletion.

The following idiom is GNU C specific:
-#define pn_logf(fmt, ...)
-            pn_logf_impl(fmt , ##__VA_ARGS__);

The use of ## after a comma deletes the comma if __VA_ARGS__ is empty, so the 
above works
even if there is no argument after fmt.

The following is more portable:

+#define pn_logf(...)
+            pn_logf_impl(__VA_ARGS__);

Now fmt is included in the variadic argument list so it is never empty.  This is
slightly less self-descriptive since it doesn't correspond as well to the
signature of pn_logf_impl(fmt, ...), but it is standard C99.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c0abbe52
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c0abbe52
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c0abbe52

Branch: refs/heads/master
Commit: c0abbe5289e555bbea5ca3ddf6e0ec7244b1ffdb
Parents: f22fa7f
Author: Alan Conway <[email protected]>
Authored: Fri Dec 12 15:46:10 2014 -0500
Committer: Alan Conway <[email protected]>
Committed: Fri Dec 12 15:48:03 2014 -0500

----------------------------------------------------------------------
 proton-c/include/proton/log.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c0abbe52/proton-c/include/proton/log.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/log.h b/proton-c/include/proton/log.h
index 5fb8e91..73b9b6d 100644
--- a/proton-c/include/proton/log.h
+++ b/proton-c/include/proton/log.h
@@ -51,10 +51,10 @@ PN_EXTERN void pn_log_enable(bool enabled);
 PN_EXTERN bool pn_log_enabled(void);
 
 /** Log a printf style message */
-#define pn_logf(fmt, ...)                       \
+#define pn_logf(...)                            \
     do {                                        \
         if (pn_log_enabled())                   \
-            pn_logf_impl(fmt , ##__VA_ARGS__);  \
+            pn_logf_impl(__VA_ARGS__);          \
     } while(0)
 
 /** va_list version of pn_logf */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to