-/* Copyright (c) 2008 The Board of Trustees of The Leland Stanford
+/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford
* Junior University
*
* We are making the OpenFlow specification and associated documentation
#define PACKED __attribute__((__packed__))
#define PRINTF_FORMAT(FMT, ARG1) __attribute__((__format__(printf, FMT, ARG1)))
#define STRFTIME_FORMAT(FMT) __attribute__((__format__(__strftime__, FMT, 0)))
+#define MALLOC_LIKE __attribute__((__malloc__))
#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)
void set_program_name(const char *);
void out_of_memory(void) NO_RETURN;
-void *xmalloc(size_t);
-void *xcalloc(size_t, size_t);
+void *xmalloc(size_t) MALLOC_LIKE;
+void *xcalloc(size_t, size_t) MALLOC_LIKE;
void *xrealloc(void *, size_t);
-void *xmemdup(const void *, size_t);
-char *xmemdup0(const char *, size_t);
-char *xstrdup(const char *);
-char *xasprintf(const char *format, ...) PRINTF_FORMAT(1, 2);
-char *xvasprintf(const char *format, va_list) PRINTF_FORMAT(1, 0);
+void *xmemdup(const void *, size_t) MALLOC_LIKE;
+char *xmemdup0(const char *, size_t) MALLOC_LIKE;
+char *xstrdup(const char *) MALLOC_LIKE;
+char *xasprintf(const char *format, ...) PRINTF_FORMAT(1, 2) MALLOC_LIKE;
+char *xvasprintf(const char *format, va_list) PRINTF_FORMAT(1, 0) MALLOC_LIKE;
void *x2nrealloc(void *p, size_t *n, size_t s);
#ifndef HAVE_STRLCPY