There's only been one log implementation exported to plugins for ages.
As well as rationalizing the code in this light we make the disorder_
names the canonical ones and provide macros to make all the existing
code work. I don't see any need to convert code to use the canonical
names currently.
ifreq.c ifreq.h \
inputline.c inputline.h \
kvp.c kvp.h \
- log.c log.h log-impl.h \
+ log.c log.h \
logfd.c logfd.h \
macros.c macros-builtin.c macros.h \
- mem.c mem.h mem-impl.h \
+ mem.c mem.h \
mime.h mime.c \
mixer.c mixer.h mixer-oss.c mixer-alsa.c \
printf.c printf.h \
+++ /dev/null
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-/** @file lib/log-impl.h @brief Errors and logging */
-
-/** @brief Log an error and quit
- *
- * If @c ${DISORDER_FATAL_ABORT} is defined (as anything) then the process
- * is aborted, so you can get a backtrace.
- */
-void disorder_fatal(int errno_value, const char *msg, ...) {
- va_list ap;
-
- va_start(ap, msg);
- elog(LOG_CRIT, errno_value, msg, ap);
- va_end(ap);
- if(getenv("DISORDER_FATAL_ABORT")) abort();
- exitfn(EXIT_FAILURE);
-}
-
-/** @brief Log an error */
-void disorder_error(int errno_value, const char *msg, ...) {
- va_list ap;
-
- va_start(ap, msg);
- elog(LOG_ERR, errno_value, msg, ap);
- va_end(ap);
-}
-
-/** @brief Log an informational message */
-void disorder_info(const char *msg, ...) {
- va_list ap;
-
- va_start(ap, msg);
- elog(LOG_INFO, 0, msg, ap);
- va_end(ap);
-}
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
}
}
-#define disorder_fatal fatal
-#define disorder_error error
-#define disorder_info info
+/** @brief Log an error and quit
+ *
+ * If @c ${DISORDER_FATAL_ABORT} is defined (as anything) then the process
+ * is aborted, so you can get a backtrace.
+ */
+void disorder_fatal(int errno_value, const char *msg, ...) {
+ va_list ap;
+
+ va_start(ap, msg);
+ elog(LOG_CRIT, errno_value, msg, ap);
+ va_end(ap);
+ if(getenv("DISORDER_FATAL_ABORT")) abort();
+ exitfn(EXIT_FAILURE);
+}
+
+/** @brief Log an error */
+void disorder_error(int errno_value, const char *msg, ...) {
+ va_list ap;
-/* shared implementation of vararg functions */
-#include "log-impl.h"
+ va_start(ap, msg);
+ elog(LOG_ERR, errno_value, msg, ap);
+ va_end(ap);
+}
+
+/** @brief Log an informational message */
+void disorder_info(const char *msg, ...) {
+ va_list ap;
+
+ va_start(ap, msg);
+ elog(LOG_INFO, 0, msg, ap);
+ va_end(ap);
+}
/** @brief Log a debug message */
-void debug(const char *msg, ...) {
+void disorder_debug(const char *msg, ...) {
va_list ap;
va_start(ap, msg);
void elog(int pri, int errno_value, const char *fmt, va_list ap);
-void fatal(int errno_value, const char *msg, ...) attribute((noreturn))
+void disorder_fatal(int errno_value, const char *msg, ...) attribute((noreturn))
attribute((format (printf, 2, 3)));
-void error(int errno_value, const char *msg, ...)
+void disorder_error(int errno_value, const char *msg, ...)
attribute((format (printf, 2, 3)));
-void info(const char *msg, ...)
+void disorder_info(const char *msg, ...)
attribute((format (printf, 1, 2)));
-void debug(const char *msg, ...)
+void disorder_debug(const char *msg, ...)
attribute((format (printf, 1, 2)));
/* report a message of the given class. @errno_value@ if present an
* non-zero is included. @fatal@ terminates the process. */
+/** @brief Backward-compatibility alias for disorder_fatal() */
+#define fatal disorder_fatal
+
+/** @brief Backward-compatibility alias for disorder_error() */
+#define error disorder_error
+
+/** @brief Backward-compatibility alias for disorder_info() */
+#define info disorder_info
+
+/** @brief Backward-compatibility alias for disorder_debug() */
+#define debug disorder_debug
+
extern int debugging;
/* set when debugging enabled */
*/
#include "disorder-server.h"
-/* shared implementation of vararg functions */
-#include "log-impl.h"
-
void *disorder_malloc(size_t n) {
return xmalloc(n);
}