[php-src] PR #14301: refactor: change `zend_is_true` to return `bool`
| From: | morrisonlevi | Date: | Wed, 22 May 2024 20:34:45 +0000 |
| Subject: | [php-src] PR #14301: refactor: change `zend_is_true` to return `bool` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-26276@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14301
Author: morrisonlevi
Previously this returned
int. Many function actually take advantage of the fact this
returns exactly 0 or 1. For instance, main/streams/xp_socket.c does:
sockopts |= STREAM_SOCKOP_IPV6_V6ONLY_ENABLED * zend_is_true(tmpzval);
And Zend/zend_compile.c does:
child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];
I changed a few places trivially from int to bool, but there are still
many places such as the object handlers which return int that should eventually be
bool.
I'm not quite sure yet what to do with ext/opcache/jit/zend_jit_ir.c:
ref = ir_CALL_1(IR_BOOL, ir_CONST_FC_FUNC(zend_is_true), jit_ZVAL_ADDR(jit, op1_addr));