From e567b6ee4917552b0f8cfdebfebd8e1cb47e54de Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 2 Jun 2014 13:44:44 -0600 Subject: [PATCH] Fix error in tree.h --- include/nuttx/tree.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/nuttx/tree.h b/include/nuttx/tree.h index d2591d6467..b8da3d0a59 100644 --- a/include/nuttx/tree.h +++ b/include/nuttx/tree.h @@ -534,8 +534,10 @@ while (0) #define RB_GENERATE(name, type, field, cmp) \ RB_GENERATE_INTERNAL(name, type, field, cmp,) + #define RB_GENERATE_STATIC(name, type, field, cmp) \ RB_GENERATE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static) + #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ attr void name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ @@ -977,23 +979,23 @@ while (0) { \ elm = RB_RIGHT(elm, field); \ } \ - else \ + } \ + else \ + { \ + if (RB_PARENT(elm, field) && \ + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ { \ - if (RB_PARENT(elm, field) && \ - (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + } \ + else \ + { \ + while (RB_PARENT(elm, field) && \ + (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ { \ elm = RB_PARENT(elm, field); \ } \ - else \ - { \ - while (RB_PARENT(elm, field) && \ - (elm == RB_LEFT(RB_PARENT(elm, field), field))) \ - { \ - elm = RB_PARENT(elm, field); \ - } \ - \ - elm = RB_PARENT(elm, field); \ - } \ + \ + elm = RB_PARENT(elm, field); \ } \ } \ \