[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2 2/8] libxl: Convert libxl__json_parse() to use json-c



On Thu, Oct 16, 2025 at 12:45:57PM +0200, Jan Beulich wrote:
> On 29.09.2025 14:07, Anthony PERARD wrote:
> > --- a/tools/libs/light/libxl_json.c
> > +++ b/tools/libs/light/libxl_json.c
> > @@ -16,7 +16,25 @@
> >  
> >  #include <math.h>
> >  
> > +#ifdef HAVE_LIBJSONC
> > +#include <json-c/json.h>
> > +#define USE_LIBJSONC_PARSER
> > +#endif
> > +
> > +#ifdef HAVE_LIBYAJL
> > +#  ifndef USE_LIBJSONC_PARSER
> > +#    define USE_LIBYAJL_PARSER
> > +#  endif
> > +#endif
> > +
> > +
> > +#ifdef USE_LIBJSONC_PARSER
> > +#include <json-c/json_visit.h>
> > +#endif
> 
> The version of json-c one of my systems is using also doesn't have this 
> header.

Looks like this was introduced in 0.13, with json_c_visit().

> Plus (uses originating from other patches in this series)
> json_object_object_add() returns void there. Plus of course any number of 
> further
> issues I'm going to see. The checking configure.ac is doing right now looks 
> to be
> insufficient overall.

json_object_object_add() prototype was change in 0.13 it seems,
according to
https://github.com/json-c/json-c/blob/master/ChangeLog

Also, another patch (xenstat) was using a deprecated function
json_object_object_get(), but the deprecation seems to have been removed
in 0.13.

I've tried to build with our Ubuntu 20.04 docker image, on which we can
install json-c 0.13 and found other missing functions.

Both json_object_new_null() and json_object_new_uint64() are missing,
the first one isn't needed, but I think we need the second one. Both
were introduced in json-c 0.14.

And last one, json_object_new_array_ext() which was introduced in 0.15.
We could replace it by json_object_new_array() if needed.

Overall, is seems the current code needs json-c 0.15, so 
    -PKG_CHECK_MODULES([libjsonc], [json-c],
    +PKG_CHECK_MODULES([libjsonc], [json-c >= 0.15],

I'll prepare a patch.

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.