[glib/glib-2-30] Remove redundant checks



commit 56891ca4eee71b6255d11f05a01972d5e4915f97
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 17 20:27:16 2011 -0400

    Remove redundant checks
    
    g_set_error() handles error == NULL, so no need to check.
    Patch by Ignacio Casal Quinteiro.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640975

 glib/gconvert.c |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/glib/gconvert.c b/glib/gconvert.c
index c5845ca..d601cad 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -763,20 +763,18 @@ g_convert_with_iconv (const gchar *str,
 	      }
 	      break;
 	    case EILSEQ:
-	      if (error)
-		g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
-                                     _("Invalid byte sequence in conversion input"));
+              g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                                   _("Invalid byte sequence in conversion input"));
 	      have_error = TRUE;
 	      break;
 	    default:
-	      if (error)
-                {
-                  int errsv = errno;
-
-                  g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
-                               _("Error during conversion: %s"),
-                               g_strerror (errsv));
-                }
+              {
+                int errsv = errno;
+
+                g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
+                             _("Error during conversion: %s"),
+                             g_strerror (errsv));
+              }
 	      have_error = TRUE;
 	      break;
 	    }
@@ -804,9 +802,8 @@ g_convert_with_iconv (const gchar *str,
 	{
           if (!have_error)
             {
-	      if (error)
-		g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
-                                     _("Partial character sequence at end of input"));
+              g_set_error_literal (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+                                   _("Partial character sequence at end of input"));
               have_error = TRUE;
             }
 	}



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