summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-05-03 17:23:44 +0100
committerVincent Sanders <vince@kyllikki.org>2015-05-03 17:40:27 +0100
commita375e58bb872feea4773a8791d68fbd6303a7000 (patch)
tree05d5fc84eb8a1c26f25f0630f5ee25877c9806b5 /render/box.c
parent7e6b86eb1ad6096d48bd7ddb10b827335293ec6c (diff)
downloadnetsurf-a375e58bb872feea4773a8791d68fbd6303a7000.tar.gz
netsurf-a375e58bb872feea4773a8791d68fbd6303a7000.tar.bz2
Silence incorrect warning from gcc 4.9
This makes the box_move_xy function return a value on all code paths. This was not really necessary as there is an assert in the path that could have returned without a value. The gcc optimiser seems unable to reason about this in this case causing a warning.
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/render/box.c b/render/box.c
index 30bafa904..c9bf61df3 100644
--- a/render/box.c
+++ b/render/box.c
@@ -481,15 +481,18 @@ enum box_walk_dir {
static inline struct box *box_move_xy(struct box *b, enum box_walk_dir dir,
int *x, int *y)
{
+ struct box *rb = NULL;
+
switch (dir) {
case BOX_WALK_CHILDREN:
b = b->children;
if (b == NULL)
- return NULL;
+ break;
*x += b->x;
*y += b->y;
if (!box_is_float(b)) {
- return b;
+ rb = b;
+ break;
}
/* Fall through */
@@ -503,39 +506,46 @@ static inline struct box *box_move_xy(struct box *b, enum box_walk_dir dir,
*x += b->x;
*y += b->y;
} while (box_is_float(b));
- return b;
+ rb = b;
+ break;
case BOX_WALK_PARENT:
*x -= b->x;
*y -= b->y;
- return b->parent;
+ rb = b->parent;
+ break;
case BOX_WALK_FLOAT_CHILDREN:
b = b->float_children;
if (b == NULL)
- return NULL;
+ break;
*x += b->x;
*y += b->y;
- return b;
+ rb = b;
+ break;
case BOX_WALK_NEXT_FLOAT_SIBLING:
*x -= b->x;
*y -= b->y;
b = b->next_float;
if (b == NULL)
- return NULL;
+ break;
*x += b->x;
*y += b->y;
- return b;
+ rb = b;
+ break;
case BOX_WALK_FLOAT_CONTAINER:
*x -= b->x;
*y -= b->y;
- return b->float_container;
+ rb = b->float_container;
+ break;
default:
assert(0 && "Bad box walk type.");
}
+
+ return rb;
}