From c32f6a9e5baa28d5ec9ab34b784d8a52aa20e30b Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 26 Mar 2017 11:06:17 +0200 Subject: [PATCH] UNLIKLEY some tests. It should not really help the compiler as it should already be able to deduce there were unlikely. --- m-list.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/m-list.h b/m-list.h index 09475931..ddfb2f6b 100644 --- a/m-list.h +++ b/m-list.h @@ -147,7 +147,7 @@ assert (v != NULL); \ struct M_C3(list_, name, _s) *next; \ next = M_GET_NEW oplist (struct M_C3(list_, name, _s)); \ - if (next == NULL) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_C3(list_, name, _s))); \ return NULL; \ } \ @@ -161,7 +161,7 @@ M_C3(list_, name, _push_back)(M_C3(list_, name,_t) v, type const x) \ { \ type *data = M_C3(list_, name, _push_raw)(v); \ - if (data == NULL) \ + if (M_UNLIKELY (data == NULL)) \ return; \ M_GET_INIT_SET oplist(*data, x); \ } \ @@ -170,7 +170,7 @@ M_C3(list_, name, _push_new)(M_C3(list_, name,_t) v) \ { \ type *data = M_C3(list_, name, _push_raw)(v); \ - if (data == NULL) \ + if (M_UNLIKELY (data == NULL)) \ return NULL; \ M_GET_INIT oplist(*data); \ return data; \ @@ -337,12 +337,12 @@ assert(M_C3(list_, name, _sublist_p)(list, insertion_point)); \ struct M_C3(list_, name, _s) *next; \ next = M_GET_NEW oplist (struct M_C3(list_, name, _s)); \ - if (next == NULL) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_C3(list_, name, _s))); \ return; \ } \ M_GET_INIT_SET oplist(next->data, x); \ - if (insertion_point[0].l[0] == NULL) { \ + if (M_UNLIKELY (insertion_point[0].l[0] == NULL)) { \ next->next = *list; \ *list = next; \ } else { \ @@ -359,7 +359,7 @@ assert(removing_point[0].l[0] != NULL); \ assert(M_C3(list_, name, _sublist_p)(list, removing_point)); \ struct M_C3(list_, name, _s) *next = removing_point[0].l[0]->next; \ - if (removing_point->previous == NULL) { \ + if (M_UNLIKELY (removing_point->previous == NULL)) { \ *list = next; \ } else { \ removing_point->previous->next = next; \ @@ -406,7 +406,7 @@ while (it_org != NULL) { \ next = M_GET_NEW oplist (struct M_C3(list_, name, _s)); \ *update_list = next; \ - if (next == NULL) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_C3(list_, name, _s))); \ return; \ } \