aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorThomas Jansen <mithi@mithi.net>2008-12-02 02:22:43 +0100
committerThomas Jansen <mithi@mithi.net>2008-12-02 02:22:43 +0100
commit2720585731eb6a39fece86fb675a644b8ea803ae (patch)
tree43c66f17c1266e484b6f8fa9951cdd98920a0f2b /src/utils.c
parent4ca24f22f191033e5dbb88f34e4088bc2814ed0f (diff)
downloadmpd-2720585731eb6a39fece86fb675a644b8ea803ae.tar.gz
mpd-2720585731eb6a39fece86fb675a644b8ea803ae.tar.xz
mpd-2720585731eb6a39fece86fb675a644b8ea803ae.zip
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.
Diffstat (limited to '')
-rw-r--r--src/utils.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/utils.c b/src/utils.c
index bb5107bb6..892f6f39f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <fcntl.h>
+#include <glib.h>
#ifdef HAVE_IPV6
#include <sys/socket.h>
@@ -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;
}