com php-src: ported ext/shmop: ext/shmop/php_shmop.h ext/ shmop/shmop.c
| From: | Anatol Belski | Date: | Tue, 19 Aug 2014 12:05:39 +0000 |
| Subject: | com php-src: ported ext/shmop: ext/shmop/php_shmop.h ext/ shmop/shmop.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80769@lists.php.net to get a copy of this message | ||
Commit: 64d54461bf17efe0f0facb5856e566010a5eb0da
Author: Anatol Belski <ab@php.net> Tue, 19 Aug 2014 14:05:39 +0200
Parents: e41ec2cfebf9af73dfe02bb6bfd4af9345468b34
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=64d54461bf17efe0f0facb5856e566010a5eb0da
Log:
ported ext/shmop
Changed paths:
M ext/shmop/php_shmop.h
M ext/shmop/shmop.c
Diff:
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 2779fe1..e0e0448 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -45,7 +45,7 @@ struct php_shmop
int shmflg;
int shmatflg;
char *addr;
- int size;
+ php_int_t size;
};
typedef struct {
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 97e0ce1..3a66d73 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -146,13 +146,13 @@ PHP_MINFO_FUNCTION(shmop)
gets and attaches a shared memory segment */
PHP_FUNCTION(shmop_open)
{
- long key, mode, size;
+ php_int_t key, mode, size;
struct php_shmop *shmop;
struct shmid_ds shm;
char *flags;
int flags_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags,
&flags_len, &mode, &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "isii", &key, &flags,
&flags_len, &mode, &size) == FAILURE) {
return;
}
@@ -227,13 +227,13 @@ err:
reads from a shm segment */
PHP_FUNCTION(shmop_read)
{
- long shmid, start, count;
+ php_int_t shmid, start, count;
struct php_shmop *shmop;
char *startaddr;
int bytes;
zend_string *return_string;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start,
&count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &shmid, &start,
&count) == FAILURE) {
return;
}
@@ -262,10 +262,10 @@ PHP_FUNCTION(shmop_read)
closes a shared memory segment */
PHP_FUNCTION(shmop_close)
{
- long shmid;
+ php_int_t shmid;
zval *res;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}
@@ -280,10 +280,10 @@ PHP_FUNCTION(shmop_close)
returns the shm size */
PHP_FUNCTION(shmop_size)
{
- long shmid;
+ php_int_t shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}
@@ -299,11 +299,10 @@ PHP_FUNCTION(shmop_write)
{
struct php_shmop *shmop;
int writesize;
- long shmid, offset;
- char *data;
- int data_len;
+ php_int_t shmid, offset;
+ zend_string *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &shmid, &data,
&data_len, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSi", &shmid, &data,
&offset) == FAILURE) {
return;
}
@@ -319,8 +318,8 @@ PHP_FUNCTION(shmop_write)
RETURN_FALSE;
}
- writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset;
- memcpy(shmop->addr + offset, data, writesize);
+ writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset;
+ memcpy(shmop->addr + offset, data->val, writesize);
RETURN_INT(writesize);
}
@@ -330,10 +329,10 @@ PHP_FUNCTION(shmop_write)
mark segment for deletion */
PHP_FUNCTION(shmop_delete)
{
- long shmid;
+ php_int_t shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}