summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authordota17 <chenguopingdota@163.com>2020-03-28 10:25:00 +0800
committerdota17 <chenguopingdota@163.com>2020-04-03 11:39:30 +0800
commit8b162c4b896e5b40feb587aedb7c4f687d14dc67 (patch)
tree1404f3ba6994caf33f5147c793307c2569ca3226 /debug.c
parentc117d8a8a83d5bcdd433b05e1846ccb73eb3413d (diff)
downloadjson-c-8b162c4b896e5b40feb587aedb7c4f687d14dc67.tar.gz
clang-format the files
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c63
1 files changed, 38 insertions, 25 deletions
diff --git a/debug.c b/debug.c
index 4b5140a..7971744 100644
--- a/debug.c
+++ b/debug.c
@@ -11,17 +11,17 @@
#include "config.h"
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdarg.h>
#if HAVE_SYSLOG_H
-# include <syslog.h>
+#include <syslog.h>
#endif /* HAVE_SYSLOG_H */
#if HAVE_UNISTD_H
-# include <unistd.h>
+#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if HAVE_SYS_PARAM_H
@@ -33,51 +33,64 @@
static int _syslog = 0;
static int _debug = 0;
-void mc_set_debug(int debug) { _debug = debug; }
-int mc_get_debug(void) { return _debug; }
+void mc_set_debug(int debug)
+{
+ _debug = debug;
+}
+int mc_get_debug(void)
+{
+ return _debug;
+}
extern void mc_set_syslog(int syslog)
{
- _syslog = syslog;
+ _syslog = syslog;
}
void mc_debug(const char *msg, ...)
{
- va_list ap;
- if(_debug) {
- va_start(ap, msg);
+ va_list ap;
+ if (_debug)
+ {
+ va_start(ap, msg);
#if HAVE_VSYSLOG
- if(_syslog) {
- vsyslog(LOG_DEBUG, msg, ap);
- } else
+ if (_syslog)
+ {
+ vsyslog(LOG_DEBUG, msg, ap);
+ }
+ else
#endif
- vprintf(msg, ap);
- va_end(ap);
- }
+ vprintf(msg, ap);
+ va_end(ap);
+ }
}
void mc_error(const char *msg, ...)
{
- va_list ap;
- va_start(ap, msg);
+ va_list ap;
+ va_start(ap, msg);
#if HAVE_VSYSLOG
- if(_syslog) {
+ if (_syslog)
+ {
vsyslog(LOG_ERR, msg, ap);
- } else
+ }
+ else
#endif
vfprintf(stderr, msg, ap);
- va_end(ap);
+ va_end(ap);
}
void mc_info(const char *msg, ...)
{
- va_list ap;
- va_start(ap, msg);
+ va_list ap;
+ va_start(ap, msg);
#if HAVE_VSYSLOG
- if(_syslog) {
+ if (_syslog)
+ {
vsyslog(LOG_INFO, msg, ap);
- } else
+ }
+ else
#endif
vfprintf(stderr, msg, ap);
- va_end(ap);
+ va_end(ap);
}