]> xenbits.xensource.com Git - libvirt.git/commitdiff
virjson: Remove const from virJSONValueObjectForeachKeyValue
authorJiri Denemark <jdenemar@redhat.com>
Wed, 14 Dec 2016 14:25:31 +0000 (15:25 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 14 Dec 2016 15:21:57 +0000 (16:21 +0100)
Almost none of our virJSONValue*Get* functions accept const virJSONValue
pointers and it wouldn't even make sense since we sometimes modify what
we get. And because there is no reason for preventing callers of
virJSONValueObjectForeachKeyValue from modifying the values they get in
each iteration we can just stop doing it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/util/virjson.c
src/util/virjson.h
src/util/virqemu.c
src/util/virqemu.h
src/util/virstoragefile.c

index b42211c0d2869af67c9cbee419d4af9556a60f83..3804e7e9776317db0eb05273163126d5304b91b6 100644 (file)
@@ -1321,7 +1321,7 @@ virJSONValueObjectIsNull(virJSONValuePtr object,
  * during iteration and -1 on generic errors.
  */
 int
-virJSONValueObjectForeachKeyValue(const virJSONValue *object,
+virJSONValueObjectForeachKeyValue(virJSONValuePtr object,
                                   virJSONValueObjectIteratorFunc cb,
                                   void *opaque)
 {
index 5b4f17253fec47198af1d753f7d9f32b0e116962..122de96c522def6d8ff13d99793ad96b94ef3520 100644 (file)
@@ -172,10 +172,10 @@ char *virJSONValueToString(virJSONValuePtr object,
                            bool pretty);
 
 typedef int (*virJSONValueObjectIteratorFunc)(const char *key,
-                                              const virJSONValue *value,
+                                              virJSONValuePtr value,
                                               void *opaque);
 
-int virJSONValueObjectForeachKeyValue(const virJSONValue *object,
+int virJSONValueObjectForeachKeyValue(virJSONValuePtr object,
                                       virJSONValueObjectIteratorFunc cb,
                                       void *opaque);
 
index 7849d8b3eb146bf95d422c3856087b4f6a964573..2e9e65f9efb06b6653d2608ec333cbb980d6001a 100644 (file)
@@ -42,7 +42,7 @@ struct virQEMUCommandLineJSONIteratorData {
 
 static int
 virQEMUBuildCommandLineJSONRecurse(const char *key,
-                                   const virJSONValue *value,
+                                   virJSONValuePtr value,
                                    virBufferPtr buf,
                                    virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc,
                                    bool nested);
@@ -51,7 +51,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
 
 int
 virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
-                                       const virJSONValue *array,
+                                       virJSONValuePtr array,
                                        virBufferPtr buf)
 {
     ssize_t pos = -1;
@@ -81,10 +81,10 @@ virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
 
 int
 virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
-                                         const virJSONValue *array,
+                                         virJSONValuePtr array,
                                          virBufferPtr buf)
 {
-    const virJSONValue *member;
+    virJSONValuePtr member;
     char *prefix = NULL;
     size_t i;
     int ret = 0;
@@ -114,7 +114,7 @@ virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
 /* internal iterator to handle nested object formatting */
 static int
 virQEMUBuildCommandLineJSONIterate(const char *key,
-                                   const virJSONValue *value,
+                                   virJSONValuePtr value,
                                    void *opaque)
 {
     struct virQEMUCommandLineJSONIteratorData *data = opaque;
@@ -140,7 +140,7 @@ virQEMUBuildCommandLineJSONIterate(const char *key,
 
 static int
 virQEMUBuildCommandLineJSONRecurse(const char *key,
-                                   const virJSONValue *value,
+                                   virJSONValuePtr value,
                                    virBufferPtr buf,
                                    virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc,
                                    bool nested)
@@ -225,7 +225,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
  * Returns 0 on success -1 on error.
  */
 int
-virQEMUBuildCommandLineJSON(const virJSONValue *value,
+virQEMUBuildCommandLineJSON(virJSONValuePtr value,
                             virBufferPtr buf,
                             virQEMUBuildCommandLineJSONArrayFormatFunc array)
 {
@@ -264,7 +264,7 @@ virQEMUBuildObjectCommandlineFromJSON(const char *type,
 
 
 char *
-virQEMUBuildDriveCommandlineFromJSON(const virJSONValue *srcdef)
+virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr srcdef)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char *ret = NULL;
index f3c2b69565a9db2265482b597a3678a6a749337f..539d62ab14ca0632a21a30f89931a504abfae10f 100644 (file)
 # include "virstorageencryption.h"
 
 typedef int (*virQEMUBuildCommandLineJSONArrayFormatFunc)(const char *key,
-                                                          const virJSONValue *array,
+                                                          virJSONValuePtr array,
                                                           virBufferPtr buf);
 int virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
-                                           const virJSONValue *array,
+                                           virJSONValuePtr array,
                                            virBufferPtr buf);
 int virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
-                                             const virJSONValue *array,
+                                             virJSONValuePtr array,
                                              virBufferPtr buf);
 
-int virQEMUBuildCommandLineJSON(const virJSONValue *value,
+int virQEMUBuildCommandLineJSON(virJSONValuePtr value,
                                 virBufferPtr buf,
                                 virQEMUBuildCommandLineJSONArrayFormatFunc array);
 
@@ -47,7 +47,7 @@ char *virQEMUBuildObjectCommandlineFromJSON(const char *type,
                                             const char *alias,
                                             virJSONValuePtr props);
 
-char *virQEMUBuildDriveCommandlineFromJSON(const virJSONValue *src);
+char *virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr src);
 
 void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str);
 void virQEMUBuildLuksOpts(virBufferPtr buf,
index f750e121a1abaf715ceb3c569d921c4d26f721e2..9ec005d5004908b3817f708491a0a8bd50d33a2d 100644 (file)
@@ -2990,7 +2990,7 @@ static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
 
 static int
 virStorageSourceParseBackingJSONDeflattenWorker(const char *key,
-                                                const virJSONValue *value,
+                                                virJSONValuePtr value,
                                                 void *opaque)
 {
     virJSONValuePtr retobj = opaque;