Merge pull request #2219 from ahlinc/fix-query-step-init

lib: make query step init depend from MAX_STEP_CAPTURE_COUNT declaration
This commit is contained in:
Andrew Hlynskyi 2023-04-19 23:36:25 +03:00 committed by GitHub
commit ae1556647a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {