rrichards Thu Oct 6 14:48:19 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/wddx wddx.c php_wddx_api.h
Log:
MFH: use sizeof instead of define
http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.119.2.4&r2=1.119.2.5&ty=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.119.2.4 php-src/ext/wddx/wddx.c:1.119.2.5
--- php-src/ext/wddx/wddx.c:1.119.2.4 Wed Oct 5 18:36:10 2005
+++ php-src/ext/wddx/wddx.c Thu Oct 6 14:48:19 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.119.2.4 2005/10/05 22:36:10 rrichards Exp $ */
+/* $Id: wddx.c,v 1.119.2.5 2005/10/06 18:48:19 rrichards Exp $ */
#include "php.h"
@@ -422,7 +422,7 @@
tmp = *var;
zval_copy_ctor(&tmp);
convert_to_string(&tmp);
- snprintf(tmp_buf, Z_STRLEN(tmp) + WDDX_NUMBER_LEN + 1, WDDX_NUMBER,
Z_STRVAL(tmp));
+ snprintf(tmp_buf, sizeof(tmp_buf), WDDX_NUMBER, Z_STRVAL(tmp));
zval_dtor(&tmp);
php_wddx_add_chunk(packet, tmp_buf);
@@ -624,8 +624,8 @@
if (name) {
name_esc = php_escape_html_entities(name, name_len,
&name_esc_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
- tmp_buf = emalloc(name_esc_len + WDDX_VAR_S_LEN + 1);
- snprintf(tmp_buf, name_esc_len + WDDX_VAR_S_LEN + 1,
WDDX_VAR_S, name_esc);
+ tmp_buf = emalloc(name_esc_len + sizeof(WDDX_VAR_S));
+ snprintf(tmp_buf, name_esc_len + sizeof(WDDX_VAR_S),
WDDX_VAR_S, name_esc);
php_wddx_add_chunk(packet, tmp_buf);
efree(tmp_buf);
efree(name_esc);
http://cvs.php.net/diff.php/php-src/ext/wddx/php_wddx_api.h?r1=1.23.2.1&r2=1.23.2.2&ty=u
Index: php-src/ext/wddx/php_wddx_api.h
diff -u php-src/ext/wddx/php_wddx_api.h:1.23.2.1
php-src/ext/wddx/php_wddx_api.h:1.23.2.2
--- php-src/ext/wddx/php_wddx_api.h:1.23.2.1 Wed Oct 5 18:36:10 2005
+++ php-src/ext/wddx/php_wddx_api.h Thu Oct 6 14:48:19 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_wddx_api.h,v 1.23.2.1 2005/10/05 22:36:10 rrichards Exp $ */
+/* $Id: php_wddx_api.h,v 1.23.2.2 2005/10/06 18:48:19 rrichards Exp $ */
#ifndef PHP_WDDX_API_H
#define PHP_WDDX_API_H
@@ -47,9 +47,6 @@
#define WDDX_VAR_S "<var name='%s'>"
#define WDDX_VAR_E "</var>"
-#define WDDX_NUMBER_LEN 17
-#define WDDX_VAR_S_LEN 13
-
#define php_wddx_add_chunk(packet, str) smart_str_appends(packet, str)
#define php_wddx_add_chunk_ex(packet, str, len)
smart_str_appendl(packet, str, len)
#define php_wddx_add_chunk_static(packet, str) smart_str_appendl(packet, str,
sizeof(str)-1)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php