From a8dcff2f0d405c90f60c3452ef067c36635c3926 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 22 Oct 2020 10:31:52 -0500 Subject: [PATCH] Merge fix-wrong-order-phas fixes from 3.15 branch --- modules/database/src/ioc/db/dbScan.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/database/src/ioc/db/dbScan.c b/modules/database/src/ioc/db/dbScan.c index f319a2452..1a809c486 100644 --- a/modules/database/src/ioc/db/dbScan.c +++ b/modules/database/src/ioc/db/dbScan.c @@ -1075,13 +1075,10 @@ static void addToList(struct dbCommon *precord, scan_list *psl) pse->pscan_list = psl; ptemp = (scan_element *)ellLast(&psl->list); while (ptemp) { - if (ptemp->precord->phas <= precord->phas) { - ellInsert(&psl->list, &ptemp->node, &pse->node); - break; - } + if (ptemp->precord->phas <= precord->phas) break; ptemp = (scan_element *)ellPrevious(&ptemp->node); } - if (ptemp == NULL) ellAdd(&psl->list, (void *)pse); + ellInsert(&psl->list, (ptemp ? &ptemp->node : NULL), &pse->node); psl->modified = TRUE; epicsMutexUnlock(psl->lock); } @@ -1107,7 +1104,7 @@ static void deleteFromList(struct dbCommon *precord, scan_list *psl) return; } pse->pscan_list = NULL; - ellDelete(&psl->list, (void *)pse); + ellDelete(&psl->list, &pse->node); psl->modified = TRUE; epicsMutexUnlock(psl->lock); }