Skip to content

Commit 2e8904f

Browse files
committed
Use ZEND_HASH_FILL_* API.
1 parent ace8fba commit 2e8904f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

ext/tokenizer/tokenizer.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,16 @@ static void add_token(
307307
}
308308
}
309309
} else if (token_type >= 256) {
310-
array_init(&token);
311-
add_next_index_long(&token, token_type);
312-
add_next_index_str(&token, make_str(text, leng, interned_strings));
313-
add_next_index_long(&token, lineno);
310+
array_init_size(&token, 3);
311+
zend_hash_real_init_packed(Z_ARRVAL(token));
312+
ZEND_HASH_FILL_PACKED(Z_ARRVAL(token)) {
313+
ZEND_HASH_FILL_SET_LONG(token_type);
314+
ZEND_HASH_FILL_NEXT();
315+
ZEND_HASH_FILL_SET_STR(make_str(text, leng, interned_strings));
316+
ZEND_HASH_FILL_NEXT();
317+
ZEND_HASH_FILL_SET_LONG(lineno);
318+
ZEND_HASH_FILL_NEXT();
319+
} ZEND_HASH_FILL_END();
314320
} else {
315321
ZVAL_STR(&token, make_str(text, leng, interned_strings));
316322
}

0 commit comments

Comments
 (0)