mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
util: json: Privatize struct _virJSONValue and sub-structs
Enforce usage of accessors by hiding the implementation in the code. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
167028e37f
commit
56b7d94f11
@ -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 {
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user