From 1d956964e2d6b183f65620505831527a8089f697 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 5 Dec 2010 15:21:00 +0100 Subject: Random fixes. Mostly found by -Wextra. --- src/ld-library.c | 11 ++++++++--- src/ld-lua-symbol.c | 1 + src/ld-lua.c | 4 ++-- src/ld-symbol.c | 12 ++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ld-library.c b/src/ld-library.c index 8fe3a41..de2a052 100644 --- a/src/ld-library.c +++ b/src/ld-library.c @@ -8,6 +8,8 @@ * */ +#include + #include #include "config.h" @@ -71,7 +73,7 @@ ld_library_class_init (LdLibraryClass *klass) * Contents of the library have changed. */ klass->changed_signal = g_signal_new - ("changed", G_TYPE_FROM_CLASS (object_class), + ("changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); @@ -423,8 +425,11 @@ ld_library_remove_child (LdLibrary *self, GObject *child) g_return_if_fail (LD_IS_LIBRARY (self)); g_return_if_fail (G_IS_OBJECT (child)); - g_object_unref (child); - self->priv->children = g_slist_remove (self->priv->children, child); + if (g_slist_find (self->priv->children, child)) + { + g_object_unref (child); + self->priv->children = g_slist_remove (self->priv->children, child); + } } /** diff --git a/src/ld-lua-symbol.c b/src/ld-lua-symbol.c index 42fb31b..5944c65 100644 --- a/src/ld-lua-symbol.c +++ b/src/ld-lua-symbol.c @@ -19,6 +19,7 @@ #include "ld-lua.h" #include "ld-lua-symbol.h" +#include "ld-lua-private.h" #include "ld-lua-symbol-private.h" diff --git a/src/ld-lua.c b/src/ld-lua.c index 8fadf20..54ba0c4 100644 --- a/src/ld-lua.c +++ b/src/ld-lua.c @@ -327,6 +327,7 @@ ld_lua_private_draw_cb (lua_State *L) /* Call the function do draw the symbol. */ push_cairo_object (L, data->cr); lua_pcall (L, 1, 0, 0); + return 0; } /** @@ -418,7 +419,6 @@ static int process_registration (lua_State *L) { LdLuaSymbol *symbol; - const gchar *name; gchar *human_name; int i, type, types[] = @@ -439,7 +439,7 @@ process_registration (lua_State *L) human_name = get_translation (L, 2); if (!human_name) - human_name = g_strdup (name); + human_name = g_strdup (symbol->priv->name); symbol->priv->human_name = human_name; if (!read_symbol_area (L, 3, &symbol->priv->area)) diff --git a/src/ld-symbol.c b/src/ld-symbol.c index 5919b8e..6005776 100644 --- a/src/ld-symbol.c +++ b/src/ld-symbol.c @@ -88,16 +88,12 @@ enum PROP_AREA }; -static void -ld_symbol_get_property (GObject *object, guint property_id, +static void ld_symbol_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void -ld_symbol_set_property (GObject *object, guint property_id, +static void ld_symbol_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void ld_symbol_finalize (GObject *gobject); - static void ld_symbol_class_init (LdSymbolClass *klass) @@ -192,7 +188,7 @@ ld_symbol_get_name (LdSymbol *self) { LdSymbolClass *klass; - g_return_if_fail (LD_IS_SYMBOL (self)); + g_return_val_if_fail (LD_IS_SYMBOL (self), NULL); klass = LD_SYMBOL_GET_CLASS (self); g_return_val_if_fail (klass->get_name != NULL, NULL); @@ -210,7 +206,7 @@ ld_symbol_get_human_name (LdSymbol *self) { LdSymbolClass *klass; - g_return_if_fail (LD_IS_SYMBOL (self)); + g_return_val_if_fail (LD_IS_SYMBOL (self), NULL); klass = LD_SYMBOL_GET_CLASS (self); g_return_val_if_fail (klass->get_human_name != NULL, NULL); -- cgit v1.2.3-70-g09d2