Tóth István wrote:
> I've found that libvirt for the most part has a very perdicitble and 
> repetitive API (great design!), and  as a result I've found myself  
> copying the same code over and over again.
> I've decided to make generic JNI functions, that can handle multiple 
> libvirt functions  with function pointers.
> The generic functions are in generic.c and they are used extensively in 
> the new Storage JNI implementation.
> 
> I'd like to have your input on this architecture, my current plan is to 
> refactor all trivial JNI functions to use these generics, unless there 
> are objections.

(I haven't really read your patches, but...)

It's definitely good to get rid of a lot of the duplicated code.  However, you
might want to take a look at the ruby-libvirt bindings as a different way to do
it.  Basically, there are a few macros which generate much of the "duplicated"
type code, and in my opinion, it's a little easier to read than lots of function
callbacks.  The downside is that it's harder to debug with something like gdb,
but I'm not sure that is something you do with JNI bindings anyway.

Just a thought.

Chris Lalancette

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

Reply via email to