chiark / gitweb /
Remove fossils
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 21 Feb 2009 20:43:33 +0000 (20:43 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 21 Feb 2009 20:43:33 +0000 (20:43 +0000)
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.

lib/Makefile.am
lib/log-impl.h [deleted file]
lib/log.c
lib/log.h
server/api.c

index f7d99acb6ee89ec6ee97e6e4b160b348da07602b..af4f8a6eaafd9271fe922e07114666725440b0c2 100644 (file)
@@ -54,10 +54,10 @@ libdisorder_a_SOURCES=charset.c charset.h           \
        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                               \
diff --git a/lib/log-impl.h b/lib/log-impl.h
deleted file mode 100644 (file)
index de47cf2..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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:
-*/
index f885e880023e45a694eeabf590b1f16b43c86f4c..3f57073a1ef6bb2834c0f7b830c7f46df817a894 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -194,15 +194,41 @@ void elog(int pri, int errno_value, const char *fmt, va_list ap) {
   }
 }
 
-#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);
index e7f6e43c221026e6666ad5db172f38c33ad59bcd..4d91008edc3e0debc4a24d43dca200ba6add5f81 100644 (file)
--- a/lib/log.h
+++ b/lib/log.h
@@ -30,17 +30,29 @@ void set_progname(char **argv);
 
 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 */
 
index cbcdf90ad47d9dd99ff3b0e9cb342aa9164b5062..e973fbe2522cf6ecc13d1e4dd1f843c07bf60d3d 100644 (file)
@@ -22,9 +22,6 @@
  */
 #include "disorder-server.h"
 
-/* shared implementation of vararg functions */
-#include "log-impl.h"
-
 void *disorder_malloc(size_t n) {
   return xmalloc(n);
 }