virjson: Remove const from virJSONValueObjectForeachKeyValue

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>
This commit is contained in:
Jiri Denemark 2016-12-14 15:25:31 +01:00
parent 20e64d3499
commit c1cb4cb9f6
5 changed files with 17 additions and 17 deletions

View File

@ -1321,7 +1321,7 @@ virJSONValueObjectIsNull(virJSONValuePtr object,
* during iteration and -1 on generic errors. * during iteration and -1 on generic errors.
*/ */
int int
virJSONValueObjectForeachKeyValue(const virJSONValue *object, virJSONValueObjectForeachKeyValue(virJSONValuePtr object,
virJSONValueObjectIteratorFunc cb, virJSONValueObjectIteratorFunc cb,
void *opaque) void *opaque)
{ {

View File

@ -172,10 +172,10 @@ char *virJSONValueToString(virJSONValuePtr object,
bool pretty); bool pretty);
typedef int (*virJSONValueObjectIteratorFunc)(const char *key, typedef int (*virJSONValueObjectIteratorFunc)(const char *key,
const virJSONValue *value, virJSONValuePtr value,
void *opaque); void *opaque);
int virJSONValueObjectForeachKeyValue(const virJSONValue *object, int virJSONValueObjectForeachKeyValue(virJSONValuePtr object,
virJSONValueObjectIteratorFunc cb, virJSONValueObjectIteratorFunc cb,
void *opaque); void *opaque);

View File

@ -42,7 +42,7 @@ struct virQEMUCommandLineJSONIteratorData {
static int static int
virQEMUBuildCommandLineJSONRecurse(const char *key, virQEMUBuildCommandLineJSONRecurse(const char *key,
const virJSONValue *value, virJSONValuePtr value,
virBufferPtr buf, virBufferPtr buf,
virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc, virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc,
bool nested); bool nested);
@ -51,7 +51,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
int int
virQEMUBuildCommandLineJSONArrayBitmap(const char *key, virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
const virJSONValue *array, virJSONValuePtr array,
virBufferPtr buf) virBufferPtr buf)
{ {
ssize_t pos = -1; ssize_t pos = -1;
@ -81,10 +81,10 @@ virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
int int
virQEMUBuildCommandLineJSONArrayNumbered(const char *key, virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
const virJSONValue *array, virJSONValuePtr array,
virBufferPtr buf) virBufferPtr buf)
{ {
const virJSONValue *member; virJSONValuePtr member;
char *prefix = NULL; char *prefix = NULL;
size_t i; size_t i;
int ret = 0; int ret = 0;
@ -114,7 +114,7 @@ virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
/* internal iterator to handle nested object formatting */ /* internal iterator to handle nested object formatting */
static int static int
virQEMUBuildCommandLineJSONIterate(const char *key, virQEMUBuildCommandLineJSONIterate(const char *key,
const virJSONValue *value, virJSONValuePtr value,
void *opaque) void *opaque)
{ {
struct virQEMUCommandLineJSONIteratorData *data = opaque; struct virQEMUCommandLineJSONIteratorData *data = opaque;
@ -140,7 +140,7 @@ virQEMUBuildCommandLineJSONIterate(const char *key,
static int static int
virQEMUBuildCommandLineJSONRecurse(const char *key, virQEMUBuildCommandLineJSONRecurse(const char *key,
const virJSONValue *value, virJSONValuePtr value,
virBufferPtr buf, virBufferPtr buf,
virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc, virQEMUBuildCommandLineJSONArrayFormatFunc arrayFunc,
bool nested) bool nested)
@ -225,7 +225,7 @@ virQEMUBuildCommandLineJSONRecurse(const char *key,
* Returns 0 on success -1 on error. * Returns 0 on success -1 on error.
*/ */
int int
virQEMUBuildCommandLineJSON(const virJSONValue *value, virQEMUBuildCommandLineJSON(virJSONValuePtr value,
virBufferPtr buf, virBufferPtr buf,
virQEMUBuildCommandLineJSONArrayFormatFunc array) virQEMUBuildCommandLineJSONArrayFormatFunc array)
{ {
@ -264,7 +264,7 @@ virQEMUBuildObjectCommandlineFromJSON(const char *type,
char * char *
virQEMUBuildDriveCommandlineFromJSON(const virJSONValue *srcdef) virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr srcdef)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
char *ret = NULL; char *ret = NULL;

View File

@ -30,16 +30,16 @@
# include "virstorageencryption.h" # include "virstorageencryption.h"
typedef int (*virQEMUBuildCommandLineJSONArrayFormatFunc)(const char *key, typedef int (*virQEMUBuildCommandLineJSONArrayFormatFunc)(const char *key,
const virJSONValue *array, virJSONValuePtr array,
virBufferPtr buf); virBufferPtr buf);
int virQEMUBuildCommandLineJSONArrayBitmap(const char *key, int virQEMUBuildCommandLineJSONArrayBitmap(const char *key,
const virJSONValue *array, virJSONValuePtr array,
virBufferPtr buf); virBufferPtr buf);
int virQEMUBuildCommandLineJSONArrayNumbered(const char *key, int virQEMUBuildCommandLineJSONArrayNumbered(const char *key,
const virJSONValue *array, virJSONValuePtr array,
virBufferPtr buf); virBufferPtr buf);
int virQEMUBuildCommandLineJSON(const virJSONValue *value, int virQEMUBuildCommandLineJSON(virJSONValuePtr value,
virBufferPtr buf, virBufferPtr buf,
virQEMUBuildCommandLineJSONArrayFormatFunc array); virQEMUBuildCommandLineJSONArrayFormatFunc array);
@ -47,7 +47,7 @@ char *virQEMUBuildObjectCommandlineFromJSON(const char *type,
const char *alias, const char *alias,
virJSONValuePtr props); virJSONValuePtr props);
char *virQEMUBuildDriveCommandlineFromJSON(const virJSONValue *src); char *virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr src);
void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str); void virQEMUBuildBufferEscapeComma(virBufferPtr buf, const char *str);
void virQEMUBuildLuksOpts(virBufferPtr buf, void virQEMUBuildLuksOpts(virBufferPtr buf,

View File

@ -2990,7 +2990,7 @@ static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
static int static int
virStorageSourceParseBackingJSONDeflattenWorker(const char *key, virStorageSourceParseBackingJSONDeflattenWorker(const char *key,
const virJSONValue *value, virJSONValuePtr value,
void *opaque) void *opaque)
{ {
virJSONValuePtr retobj = opaque; virJSONValuePtr retobj = opaque;