Skip to contentSkip to conversation

tools/libxl: use libxl wrapper for yajl_gen_alloc

PATCH In review Olaf Hering 2 participants 2 messages Feb 9, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxl: use libxl wrapper for yajl_gen_alloc

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1328787526 -3600
# Node ID 6176980d3c0d969e71a9eebf43d3e2cfb6ca4025 # Parent 8ba7ae0b070b4de93fc033067c61714c202d64c1 tools/libxl: use libxl wrapper for yajl_gen_alloc

To fix compile errors with libyajl2:
use libxl__yajl_gen_alloc()
use libxl_yajl_length
link xl with -lyajl for yajl_gen_string()

tools/libxl/Makefile +1 -1
diff -r 8ba7ae0b070b -r 6176980d3c0d tools/libxl/Makefile
@@ -142,7 +142,7 @@ libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
 
 xl: $(XL_OBJS) libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) -lyajl $(APPEND_LDFLAGS)
 
 testidl: testidl.o libxlutil.so libxenlight.so
 	$(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
tools/libxl/xl_cmdimpl.c +2 -3
diff -r 8ba7ae0b070b -r 6176980d3c0d tools/libxl/xl_cmdimpl.c
@@ -297,13 +297,12 @@ static void printf_info(enum output_form
     if (output_format == OUTPUT_FORMAT_SXP)
         return printf_info_sexp(domid, d_config);
 
-    yajl_gen_config conf = { 1, "    " };
     const char *buf;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
     if (!hand) {
         fprintf(stderr, "unable to allocate JSON generator\n");
         return;
#1 lore raw
Quoted 9 lines · Olaf Hering

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1328787526 -3600
# Node ID 6176980d3c0d969e71a9eebf43d3e2cfb6ca4025 # Parent 8ba7ae0b070b4de93fc033067c61714c202d64c1 tools/libxl: use libxl wrapper for yajl_gen_alloc

To fix compile errors with libyajl2:
use libxl__yajl_gen_alloc()

I didn't notice this when it went in but if this is a public function it should be libxl_yajl_gen_alloc not libxl__yajl_gen_alloc. Can you also fix that please?

Ian.

Quoted 41 lines

use libxl_yajl_length
link xl with -lyajl for yajl_gen_string()

diff -r 8ba7ae0b070b -r 6176980d3c0d tools/libxl/Makefile

tools/libxl/Makefile +1 -1
@@ -142,7 +142,7 @@ libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
 
 xl: $(XL_OBJS) libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) -lyajl $(APPEND_LDFLAGS)
 
 testidl: testidl.o libxlutil.so libxenlight.so
 	$(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)

diff -r 8ba7ae0b070b -r 6176980d3c0d tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c +2 -3
@@ -297,13 +297,12 @@ static void printf_info(enum output_form
     if (output_format == OUTPUT_FORMAT_SXP)
         return printf_info_sexp(domid, d_config);
 
-    yajl_gen_config conf = { 1, "    " };
     const char *buf;
-    unsigned int len = 0;
+    libxl_yajl_length len = 0;
     yajl_gen_status s;
     yajl_gen hand;
 
-    hand = yajl_gen_alloc(&conf, NULL);
+    hand = libxl__yajl_gen_alloc(NULL);
     if (!hand) {
         fprintf(stderr, "unable to allocate JSON generator\n");
         return;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel