aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-09-02 11:06:37 +0200
committerThomas White <taw@physics.org>2022-09-02 13:58:42 +0200
commit00fa8663bfd35822063750ff12930a2fd8904037 (patch)
treedfbced3b971a15c74e2fb4d6f2d6bc79b94bbce3 /libcrystfel
parent669c9df2ed66681f17a4b381d3d1deba4e5a08b2 (diff)
RefList: assert that a Reflection can only be on one list
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/reflist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libcrystfel/src/reflist.c b/libcrystfel/src/reflist.c
index d60ee46e..71eda6b2 100644
--- a/libcrystfel/src/reflist.c
+++ b/libcrystfel/src/reflist.c
@@ -103,6 +103,7 @@ struct _reflection {
struct _reflection *next; /* Next and previous in doubly linked */
struct _reflection *prev; /* list of duplicate reflections */
enum _nodecol col; /* Colour (red or black) */
+ int in_list; /* If 0, reflection is not in a list */
/* Payload */
pthread_mutex_t lock; /* Protects the contents of "data" */
@@ -126,6 +127,7 @@ static Reflection *new_node(unsigned int serial)
new = calloc(1, sizeof(struct _reflection));
if ( new == NULL ) return NULL;
+ new->in_list = 0;
new->serial = serial;
new->next = NULL;
new->prev = NULL;
@@ -895,6 +897,8 @@ static void add_refl_to_list_real(RefList *list,
{
Reflection *f;
+ assert(!new->in_list);
+
f = find_refl(list, h, k, l);
if ( f == NULL ) {
@@ -910,6 +914,8 @@ static void add_refl_to_list_real(RefList *list,
f->next = new;
new->prev = f;
}
+
+ new->in_list = 1;
}