From 4fe3a6615501081baa2d755e202fc4d3523085ce Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 5 May 2021 15:06:13 +0000 Subject: [PATCH] chore: Mark pq enospc as unlikely --- runtime/src/priority_queue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/priority_queue.c b/runtime/src/priority_queue.c index 52cfc7f..0fb649e 100644 --- a/runtime/src/priority_queue.c +++ b/runtime/src/priority_queue.c @@ -35,7 +35,7 @@ priority_queue_append(struct priority_queue *self, void *new_item) int rc; if (unlikely(self->size + 1 > self->capacity)) panic("PQ overflow"); - if (self->size + 1 == self->capacity) goto err_enospc; + if (unlikely(self->size + 1 == self->capacity)) goto err_enospc; self->items[++self->size] = new_item; rc = 0; @@ -255,7 +255,7 @@ priority_queue_enqueue_nolock(struct priority_queue *self, void *value) int rc; - if (priority_queue_append(self, value) == -ENOSPC) goto err_enospc; + if (unlikely(priority_queue_append(self, value) == -ENOSPC)) goto err_enospc; priority_queue_percolate_up(self);