Skip to content

Commit 1bf9b92

Browse files
committed
decoder: Code style
1 parent 1cc4262 commit 1bf9b92

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/simdjson_decoder.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ static zend_always_inline Bucket *simdjson_hash_str_find_bucket(const HashTable
211211
return NULL;
212212
}
213213

214-
static zend_always_inline void simdjson_release_reused_key_strings(HashTable *dedup_key_strings) {
215-
ZEND_ASSERT(dedup_key_strings->nNumUsed > 0);
216-
Bucket *p = dedup_key_strings->arData;
217-
Bucket *end = p + dedup_key_strings->nNumUsed;
214+
static zend_always_inline void simdjson_dedup_key_strings_release(HashTable *ht) {
215+
ZEND_ASSERT(ht->nNumUsed > 0);
216+
Bucket *p = ht->arData;
217+
Bucket *end = p + ht->nNumUsed;
218218
do {
219219
if (GC_DELREF(p->key) == 0) {
220220
ZEND_ASSERT(!(GC_FLAGS(p->key) & IS_STR_PERSISTENT));
@@ -223,7 +223,7 @@ static zend_always_inline void simdjson_release_reused_key_strings(HashTable *de
223223
} while (++p != end);
224224
}
225225

226-
static zend_always_inline void simdjson_init_reused_key_strings(HashTable *ht) {
226+
static zend_always_inline void simdjson_dedup_key_strings_init(HashTable *ht) {
227227
if (UNEXPECTED(ht->nTableSize == 0)) {
228228
// zend_hash_init
229229
ht->nNumUsed = 0;
@@ -236,7 +236,7 @@ static zend_always_inline void simdjson_init_reused_key_strings(HashTable *ht) {
236236
} else if (ht->nNumUsed > SIMDJSON_DEDUP_STRING_COUNT / 2) {
237237
// more than half of hash table is already full before decoding new structure, so we will make space for new keys
238238
// by removing old keys
239-
simdjson_release_reused_key_strings(ht);
239+
simdjson_dedup_key_strings_release(ht);
240240
ZEND_ASSERT(ht->nTableMask == HT_SIZE_TO_MASK(SIMDJSON_DEDUP_STRING_COUNT));
241241
HT_HASH_RESET(ht);
242242
ht->nNumUsed = 0;
@@ -547,7 +547,7 @@ PHP_SIMDJSON_API void php_simdjson_free_parser(simdjson_php_parser* parser) /* {
547547
// Destroy dedup_key_strings hash if was allocated
548548
if (parser->dedup_key_strings.nTableSize) {
549549
if (parser->dedup_key_strings.nNumUsed) {
550-
simdjson_release_reused_key_strings(&parser->dedup_key_strings);
550+
simdjson_dedup_key_strings_release(&parser->dedup_key_strings);
551551
}
552552
efree(HT_GET_DATA_ADDR(&parser->dedup_key_strings));
553553
}
@@ -558,7 +558,7 @@ PHP_SIMDJSON_API void php_simdjson_free_parser(simdjson_php_parser* parser) /* {
558558
static simdjson_php_error_code simdjson_convert_element(simdjson::dom::element element, zval *return_value, bool associative, HashTable *dedup_key_strings) {
559559
#if PHP_VERSION_ID >= 80200
560560
// Allocate table for reusing already allocated keys
561-
simdjson_init_reused_key_strings(dedup_key_strings);
561+
simdjson_dedup_key_strings_init(dedup_key_strings);
562562
#endif
563563
simdjson_php_error_code resp;
564564
if (associative) {

0 commit comments

Comments
 (0)