From 73d031a390126b012d3d0a73e7241b3aa608b973 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sun, 20 Jan 2008 15:33:24 +0000 Subject: Optimize wddx boolean encoding --- ext/wddx/php_wddx_api.h | 3 ++- ext/wddx/wddx.c | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'ext/wddx') diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h index 6a884f7189..c639480e68 100644 --- a/ext/wddx/php_wddx_api.h +++ b/ext/wddx/php_wddx_api.h @@ -27,7 +27,8 @@ #define WDDX_ARRAY_E "" #define WDDX_BINARY_S "" #define WDDX_BINARY_E "" -#define WDDX_BOOLEAN "" +#define WDDX_BOOLEAN_TRUE "" +#define WDDX_BOOLEAN_FALSE "" #define WDDX_CHAR "" #define WDDX_COMMENT_S "" #define WDDX_COMMENT_E "" diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 3c67a4924a..5600ad70dd 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); } /* }}} */ -- cgit v1.2.1