sniper Thu Mar 6 20:03:05 2003 EDT
Modified files:
/php4/ext/sysvmsg php_sysvmsg.h sysvmsg.c
Log:
WS & CS fixes
Index: php4/ext/sysvmsg/php_sysvmsg.h
diff -u php4/ext/sysvmsg/php_sysvmsg.h:1.2 php4/ext/sysvmsg/php_sysvmsg.h:1.3
--- php4/ext/sysvmsg/php_sysvmsg.h:1.2 Sun Oct 27 06:56:06 2002
+++ php4/ext/sysvmsg/php_sysvmsg.h Thu Mar 6 20:03:04 2003
@@ -1,20 +1,22 @@
/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | [EMAIL PROTECTED] so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <[EMAIL PROTECTED]> |
- +----------------------------------------------------------------------+
- */
+ +----------------------------------------------------------------------+
+ | PHP Version 4 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2003 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.02 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available at through the world-wide-web at |
+ | http://www.php.net/license/2_02.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | [EMAIL PROTECTED] so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <[EMAIL PROTECTED]> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: php_sysvmsg.h,v 1.3 2003/03/07 01:03:04 sniper Exp $ */
#ifndef PHP_SYSVMSG_H
#define PHP_SYSVMSG_H
Index: php4/ext/sysvmsg/sysvmsg.c
diff -u php4/ext/sysvmsg/sysvmsg.c:1.8 php4/ext/sysvmsg/sysvmsg.c:1.9
--- php4/ext/sysvmsg/sysvmsg.c:1.8 Fri Jan 24 11:24:45 2003
+++ php4/ext/sysvmsg/sysvmsg.c Thu Mar 6 20:03:04 2003
@@ -1,21 +1,22 @@
/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997-2003 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.02 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_02.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | [EMAIL PROTECTED] so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Wez Furlong <[EMAIL PROTECTED] |
- +----------------------------------------------------------------------+
- */
-/* $Id: sysvmsg.c,v 1.8 2003/01/24 16:24:45 iliaa Exp $ */
+ +----------------------------------------------------------------------+
+ | PHP Version 4 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 1997-2003 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.02 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available at through the world-wide-web at |
+ | http://www.php.net/license/2_02.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | [EMAIL PROTECTED] so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Author: Wez Furlong <[EMAIL PROTECTED]> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: sysvmsg.c,v 1.9 2003/03/07 01:03:04 sniper Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -40,8 +41,7 @@
static int le_sysvmsg;
static unsigned char sixth_arg_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_NONE,
BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-static unsigned char msg_receive_args_force_ref[] = { 8, BYREF_NONE, BYREF_NONE,
BYREF_FORCE,
- BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
+static unsigned char msg_receive_args_force_ref[] = { 8, BYREF_NONE, BYREF_NONE,
BYREF_FORCE, BYREF_NONE, BYREF_FORCE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
/* {{{ sysvmsg_functions[]
*
@@ -82,15 +82,15 @@
*/
/* Remove comments and fill if you need to have entries in php.ini
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("sysvmsg.value", "42", PHP_INI_ALL, OnUpdateInt,
global_value, zend_sysvmsg_globals, sysvmsg_globals)
- STD_PHP_INI_ENTRY("sysvmsg.string", "foobar", PHP_INI_ALL, OnUpdateString,
global_string, zend_sysvmsg_globals, sysvmsg_globals)
+ STD_PHP_INI_ENTRY("sysvmsg.value", "42", PHP_INI_ALL, OnUpdateInt,
global_value, zend_sysvmsg_globals, sysvmsg_globals)
+ STD_PHP_INI_ENTRY("sysvmsg.string", "foobar", PHP_INI_ALL, OnUpdateString,
global_string, zend_sysvmsg_globals, sysvmsg_globals)
PHP_INI_END()
*/
/* }}} */
static void sysvmsg_release(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
- sysvmsg_queue_t * mq = (sysvmsg_queue_t*)rsrc->ptr;
+ sysvmsg_queue_t * mq = (sysvmsg_queue_t *) rsrc->ptr;
efree(mq);
}
@@ -100,8 +100,8 @@
{
le_sysvmsg = zend_register_list_destructors_ex(sysvmsg_release, NULL, "sysvmsg
queue", module_number);
REGISTER_LONG_CONSTANT("MSG_IPC_NOWAIT", PHP_MSG_IPC_NOWAIT,
CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR,
CONST_PERSISTENT|CONST_CS);
- REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT,
CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_NOERROR", PHP_MSG_NOERROR,
CONST_PERSISTENT|CONST_CS);
+ REGISTER_LONG_CONSTANT("MSG_EXCEPT", PHP_MSG_EXCEPT,
CONST_PERSISTENT|CONST_CS);
return SUCCESS;
}
/* }}} */
@@ -119,8 +119,8 @@
PHP_MINFO_FUNCTION(sysvmsg)
{
php_info_print_table_start();
- php_info_print_table_header(2, "sysvmsg support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.8 $");
+ php_info_print_table_row(2, "sysvmsg support", "enabled");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.9 $");
php_info_print_table_end();
}
/* }}} */
@@ -135,32 +135,29 @@
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &queue, &data) ==
FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &queue, &data) ==
FAILURE) {
return;
-
+ }
+
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue",
le_sysvmsg);
if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
zval **item;
/* now pull out members of data and set them in the stat buffer */
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.uid",
- sizeof("msg_perm.uid"), (void**)&item) ==
SUCCESS) {
+ if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.uid",
sizeof("msg_perm.uid"), (void **) &item) == SUCCESS) {
convert_to_long_ex(item);
stat.msg_perm.uid = Z_LVAL_PP(item);
}
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.gid",
- sizeof("msg_perm.gid"), (void**)&item) ==
SUCCESS) {
+ if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.gid",
sizeof("msg_perm.gid"), (void **) &item) == SUCCESS) {
convert_to_long_ex(item);
stat.msg_perm.gid = Z_LVAL_PP(item);
}
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.mode",
- sizeof("msg_perm.mode"), (void**)&item) ==
SUCCESS) {
+ if (zend_hash_find(Z_ARRVAL_P(data), "msg_perm.mode",
sizeof("msg_perm.mode"), (void **) &item) == SUCCESS) {
convert_to_long_ex(item);
stat.msg_perm.mode = Z_LVAL_PP(item);
}
- if (zend_hash_find(Z_ARRVAL_P(data), "msg_qbytes",
- sizeof("msg_qbytes"), (void**)&item) ==
SUCCESS) {
+ if (zend_hash_find(Z_ARRVAL_P(data), "msg_qbytes",
sizeof("msg_qbytes"), (void **) &item) == SUCCESS) {
convert_to_long_ex(item);
stat.msg_qbytes = Z_LVAL_PP(item);
}
@@ -181,9 +178,10 @@
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE) {
return;
-
+ }
+
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue",
le_sysvmsg);
if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
@@ -215,13 +213,13 @@
return;
}
- mq = (sysvmsg_queue_t *)emalloc(sizeof(sysvmsg_queue_t));
+ mq = (sysvmsg_queue_t *) emalloc(sizeof(sysvmsg_queue_t));
mq->key = key;
mq->id = msgget(key, 0);
if (mq->id < 0) {
/* doesn't already exist; create it */
- mq->id = msgget(key, IPC_CREAT|IPC_EXCL|perms);
+ mq->id = msgget(key, IPC_CREAT | IPC_EXCL | perms);
if (mq->id < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key
0x%x: %s", key, strerror(errno));
efree(mq);
@@ -239,9 +237,10 @@
zval *queue;
sysvmsg_queue_t *mq = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE)
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &queue) == FAILURE) {
return;
-
+ }
+
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue",
le_sysvmsg);
if (msgctl(mq->id, IPC_RMID, NULL) == 0) {
@@ -252,7 +251,7 @@
}
/* }}} */
-/* {{{ proto mixed msg_receive(resource queue, long desiredmsgtype, long &msgtype,
long maxsize, mixed message [[, bool unserialize=true][, long flags=0[, long
errorcode]]]
+/* {{{ proto mixed msg_receive(resource queue, long desiredmsgtype, long &msgtype,
long maxsize, mixed message [, bool unserialize=true [, long flags=0 [, long
errorcode]]])
Send a message of type msgtype (must be > 0) to a message queue */
PHP_FUNCTION(msg_receive)
{
@@ -266,11 +265,12 @@
RETVAL_FALSE;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlzlz|blz",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlzlz|blz",
&queue, &desiredmsgtype, &out_msgtype, &maxsize,
- &out_message, &do_unserialize, &flags, &zerrcode) ==
FAILURE)
+ &out_message, &do_unserialize, &flags, &zerrcode) ==
FAILURE) {
return;
-
+ }
+
if (flags != 0) {
if (flags & PHP_MSG_EXCEPT) {
#ifndef MSG_EXCEPT
@@ -280,15 +280,17 @@
realflags |= MSG_EXCEPT;
#endif
}
- if (flags & PHP_MSG_NOERROR)
+ if (flags & PHP_MSG_NOERROR) {
realflags |= MSG_NOERROR;
- if (flags & PHP_MSG_IPC_NOWAIT)
+ }
+ if (flags & PHP_MSG_IPC_NOWAIT) {
realflags |= IPC_NOWAIT;
+ }
}
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue",
le_sysvmsg);
- messagebuffer = (struct php_msgbuf*)emalloc(sizeof(struct php_msgbuf) +
maxsize);
+ messagebuffer = (struct php_msgbuf *) emalloc(sizeof(struct php_msgbuf) +
maxsize);
result = msgrcv(mq->id, messagebuffer, maxsize, desiredmsgtype, realflags);
@@ -309,7 +311,7 @@
if (do_unserialize) {
php_unserialize_data_t var_hash;
zval *tmp = NULL;
- const char *p = (const char*)messagebuffer->mtext;
+ const char *p = (const char *) messagebuffer->mtext;
MAKE_STD_ZVAL(tmp);
PHP_VAR_UNSERIALIZE_INIT(var_hash);
@@ -331,7 +333,7 @@
}
/* }}} */
-/* {{{ proto bool msg_send(resource queue, long msgtype, mixed message [[, bool
serialize=true][, bool blocking=true][, long errorcode]])
+/* {{{ proto bool msg_send(resource queue, long msgtype, mixed message [, bool
serialize=true [, bool blocking=true [, long errorcode]]])
Send a message of type msgtype (must be > 0) to a message queue */
PHP_FUNCTION(msg_send)
{
@@ -346,9 +348,10 @@
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz|bbz",
- &queue, &msgtype, &message, &do_serialize, &blocking,
&zerror) == FAILURE)
+ &queue, &msgtype, &message, &do_serialize, &blocking,
&zerror) == FAILURE) {
return;
-
+ }
+
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t*, &queue, -1, "sysvmsg queue",
le_sysvmsg);
if (do_serialize) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php