[gtk/wip/baedert/for-master: 99/146] box: Don't do casts before preconditions
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 99/146] box: Don't do casts before preconditions
- Date: Mon, 9 Sep 2019 14:40:02 +0000 (UTC)
commit 043dfe25305fd1f199deba74c4a2cf8f31f9e881
Author: Timm Bäder <mail baedert org>
Date: Wed Aug 28 09:26:29 2019 +0200
box: Don't do casts before preconditions
gtk/gtkbox.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index bd016c98c7..f6195dbfbb 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -550,7 +550,7 @@ gtk_box_forall (GtkContainer *container,
* @sibling: (nullable): the sibling to move @child after, or %NULL
*
* Inserts @child in the position after @sibling in the list
- * of @box children. If @sibling is %NULL, insert @child at
+ * of @box children. If @sibling is %NULL, insert @child at
* the first position.
*/
void
@@ -558,11 +558,14 @@ gtk_box_insert_child_after (GtkBox *box,
GtkWidget *child,
GtkWidget *sibling)
{
- GtkWidget *widget = GTK_WIDGET (box);
+ GtkWidget *widget;
g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (gtk_widget_get_parent (child) == NULL);
+
+ widget = GTK_WIDGET (box);
+
if (sibling)
{
g_return_if_fail (GTK_IS_WIDGET (sibling));
@@ -593,11 +596,14 @@ gtk_box_reorder_child_after (GtkBox *box,
GtkWidget *child,
GtkWidget *sibling)
{
- GtkWidget *widget = GTK_WIDGET (box);
+ GtkWidget *widget;
g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (GTK_IS_WIDGET (child));
- g_return_if_fail (gtk_widget_get_parent (child) == widget);
+ g_return_if_fail (gtk_widget_get_parent (child) == (GtkWidget *)box);
+
+ widget = GTK_WIDGET (box);
+
if (sibling)
{
g_return_if_fail (GTK_IS_WIDGET (sibling));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]