Fix wrong PHAS order

Records with lower PHAS value than any previously loaded records
were inserted at the end of the list rather than at the beginning.
This fixes lp: #1899697. Also fixes a proto-bug in that the second
argument to the previously used ellAdd() call assumed that
offsetof(scan_element, node)==0.

Thanks to Bruno Martins for providing this patch.
This commit is contained in:
Martin Konrad
2020-10-13 18:22:08 -04:00
parent ad3728d00d
commit bbc0a56d2b

View File

@@ -998,7 +998,7 @@ static void addToList(struct dbCommon *precord, scan_list *psl)
}
ptemp = (scan_element *)ellPrevious(&ptemp->node);
}
if (ptemp == NULL) ellAdd(&psl->list, (void *)pse);
if (ptemp == NULL) ellInsert(&psl->list, NULL, &pse->node);
psl->modified = TRUE;
epicsMutexUnlock(psl->lock);
}
@@ -1024,7 +1024,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);
}