Change __lttng_print to a define macro
authorDavid Goulet <david.goulet@polymtl.ca>
Fri, 29 Apr 2011 15:55:21 +0000 (11:55 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Fri, 29 Apr 2011 15:55:21 +0000 (11:55 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
include/lttngerr.h

index c987fdd6141f92ad2da633e701d0deea0f3d4231..1da7863a1c6d8c84c473b2b34cf1c647d2a5ed05 100644 (file)
@@ -36,24 +36,19 @@ enum __lttng_print_type {
 /*
  *  __lttng_print
  *
- *  Internal function for printing message
- *  depending on command line option and verbosity.
+ *  Macro for printing message depending on
+ *  command line option and verbosity.
  */
-void __lttng_print(enum __lttng_print_type type, const char *fmt, ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-
-       if (opt_quiet == 0) {
-               if (type == PRINT_MSG || (opt_verbose && type == PRINT_DBG)) {
-                       vfprintf(stdout, fmt, ap);
-               } else if (type != PRINT_MSG && type != PRINT_DBG) {
-                       vfprintf(stderr, fmt, ap);
-               }
-       }
-
-       va_end(ap);
-}
+#define __lttng_print(type, fmt, args...)      \
+       do {                                                    \
+               if (opt_quiet == 0) {           \
+                       if (type == PRINT_MSG || (opt_verbose && type == PRINT_DBG)) {  \
+                               fprintf(stdout, fmt, ## args);  \
+                       } else if (type != PRINT_MSG && type != PRINT_DBG) {    \
+                               fprintf(stderr, fmt, ## args);          \
+                       }       \
+               }       \
+       } while (0);
 
 #define MSG(fmt, args...) __lttng_print(PRINT_MSG, fmt "\n", ## args)
 #define ERR(fmt, args...) __lttng_print(PRINT_ERR, "Error: " fmt "\n", ## args)
This page took 0.034324 seconds and 4 git commands to generate.