From fb5abc52ba5b0c844a1c03d00085e022c134d0fa Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Mon, 28 Dec 2015 05:42:18 -0500 Subject: [PATCH] epoch: Prefer additional return point to nesting. --- src/ck_epoch.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/ck_epoch.c b/src/ck_epoch.c index 7ee2167..2fff264 100644 --- a/src/ck_epoch.c +++ b/src/ck_epoch.c @@ -143,12 +143,15 @@ void _ck_epoch_delref(struct ck_epoch_record *record, struct ck_epoch_section *section) { - struct ck_epoch_ref *current; + struct ck_epoch_ref *current, *other; unsigned int i = section->bucket; current = &record->local.bucket[i]; current->count--; + if (current->count > 0) + return; + /* * If the current bucket no longer has any references, then * determine whether we have already transitioned into a newer @@ -158,19 +161,15 @@ _ck_epoch_delref(struct ck_epoch_record *record, * If no other active bucket exists, then the record will go * inactive in order to allow for forward progress. */ - if (current->count == 0) { - struct ck_epoch_ref *other; - - other = &record->local.bucket[(i + 1) & - CK_EPOCH_SENSE_MASK]; - if (other->count > 0 && - ((int)(current->epoch - other->epoch) < 0)) { - /* - * The other epoch value is actually the newest, - * transition to it. - */ - ck_pr_store_uint(&record->epoch, other->epoch); - } + other = &record->local.bucket[(i + 1) & + CK_EPOCH_SENSE_MASK]; + if (other->count > 0 && + ((int)(current->epoch - other->epoch) < 0)) { + /* + * The other epoch value is actually the newest, + * transition to it. + */ + ck_pr_store_uint(&record->epoch, other->epoch); } return;