libnm: fix warning about returning zero instead of %NULL in _nm_object_create()

clang warns:
    make[4]: Entering directory `./NetworkManager/libnm'
      CC       nm-object.lo
    nm-object.c:640:11: error: expression which evaluates to zero treated as a null pointer constant of type 'GObject *' (aka 'struct _GObject *') [-Werror,-Wnon-literal-null-conversion]
                            return G_TYPE_INVALID;
                                   ^~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:57:26: note: expanded from macro 'G_TYPE_INVALID'
    #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:221:36: note: expanded from macro 'G_TYPE_MAKE_FUNDAMENTAL'
    #define G_TYPE_MAKE_FUNDAMENTAL(x)      ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nm-object.c:655:11: error: expression which evaluates to zero treated as a null pointer constant of type 'GObject *' (aka 'struct _GObject *') [-Werror,-Wnon-literal-null-conversion]
                            return G_TYPE_INVALID;
                                   ^~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:57:26: note: expanded from macro 'G_TYPE_INVALID'
    #define G_TYPE_INVALID                  G_TYPE_MAKE_FUNDAMENTAL (0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/glib-2.0/gobject/gtype.h:221:36: note: expanded from macro 'G_TYPE_MAKE_FUNDAMENTAL'
    #define G_TYPE_MAKE_FUNDAMENTAL(x)      ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2 errors generated.

Fixes: b3c4917b0f
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-09-22 09:53:20 +02:00
parent 85566e46d9
commit 351cf9b328

View file

@ -637,7 +637,7 @@ _nm_object_create (GType type, GDBusConnection *connection, const char *path)
if (!proxy) {
g_warning ("Could not create proxy for %s: %s.", path, error->message);
g_error_free (error);
return G_TYPE_INVALID;
return NULL;
}
ret = g_dbus_proxy_call_sync (proxy,
@ -652,7 +652,7 @@ _nm_object_create (GType type, GDBusConnection *connection, const char *path)
g_warning ("Could not fetch property '%s' of interface '%s' on %s: %s\n",
type_data->property, type_data->interface, path, error->message);
g_error_free (error);
return G_TYPE_INVALID;
return NULL;
}
g_variant_get (ret, "(v)", &value);