qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 22/24] qapi: New parse_qapi_name()


From: Kevin Wolf
Subject: Re: [Qemu-devel] [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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]