[php-src] master: socket: return result from HT directly in get_ancillary_reg_entry()
| From: | Gina Peter Banyard | Date: | Thu, 12 Nov 2026 22:27:07 +0000 |
| Subject: | [php-src] master: socket: return result from HT directly in get_ancillary_reg_entry() | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143665@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Date: 2026-11-12T22:27:01Z
Commit: https://github.com/php/php-src/commit/5b43891f5ade63220ecbfbb90307a7e8eb115737
Raw diff: https://github.com/php/php-src/commit/5b43891f5ade63220ecbfbb90307a7e8eb115737.diff
socket: return result from HT directly in get_ancillary_reg_entry()
No need to check the pointer is not NULL just to return it or NULL
Changed paths:
M ext/sockets/sendrecvmsg.c
Diff:
diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c
index cc268bd68b0a..a2f697e6fe62 100644
--- a/ext/sockets/sendrecvmsg.c
+++ b/ext/sockets/sendrecvmsg.c
@@ -154,7 +154,6 @@ static void destroy_ancillary_registry(void)
ancillary_reg_entry *get_ancillary_reg_entry(int cmsg_level, int msg_type)
{
anc_reg_key key = { cmsg_level, msg_type };
- ancillary_reg_entry *entry;
#ifdef ZTS
tsrm_mutex_lock(ancillary_mutex);
@@ -166,11 +165,7 @@ ancillary_reg_entry *get_ancillary_reg_entry(int cmsg_level, int msg_type)
tsrm_mutex_unlock(ancillary_mutex);
#endif
- if ((entry = zend_hash_str_find_ptr(&ancillary_registry.ht, (char*)&key, sizeof(key))) !=
NULL) {
- return entry;
- } else {
- return NULL;
- }
+ return zend_hash_str_find_ptr(&ancillary_registry.ht, (char*)&key, sizeof(key));
}
PHP_FUNCTION(socket_sendmsg)