summaryrefslogtreecommitdiff
path: root/ext/standard/assert.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-02-16 16:35:04 +0000
committerDmitry Stogov <dmitry@php.net>2007-02-16 16:35:04 +0000
commita3493bd3decf624fceba789078f7fd4f48dd3154 (patch)
treed3f24626433c1b1c4ecc66f589a03eec3e3429d3 /ext/standard/assert.c
parent01058e9770da3bb253f853aebd6d9d6f5ba4456a (diff)
downloadphp-git-a3493bd3decf624fceba789078f7fd4f48dd3154.tar.gz
Optimize out RINIT()
Diffstat (limited to 'ext/standard/assert.c')
-rw-r--r--ext/standard/assert.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 36f717085a..b88dbf80fb 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -114,16 +114,6 @@ PHP_MSHUTDOWN_FUNCTION(assert)
return SUCCESS;
}
-PHP_RINIT_FUNCTION(assert)
-{
- if (ASSERTG(cb)) {
- MAKE_STD_ZVAL(ASSERTG(callback));
- ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
- }
-
- return SUCCESS;
-}
-
PHP_RSHUTDOWN_FUNCTION(assert)
{
if (ASSERTG(callback)) {
@@ -197,6 +187,11 @@ PHP_FUNCTION(assert)
RETURN_TRUE;
}
+ if (!ASSERTG(callback) && ASSERTG(cb)) {
+ MAKE_STD_ZVAL(ASSERTG(callback));
+ ZVAL_STRING(ASSERTG(callback), ASSERTG(cb), 1);
+ }
+
if (ASSERTG(callback)) {
zval *args[3];
zval *retval;
@@ -293,6 +288,8 @@ PHP_FUNCTION(assert_options)
case ASSERT_CALLBACK:
if (ASSERTG(callback) != NULL) {
RETVAL_ZVAL(ASSERTG(callback), 1, 0);
+ } else if (ASSERTG(cb)) {
+ RETVAL_STRING(ASSERTG(cb), 1);
} else {
RETVAL_NULL();
}