From 4f4b86a40baac59818d2c116aafa037a3733eaee Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Wed, 19 Apr 2023 09:36:42 +0300 Subject: [PATCH] lib: make query step init depend from MAX_STEP_CAPTURE_COUNT decl --- lib/src/query.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/query.c b/lib/src/query.c index 275512c0..e5676e0f 100644 --- a/lib/src/query.c +++ b/lib/src/query.c @@ -801,11 +801,10 @@ static QueryStep query_step__new( uint16_t depth, bool is_immediate ) { - return (QueryStep) { + QueryStep step = { .symbol = symbol, .depth = depth, .field = 0, - .capture_ids = {NONE, NONE, NONE}, .alternative_index = NONE, .negated_field_list_id = 0, .contains_captures = false, @@ -817,6 +816,10 @@ static QueryStep query_step__new( .is_immediate = is_immediate, .alternative_is_immediate = false, }; + for (unsigned i = 0; i < MAX_STEP_CAPTURE_COUNT; i++) { + step.capture_ids[i] = NONE; + } + return step; } static void query_step__add_capture(QueryStep *self, uint16_t capture_id) {