[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/16] qapi: introduce "size" type
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 02/16] qapi: introduce "size" type |
Date: |
Tue, 05 Jun 2012 22:39:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Il 22/05/2012 12:45, Laszlo Ersek ha scritto:
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
> qapi/qapi-visit-core.h | 4 ++++
> qapi/qapi-visit-core.c | 7 +++++++
> scripts/qapi.py | 2 +-
> 3 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h
> index e850746..bab2fec 100644
> --- a/qapi/qapi-visit-core.h
> +++ b/qapi/qapi-visit-core.h
> @@ -39,6 +39,9 @@ struct Visitor
> const char *kind, const char *name, Error **errp);
>
> void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error
> **errp);
> + /* visit_type_size() falls back to (*type_int)() if type_size is unset */
> + void (*type_size)(Visitor *v, int64_t *obj, const char *name,
> + Error **errp);
> void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp);
> void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp);
> void (*type_number)(Visitor *v, double *obj, const char *name,
> @@ -69,6 +72,7 @@ void visit_end_optional(Visitor *v, Error **errp);
> void visit_type_enum(Visitor *v, int *obj, const char *strings[],
> const char *kind, const char *name, Error **errp);
> void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error
> **errp);
> +void visit_type_size(Visitor *v, int64_t *obj, const char *name, Error
> **errp);
> void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp);
> void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp);
> void visit_type_number(Visitor *v, double *obj, const char *name, Error
> **errp);
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index df1ed5c..ea31cf5 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -95,6 +95,13 @@ void visit_type_int(Visitor *v, int64_t *obj, const char
> *name, Error **errp)
> }
> }
>
> +void visit_type_size(Visitor *v, int64_t *obj, const char *name, Error
> **errp)
> +{
> + if (!error_is_set(errp)) {
> + (v->type_size ? v->type_size : v->type_int)(v, obj, name, errp);
> + }
> +}
> +
> void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
> {
> if (!error_is_set(errp)) {
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index e062336..6aebb0f 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -157,7 +157,7 @@ def is_enum(name):
> def c_type(name):
> if name == 'str':
> return 'char *'
> - elif name == 'int':
> + elif name == 'int' or name == 'size':
> return 'int64_t'
> elif name == 'bool':
> return 'bool'
Reviewed-by: Paolo Bonzini <address@hidden>
Paolo
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH 02/16] qapi: introduce "size" type,
Paolo Bonzini <=