[Libvir] Re: [PATCH] allocate virBuffer* routines
Daniel Veillard
veillard at redhat.com
Tue Apr 24 13:44:27 UTC 2007
On Tue, Apr 24, 2007 at 09:48:09PM +0900, S.Sakamoto wrote:
> Hi, Daniel
>
> > I can't help thinking this method
> > would be better off using the dyn allocated virBuffer* routines instead
> > of a static string & snprintf.
> Oops, sorry,
> virBuffer* routines had entirely slipped my mind.
> Buffer is allocated dynamically when I use this.
>
> therefore, I make the patch which virBuffer* routines is in.
Cool, way better :-) , and honnestly the buffer based code is
more readable.
Applied and commited,
> + buf.content = malloc(1000);
> + if (buf.content == NULL)
> + return -1;
Except here where I changed it to raise an error:
if (buf.content == NULL) {
virXendError(xend, VIR_ERR_NO_MEMORY, _("allocate new buffer"));
return -1;
}
(did the same for urlencode a few lines down too)
Thanks a lot !
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