Re: [libvirt] PATCH: Fix default bus type selection for disks

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> On Tue, May 13, 2008 at 10:31:10AM +0200, Jim Meyering wrote:
>> "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
>>
>> in spite of the proliferation of casts --
>> That's not good for readability/maintainability.
>>
>> What do you think of this?
>>
>>     static inline char *xml2char(xmlChar *x) { return (char *) x; }
>>
>> The uses are still ugly, but at least they're safer:
>> (note that the parameter cannot be a "const" pointer because the
>> incoming xmlChar* is almost always non-const, as it must be, since
>> it's going to be freed).
>
> I'd suggest going one better and defining a thing wrapper around the
> xmlNodeGetProp method
>
>     char *virXMLGetProp(xmlNodePtr *node, const char *name) {
>         return (char *)xmlNodeGetProp(node, BAD_CAST name);
>     }
>
> That should let us get rid of all these casts throughout the code

Good idea.
Do you want to do it?  or shall I...

> The only potential issue would be that xmlChar * is technically supposed to
> be free via the xmlFree() method, rather than free(), but I believe they're
> defined to be identical unless special debug allocators are registered ?

Right.
When I removed some useless if-before-xmlFree tests,
Daniel Veillard assured us that xmlFree-in-libvirt
should always be "free", so this is ok.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]