updated on Tue Jan 10 12:02:00 UTC 2012
[aur-mirror.git] / libvirt-git / yajl-2.x.patch
blob80d3edce0686ea0c2865a0d1806e76d23a65fb1c
1 --- a/src/util/json.c 2011-03-24 03:10:26.000000000 -0400
2 +++ b/src/util/json.c 2011-04-25 20:01:29.354939116 -0400
3 @@ -709,7 +709,7 @@
5 static int virJSONParserHandleNumber(void * ctx,
6 const char * s,
7 - unsigned int l)
8 + size_t l)
10 virJSONParserPtr parser = ctx;
11 char *str = strndup(s, l);
12 @@ -735,7 +735,7 @@
14 static int virJSONParserHandleString(void * ctx,
15 const unsigned char * stringVal,
16 - unsigned int stringLen)
17 + size_t stringLen)
19 virJSONParserPtr parser = ctx;
20 virJSONValuePtr value = virJSONValueNewStringLen((const char *)stringVal,
21 @@ -756,7 +756,7 @@
23 static int virJSONParserHandleMapKey(void * ctx,
24 const unsigned char * stringVal,
25 - unsigned int stringLen)
26 + size_t stringLen)
28 virJSONParserPtr parser = ctx;
29 virJSONParserStatePtr state;
30 @@ -894,14 +894,14 @@
31 /* XXX add an incremental streaming parser - yajl trivially supports it */
32 virJSONValuePtr virJSONValueFromString(const char *jsonstring)
34 - yajl_parser_config cfg = { 1, 1 };
35 yajl_handle hand;
36 virJSONParser parser = { NULL, NULL, 0 };
37 virJSONValuePtr ret = NULL;
39 VIR_DEBUG("string=%s", jsonstring);
41 - hand = yajl_alloc(&parserCallbacks, &cfg, NULL, &parser);
42 + hand = yajl_alloc(&parserCallbacks, NULL, &parser);
43 + yajl_config(hand, yajl_allow_comments, 1);
45 if (yajl_parse(hand,
46 (const unsigned char *)jsonstring,
47 @@ -1002,15 +1002,16 @@
49 char *virJSONValueToString(virJSONValuePtr object)
51 - yajl_gen_config conf = { 0, " " }; /* Turns off pretty printing since QEMU can't cope */
52 yajl_gen g;
53 const unsigned char *str;
54 char *ret = NULL;
55 - unsigned int len;
56 + size_t len;
58 VIR_DEBUG("object=%p", object);
60 - g = yajl_gen_alloc(&conf, NULL);
61 + g = yajl_gen_alloc(NULL);
62 + yajl_gen_config(g, yajl_gen_beautify, 0);
63 + yajl_gen_config(g, yajl_gen_indent_string, " ");
65 if (virJSONValueToStringOne(object, g) < 0) {
66 virReportOOMError();