
On 09/10/2012 11:19 AM, Christophe Fergeau wrote:
Hey,
On Fri, Sep 07, 2012 at 03:56:34PM +0200, Martin Kletzander wrote:
On 09/05/2012 11:27 AM, Michal Privoznik wrote:
+ +static const gchar * +gvir_designer_domain_get_preferred_nic_model(GVirDesignerDomain *design, + GError **error) +{ + const gchar *ret = NULL; + OsinfoDeviceLink *link = NULL;
You are using "link" here which shadows some global declaration. I'm saying "some" because the compiler told me so, but after many files I wasn't so eager to find it, so I don't know which one. Anyway changing it to dev_link (as you use everywhere else) worked.
Probably link(3) which creates hardlinks.
Oh, right. I was looking at the code and it starts looking as something else than C sometimes. Thanks for "waking me up" :)
+ + GVirConfigDomainInterface *ret; + const gchar *model = NULL; + + model = gvir_designer_domain_get_preferred_nic_model(design, error); + + ret = GVIR_CONFIG_DOMAIN_INTERFACE(gvir_config_domain_interface_network_new());
I can't find the function anywhere, even though it isn't defined automagically (IIUC), but it compiles (I wonder what the macro does in here).
$prefix/include/libvirt-gconfig-1.0/libvirt-gconfig/libvirt-gconfig-interface.h has: #define GVIR_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_INTERFACE, GVirConfigInterface)) which is C cast + runtime type check. This is used everywhere in GObject land. gvir_config_domain_interface_network_new is defined in libvirt-gconfig-domain-interface-network.h
Thanks, but I have to look inside this one, anyway. You confirmed me what I thought this is what the function is doing, but I saw no need for cast in here. Now I see it has to be changed from InterfaceNetwork to Interface. I guess this is some kind of polymorphism/inheritance design in glib. As I said before, I'm not very familiar with glib (and similar), I just wanted to check Michal's code and give it some attention :) Have a nice day, Martin