]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: json: Privatize struct _virJSONValue and sub-structs
authorPeter Krempa <pkrempa@redhat.com>
Thu, 29 Mar 2018 18:36:56 +0000 (20:36 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Apr 2018 11:34:33 +0000 (13:34 +0200)
Enforce usage of accessors by hiding the implementation in the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
src/util/virjson.c
src/util/virjson.h

index 6f2b52257fa12ac1240e8da7a65205507bbd4cbf..3ddefc34cafcc6a82d358749f7a3b5b28a4a73d7 100644 (file)
 
 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 {
index e80d10dea1a29d15a153d758960036a5508a1c97..f7283dcf97619442d5b9beb0452e57bfb37fbc7a 100644 (file)
@@ -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);