fix ws/folding

This commit is contained in:
Antony Dovgal 2007-07-23 12:24:52 +00:00
parent 5b71d45eff
commit 17ee976404

View File

@ -86,7 +86,8 @@ static PHP_MINFO_FUNCTION(json)
static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC); static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC);
static void json_escape_string(smart_str *buf, char *s, int len); static void json_escape_string(smart_str *buf, char *s, int len);
static int json_determine_array_type(zval **val TSRMLS_DC) { static int json_determine_array_type(zval **val TSRMLS_DC) /* {{{ */
{
int i; int i;
HashTable *myht = HASH_OF(*val); HashTable *myht = HASH_OF(*val);
@ -117,8 +118,9 @@ static int json_determine_array_type(zval **val TSRMLS_DC) {
return 0; return 0;
} }
/* }}} */
static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) { static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) { /* {{{ */
int i, r; int i, r;
HashTable *myht; HashTable *myht;
@ -224,10 +226,11 @@ static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) {
smart_str_appendc(buf, '}'); smart_str_appendc(buf, '}');
} }
} }
/* }}} */
#define REVERSE16(us) (((us & 0xf) << 12) | (((us >> 4) & 0xf) << 8) | (((us >> 8) & 0xf) << 4) | ((us >> 12) & 0xf)) #define REVERSE16(us) (((us & 0xf) << 12) | (((us >> 4) & 0xf) << 8) | (((us >> 8) & 0xf) << 4) | ((us >> 12) & 0xf))
static void json_escape_string(smart_str *buf, char *s, int len) static void json_escape_string(smart_str *buf, char *s, int len) /* {{{ */
{ {
int pos = 0; int pos = 0;
unsigned short us; unsigned short us;
@ -328,8 +331,10 @@ static void json_escape_string(smart_str *buf, char *s, int len)
smart_str_appendc(buf, '"'); smart_str_appendc(buf, '"');
efree(utf16); efree(utf16);
} }
/* }}} */
static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) { static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) /* {{{ */
{
switch (Z_TYPE_P(val)) { switch (Z_TYPE_P(val)) {
case IS_NULL: case IS_NULL:
smart_str_appendl(buf, "null", 4); smart_str_appendl(buf, "null", 4);
@ -378,6 +383,7 @@ static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) {
return; return;
} }
/* }}} */
/* {{{ proto string json_encode(mixed data) /* {{{ proto string json_encode(mixed data)
Returns the JSON representation of a value */ Returns the JSON representation of a value */