summaryrefslogtreecommitdiff
path: root/ext/wddx
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-01-20 15:33:24 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2008-01-20 15:33:24 (GMT)
commit73d031a390126b012d3d0a73e7241b3aa608b973 (patch)
tree4eb3e4440478c0dcc1cc439ef69b0f2b8945cdc7 /ext/wddx
parent72473f52994c4c02b8a4f3f9a8b4bfb6f2973ada (diff)
downloadphp-73d031a390126b012d3d0a73e7241b3aa608b973.tar.gz
Optimize wddx boolean encoding
Diffstat (limited to 'ext/wddx')
-rw-r--r--ext/wddx/php_wddx_api.h3
-rw-r--r--ext/wddx/wddx.c5
2 files changed, 3 insertions, 5 deletions
diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h
index 6a884f7..c639480 100644
--- a/ext/wddx/php_wddx_api.h
+++ b/ext/wddx/php_wddx_api.h
@@ -27,7 +27,8 @@
#define WDDX_ARRAY_E "</array>"
#define WDDX_BINARY_S "<binary>"
#define WDDX_BINARY_E "</binary>"
-#define WDDX_BOOLEAN "<boolean value='%s'/>"
+#define WDDX_BOOLEAN_TRUE "<boolean value='true'/>"
+#define WDDX_BOOLEAN_FALSE "<boolean value='false'/>"
#define WDDX_CHAR "<char code='%02X'/>"
#define WDDX_COMMENT_S "<comment>"
#define WDDX_COMMENT_E "</comment>"
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 3c67a49..5600ad7 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -407,10 +407,7 @@ static void php_wddx_serialize_number(wddx_packet *packet, zval *var)
*/
static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var)
{
- char tmp_buf[WDDX_BUF_LEN];
-
- snprintf(tmp_buf, sizeof(tmp_buf), WDDX_BOOLEAN, Z_LVAL_P(var) ? "true" : "false");
- php_wddx_add_chunk(packet, tmp_buf);
+ php_wddx_add_chunk(packet, Z_LVAL_P(var) ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE);
}
/* }}} */