chiark / gitweb /
disobedience, playrtp: Have `playrtp' handle volume control.
[disorder] / lib / disorder.h
index 98ddff0e0202231f10fa63fe1cd7ec5299490c39..9fde2d8e397e00c3c6dd4f8f4610f57558835e67 100644 (file)
@@ -1,21 +1,19 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2004, 2005, 2006 Richard Kettlewell
+ * Copyright (C) 2004-2008 Richard Kettlewell
  *
- * This program is free software; you can redistribute it and/or modify
+ * 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 2 of the License, or
+ * 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.
- *
+ * 
+ * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef DISORDER_H
 extern "C" {
 #endif
 
+#ifdef __GNUC__
+# define DISORDER_IFGNUC(x) x
+#else
+# define DISORDER_IFGNUC(x)
+#endif
+
 /* memory allocation **********************************************************/
 
 void *disorder_malloc(size_t);
@@ -49,34 +53,24 @@ char *disorder_strndup(const char *, size_t);
  * {xmalloc,xrealloc}_noptr don't promise to clear the new space
  */
 
-#ifdef __GNUC__
-
 int disorder_snprintf(char buffer[], size_t bufsize, const char *fmt, ...)
-  __attribute__((format (printf, 3, 4)));
+  DISORDER_IFGNUC(__attribute__((format (printf, 3, 4))));
 /* like snprintf */
   
 int disorder_asprintf(char **rp, const char *fmt, ...)
-  __attribute__((format (printf, 2, 3)));
+  DISORDER_IFGNUC(__attribute__((format (printf, 2, 3))));
 /* like asprintf but uses xmalloc_noptr() */
 
-#else
-
-int disorder_snprintf(char buffer[], size_t bufsize, const char *fmt, ...);
-/* like snprintf */
-  
-int disorder_asprintf(char **rp, const char *fmt, ...);
-/* like asprintf but uses xmalloc_noptr() */
-
-#endif
-
 /* logging ********************************************************************/
 
-void disorder_error(int errno_value, const char *fmt, ...);
+void disorder_error(int errno_value, const char *fmt, ...)
+  DISORDER_IFGNUC(__attribute__((format (printf, 2, 3))));
 /* report an error.  If errno_value is nonzero then the errno string
  * is included. */
   
-void disorder_fatal(int errno_value, const char *fmt, ...);
+void disorder_fatal(int errno_value, const char *fmt, ...)
+  DISORDER_IFGNUC(__attribute__((noreturn))
+                  __attribute__((format (printf, 2, 3))));
 /* report an error and terminate.  If errno_value is nonzero then the
  * errno string is included.  This is the only safe way to terminate
  * the process. */