From 721cc304780cf10fdbd25d35e3b2eca22cae3daf Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Thu, 16 Dec 2010 05:18:41 +0100 Subject: Overall cleanup. * Add missing asserts to exported functions. * Unify formatting. * Fix the gtk-doc comment for ld_symbol_category_set_human_name(). * Make ld_library_load() reflect it's declaration. * Remove an unused variable in ld_library_load_cb(). * Change all char's to gchar's. --- src/ld-canvas.c | 8 ++++++++ src/ld-library.c | 16 +++++++--------- src/ld-lua.c | 3 +++ src/ld-symbol-category.c | 14 +++++--------- src/ld-symbol.c | 1 - src/logdiag.c | 3 ++- 6 files changed, 25 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ld-canvas.c b/src/ld-canvas.c index dcab249..07d7a51 100644 --- a/src/ld-canvas.c +++ b/src/ld-canvas.c @@ -384,6 +384,9 @@ ld_canvas_new (void) void ld_canvas_set_document (LdCanvas *self, LdDocument *document) { + g_return_if_fail (LD_IS_CANVAS (self)); + g_return_if_fail (LD_IS_DOCUMENT (document)); + if (self->priv->document) g_object_unref (self->priv->document); @@ -403,6 +406,7 @@ ld_canvas_set_document (LdCanvas *self, LdDocument *document) LdDocument * ld_canvas_get_document (LdCanvas *self) { + g_return_val_if_fail (LD_IS_CANVAS (self), NULL); return self->priv->document; } @@ -416,6 +420,9 @@ ld_canvas_get_document (LdCanvas *self) void ld_canvas_set_library (LdCanvas *self, LdLibrary *library) { + g_return_if_fail (LD_IS_CANVAS (self)); + g_return_if_fail (LD_IS_LIBRARY (library)); + if (self->priv->library) g_object_unref (self->priv->library); @@ -435,6 +442,7 @@ ld_canvas_set_library (LdCanvas *self, LdLibrary *library) LdLibrary * ld_canvas_get_library (LdCanvas *self) { + g_return_val_if_fail (LD_IS_CANVAS (self), NULL); return self->priv->library; } diff --git a/src/ld-library.c b/src/ld-library.c index 2bd0365..4c980d0 100644 --- a/src/ld-library.c +++ b/src/ld-library.c @@ -43,11 +43,10 @@ struct _LdLibraryPrivate G_DEFINE_TYPE (LdLibrary, ld_library, G_TYPE_OBJECT); -static void -ld_library_finalize (GObject *gobject); +static void ld_library_finalize (GObject *gobject); -static LdSymbolCategory *load_category - (LdLibrary *self, const char *path, const char *name); +static LdSymbolCategory *load_category (LdLibrary *self, + const gchar *path, const gchar *name); static gboolean load_category_cb (const gchar *base, const gchar *filename, gpointer userdata); static void load_category_symbol_cb (LdSymbol *symbol, gpointer user_data); @@ -175,7 +174,7 @@ LoadCategoryData; * Loads a category into the library. */ static LdSymbolCategory * -load_category (LdLibrary *self, const char *path, const char *name) +load_category (LdLibrary *self, const gchar *path, const gchar *name) { LdSymbolCategory *cat; gchar *icon_file, *category_file; @@ -353,16 +352,16 @@ LibraryLoadData; * Load the contents of a directory into the library. */ gboolean -ld_library_load (LdLibrary *self, const char *path) +ld_library_load (LdLibrary *self, const gchar *directory) { LibraryLoadData data; g_return_val_if_fail (LD_IS_LIBRARY (self), FALSE); - g_return_val_if_fail (path != NULL, FALSE); + g_return_val_if_fail (directory != NULL, FALSE); data.self = self; data.changed = FALSE; - foreach_dir (path, ld_library_load_cb, &data, NULL); + foreach_dir (directory, ld_library_load_cb, &data, NULL); if (data.changed) g_signal_emit (self, LD_LIBRARY_GET_CLASS (self)->changed_signal, 0); @@ -379,7 +378,6 @@ static gboolean ld_library_load_cb (const gchar *base, const gchar *filename, gpointer userdata) { LdSymbolCategory *cat; - gchar *categ_path; LibraryLoadData *data; g_return_val_if_fail (base != NULL, FALSE); diff --git a/src/ld-lua.c b/src/ld-lua.c index 4ed68eb..f51ab1c 100644 --- a/src/ld-lua.c +++ b/src/ld-lua.c @@ -223,6 +223,8 @@ gboolean ld_lua_check_file (LdLua *self, const gchar *filename) { g_return_val_if_fail (LD_IS_LUA (self), FALSE); + g_return_val_if_fail (filename != NULL, FALSE); + return g_str_has_suffix (filename, ".lua") && g_file_test (filename, G_FILE_TEST_IS_REGULAR); } @@ -297,6 +299,7 @@ ld_lua_private_draw (LdLua *self, LdLuaSymbol *symbol, cairo_t *cr) g_return_if_fail (LD_IS_LUA (self)); g_return_if_fail (LD_IS_LUA_SYMBOL (symbol)); + g_return_if_fail (cr != NULL); data.symbol = symbol; data.cr = cr; diff --git a/src/ld-symbol-category.c b/src/ld-symbol-category.c index 9c74e90..b7963aa 100644 --- a/src/ld-symbol-category.c +++ b/src/ld-symbol-category.c @@ -49,16 +49,11 @@ enum PROP_IMAGE_PATH }; -static void -ld_symbol_category_get_property (GObject *object, guint property_id, +static void ld_symbol_category_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); - -static void -ld_symbol_category_set_property (GObject *object, guint property_id, +static void ld_symbol_category_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); - -static void -ld_symbol_category_finalize (GObject *gobject); +static void ld_symbol_category_finalize (GObject *gobject); static void @@ -179,6 +174,7 @@ ld_symbol_category_finalize (GObject *gobject) G_OBJECT_CLASS (ld_symbol_category_parent_class)->finalize (gobject); } + /** * ld_symbol_category_new: * @name: The name of the new category. @@ -235,7 +231,7 @@ ld_symbol_category_get_name (LdSymbolCategory *self) /** * ld_symbol_category_set_human_name: * @self: An #LdSymbolCategory object. - * @name: The new localized human name for this category. + * @human_name: The new localized human name for this category. */ void ld_symbol_category_set_human_name (LdSymbolCategory *self, diff --git a/src/ld-symbol.c b/src/ld-symbol.c index 6005776..014016e 100644 --- a/src/ld-symbol.c +++ b/src/ld-symbol.c @@ -90,7 +90,6 @@ enum 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, const GValue *value, GParamSpec *pspec); diff --git a/src/logdiag.c b/src/logdiag.c index 324180a..9752978 100644 --- a/src/logdiag.c +++ b/src/logdiag.c @@ -15,7 +15,8 @@ #include "ld-window-main.h" -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { GtkWidget *wnd; -- cgit v1.2.3-70-g09d2