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

Re: [libvirt] [PATCH v3 2/8] Qemu arbitrary command-line arguments.



On 07/02/2010 09:18 AM, Chris Lalancette wrote:
> +        if (tmp[0] == '\0') {
> +            qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                            "%s", _("Empty qemu environment name specified"));
> +            goto error;
> +        }
> +        if (strspn(tmp, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_") == 0) {
> +            qemuReportError(VIR_ERR_INTERNAL_ERROR,
> +                            "%s", _("Invalid environment name, it must begin with a letter or underscore"));
> +            goto error;
> +        }

Rather than using strspn here, why not go with a more efficient
c_isdigit()?  For that matter, checking tmp[0]!='\0' can be subsumed by
the c_isdigit(tmp[0]), but then your error messages would have to be merged.

-- 
Eric Blake
volunteer cygwin package maintainer

CYGWIN-ANNOUNCE UNSUBSCRIBE INFO:
=================================
To unsubscribe to the cygwin-announce mailing list, look at the
"List-Unsubscribe: " tag in the email header of this message.  Send email
to the address specified there.  It will be in the format:

cygwin-announce-unsubscribe-YOU=YOURDOMAIN COM cygwin com

If you need more information on unsubscribing, start reading here:

http://sourceware.org/lists.html#unsubscribe-simple

Please read *all* of the information on unsubscribing that is available
starting at this URL.


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