From: Alan T. DeKok Date: Mon, 21 Mar 2022 22:13:47 +0000 (-0400) Subject: return child structs AFTER the members of the current struct X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d3c43c741f561b9874add9fca182edb5eae3a42;p=thirdparty%2Ffreeradius-server.git return child structs AFTER the members of the current struct --- diff --git a/src/lib/util/struct.c b/src/lib/util/struct.c index 4138d89ad11..372f49f92ab 100644 --- a/src/lib/util/struct.c +++ b/src/lib/util/struct.c @@ -466,10 +466,16 @@ static int8_t pair_sort_increasing(void const *a, void const *b) { fr_pair_t const *my_a = a; fr_pair_t const *my_b = b; + int rcode; - return (my_a->da->attr > my_b->da->attr) - (my_a->da->attr < my_b->da->attr); -} + /* + * Deeper attributes come later in the list. + */ + rcode = CMP_PREFER_SMALLER(my_a->da->depth, my_b->da->depth); + if (rcode != 0) return rcode; + return CMP_PREFER_SMALLER(my_a->da->attr, my_b->da->attr); +} ssize_t fr_struct_to_network(fr_dbuff_t *dbuff, fr_da_stack_t *da_stack, unsigned int depth,