Skip to content

Commit

Permalink
Correct comparison of module xlats
Browse files Browse the repository at this point in the history
  • Loading branch information
ndptech committed Oct 15, 2024
1 parent 0ff4b97 commit adde3df
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/unlang/xlat_redundant.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ void xlat_redundant_add_xlat(xlat_redundant_t *xr, xlat_t const *x)
*/
static int8_t module_xlat_cmp(void const *a, void const *b)
{
int8_t ret;

module_rlm_xlat_t const *mrx_a = talloc_get_type_abort_const(a, module_rlm_xlat_t);
module_rlm_xlat_t const *mrx_b = talloc_get_type_abort_const(b, module_rlm_xlat_t);
char const *a_p, *b_p;
Expand All @@ -353,13 +351,12 @@ static int8_t module_xlat_cmp(void const *a, void const *b)
*/
a_p = strchr(mrx_a->xlat->name, '.');
b_p = strchr(mrx_b->xlat->name, '.');
ret = CMP(a_p == NULL, b_p == NULL);
if ((ret != 0)) return 0;
if (!a_p && !b_p) return 0;

/*
* Compare the bit after the module name
*/
if (!a_p || !b_p) return 0;
if (!a_p || !b_p) return CMP(a_p, b_p);

return CMP(strcmp(a_p, b_p), 0);
}
Expand Down

0 comments on commit adde3df

Please sign in to comment.