[glib] gfile: Use g_error_matches



commit 44372f4dd0a4a8aac1b66b820810b3f7bdf70513
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Dec 3 18:51:51 2013 -0800

    gfile: Use g_error_matches
    
    Make proper use of g_error_matches() instead of comparing only error codes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719455

 gio/gfile.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 4e25d38..65083ef 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -3758,7 +3758,7 @@ g_file_make_directory_with_parents (GFile         *file,
     return FALSE;
 
   g_file_make_directory (file, cancellable, &my_error);
-  if (my_error == NULL || my_error->code != G_IO_ERROR_NOT_FOUND)
+  if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
     {
       if (my_error)
         g_propagate_error (error, my_error);
@@ -3767,7 +3767,7 @@ g_file_make_directory_with_parents (GFile         *file,
 
   work_file = g_object_ref (file);
 
-  while (my_error != NULL && my_error->code == G_IO_ERROR_NOT_FOUND)
+  while (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
     {
       GFile *parent_file;
 
@@ -3786,7 +3786,7 @@ g_file_make_directory_with_parents (GFile         *file,
       g_object_unref (work_file);
       work_file = g_object_ref (parent_file);
 
-      if (my_error != NULL && my_error->code == G_IO_ERROR_NOT_FOUND)
+      if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
         list = g_list_prepend (list, parent_file);  /* Transfer ownership of ref */
       else
         g_object_unref (parent_file);


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