summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/JSON_parser.c26
-rw-r--r--ext/json/JSON_parser.h6
-rw-r--r--ext/json/json.c78
-rw-r--r--ext/json/php_json.h8
4 files changed, 59 insertions, 59 deletions
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c
index d78ec35a2e..2e4f258b1e 100644
--- a/ext/json/JSON_parser.c
+++ b/ext/json/JSON_parser.c
@@ -291,7 +291,7 @@ static int dehexchar(char c)
}
-static void json_create_zval(zval *z, smart_str *buf, int type, int options TSRMLS_DC)
+static void json_create_zval(zval *z, smart_str *buf, int type, int options)
{
if (type == IS_LONG)
{
@@ -393,11 +393,11 @@ static void utf16_to_utf8(smart_str *buf, unsigned short utf16)
}
}
-static inline void add_assoc_or_property(int assoc, zval *target, smart_str *key, zval *zv TSRMLS_DC)
+static inline void add_assoc_or_property(int assoc, zval *target, smart_str *key, zval *zv)
{
zend_bool empty_key = !key->s || key->s->len == 0;
if (!assoc) {
- add_property_zval_ex(target, empty_key ? "_empty_" : key->s->val, empty_key ? sizeof("_empty_")-1 : key->s->len, zv TSRMLS_CC);
+ add_property_zval_ex(target, empty_key ? "_empty_" : key->s->val, empty_key ? sizeof("_empty_")-1 : key->s->len, zv);
if (Z_REFCOUNTED_P(zv)) Z_DELREF_P(zv);
} else {
add_assoc_zval_ex(target, empty_key ? "" : key->s->val, empty_key ? 0 : key->s->len, zv);
@@ -407,7 +407,7 @@ static inline void add_assoc_or_property(int assoc, zval *target, smart_str *key
}
}
-static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int assoc TSRMLS_DC)
+static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int assoc)
{
zval *root = &jp->the_zstack[up];
zval *child = &jp->the_zstack[cur];
@@ -419,7 +419,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass
}
else if (up_mode == MODE_OBJECT)
{
- add_assoc_or_property(assoc, root, key, child TSRMLS_CC);
+ add_assoc_or_property(assoc, root, key, child);
}
}
@@ -444,7 +444,7 @@ static void attach_zval(JSON_parser jp, int up, int cur, smart_str *key, int ass
machine with a stack.
*/
int
-parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC)
+parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options)
{
int next_char; /* the next character */
int next_class; /* the next character class */
@@ -557,9 +557,9 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
zval mval;
smart_str_0(&buf);
- json_create_zval(&mval, &buf, type, options TSRMLS_CC);
+ json_create_zval(&mval, &buf, type, options);
- add_assoc_or_property(assoc, &jp->the_zstack[jp->top], &key, &mval TSRMLS_CC);
+ add_assoc_or_property(assoc, &jp->the_zstack[jp->top], &key, &mval);
if (buf.s) { buf.s->len = 0; }
JSON_RESET_TYPE();
@@ -580,7 +580,7 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
zval mval;
smart_str_0(&buf);
- json_create_zval(&mval, &buf, type, options TSRMLS_CC);
+ json_create_zval(&mval, &buf, type, options);
add_next_index_zval(&jp->the_zstack[jp->top], &mval);
buf.s->len = 0;
JSON_RESET_TYPE();
@@ -615,7 +615,7 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
}
if (jp->top > 1) {
- attach_zval(jp, jp->top - 1, jp->top, &key, assoc TSRMLS_CC);
+ attach_zval(jp, jp->top - 1, jp->top, &key, assoc);
}
JSON_RESET_TYPE();
@@ -640,7 +640,7 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
}
if (jp->top > 1) {
- attach_zval(jp, jp->top - 1, jp->top, &key, assoc TSRMLS_CC);
+ attach_zval(jp, jp->top - 1, jp->top, &key, assoc);
}
JSON_RESET_TYPE();
@@ -689,14 +689,14 @@ parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length,
jp->stack[jp->top] == MODE_ARRAY))
{
smart_str_0(&buf);
- json_create_zval(&mval, &buf, type, options TSRMLS_CC);
+ json_create_zval(&mval, &buf, type, options);
}
switch (jp->stack[jp->top]) {
case MODE_OBJECT:
if (pop(jp, MODE_OBJECT) && push(jp, MODE_KEY)) {
if (type != -1) {
- add_assoc_or_property(assoc, &jp->the_zstack[jp->top], &key, &mval TSRMLS_CC);
+ add_assoc_or_property(assoc, &jp->the_zstack[jp->top], &key, &mval);
}
jp->state = KE;
}
diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h
index da47f4078f..91081e8bf6 100644
--- a/ext/json/JSON_parser.h
+++ b/ext/json/JSON_parser.h
@@ -32,12 +32,12 @@ enum error_codes {
};
extern JSON_parser new_JSON_parser(int depth);
-extern int parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options TSRMLS_DC);
+extern int parse_JSON_ex(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int options);
extern int free_JSON_parser(JSON_parser jp);
-static inline int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc TSRMLS_DC)
+static inline int parse_JSON(JSON_parser jp, zval *z, unsigned short utf16_json[], int length, int assoc)
{
- return parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0 TSRMLS_CC);
+ return parse_JSON_ex(jp, z, utf16_json, length, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0);
}
#endif
diff --git a/ext/json/json.c b/ext/json/json.c
index 91bedcace9..481ab756ed 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -91,7 +91,7 @@ static PHP_MINIT_FUNCTION(json)
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface);
- php_json_serializable_ce = zend_register_internal_interface(&ce TSRMLS_CC);
+ php_json_serializable_ce = zend_register_internal_interface(&ce);
REGISTER_LONG_CONSTANT("JSON_HEX_TAG", PHP_JSON_HEX_TAG, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("JSON_HEX_AMP", PHP_JSON_HEX_AMP, CONST_CS | CONST_PERSISTENT);
@@ -173,9 +173,9 @@ static PHP_MINFO_FUNCTION(json)
}
/* }}} */
-static void json_escape_string(smart_str *buf, char *s, size_t len, int options TSRMLS_DC);
+static void json_escape_string(smart_str *buf, char *s, size_t len, int options);
-static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */
+static int json_determine_array_type(zval *val) /* {{{ */
{
int i;
HashTable *myht = HASH_OF(val);
@@ -204,7 +204,7 @@ static int json_determine_array_type(zval *val TSRMLS_DC) /* {{{ */
/* {{{ Pretty printing support functions */
-static inline void json_pretty_print_char(smart_str *buf, int options, char c TSRMLS_DC) /* {{{ */
+static inline void json_pretty_print_char(smart_str *buf, int options, char c) /* {{{ */
{
if (options & PHP_JSON_PRETTY_PRINT) {
smart_str_appendc(buf, c);
@@ -212,7 +212,7 @@ static inline void json_pretty_print_char(smart_str *buf, int options, char c TS
}
/* }}} */
-static inline void json_pretty_print_indent(smart_str *buf, int options TSRMLS_DC) /* {{{ */
+static inline void json_pretty_print_indent(smart_str *buf, int options) /* {{{ */
{
int i;
@@ -226,14 +226,14 @@ static inline void json_pretty_print_indent(smart_str *buf, int options TSRMLS_D
/* }}} */
-static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */
+static void json_encode_array(smart_str *buf, zval *val, int options) /* {{{ */
{
int i, r, need_comma = 0;
HashTable *myht;
if (Z_TYPE_P(val) == IS_ARRAY) {
myht = HASH_OF(val);
- r = (options & PHP_JSON_FORCE_OBJECT) ? PHP_JSON_OUTPUT_OBJECT : json_determine_array_type(val TSRMLS_CC);
+ r = (options & PHP_JSON_FORCE_OBJECT) ? PHP_JSON_OUTPUT_OBJECT : json_determine_array_type(val);
} else {
myht = Z_OBJPROP_P(val);
r = PHP_JSON_OUTPUT_OBJECT;
@@ -275,9 +275,9 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
need_comma = 1;
}
- json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
- json_pretty_print_indent(buf, options TSRMLS_CC);
- php_json_encode(buf, data, options TSRMLS_CC);
+ json_pretty_print_char(buf, options, '\n');
+ json_pretty_print_indent(buf, options);
+ php_json_encode(buf, data, options);
} else if (r == PHP_JSON_OUTPUT_OBJECT) {
if (key) {
if (key->val[0] == '\0' && Z_TYPE_P(val) == IS_OBJECT) {
@@ -294,15 +294,15 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
need_comma = 1;
}
- json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
- json_pretty_print_indent(buf, options TSRMLS_CC);
+ json_pretty_print_char(buf, options, '\n');
+ json_pretty_print_indent(buf, options);
- json_escape_string(buf, key->val, key->len, options & ~PHP_JSON_NUMERIC_CHECK TSRMLS_CC);
+ json_escape_string(buf, key->val, key->len, options & ~PHP_JSON_NUMERIC_CHECK);
smart_str_appendc(buf, ':');
- json_pretty_print_char(buf, options, ' ' TSRMLS_CC);
+ json_pretty_print_char(buf, options, ' ');
- php_json_encode(buf, data, options TSRMLS_CC);
+ php_json_encode(buf, data, options);
} else {
if (need_comma) {
smart_str_appendc(buf, ',');
@@ -310,17 +310,17 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
need_comma = 1;
}
- json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
- json_pretty_print_indent(buf, options TSRMLS_CC);
+ json_pretty_print_char(buf, options, '\n');
+ json_pretty_print_indent(buf, options);
smart_str_appendc(buf, '"');
smart_str_append_long(buf, (zend_long) index);
smart_str_appendc(buf, '"');
smart_str_appendc(buf, ':');
- json_pretty_print_char(buf, options, ' ' TSRMLS_CC);
+ json_pretty_print_char(buf, options, ' ');
- php_json_encode(buf, data, options TSRMLS_CC);
+ php_json_encode(buf, data, options);
}
}
@@ -337,8 +337,8 @@ static void json_encode_array(smart_str *buf, zval *val, int options TSRMLS_DC)
/* Only keep closing bracket on same line for empty arrays/objects */
if (need_comma) {
- json_pretty_print_char(buf, options, '\n' TSRMLS_CC);
- json_pretty_print_indent(buf, options TSRMLS_CC);
+ json_pretty_print_char(buf, options, '\n');
+ json_pretty_print_indent(buf, options);
}
if (r == PHP_JSON_OUTPUT_ARRAY) {
@@ -386,7 +386,7 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{
}
/* }}} */
-static void json_escape_string(smart_str *buf, char *s, size_t len, int options TSRMLS_DC) /* {{{ */
+static void json_escape_string(smart_str *buf, char *s, size_t len, int options) /* {{{ */
{
int status;
unsigned int us, next_us = 0;
@@ -556,7 +556,7 @@ static void json_escape_string(smart_str *buf, char *s, size_t len, int options
}
/* }}} */
-static void json_encode_serializable_object(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */
+static void json_encode_serializable_object(smart_str *buf, zval *val, int options) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(val);
zval retval, fname;
@@ -576,8 +576,8 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
ZVAL_STRING(&fname, "jsonSerialize");
- if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL TSRMLS_CC) || Z_TYPE(retval) == IS_UNDEF) {
- zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name->val);
+ if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL) || Z_TYPE(retval) == IS_UNDEF) {
+ zend_throw_exception_ex(NULL, 0, "Failed calling %s::jsonSerialize()", ce->name->val);
smart_str_appendl(buf, "null", sizeof("null") - 1);
zval_ptr_dtor(&fname);
return;
@@ -594,10 +594,10 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
if ((Z_TYPE(retval) == IS_OBJECT) &&
(Z_OBJ_HANDLE(retval) == Z_OBJ_HANDLE_P(val))) {
/* Handle the case where jsonSerialize does: return $this; by going straight to encode array */
- json_encode_array(buf, &retval, options TSRMLS_CC);
+ json_encode_array(buf, &retval, options);
} else {
/* All other types, encode as normal */
- php_json_encode(buf, &retval, options TSRMLS_CC);
+ php_json_encode(buf, &retval, options);
}
zval_ptr_dtor(&retval);
@@ -605,7 +605,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio
}
/* }}} */
-PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC) /* {{{ */
+PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options) /* {{{ */
{
again:
switch (Z_TYPE_P(val))
@@ -643,17 +643,17 @@ again:
break;
case IS_STRING:
- json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options TSRMLS_CC);
+ json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options);
break;
case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(val), php_json_serializable_ce TSRMLS_CC)) {
- json_encode_serializable_object(buf, val, options TSRMLS_CC);
+ if (instanceof_function(Z_OBJCE_P(val), php_json_serializable_ce)) {
+ json_encode_serializable_object(buf, val, options);
break;
}
/* fallthrough -- Non-serializable object */
case IS_ARRAY:
- json_encode_array(buf, val, options TSRMLS_CC);
+ json_encode_array(buf, val, options);
break;
case IS_REFERENCE:
@@ -670,7 +670,7 @@ again:
}
/* }}} */
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC) /* {{{ */
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth) /* {{{ */
{
size_t utf16_len;
unsigned short *utf16;
@@ -688,13 +688,13 @@ PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_l
}
if (depth <= 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Depth must be greater than zero");
+ php_error_docref(NULL, E_WARNING, "Depth must be greater than zero");
efree(utf16);
RETURN_NULL();
}
jp = new_JSON_parser(depth);
- if (!parse_JSON_ex(jp, return_value, utf16, utf16_len, options TSRMLS_CC)) {
+ if (!parse_JSON_ex(jp, return_value, utf16, utf16_len, options)) {
double d;
int type, overflow_info;
zend_long p;
@@ -780,7 +780,7 @@ static PHP_FUNCTION(json_encode)
zend_long options = 0;
zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &parameter, &options, &depth) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ll", &parameter, &options, &depth) == FAILURE) {
return;
}
@@ -788,7 +788,7 @@ static PHP_FUNCTION(json_encode)
JSON_G(encode_max_depth) = depth;
- php_json_encode(&buf, parameter, options TSRMLS_CC);
+ php_json_encode(&buf, parameter, options);
if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && !(options & PHP_JSON_PARTIAL_OUTPUT_ON_ERROR)) {
smart_str_free(&buf);
@@ -810,7 +810,7 @@ static PHP_FUNCTION(json_decode)
zend_long depth = JSON_PARSER_DEFAULT_DEPTH;
zend_long options = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|bll", &str, &str_len, &assoc, &depth, &options) == FAILURE) {
return;
}
@@ -827,7 +827,7 @@ static PHP_FUNCTION(json_decode)
options &= ~PHP_JSON_OBJECT_AS_ARRAY;
}
- php_json_decode_ex(return_value, str, str_len, options, depth TSRMLS_CC);
+ php_json_decode_ex(return_value, str, str_len, options, depth);
}
/* }}} */
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 64ad811bc7..62eca734a2 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -52,8 +52,8 @@ ZEND_TSRMLS_CACHE_EXTERN;
# define JSON_G(v) (json_globals.v)
#endif
-PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth TSRMLS_DC);
+PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options);
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth);
extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
@@ -77,9 +77,9 @@ extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
#define PHP_JSON_OBJECT_AS_ARRAY (1<<0)
#define PHP_JSON_BIGINT_AS_STRING (1<<1)
-static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth TSRMLS_DC)
+static inline void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth)
{
- php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth TSRMLS_CC);
+ php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth);
}