From ecb01c42d9f757167fb4ff09517a68244cfd66de Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 3 Mar 2004 18:10:22 +0000 Subject: Simplify by not using a temporary variable, and clarify the documentation. 2004-03-03 Federico Mena Quintero * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by not using a temporary variable, and clarify the documentation. Fixes #136008. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkfilesystem.c | 24 +++++++++++------------- 6 files changed, 41 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index c29e19893e..3fb14275ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-03-03 Federico Mena Quintero + + * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by + not using a temporary variable, and clarify the documentation. + Fixes #136008. + 2004-03-03 Mark McLoughlin * gtk/gtkexpander.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c29e19893e..3fb14275ee 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +2004-03-03 Federico Mena Quintero + + * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by + not using a temporary variable, and clarify the documentation. + Fixes #136008. + 2004-03-03 Mark McLoughlin * gtk/gtkexpander.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c29e19893e..3fb14275ee 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +2004-03-03 Federico Mena Quintero + + * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by + not using a temporary variable, and clarify the documentation. + Fixes #136008. + 2004-03-03 Mark McLoughlin * gtk/gtkexpander.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c29e19893e..3fb14275ee 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +2004-03-03 Federico Mena Quintero + + * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by + not using a temporary variable, and clarify the documentation. + Fixes #136008. + 2004-03-03 Mark McLoughlin * gtk/gtkexpander.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c29e19893e..3fb14275ee 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +2004-03-03 Federico Mena Quintero + + * gtk/gtkfilesystem.c (gtk_file_system_get_parent): Simplify by + not using a temporary variable, and clarify the documentation. + Fixes #136008. + 2004-03-03 Mark McLoughlin * gtk/gtkexpander.c: diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 8be7443bbf..156d352f13 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -497,12 +497,13 @@ gtk_file_system_volume_render_icon (GtkFileSystem *file_system, * @parent: location to store parent path name * @error: location to store error, or %NULL * - * Gets the name of the parent folder of a file. + * Gets the name of the parent folder of a path. If the path has no parent, as when + * you request the parent of a file system root, then @parent will be set to %NULL. * - * Return value: TRUE if the operation was successful; note that in this case @parent - * can be returned as %NULL if the base @path has no parent folder (i.e. if it is - * already a file system root). If the operation fails, this function returns FALSE - * and sets the @error value if it is specified. + * Return value: %TRUE if the operation was successful: @parent will be set to + * the name of the @path's parent, or to %NULL if @path is already a file system + * root. If the operation fails, this function returns %FALSE, sets @parent to + * NULL, and sets the @error value if it is specified. **/ gboolean gtk_file_system_get_parent (GtkFileSystem *file_system, @@ -510,21 +511,18 @@ gtk_file_system_get_parent (GtkFileSystem *file_system, GtkFilePath **parent, GError **error) { - GtkFilePath *tmp_parent = NULL; gboolean result; g_return_val_if_fail (GTK_IS_FILE_SYSTEM (file_system), FALSE); g_return_val_if_fail (path != NULL, FALSE); + g_return_val_if_fail (parent != NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - result = GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_parent (file_system, path, &tmp_parent, error); - g_assert (result || tmp_parent == NULL); + *parent = NULL; + + result = GTK_FILE_SYSTEM_GET_IFACE (file_system)->get_parent (file_system, path, parent, error); + g_assert (result || *parent == NULL); - if (parent) - *parent = tmp_parent; - else - gtk_file_path_free (tmp_parent); - return result; } -- cgit v1.2.1