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

Re: [libvirt] [libvirt-glib 11/37] Implement gvir_config_os_set_os_type



On Tue, Nov 15, 2011 at 3:18 PM, Christophe Fergeau <cfergeau redhat com> wrote:
> What do you mean exactly? Having a warning in genum_get_nick and drop the
> != NULL test? Or only to add the warning in genum_get_nick, and not add a
> warning here? I can easily add a g_warn_if_reached() in genum_get_nick

Yeah, I meant putting  g_warn_if_reached() in genum_get_nick().

However, thinking a bit more about it, genum_get_nick() shouldn't warn
if given a value that has no associated nick, because enums shouldn't
be limited to their associated name, and those value would be
perfectly valid, but should return NULL and that's it.

However, siliently not doing anything is misleading. So instead of

if (type_str != NULL)
  xmlNodeSetContent(node, (xmlChar*)type_str);

I would do (or similar):

g_return_if_fail (type_str != NULL);
xmlNodeSetContent(node, (xmlChar*)type_str);


cheers

-- 
Marc-André Lureau


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