From e1d5d392bd879500bdb20db1bf70be8ac53356da Mon Sep 17 00:00:00 2001 From: Qoqnus master Date: Wed, 23 Sep 2026 07:32:06 +0330 Subject: [PATCH] qbuild/qstruct: Created string comparator to be used for rbtree --- qbuild/qstruct/qstruct.c | 4 ++++ qbuild/qstruct/qstruct.internal.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/qbuild/qstruct/qstruct.c b/qbuild/qstruct/qstruct.c index deb5052..7b7dacb 100644 --- a/qbuild/qstruct/qstruct.c +++ b/qbuild/qstruct/qstruct.c @@ -1,2 +1,6 @@ #include +int8_t _qstruct_comparator_string(char *x, char *y) { + return strcmp(x, y); +} + diff --git a/qbuild/qstruct/qstruct.internal.h b/qbuild/qstruct/qstruct.internal.h index f9cb22e..62bcbce 100644 --- a/qbuild/qstruct/qstruct.internal.h +++ b/qbuild/qstruct/qstruct.internal.h @@ -16,6 +16,11 @@ extern "C" { if (res != QSTRUCT_RESULT_OK) return QBUILD_RESULT_DATASTRUCTURE_FAILED; \ } while (0); +/* + * Compares to strings + */ +int8_t _qstruct_comparator_string(char *x, char *y); + #ifdef __cplusplus } #endif