treap: style fix
Missing spaces in while (0) and trpn_pointer(a, b). Remove parentheses around return value. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
be47d5a646
commit
6ad263ce7a
@ -37,7 +37,7 @@ struct trp_root {
|
|||||||
*trpn_pointer(a_base, a_offset) = \
|
*trpn_pointer(a_base, a_offset) = \
|
||||||
*trpn_pointer(a_base, old_offset); \
|
*trpn_pointer(a_base, old_offset); \
|
||||||
} \
|
} \
|
||||||
} while (0);
|
} while (0)
|
||||||
|
|
||||||
/* Left accessors. */
|
/* Left accessors. */
|
||||||
#define trp_left_get(a_base, a_field, a_node) \
|
#define trp_left_get(a_base, a_field, a_node) \
|
||||||
@ -163,7 +163,7 @@ a_attr a_type MAYBE_UNUSED *a_pre##nsearch(struct trp_root *treap, a_type *key)
|
|||||||
a_attr uint32_t MAYBE_UNUSED a_pre##insert_recurse(uint32_t cur_node, uint32_t ins_node) \
|
a_attr uint32_t MAYBE_UNUSED a_pre##insert_recurse(uint32_t cur_node, uint32_t ins_node) \
|
||||||
{ \
|
{ \
|
||||||
if (cur_node == ~0) { \
|
if (cur_node == ~0) { \
|
||||||
return (ins_node); \
|
return ins_node; \
|
||||||
} else { \
|
} else { \
|
||||||
uint32_t ret; \
|
uint32_t ret; \
|
||||||
int cmp = (a_cmp)(trpn_pointer(a_base, ins_node), \
|
int cmp = (a_cmp)(trpn_pointer(a_base, ins_node), \
|
||||||
@ -185,7 +185,7 @@ a_attr uint32_t MAYBE_UNUSED a_pre##insert_recurse(uint32_t cur_node, uint32_t i
|
|||||||
else \
|
else \
|
||||||
ret = cur_node; \
|
ret = cur_node; \
|
||||||
} \
|
} \
|
||||||
return (ret); \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
a_attr void MAYBE_UNUSED a_pre##insert(struct trp_root *treap, a_type *node) \
|
a_attr void MAYBE_UNUSED a_pre##insert(struct trp_root *treap, a_type *node) \
|
||||||
@ -204,27 +204,27 @@ a_attr uint32_t MAYBE_UNUSED a_pre##remove_recurse(uint32_t cur_node, uint32_t r
|
|||||||
uint32_t right = trp_right_get(a_base, a_field, cur_node); \
|
uint32_t right = trp_right_get(a_base, a_field, cur_node); \
|
||||||
if (left == ~0) { \
|
if (left == ~0) { \
|
||||||
if (right == ~0) \
|
if (right == ~0) \
|
||||||
return (~0); \
|
return ~0; \
|
||||||
} else if (right == ~0 || trp_prio_get(left) < trp_prio_get(right)) { \
|
} else if (right == ~0 || trp_prio_get(left) < trp_prio_get(right)) { \
|
||||||
trpn_rotate_right(a_base, a_field, cur_node, ret); \
|
trpn_rotate_right(a_base, a_field, cur_node, ret); \
|
||||||
right = a_pre##remove_recurse(cur_node, rem_node); \
|
right = a_pre##remove_recurse(cur_node, rem_node); \
|
||||||
trp_right_set(a_base, a_field, ret, right); \
|
trp_right_set(a_base, a_field, ret, right); \
|
||||||
return (ret); \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
trpn_rotate_left(a_base, a_field, cur_node, ret); \
|
trpn_rotate_left(a_base, a_field, cur_node, ret); \
|
||||||
left = a_pre##remove_recurse(cur_node, rem_node); \
|
left = a_pre##remove_recurse(cur_node, rem_node); \
|
||||||
trp_left_set(a_base, a_field, ret, left); \
|
trp_left_set(a_base, a_field, ret, left); \
|
||||||
return (ret); \
|
return ret; \
|
||||||
} else if (cmp < 0) { \
|
} else if (cmp < 0) { \
|
||||||
uint32_t left = a_pre##remove_recurse( \
|
uint32_t left = a_pre##remove_recurse( \
|
||||||
trp_left_get(a_base, a_field, cur_node), rem_node); \
|
trp_left_get(a_base, a_field, cur_node), rem_node); \
|
||||||
trp_left_set(a_base, a_field, cur_node, left); \
|
trp_left_set(a_base, a_field, cur_node, left); \
|
||||||
return (cur_node); \
|
return cur_node; \
|
||||||
} else { \
|
} else { \
|
||||||
uint32_t right = a_pre##remove_recurse( \
|
uint32_t right = a_pre##remove_recurse( \
|
||||||
trp_right_get(a_base, a_field, cur_node), rem_node); \
|
trp_right_get(a_base, a_field, cur_node), rem_node); \
|
||||||
trp_right_set(a_base, a_field, cur_node, right); \
|
trp_right_set(a_base, a_field, cur_node, right); \
|
||||||
return (cur_node); \
|
return cur_node; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
a_attr void MAYBE_UNUSED a_pre##remove(struct trp_root *treap, a_type *node) \
|
a_attr void MAYBE_UNUSED a_pre##remove(struct trp_root *treap, a_type *node) \
|
||||||
|
Loading…
Reference in New Issue
Block a user