Lines Matching refs:pb
100 static int json_escape_str(struct printbuf *pb, char *str, int len) in json_escape_str() argument
118 printbuf_memappend(pb, str + start_offset, pos - start_offset); in json_escape_str()
120 if(c == '\b') printbuf_memappend(pb, "\\b", 2); in json_escape_str()
121 else if(c == '\n') printbuf_memappend(pb, "\\n", 2); in json_escape_str()
122 else if(c == '\r') printbuf_memappend(pb, "\\r", 2); in json_escape_str()
123 else if(c == '\t') printbuf_memappend(pb, "\\t", 2); in json_escape_str()
124 else if(c == '\f') printbuf_memappend(pb, "\\f", 2); in json_escape_str()
125 else if(c == '"') printbuf_memappend(pb, "\\\"", 2); in json_escape_str()
126 else if(c == '\\') printbuf_memappend(pb, "\\\\", 2); in json_escape_str()
127 else if(c == '/') printbuf_memappend(pb, "\\/", 2); in json_escape_str()
135 printbuf_memappend(pb, str + start_offset, pos - start_offset); in json_escape_str()
136 sprintbuf(pb, "\\u00%c%c", in json_escape_str()
145 printbuf_memappend(pb, str + start_offset, pos - start_offset); in json_escape_str()
299 static void indent(struct printbuf *pb, int level, int flags) in indent() argument
303 printbuf_memset(pb, -1, ' ', level * 2); in indent()
310 struct printbuf *pb, in json_object_object_to_json_string() argument
317 sprintbuf(pb, "{" /*}*/); in json_object_object_to_json_string()
319 sprintbuf(pb, "\n"); in json_object_object_to_json_string()
324 sprintbuf(pb, ","); in json_object_object_to_json_string()
326 sprintbuf(pb, "\n"); in json_object_object_to_json_string()
330 sprintbuf(pb, " "); in json_object_object_to_json_string()
331 indent(pb, level+1, flags); in json_object_object_to_json_string()
332 sprintbuf(pb, "\""); in json_object_object_to_json_string()
333 json_escape_str(pb, iter.key, strlen(iter.key)); in json_object_object_to_json_string()
335 sprintbuf(pb, "\": "); in json_object_object_to_json_string()
337 sprintbuf(pb, "\":"); in json_object_object_to_json_string()
339 sprintbuf(pb, "null"); in json_object_object_to_json_string()
341 iter.val->_to_json_string(iter.val, pb, level+1,flags); in json_object_object_to_json_string()
346 sprintbuf(pb, "\n"); in json_object_object_to_json_string()
347 indent(pb,level,flags); in json_object_object_to_json_string()
350 return sprintbuf(pb, /*{*/ " }"); in json_object_object_to_json_string()
352 return sprintbuf(pb, /*{*/ "}"); in json_object_object_to_json_string()
458 struct printbuf *pb, in json_object_boolean_to_json_string() argument
463 return sprintbuf(pb, "true"); in json_object_boolean_to_json_string()
465 return sprintbuf(pb, "false"); in json_object_boolean_to_json_string()
501 struct printbuf *pb, in json_object_int_to_json_string() argument
505 return sprintbuf(pb, "%"PRId64, jso->o.c_int64); in json_object_int_to_json_string()
593 struct printbuf *pb, in json_object_double_to_json_string() argument
629 printbuf_memappend(pb, buf, size); in json_object_double_to_json_string()
662 struct printbuf *pb, int level, int flags) in json_object_userdata_to_json_string() argument
665 printbuf_memappend(pb, jso->_userdata, userdata_len); in json_object_userdata_to_json_string()
727 struct printbuf *pb, in json_object_string_to_json_string() argument
731 sprintbuf(pb, "\""); in json_object_string_to_json_string()
732 json_escape_str(pb, jso->o.c_string.str, jso->o.c_string.len); in json_object_string_to_json_string()
733 sprintbuf(pb, "\""); in json_object_string_to_json_string()
811 struct printbuf *pb, in json_object_array_to_json_string() argument
817 sprintbuf(pb, "["); in json_object_array_to_json_string()
819 sprintbuf(pb, "\n"); in json_object_array_to_json_string()
825 sprintbuf(pb, ","); in json_object_array_to_json_string()
827 sprintbuf(pb, "\n"); in json_object_array_to_json_string()
831 sprintbuf(pb, " "); in json_object_array_to_json_string()
832 indent(pb, level + 1, flags); in json_object_array_to_json_string()
835 sprintbuf(pb, "null"); in json_object_array_to_json_string()
837 val->_to_json_string(val, pb, level+1, flags); in json_object_array_to_json_string()
842 sprintbuf(pb, "\n"); in json_object_array_to_json_string()
843 indent(pb,level,flags); in json_object_array_to_json_string()
847 return sprintbuf(pb, " ]"); in json_object_array_to_json_string()
849 return sprintbuf(pb, "]"); in json_object_array_to_json_string()