From a1ffb40e32741f992c743e7b16c061fefa3747ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20B=C3=ADlka?= Date: Mon, 10 Feb 2014 14:45:42 +0100 Subject: Use glibc_likely instead __builtin_expect. --- nscd/mem.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nscd/mem.c') diff --git a/nscd/mem.c b/nscd/mem.c index 0d09e21d5e..b4090fb6a5 100644 --- a/nscd/mem.c +++ b/nscd/mem.c @@ -124,11 +124,11 @@ gc (struct database_dyn *db) /* In prune_cache we are also using a dynamically allocated array. If the array in the caller is too large we have malloc'ed it. */ size_t stack_used = sizeof (bool) * db->head->module; - if (__builtin_expect (stack_used > MAX_STACK_USE, 0)) + if (__glibc_unlikely (stack_used > MAX_STACK_USE)) stack_used = 0; size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS; size_t memory_needed = nmark * sizeof (BITMAP_T); - if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1)) + if (__glibc_likely (stack_used + memory_needed <= MAX_STACK_USE)) { mark = (BITMAP_T *) alloca_account (memory_needed, stack_used); mark_use_malloc = false; @@ -146,7 +146,7 @@ gc (struct database_dyn *db) struct hashentry **he; struct hashentry **he_data; bool he_use_malloc; - if (__builtin_expect (stack_used + memory_needed <= MAX_STACK_USE, 1)) + if (__glibc_likely (stack_used + memory_needed <= MAX_STACK_USE)) { he = alloca_account (memory_needed, stack_used); he_use_malloc = false; @@ -421,7 +421,7 @@ gc (struct database_dyn *db) } while (runp != moves->next); - if (__builtin_expect (debug_level >= 3, 0)) + if (__glibc_unlikely (debug_level >= 3)) dbg_log (_("freed %zu bytes in %s cache"), db->head->first_free - ((char *) moves->to + moves->size - db->data), @@ -432,7 +432,7 @@ gc (struct database_dyn *db) db->head->first_free = (char *) moves->to + moves->size - db->data; /* Consistency check. */ - if (__builtin_expect (debug_level >= 3, 0)) + if (__glibc_unlikely (debug_level >= 3)) { for (size_t idx = 0; idx < db->head->module; ++idx) { @@ -527,7 +527,7 @@ mempool_alloc (struct database_dyn *db, size_t len, int data_alloc) retry: res = db->data + db->head->first_free; - if (__builtin_expect (db->head->first_free + len > db->head->data_size, 0)) + if (__glibc_unlikely (db->head->first_free + len > db->head->data_size)) { if (! tried_resize) { -- cgit v1.2.1