[libvirt] libvirt-java storage support and refactoring
Daniel Veillard
veillard at redhat.com
Mon Aug 4 05:56:24 UTC 2008
On Mon, Aug 04, 2008 at 07:46:05AM +0200, Toth Istvan wrote:
> On Sun, 2008-08-03 at 05:56 -0400, Daniel Veillard wrote:
> > How is it smaller code ?
>
> Actually, that's not the new-style code, It's just the bugfixed one. I
> have not converted that file yet.
heh, okay :-)
> To see the new style code, look at the *Storage*.c files.
>
> A similar function looks like this there:
>
> JNIEXPORT jlong JNICALL Java_org_libvirt_StoragePool__1storageVolCreateXML
> (JNIEnv *env, jobject obj, jlong VSPP, jstring xmlDesc, jint flags){
> return generic_CreateDefineXML_with_flags(env, obj, VSPP, xmlDesc, flags, (void* (*)(void*, const char *, unsigned int))&virStorageVolCreateXML);
> }
>
ah, yes, I see now !
> >
> > It seems to be that the old code didn't ever tried to free allocated strings
> > and the new one does, which is the explanation of the code grows. I would side
> > with Chris on the usage of macros instead of call like this. There is 2 reasons
> > one is the readability, but also the static type checking.
>
> Actually, the old-style function does static type checking, it's just
> new style that suffers there.
>
> Using macros is a great idea, that may get rid of all those nasty casts.
yes that's probably the best alternative,
thanks !
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