#include <string.h>
#include <strings.h>
-#include "libjson/bits.h"
-#include "libjson/arraylist.h"
+#include "bits.h"
+#include "arraylist.h"
struct array_list*
#include <unistd.h>
#include <sys/param.h>
-#include "libjson/debug.h"
+#include "debug.h"
static int _syslog = 0;
#include <stdlib.h>
#include <string.h>
-#include "libjson/debug.h"
-#include "libjson/printbuf.h"
-#include "libjson/linkhash.h"
-#include "libjson/arraylist.h"
-#include "libjson/json_object.h"
-#include "libjson/ossupport.h"
-#include "libjson/json_object_private.h"
+#include "debug.h"
+#include "printbuf.h"
+#include "linkhash.h"
+#include "arraylist.h"
+#include "json_object.h"
+#include "ossupport.h"
+#include "json_object_private.h"
/* #define REFCOUNT_DEBUG */
do {
c = str[pos];
switch(c) {
- case '\b':
- case '\n':
- case '\r':
- case '\t':
- case '"':
- if(pos - start_offset > 0)
- printbuf_memappend(pb, str + start_offset, pos - start_offset);
- if(c == '\b') printbuf_memappend(pb, "\\b", 2);
- else if(c == '\n') printbuf_memappend(pb, "\\n", 2);
- else if(c == '\r') printbuf_memappend(pb, "\\r", 2);
- else if(c == '\t') printbuf_memappend(pb, "\\t", 2);
- else if(c == '"') printbuf_memappend(pb, "\\\"", 2);
+ case '\b':
+ case '\n':
+ case '\r':
+ case '\t':
+ case '"':
+
+ if(pos - start_offset > 0)
+ printbuf_memappend(pb, str + start_offset, pos - start_offset);
+
+ if(c == '\b') printbuf_memappend(pb, "\\b", 2);
+ else if(c == '\n') printbuf_memappend(pb, "\\n", 2);
+ else if(c == '\r') printbuf_memappend(pb, "\\r", 2);
+ else if(c == '\t') printbuf_memappend(pb, "\\t", 2);
+ else if(c == '"') printbuf_memappend(pb, "\\\"", 2);
+
start_offset = ++pos;
break;
+
default:
if(c && c < ' ') {
- if(pos - start_offset > 0)
- printbuf_memappend(pb, str + start_offset, pos - start_offset);
- sprintbuf(pb, "\\u00%c%c",
- json_hex_chars[c >> 4],
- json_hex_chars[c & 0xf]);
- start_offset = ++pos;
+ if(pos - start_offset > 0)
+ printbuf_memappend(pb, str + start_offset, pos - start_offset);
+
+ sprintbuf(pb, "\\u00%c%c",
+ json_hex_chars[c >> 4], json_hex_chars[c & 0xf]);
+
+ start_offset = ++pos;
+
} else if(c) pos++;
}
} while(c);
+
if(pos - start_offset > 0)
printbuf_memappend(pb, str + start_offset, pos - start_offset);
+
return 0;
}
#include <ctype.h>
#include <string.h>
-#include "libjson/json_tokener.h"
-#include "libjson/bits.h"
-#include "libjson/debug.h"
-#include "libjson/printbuf.h"
-#include "libjson/linkhash.h"
-#include "libjson/arraylist.h"
-#include "libjson/json_object.h"
-#include "libjson/ossupport.h"
-#include "libjson/json_object_private.h"
+#include "json_tokener.h"
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
+#include "linkhash.h"
+#include "arraylist.h"
+#include "json_object.h"
+#include "ossupport.h"
+#include "json_object_private.h"
}
break;
- case json_tokener_state_escape_unicode:
- if(strchr(json_hex_chars, c)) {
- this->pos++;
- if(this->pos - start_offset == 4) {
- unsigned char utf_out[3];
- unsigned int ucs_char =
- (hexdigit(*(this->source + start_offset)) << 12) +
- (hexdigit(*(this->source + start_offset + 1)) << 8) +
- (hexdigit(*(this->source + start_offset + 2)) << 4) +
- hexdigit(*(this->source + start_offset + 3));
- if (ucs_char < 0x80) {
- utf_out[0] = ucs_char;
- printbuf_memappend(this->pb, utf_out, 1);
- } else if (ucs_char < 0x800) {
- utf_out[0] = 0xc0 | (ucs_char >> 6);
- utf_out[1] = 0x80 | (ucs_char & 0x3f);
- printbuf_memappend(this->pb, utf_out, 2);
- } else {
- utf_out[0] = 0xe0 | (ucs_char >> 12);
- utf_out[1] = 0x80 | ((ucs_char >> 6) & 0x3f);
- utf_out[2] = 0x80 | (ucs_char & 0x3f);
- printbuf_memappend(this->pb, utf_out, 3);
- }
- start_offset = this->pos;
- state = saved_state;
+ case json_tokener_state_escape_unicode:
+
+ if(strchr(json_hex_chars, c)) {
+ this->pos++;
+
+ if(this->pos - start_offset == 4) {
+ unsigned char utf_out[3];
+ unsigned int ucs_char =
+ (hexdigit(*(this->source + start_offset)) << 12) +
+ (hexdigit(*(this->source + start_offset + 1)) << 8) +
+ (hexdigit(*(this->source + start_offset + 2)) << 4) +
+ hexdigit(*(this->source + start_offset + 3));
+
+ if (ucs_char < 0x80) {
+ utf_out[0] = ucs_char;
+ printbuf_memappend(this->pb, utf_out, 1);
+ } else if (ucs_char < 0x800) {
+ utf_out[0] = 0xc0 | (ucs_char >> 6);
+ utf_out[1] = 0x80 | (ucs_char & 0x3f);
+ printbuf_memappend(this->pb, utf_out, 2);
+ } else {
+ utf_out[0] = 0xe0 | (ucs_char >> 12);
+ utf_out[1] = 0x80 | ((ucs_char >> 6) & 0x3f);
+ utf_out[2] = 0x80 | (ucs_char & 0x3f);
+ printbuf_memappend(this->pb, utf_out, 3);
+ }
+ start_offset = this->pos;
+ state = saved_state;
+ }
+ } else {
+ err = json_tokener_error_parse_string;
+ goto out;
}
- } else {
- err = json_tokener_error_parse_string;
- goto out;
- }
- break;
+ break;
case json_tokener_state_boolean:
if(strncasecmp("true", this->source + start_offset,
#include <sys/stat.h>
#include <fcntl.h>
-#include "libjson/json_util.h"
-#include "libjson/json_tokener.h"
-#include "libjson/bits.h"
-#include "libjson/debug.h"
-#include "libjson/printbuf.h"
-#include "libjson/linkhash.h"
-#include "libjson/arraylist.h"
-#include "libjson/json_object.h"
-#include "libjson/ossupport.h"
-#include "libjson/json_object_private.h"
+#include "json_util.h"
+#include "json_tokener.h"
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
+#include "linkhash.h"
+#include "arraylist.h"
+#include "json_object.h"
+#include "ossupport.h"
+#include "json_object_private.h"
#include <stdlib.h>
#include <stdarg.h>
-#include "libjson/linkhash.h"
+#include "linkhash.h"
void lh_abort(const char *msg, ...)
#include <stdio.h>
#include <string.h>
-#include "libjson/json.h"
+#include "json.h"
struct oils_method_struct {
#include <stdlib.h>
#include <string.h>
-#include "libjson/json.h"
+#include "json.h"
int main(int argc, char **argv)
#include <stdarg.h>
#include <string.h>
-#include "libjson/bits.h"
-#include "libjson/debug.h"
-#include "libjson/printbuf.h"
+#include "bits.h"
+#include "debug.h"
+#include "printbuf.h"
struct printbuf* printbuf_new()
#include <stdlib.h>
#include <string.h>
-#include "libjson/json.h"
+#include "json.h"
int main(int argc, char **argv)
#include <stdlib.h>
#include <string.h>
-#include "libjson/json.h"
+#include "json.h"
int main(int argc, char **argv)