- for (entry = list->table[bucket]; entry != NULL; entry = entry->hash_next)
- if (entry->hashcode == hashcode)
- {
- if (((struct gl_multiple_nodes *) entry)->magic == MULTIPLE_NODES_MAGIC)
- {
- /* An entry representing multiple nodes. */
- gl_oset_t nodes = ((struct gl_multiple_nodes *) entry)->nodes;
- /* The first node is interesting. */
- gl_list_node_t node = gl_oset_first (nodes);
- if (equals != NULL ? equals (elt, node->value) : elt == node->value)
- {
- /* All nodes in the entry are equal to the given ELT. */
- if (start_index == 0)
- {
- /* We have to return only the one at the minimal
- position, and this is the first one in the ordered
- set. */
- if (end_index == list->root->branch_size
- || node_position (node) < end_index)
- return node;
- }
- else
- {
- /* We have to return only the one at the minimal
- position >= start_index. */
- const void *elt;
- if (gl_oset_search_atleast (nodes,
- compare_position_threshold,
- (void *)(uintptr_t)start_index,
- &elt))
- {
- node = (gl_list_node_t) elt;
- if (end_index == list->root->branch_size
- || node_position (node) < end_index)
- return node;
- }
- }
- break;
- }
- }
- else
- {
- /* An entry representing a single node. */
- gl_list_node_t node = (struct gl_list_node_impl *) entry;
- if (equals != NULL ? equals (elt, node->value) : elt == node->value)
- {
- bool position_in_bounds;
- if (start_index == 0 && end_index == list->root->branch_size)
- position_in_bounds = true;
- else
- {
- size_t position = node_position (node);
- position_in_bounds =
- (position >= start_index && position < end_index);
- }
- if (position_in_bounds)
- return node;
- break;
- }
- }
- }
+ for (entry = list->table[bucket]; entry != NULL; entry = entry->hash_next)
+ if (entry->hashcode == hashcode)
+ {
+ if (((struct gl_multiple_nodes *) entry)->magic == MULTIPLE_NODES_MAGIC)
+ {
+ /* An entry representing multiple nodes. */
+ gl_oset_t nodes = ((struct gl_multiple_nodes *) entry)->nodes;
+ /* The first node is interesting. */
+ gl_list_node_t node = gl_oset_first (nodes);
+ if (equals != NULL ? equals (elt, node->value) : elt == node->value)
+ {
+ /* All nodes in the entry are equal to the given ELT. */
+ if (start_index == 0)
+ {
+ /* We have to return only the one at the minimal
+ position, and this is the first one in the ordered
+ set. */
+ if (end_index == list->root->branch_size
+ || node_position (node) < end_index)
+ return node;
+ }
+ else
+ {
+ /* We have to return only the one at the minimal
+ position >= start_index. */
+ const void *elt;
+ if (gl_oset_search_atleast (nodes,
+ compare_position_threshold,
+ (void *)(uintptr_t)start_index,
+ &elt))
+ {
+ node = (gl_list_node_t) elt;
+ if (end_index == list->root->branch_size
+ || node_position (node) < end_index)
+ return node;
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ /* An entry representing a single node. */
+ gl_list_node_t node = (struct gl_list_node_impl *) entry;
+ if (equals != NULL ? equals (elt, node->value) : elt == node->value)
+ {
+ bool position_in_bounds;
+ if (start_index == 0 && end_index == list->root->branch_size)
+ position_in_bounds = true;
+ else
+ {
+ size_t position = node_position (node);
+ position_in_bounds =
+ (position >= start_index && position < end_index);
+ }
+ if (position_in_bounds)
+ return node;
+ break;
+ }
+ }
+ }