From 2720585731eb6a39fece86fb675a644b8ea803ae Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Tue, 2 Dec 2008 02:22:43 +0100 Subject: replaced mpd_likely/mpd_unlikely by G_LIKELY/G_UNLIKELY We want to remove gcc.h eventually. This takes care of all the G_LIKELY/G_UNLIKELY macros. --- src/utils.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index bb5107bb..892f6f39 100644 --- a/src/utils.c +++ b/src/utils.c @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef HAVE_IPV6 #include @@ -78,7 +79,7 @@ int ipv6Supported(void) mpd_malloc char *xstrdup(const char *s) { char *ret = strdup(s); - if (mpd_unlikely(!ret)) + if (G_UNLIKELY(!ret)) FATAL("OOM: strdup\n"); return ret; } @@ -89,10 +90,10 @@ mpd_malloc void *xmalloc(size_t size) { void *ret; - assert(mpd_likely(size)); + assert(G_LIKELY(size)); ret = malloc(size); - if (mpd_unlikely(!ret)) + if (G_UNLIKELY(!ret)) FATAL("OOM: malloc\n"); return ret; } @@ -104,10 +105,10 @@ mpd_malloc void *xrealloc(void *ptr, size_t size) /* some C libraries return NULL when size == 0, * make sure we get a free()-able pointer (free(NULL) * doesn't work with all C libraries, either) */ - if (mpd_unlikely(!ret && !size)) + if (G_UNLIKELY(!ret && !size)) ret = realloc(ptr, 1); - if (mpd_unlikely(!ret)) + if (G_UNLIKELY(!ret)) FATAL("OOM: realloc\n"); return ret; } @@ -116,10 +117,10 @@ mpd_malloc void *xcalloc(size_t nmemb, size_t size) { void *ret; - assert(mpd_likely(nmemb && size)); + assert(G_LIKELY(nmemb && size)); ret = calloc(nmemb, size); - if (mpd_unlikely(!ret)) + if (G_UNLIKELY(!ret)) FATAL("OOM: calloc\n"); return ret; } -- cgit v1.2.3