X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/763d5e6ad88ef3ba1cd1d7742d060e4f1e54c6b8..8ab2aa9fd51a89e06d92a4f7c3792aaa4a08cc71:/lib/disorder.h
diff --git a/lib/disorder.h b/lib/disorder.h
index db41eec..9fde2d8 100644
--- a/lib/disorder.h
+++ b/lib/disorder.h
@@ -1,30 +1,36 @@
/*
* 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 .
*/
#ifndef DISORDER_H
#define DISORDER_H
+#include
+
#ifdef __cplusplus
extern "C" {
#endif
+#ifdef __GNUC__
+# define DISORDER_IFGNUC(x) x
+#else
+# define DISORDER_IFGNUC(x)
+#endif
+
/* memory allocation **********************************************************/
void *disorder_malloc(size_t);
@@ -47,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. */