Merge Core Audio fixes
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 22 Feb 2009 14:09:22 +0000 (14:09 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 22 Feb 2009 14:09:22 +0000 (14:09 +0000)
lib/Makefile.am
lib/log-impl.h [deleted file]
lib/log.c
lib/log.h
lib/mem-impl.h [deleted file]
server/api-client.c [deleted file]
server/api-client.h [deleted file]
server/api.c

index b270e82..9df1dfd 100644 (file)
@@ -55,10 +55,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 f885e88..3f57073 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 e7f6e43..4d91008 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 */
 
diff --git a/lib/mem-impl.h b/lib/mem-impl.h
deleted file mode 100644 (file)
index b3a16bb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 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/>.
- */
-
-int disorder_asprintf(char **rp, const char *fmt, ...) {
-  va_list ap;
-  int n;
-
-  va_start(ap, fmt);
-  n = byte_vasprintf(rp, fmt, ap);
-  va_end(ap);
-  return n;
-}
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
diff --git a/server/api-client.c b/server/api-client.c
deleted file mode 100644 (file)
index 9321770..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 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/>.
- */
-
-#include "common.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <locale.h>
-
-#include "client.h"
-#include "mem.h"
-#include "log.h"
-#include "configuration.h"
-#include "disorder.h"
-#include "api-client.h"
-
-static disorder_client *c;
-
-disorder_client *disorder_get_client(void) {
-  if(!c)
-    if(!(c = disorder_new(0))) exit(EXIT_FAILURE);
-  return c;
-}
-
-int disorder_track_exists(const char *track) {
-  int result;
-
-  return disorder_exists(c, track, &result) ? 0 : result;
-}
-
-const char *disorder_track_get_data(const char *track, const char *key) {
-  char *value;
-
-  if(disorder_get(c, track, key, &value)) return 0;
-  return value;
-}
-
-int disorder_track_set_data(const char *track,
-                           const char *key,
-                           const char *value) {
-  if(value)
-    return disorder_set(c, track, key, value);
-  else
-    return disorder_unset(c, track, key);
-}
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
diff --git a/server/api-client.h b/server/api-client.h
deleted file mode 100644 (file)
index 99a9410..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of DisOrder.
- * Copyright (C) 2004, 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/>.
- */
-#ifndef API_CLIENT_H
-#define API_CLIENT_H
-
-disorder_client *disorder_get_client(void);
-
-#endif /* API_CLIENT_H */
-
-/*
-Local Variables:
-c-basic-offset:2
-comment-column:40
-End:
-*/
index fe9686c..e973fbe 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2004, 2007, 2008 Richard Kettlewell
+ * Copyright (C) 2004, 2007, 2008, 2009 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
  */
 #include "disorder-server.h"
 
-/* shared implementation of vararg functions */
-#include "log-impl.h"
-#include "mem-impl.h"
-
 void *disorder_malloc(size_t n) {
   return xmalloc(n);
 }
@@ -60,6 +56,16 @@ int disorder_snprintf(char buffer[], size_t bufsize, const char *fmt, ...) {
   return n;
 }
 
+int disorder_asprintf(char **rp, const char *fmt, ...) {
+  va_list ap;
+  int n;
+
+  va_start(ap, fmt);
+  n = byte_vasprintf(rp, fmt, ap);
+  va_end(ap);
+  return n;
+}
+
 /*
 Local Variables:
 c-basic-offset:2