Skip to content

leaflet: initialize a variable

while trying to compile libhandy, I bumped into a gcc warning.

[22/34] Compiling C object 'src/src@@handy-0.0@sha/hdy-leaflet.c.o'.
../src/hdy-leaflet.c: In function ‘hdy_leaflet_size_allocate’:
../src/hdy-leaflet.c:1488:16: warning: ‘max_child_size’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       end_size += orientation == GTK_ORIENTATION_HORIZONTAL ?
         (box_homogeneous ? max_child_size : child_info->nat.width) :
         (box_homogeneous ? max_child_size : child_info->nat.height);
../src/hdy-leaflet.c:1390:8: note: ‘max_child_size’ was declared here
   gint max_child_size;

I think this takes care of it, it moves the initialization of max_child_state in the scope of the case statement, as opposed to the if branch

cc @adrien.plazas

Edited by Jordan Petridis

Merge request reports