[Libvir] [PATCH] Enhance virBuffer code

Daniel Veillard veillard at redhat.com
Fri Dec 14 13:22:24 UTC 2007


On Fri, Dec 14, 2007 at 11:06:36AM +0000, Richard W.M. Jones wrote:
> OK, how about this?
> 
> Rich.
> 
> +    for (p = str; *p; ++p) {
> +        /* Want to escape only A-Z and 0-9.  This may not work on 
> EBCDIC. */
> +        if (isascii (*p) && isalnum (*p))
> +            grow_size++;
> +        else
> +            grow_size += 3; /* %ab */
> +    }

  Huh ? How much time and context informations are needed to understand
what that code does. Compare to the time needed for the explicit ranges.
I really don't see any progress there, and still object to the EBCDIC
argument, on such machine you usually don't even get c99 like compilers.
This makes no sense to me, really !
  Add /* Not EBCDIC safe */ comment on top of the range if you really
believe someone is gonna cut and paste libvirt escaping code into a
different context, but please keep the semantic of the code clear, it's
#1 IMHO for maintainance.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list