rrichards Thu Oct 6 14:47:48 2005 EDT
Modified files:
/php-src/ext/wddx wddx.c php_wddx_api.h
Log:
use sizeof instead of define
http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.124&r2=1.125&ty=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.124 php-src/ext/wddx/wddx.c:1.125
--- php-src/ext/wddx/wddx.c:1.124 Wed Oct 5 18:35:11 2005
+++ php-src/ext/wddx/wddx.c Thu Oct 6 14:47:46 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.124 2005/10/05 22:35:11 rrichards Exp $ */
+/* $Id: wddx.c,v 1.125 2005/10/06 18:47:46 rrichards Exp $ */
#include "php.h"
@@ -423,7 +423,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);
@@ -625,8 +625,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.25&r2=1.26&ty=u
Index: php-src/ext/wddx/php_wddx_api.h
diff -u php-src/ext/wddx/php_wddx_api.h:1.25
php-src/ext/wddx/php_wddx_api.h:1.26
--- php-src/ext/wddx/php_wddx_api.h:1.25 Wed Oct 5 18:35:11 2005
+++ php-src/ext/wddx/php_wddx_api.h Thu Oct 6 14:47:47 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_wddx_api.h,v 1.25 2005/10/05 22:35:11 rrichards Exp $ */
+/* $Id: php_wddx_api.h,v 1.26 2005/10/06 18:47:47 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