summaryrefslogtreecommitdiff
path: root/ext/shmop
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-02-03 22:07:31 +0800
committerXinchen Hui <laruence@gmail.com>2015-02-03 22:07:31 +0800
commit2c842dfce076037873ec223a1709011aefbd653e (patch)
tree3d9731c3bdfb6c6f71d33f01d277908ff99a0630 /ext/shmop
parentd4546601f3e04990c36f5d2b6794944739c26c8c (diff)
downloadphp-git-2c842dfce076037873ec223a1709011aefbd653e.tar.gz
Fixed shmop tests fails
Diffstat (limited to 'ext/shmop')
-rw-r--r--ext/shmop/shmop.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 0779d27671..2000bd24f0 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -237,7 +237,7 @@ PHP_FUNCTION(shmop_read)
return;
}
- if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+ if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
RETURN_FALSE;
}
@@ -264,17 +264,19 @@ PHP_FUNCTION(shmop_read)
closes a shared memory segment */
PHP_FUNCTION(shmop_close)
{
- zend_long shmid;
- zval *res;
+ zval *shmid;
+ struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shmid) == FAILURE) {
return;
}
- res = zend_hash_index_find(&EG(regular_list), shmid);
- if (res) {
- zend_list_close(Z_RES_P(res));
+
+ if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
+ RETURN_FALSE;
}
+
+ zend_list_close(Z_RES_P(shmid));
}
/* }}} */
@@ -289,7 +291,7 @@ PHP_FUNCTION(shmop_size)
return;
}
- if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+ if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
RETURN_FALSE;
}
@@ -311,7 +313,7 @@ PHP_FUNCTION(shmop_write)
return;
}
- if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+ if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
RETURN_FALSE;
}
@@ -343,7 +345,7 @@ PHP_FUNCTION(shmop_delete)
return;
}
- if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type))) {
+ if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
RETURN_FALSE;
}