From ace81ea0c5d5a86f154a0f5c9d125e4fc0a0b451 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 16 Mar 2020 14:06:47 +0100
Subject: [PATCH] Simplify the logic in engine_count_and_link_tasks_mapper() by
 adding an 'else if' where there should have been one a long time ago.

---
 src/engine_maketasks.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c
index c8606fe281..28db5daedc 100644
--- a/src/engine_maketasks.c
+++ b/src/engine_maketasks.c
@@ -1493,22 +1493,21 @@ void engine_count_and_link_tasks_mapper(void *map_data, int num_elements,
     /* Link sort tasks to all the higher sort task. */
     if (t_type == task_type_sort) {
       for (struct cell *finger = t->ci->parent; finger != NULL;
-           finger = finger->parent)
+           finger = finger->parent) {
         if (finger->hydro.sorts != NULL)
           scheduler_addunlock(sched, t, finger->hydro.sorts);
-    }
+      }
 
-    /* Link stars sort tasks to all the higher sort task. */
-    if (t_type == task_type_stars_sort) {
+      /* Link stars sort tasks to all the higher sort task. */
+    } else if (t_type == task_type_stars_sort) {
       for (struct cell *finger = t->ci->parent; finger != NULL;
            finger = finger->parent) {
         if (finger->stars.sorts != NULL)
           scheduler_addunlock(sched, t, finger->stars.sorts);
       }
-    }
 
-    /* Link self tasks to cells. */
-    else if (t_type == task_type_self) {
+      /* Link self tasks to cells. */
+    } else if (t_type == task_type_self) {
       atomic_inc(&ci->nr_tasks);
 
       if (t_subtype == task_subtype_density) {
-- 
GitLab