[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 3/9] libxl_internal: make JSON_* types or-able
On Thu, 2014-04-10 at 16:40 +0100, Wei Liu wrote: > Libxl can generate number as type JSON_INTEGER, JSON_DOUBLE or > JSON_NUMBER, Those are three distinct types, right? Rather than NUMBER being the union of INTERGERs and DOUBLEs? > string as type JSON_STRING or JSON_NULL (if string is > null). > > So make JSON_* type or-able I think the phrase you want is "make FOO a bit-field". > + JSON_ANY = (1 << 8) Is ANY here meaning "Any of the others" or is it a specific JSON type? If the former then should this be 0xff? (or whatever mask achieves the aim of matching all types) > } libxl__json_node_type; > > typedef struct libxl__json_object { > diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c > index 002ae2d..da315f6 100644 > --- a/tools/libxl/libxl_json.c > +++ b/tools/libxl/libxl_json.c > @@ -363,7 +363,7 @@ const libxl__json_object *libxl__json_map_get(const char > *key, > return NULL; > if (strcmp(key, node->map_key) == 0) { > if (expected_type == JSON_ANY > - || (node->obj && node->obj->type == expected_type)) { > + || (node->obj && (node->obj->type & expected_type))) { > return node->obj; > } else { > return NULL; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |