Skip to content

Zend/zend_hash: Add various NONNULL attributes - #18511

Merged
Girgias merged 2 commits into
php:masterfrom
Girgias:nonnull-attr
Nov 22, 2026
Merged

Girgias merged 2 commits into
php:masterfrom
Girgias:nonnull-attr

Conversation

@Girgias

@Girgias Girgias commented May 6, 2025

Copy link
Copy Markdown
Member

To have some compiler assisted sanity checks.

Comment thread Zend/zend_hash.c
}

static zend_always_inline zval *_zend_hash_str_add_or_update_i(HashTable *ht, const char *str, size_t len, zend_ulong h, zval *pData, uint32_t flag)
ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2) static zend_always_inline zval *_zend_hash_str_add_or_update_i(HashTable *ht, const char *str, size_t len, zend_ulong h, zval *pData, uint32_t flag)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we don't mark zval *pData as non NULL as this function is used for lookup functions which pass NULL to pData.

Comment thread Zend/zend_hash.c
}

static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht, zend_ulong h, zval *pData, uint32_t flag)
ZEND_ATTRIBUTE_NONNULL_ARGS(1) static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht, zend_ulong h, zval *pData, uint32_t flag)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@Girgias
Girgias force-pushed the nonnull-attr branch 2 times, most recently from 0254114 to 32988c3 Compare November 11, 2026 03:29
@Girgias
Girgias marked this pull request as ready for review November 11, 2026 04:53
@Girgias
Girgias requested review from TimWolla and ndossche November 12, 2026 22:25
@Girgias
Girgias merged commit 1e439af into php:master Nov 22, 2026
18 checks passed
@Girgias
Girgias deleted the nonnull-attr branch November 22, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant