widget: Avoid an unnecessary check
authorMohammed Sadiq <sadiq@sadiqpk.org>
Fri, 11 May 2018 01:39:45 +0000 (07:09 +0530)
committerMohammed Sadiq <sadiq@sadiqpk.org>
Fri, 11 May 2018 10:39:38 +0000 (16:09 +0530)
The preceding loop terminates when either the widget is NULL,
or if their type matches. There is no reason to check that again

gtk/gtkwidget.c

index 59b6409c9808f5aa79ff3e90d10d79ce1591a6d5..9ff1562367cf196ab47e5ddde7a7a53f952a4684 100644 (file)
@@ -8114,9 +8114,6 @@ gtk_widget_get_ancestor (GtkWidget *widget,
   while (widget && !g_type_is_a (G_OBJECT_TYPE (widget), widget_type))
     widget = widget->priv->parent;
 
-  if (!(widget && g_type_is_a (G_OBJECT_TYPE (widget), widget_type)))
-    return NULL;
-
   return widget;
 }