summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-10-17 12:15:51 -0400
committerpommicket <pommicket@gmail.com>2023-10-17 12:15:51 -0400
commit7b7fb826b33773bab0cb57cc0dc234a9d7a0742e (patch)
tree867d92c5fdb3fca10210a560b47c5f782ac905f3
parent7141f05bdc5df4270b0dd68704049eb70bdcc05b (diff)
stabilize config sort
-rw-r--r--ted.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ted.c b/ted.c
index fc54a93..85e1a0b 100644
--- a/ted.c
+++ b/ted.c
@@ -220,12 +220,14 @@ char *ted_get_root_dir(Ted *ted) {
static int applicable_configs_cmp(void *context, const void *av, const void *bv) {
const Config *const all_configs = context;
- const u32 *ai = av, *bi = bv;
- const Config *ac = &all_configs[*ai], *bc = &all_configs[*bi];
+ const u32 ai = *(const u32 *)av, bi = *(const u32 *)bv;
+ const Config *ac = &all_configs[ai], *bc = &all_configs[bi];
const i32 a = config_priority(ac);
const i32 b = config_priority(bc);
if (a < b) return -1;
if (a > b) return 1;
+ if (ai < bi) return -1;
+ if (ai > bi) return 1;
return 0;
}