diff --git a/src/util/virjson.c b/src/util/virjson.c index 6f2b52257fa12ac1240e8da7a65205507bbd4cbf..3ddefc34cafcc6a82d358749f7a3b5b28a4a73d7 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -51,6 +51,45 @@ VIR_LOG_INIT("util.json"); +typedef struct _virJSONObject virJSONObject; +typedef virJSONObject *virJSONObjectPtr; + +typedef struct _virJSONObjectPair virJSONObjectPair; +typedef virJSONObjectPair *virJSONObjectPairPtr; + +typedef struct _virJSONArray virJSONArray; +typedef virJSONArray *virJSONArrayPtr; + + +struct _virJSONObjectPair { + char *key; + virJSONValuePtr value; +}; + +struct _virJSONObject { + size_t npairs; + virJSONObjectPairPtr pairs; +}; + +struct _virJSONArray { + size_t nvalues; + virJSONValuePtr *values; +}; + +struct _virJSONValue { + int type; /* enum virJSONType */ + bool protect; /* prevents deletion when embedded in another object */ + + union { + virJSONObject object; + virJSONArray array; + char *string; + char *number; /* int/float/etc format is context defined so we can't parse it here :-( */ + int boolean; + } data; +}; + + typedef struct _virJSONParserState virJSONParserState; typedef virJSONParserState *virJSONParserStatePtr; struct _virJSONParserState { diff --git a/src/util/virjson.h b/src/util/virjson.h index e80d10dea1a29d15a153d758960036a5508a1c97..f7283dcf97619442d5b9beb0452e57bfb37fbc7a 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -42,44 +42,6 @@ typedef enum { typedef struct _virJSONValue virJSONValue; typedef virJSONValue *virJSONValuePtr; -typedef struct _virJSONObject virJSONObject; -typedef virJSONObject *virJSONObjectPtr; - -typedef struct _virJSONObjectPair virJSONObjectPair; -typedef virJSONObjectPair *virJSONObjectPairPtr; - -typedef struct _virJSONArray virJSONArray; -typedef virJSONArray *virJSONArrayPtr; - - -struct _virJSONObjectPair { - char *key; - virJSONValuePtr value; -}; - -struct _virJSONObject { - size_t npairs; - virJSONObjectPairPtr pairs; -}; - -struct _virJSONArray { - size_t nvalues; - virJSONValuePtr *values; -}; - -struct _virJSONValue { - int type; /* enum virJSONType */ - bool protect; /* prevents deletion when embedded in another object */ - - union { - virJSONObject object; - virJSONArray array; - char *string; - char *number; /* int/float/etc format is context defined so we can't parse it here :-( */ - int boolean; - } data; -}; - void virJSONValueFree(virJSONValuePtr value); void virJSONValueHashFree(void *opaque, const void *name);