summaryrefslogtreecommitdiff
path: root/ext/standard/file.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-06-05 16:04:11 +0400
committerDmitry Stogov <dmitry@zend.com>2014-06-05 16:04:11 +0400
commitc1965f58d4dd3970912dcd6a63ccd5860bae1a97 (patch)
tree15b4a94e8e8405f791438c468ad4eb03f60c4079 /ext/standard/file.c
parent3d87391cc06fe87344536e88ac74ded22b0195cf (diff)
downloadphp-git-c1965f58d4dd3970912dcd6a63ccd5860bae1a97.tar.gz
Use reference counting instead of zval duplication
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r--ext/standard/file.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index f8c3e98108..897eaa7be8 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -344,7 +344,7 @@ PHP_FUNCTION(flock)
php_stream *stream;
long operation = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &arg1, &operation, &arg3) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z/", &arg1, &operation, &arg3) == FAILURE) {
return;
}
@@ -356,16 +356,16 @@ PHP_FUNCTION(flock)
RETURN_FALSE;
}
- if (arg3 && Z_ISREF_P(arg3)) {
- convert_to_long_ex(Z_REFVAL_P(arg3));
- Z_LVAL_P(Z_REFVAL_P(arg3)) = 0;
+ if (arg3) {
+ zval_dtor(arg3);
+ ZVAL_LONG(arg3, 0);
}
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
act = flock_values[act - 1] | (operation & PHP_LOCK_NB ? LOCK_NB : 0);
if (php_stream_lock(stream, act)) {
- if (operation && errno == EWOULDBLOCK && arg3 && Z_ISREF_P(arg3)) {
- Z_LVAL_P(Z_REFVAL_P(arg3)) = 1;
+ if (operation && errno == EWOULDBLOCK && arg3) {
+ ZVAL_LONG(arg3, 1);
}
RETURN_FALSE;
}