[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 22/24] qapi: New parse_qapi_name()
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-block] [PATCH 22/24] qapi: New parse_qapi_name() |
Date: |
Tue, 28 Feb 2017 19:02:56 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 27.02.2017 um 12:20 hat Markus Armbruster geschrieben:
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> include/qapi/util.h | 2 ++
> qapi/qapi-util.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> tests/test-qapi-util.c | 34 ++++++++++++++++++++++++++++++++++
> 3 files changed, 83 insertions(+)
>
> diff --git a/include/qapi/util.h b/include/qapi/util.h
> index 7ad26c0..7436ed8 100644
> --- a/include/qapi/util.h
> +++ b/include/qapi/util.h
> @@ -14,4 +14,6 @@
> int qapi_enum_parse(const char * const lookup[], const char *buf,
> int max, int def, Error **errp);
>
> +int parse_qapi_name(const char *name, bool complete);
> +
> #endif
> diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
> index 818730a..53b27e2 100644
> --- a/qapi/qapi-util.c
> +++ b/qapi/qapi-util.c
> @@ -33,3 +33,50 @@ int qapi_enum_parse(const char * const lookup[], const
> char *buf,
> error_setg(errp, "invalid parameter value: %s", buf);
> return def;
> }
> +
> +/*
> + * Parse a valid QAPI name from @str.
> + * A valid name consists of letters, digits, hyphen and underscore.
> + * It may be prefixed by __RFQDN_ (downstream extension), where RFQDN
> + * may contain only letters, digits and hyphen.
And '.' according to the code below.
> + * The special exception for enumeration names is not implemented.
> + * See docs/qapi-code-gen.txt for more on QAPI naming rules.
> + * Keep this consistent with scripts/qapi.py!
> + * If @complete, the parse fails unless it consumes @str completely.
> + * Return its length on success, -1 on failure.
> + */
Kevin
- [Qemu-block] [PATCH 08/24] qobject: Propagate parse errors through qobject_from_jsonv(), (continued)
- [Qemu-block] [PATCH 08/24] qobject: Propagate parse errors through qobject_from_jsonv(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 19/24] qapi: Improve how keyval input visitor reports unexpected dicts, Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 12/24] qobject: Propagate parse errors through qobject_from_json(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 22/24] qapi: New parse_qapi_name(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 07/24] qapi: Factor out common qobject_input_get_keyval(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 15/24] test-visitor-serialization: Pass &error_abort to qobject_from_json(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 14/24] check-qjson: Test errors from qobject_from_json(), Markus Armbruster, 2017/02/27
- [Qemu-block] [PATCH 23/24] keyval: Restrict key components to valid QAPI names, Markus Armbruster, 2017/02/27