Skip to content

Commit 24b311b

Browse files
MaxKellermannGirgias
authored andcommitted
ext/opcache/zend_shared_alloc: rename _register_xlat_entry() params
The name "new" happens to be a C++ keyword, which was the my reason to rethink those names. The "xlat_table" is not only used to translate pointers for persisting scripts to shared memory, but is also used to annoate pointers (e.g. by the JIT to associate an op_array with its jit_extension). The names "old" and "new" aren't good for that; often, there's nothing "old" or "new" about them. It's actually a generic lookup table, and "old" shall be named "key" (which it is called internally already), and "new" is renamed to simply "value".
1 parent b47bfd6 commit 24b311b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ext/opcache/zend_shared_alloc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,18 +541,18 @@ void zend_shared_alloc_restore_xlat_table(uint32_t checkpoint)
541541
zend_hash_discard(&ZCG(xlat_table), checkpoint);
542542
}
543543

544-
void zend_shared_alloc_register_xlat_entry(const void *old, const void *new)
544+
void zend_shared_alloc_register_xlat_entry(const void *key_pointer, const void *value)
545545
{
546-
zend_ulong key = (zend_ulong)old;
546+
zend_ulong key = (zend_ulong)key_pointer;
547547

548548
key = zend_rotr3(key);
549-
zend_hash_index_add_new_ptr(&ZCG(xlat_table), key, (void*)new);
549+
zend_hash_index_add_new_ptr(&ZCG(xlat_table), key, (void*)value);
550550
}
551551

552-
void *zend_shared_alloc_get_xlat_entry(const void *old)
552+
void *zend_shared_alloc_get_xlat_entry(const void *key_pointer)
553553
{
554554
void *retval;
555-
zend_ulong key = (zend_ulong)old;
555+
zend_ulong key = (zend_ulong)key_pointer;
556556

557557
key = zend_rotr3(key);
558558
if ((retval = zend_hash_index_find_ptr(&ZCG(xlat_table), key)) == NULL) {

ext/opcache/zend_shared_alloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ void zend_shared_alloc_destroy_xlat_table(void);
185185
void zend_shared_alloc_clear_xlat_table(void);
186186
uint32_t zend_shared_alloc_checkpoint_xlat_table(void);
187187
void zend_shared_alloc_restore_xlat_table(uint32_t checkpoint);
188-
void zend_shared_alloc_register_xlat_entry(const void *old, const void *new);
189-
void *zend_shared_alloc_get_xlat_entry(const void *old);
188+
void zend_shared_alloc_register_xlat_entry(const void *key, const void *value);
189+
void *zend_shared_alloc_get_xlat_entry(const void *key);
190190

191191
size_t zend_shared_alloc_get_free_memory(void);
192192
void zend_shared_alloc_save_state(void);

0 commit comments

Comments
 (0)