Skip to content

Commit 4b517a9

Browse files
authored
[skip ci] Document HASH_ constants (#16806)
Not all of these are straight-forward to understand.
1 parent 14320df commit 4b517a9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Zend/zend_hash.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
#define HASH_KEY_IS_LONG 2
3131
#define HASH_KEY_NON_EXISTENT 3
3232

33-
#define HASH_UPDATE (1<<0)
34-
#define HASH_ADD (1<<1)
35-
#define HASH_UPDATE_INDIRECT (1<<2)
36-
#define HASH_ADD_NEW (1<<3)
37-
#define HASH_ADD_NEXT (1<<4)
38-
#define HASH_LOOKUP (1<<5)
33+
#define HASH_UPDATE (1<<0) /* Create new entry, or update the existing one. */
34+
#define HASH_ADD (1<<1) /* Create new entry, or fail if it exists. */
35+
#define HASH_UPDATE_INDIRECT (1<<2) /* If the given ht entry is an indirect zval, unwrap it before writing to it. \
36+
* When used with HASH_ADD, writing is allowed if the target zval is IS_UNDEF. */
37+
#define HASH_ADD_NEW (1<<3) /* Used when the offset is known not to exist. */
38+
#define HASH_ADD_NEXT (1<<4) /* Append to an array. (e.g. $array[] = 42;) */
39+
#define HASH_LOOKUP (1<<5) /* Look up an existing entry, or create one with a NULL value. */
3940

4041
#define HASH_FLAG_CONSISTENCY ((1<<0) | (1<<1))
4142
#define HASH_FLAG_PACKED (1<<2)

0 commit comments

Comments
 (0)