Lines Matching refs:buf
44 static void php_json_escape_string(smart_str *buf, char *s, size_t len, int options);
75 static inline void php_json_pretty_print_char(smart_str *buf, int options, char c) /* {{{ */ in php_json_pretty_print_char() argument
78 smart_str_appendc(buf, c); in php_json_pretty_print_char()
83 static inline void php_json_pretty_print_indent(smart_str *buf, int options) /* {{{ */ in php_json_pretty_print_indent() argument
89 smart_str_appendl(buf, " ", 4); in php_json_pretty_print_indent()
103 static inline void php_json_encode_double(smart_str *buf, double d, int options) /* {{{ */ in php_json_encode_double() argument
114 smart_str_appendl(buf, num, len); in php_json_encode_double()
118 static void php_json_encode_array(smart_str *buf, zval *val, int options) /* {{{ */ in php_json_encode_array() argument
133 smart_str_appendl(buf, "null", 4); in php_json_encode_array()
138 smart_str_appendc(buf, '['); in php_json_encode_array()
140 smart_str_appendc(buf, '{'); in php_json_encode_array()
162 smart_str_appendc(buf, ','); in php_json_encode_array()
167 php_json_pretty_print_char(buf, options, '\n'); in php_json_encode_array()
168 php_json_pretty_print_indent(buf, options); in php_json_encode_array()
169 php_json_encode(buf, data, options); in php_json_encode_array()
181 smart_str_appendc(buf, ','); in php_json_encode_array()
186 php_json_pretty_print_char(buf, options, '\n'); in php_json_encode_array()
187 php_json_pretty_print_indent(buf, options); in php_json_encode_array()
189 php_json_escape_string(buf, ZSTR_VAL(key), ZSTR_LEN(key), options & ~PHP_JSON_NUMERIC_CHECK); in php_json_encode_array()
190 smart_str_appendc(buf, ':'); in php_json_encode_array()
192 php_json_pretty_print_char(buf, options, ' '); in php_json_encode_array()
194 php_json_encode(buf, data, options); in php_json_encode_array()
197 smart_str_appendc(buf, ','); in php_json_encode_array()
202 php_json_pretty_print_char(buf, options, '\n'); in php_json_encode_array()
203 php_json_pretty_print_indent(buf, options); in php_json_encode_array()
205 smart_str_appendc(buf, '"'); in php_json_encode_array()
206 smart_str_append_long(buf, (zend_long) index); in php_json_encode_array()
207 smart_str_appendc(buf, '"'); in php_json_encode_array()
208 smart_str_appendc(buf, ':'); in php_json_encode_array()
210 php_json_pretty_print_char(buf, options, ' '); in php_json_encode_array()
212 php_json_encode(buf, data, options); in php_json_encode_array()
229 php_json_pretty_print_char(buf, options, '\n'); in php_json_encode_array()
230 php_json_pretty_print_indent(buf, options); in php_json_encode_array()
234 smart_str_appendc(buf, ']'); in php_json_encode_array()
236 smart_str_appendc(buf, '}'); in php_json_encode_array()
278 static void php_json_escape_string(smart_str *buf, char *s, size_t len, int options) /* {{{ */ in php_json_escape_string() argument
285 smart_str_appendl(buf, "\"\"", 2); in php_json_escape_string()
296 smart_str_append_long(buf, p); in php_json_escape_string()
299 php_json_encode_double(buf, d, options); in php_json_escape_string()
310 smart_str_appendl(buf, "null", 4); in php_json_escape_string()
316 checkpoint = buf->s ? ZSTR_LEN(buf->s) : 0; in php_json_escape_string()
319 smart_str_alloc(buf, len+2, 0); in php_json_escape_string()
320 smart_str_appendc(buf, '"'); in php_json_escape_string()
328 if (buf->s) { in php_json_escape_string()
329 ZSTR_LEN(buf->s) = checkpoint; in php_json_escape_string()
332 smart_str_appendl(buf, "null", 4); in php_json_escape_string()
341 smart_str_appendl(buf, "\\u", 2); in php_json_escape_string()
342 smart_str_appendc(buf, digits[(us & 0xf000) >> 12]); in php_json_escape_string()
343 smart_str_appendc(buf, digits[(us & 0xf00) >> 8]); in php_json_escape_string()
344 smart_str_appendc(buf, digits[(us & 0xf0) >> 4]); in php_json_escape_string()
345 smart_str_appendc(buf, digits[(us & 0xf)]); in php_json_escape_string()
348 smart_str_appendl(buf, "\\u", 2); in php_json_escape_string()
349 smart_str_appendc(buf, digits[(us & 0xf000) >> 12]); in php_json_escape_string()
350 smart_str_appendc(buf, digits[(us & 0xf00) >> 8]); in php_json_escape_string()
351 smart_str_appendc(buf, digits[(us & 0xf0) >> 4]); in php_json_escape_string()
352 smart_str_appendc(buf, digits[(us & 0xf)]); in php_json_escape_string()
359 smart_str_appendl(buf, "\\u0022", 6); in php_json_escape_string()
361 smart_str_appendl(buf, "\\\"", 2); in php_json_escape_string()
366 smart_str_appendl(buf, "\\\\", 2); in php_json_escape_string()
371 smart_str_appendc(buf, '/'); in php_json_escape_string()
373 smart_str_appendl(buf, "\\/", 2); in php_json_escape_string()
378 smart_str_appendl(buf, "\\b", 2); in php_json_escape_string()
382 smart_str_appendl(buf, "\\f", 2); in php_json_escape_string()
386 smart_str_appendl(buf, "\\n", 2); in php_json_escape_string()
390 smart_str_appendl(buf, "\\r", 2); in php_json_escape_string()
394 smart_str_appendl(buf, "\\t", 2); in php_json_escape_string()
399 smart_str_appendl(buf, "\\u003C", 6); in php_json_escape_string()
401 smart_str_appendc(buf, '<'); in php_json_escape_string()
407 smart_str_appendl(buf, "\\u003E", 6); in php_json_escape_string()
409 smart_str_appendc(buf, '>'); in php_json_escape_string()
415 smart_str_appendl(buf, "\\u0026", 6); in php_json_escape_string()
417 smart_str_appendc(buf, '&'); in php_json_escape_string()
423 smart_str_appendl(buf, "\\u0027", 6); in php_json_escape_string()
425 smart_str_appendc(buf, '\''); in php_json_escape_string()
431 smart_str_appendc(buf, (unsigned char) us); in php_json_escape_string()
433 smart_str_appendl(buf, "\\u00", sizeof("\\u00")-1); in php_json_escape_string()
434 smart_str_appendc(buf, digits[(us & 0xf0) >> 4]); in php_json_escape_string()
435 smart_str_appendc(buf, digits[(us & 0xf)]); in php_json_escape_string()
442 smart_str_appendc(buf, '"'); in php_json_escape_string()
446 static void php_json_encode_serializable_object(smart_str *buf, zval *val, int options) /* {{{ */ in php_json_encode_serializable_object() argument
461 smart_str_appendl(buf, "null", 4); in php_json_encode_serializable_object()
473 smart_str_appendl(buf, "null", sizeof("null") - 1); in php_json_encode_serializable_object()
483 smart_str_appendl(buf, "null", sizeof("null") - 1); in php_json_encode_serializable_object()
490 php_json_encode_array(buf, &retval, options); in php_json_encode_serializable_object()
493 php_json_encode(buf, &retval, options); in php_json_encode_serializable_object()
501 void php_json_encode_zval(smart_str *buf, zval *val, int options) /* {{{ */ in php_json_encode_zval() argument
507 smart_str_appendl(buf, "null", 4); in php_json_encode_zval()
511 smart_str_appendl(buf, "true", 4); in php_json_encode_zval()
514 smart_str_appendl(buf, "false", 5); in php_json_encode_zval()
518 smart_str_append_long(buf, Z_LVAL_P(val)); in php_json_encode_zval()
523 php_json_encode_double(buf, Z_DVAL_P(val), options); in php_json_encode_zval()
526 smart_str_appendc(buf, '0'); in php_json_encode_zval()
531 php_json_escape_string(buf, Z_STRVAL_P(val), Z_STRLEN_P(val), options); in php_json_encode_zval()
536 php_json_encode_serializable_object(buf, val, options); in php_json_encode_zval()
541 php_json_encode_array(buf, val, options); in php_json_encode_zval()
550 smart_str_appendl(buf, "null", 4); in php_json_encode_zval()