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

Re: [Xen-devel] [PATCH v4 01/53] xen: add an optional string end parameter to parse_bool()



>>> On 23.08.17 at 19:33, <jgross@xxxxxxxx> wrote:
> @@ -163,20 +163,24 @@ void __init cmdline_parse(const char *cmdline)
>  #endif
>  }
>  
> -int __init parse_bool(const char *s)
> +int __init parse_bool(const char *s, const char *e)
>  {
> -    if ( !strcmp("no", s) ||
> -         !strcmp("off", s) ||
> -         !strcmp("false", s) ||
> -         !strcmp("disable", s) ||
> -         !strcmp("0", s) )
> +    unsigned int len;
> +
> +    len = e ? e - s : strlen(s);

If you don't mind, I'd like to see ASSERT(e >= s) added to the middle
part here; should be easily doable while committing.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.