chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/configuration.c, lib/home.c: Introduce environment variables.
[disorder]
/
lib
/
disorder.h
diff --git
a/lib/disorder.h
b/lib/disorder.h
index 856f0a349e73d15dca48af1066e6082eeb7ad8c1..9fde2d8e397e00c3c6dd4f8f4610f57558835e67 100644
(file)
--- a/
lib/disorder.h
+++ b/
lib/disorder.h
@@
-2,20
+2,18
@@
* This file is part of DisOrder.
* Copyright (C) 2004-2008 Richard Kettlewell
*
* This file is part of DisOrder.
* 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
* 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.
* (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
+ * G
NU G
eneral Public License for more details.
+ *
* You should have received a copy of the GNU General Public License
* 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
*/
#ifndef DISORDER_H
@@
-27,6
+25,12
@@
extern "C" {
#endif
extern "C" {
#endif
+#ifdef __GNUC__
+# define DISORDER_IFGNUC(x) x
+#else
+# define DISORDER_IFGNUC(x)
+#endif
+
/* memory allocation **********************************************************/
void *disorder_malloc(size_t);
/* 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
*/
* {xmalloc,xrealloc}_noptr don't promise to clear the new space
*/
-#ifdef __GNUC__
-
int disorder_snprintf(char buffer[], size_t bufsize, const char *fmt, ...)
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, ...)
/* 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() */
/* 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 ********************************************************************/
/* 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. */
/* 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. */
/* 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. */