Use ZEND_HASH_FILL_* API.

This commit is contained in:
Dmitry Stogov 2021-08-12 02:28:26 +03:00
parent ace8fba759
commit 2e8904fee0

View File

@ -307,10 +307,16 @@ static void add_token(
} }
} }
} else if (token_type >= 256) { } else if (token_type >= 256) {
array_init(&token); array_init_size(&token, 3);
add_next_index_long(&token, token_type); zend_hash_real_init_packed(Z_ARRVAL(token));
add_next_index_str(&token, make_str(text, leng, interned_strings)); ZEND_HASH_FILL_PACKED(Z_ARRVAL(token)) {
add_next_index_long(&token, lineno); ZEND_HASH_FILL_SET_LONG(token_type);
ZEND_HASH_FILL_NEXT();
ZEND_HASH_FILL_SET_STR(make_str(text, leng, interned_strings));
ZEND_HASH_FILL_NEXT();
ZEND_HASH_FILL_SET_LONG(lineno);
ZEND_HASH_FILL_NEXT();
} ZEND_HASH_FILL_END();
} else { } else {
ZVAL_STR(&token, make_str(text, leng, interned_strings)); ZVAL_STR(&token, make_str(text, leng, interned_strings));
} }