[libvirt] Fix for newer yajl

Brecht Sanders brecht at sanders.org
Wed Jul 27 07:40:47 UTC 2011


Hi,
I just notices that compiling libvirt against yail version 2 there were 
some errors, mainly because yajl_parser_config is no longer used.
The patch below fixed this for me.
Regards
     Brecht Sanders


--- src/util/json.c  2011-03-24 08:10:26 +0100
+++ src/util/json.c  2011-07-27 09:29:52 +0200
@@ -34,2 +34,3 @@
  # include <yajl/yajl_parse.h>
+# include <yajl/yajl_version.h>
  #endif
@@ -896,3 +897,5 @@
  {
+#if YAJL_MAJOR < 2
      yajl_parser_config cfg = { 1, 1 };
+#endif
      yajl_handle hand;
@@ -903,3 +906,7 @@

+#if YAJL_MAJOR < 2
      hand = yajl_alloc(&parserCallbacks, &cfg, NULL, &parser);
+#else
+    hand = yajl_alloc(&parserCallbacks, NULL, &parser);
+#endif

@@ -1004,3 +1011,5 @@
  {
+#if YAJL_MAJOR < 2
      yajl_gen_config conf = { 0, " " }; /* Turns off pretty printing 
since QEMUcan't cope */
+#endif
      yajl_gen g;
@@ -1012,3 +1021,7 @@

+#if YAJL_MAJOR < 2
      g = yajl_gen_alloc(&conf, NULL);
+#else
+    g = yajl_gen_alloc(NULL);
+#endif





More information about the libvir-list mailing list