i3 - improved tiling WM


Avoid use of uninitialized variable in print_battery_info

Patch status: merged

Patch by Alexander Monakov

Long description:

The boolean flag 'watt_as_unit' may be used without being initialized if the
configured battery path does not contain expected statistics (for example if
it is misconfigured and points to AC adapter info or simply an unrelated file).

Even though it does not cause ill effects, it causes a warning (true positive)
when running i3status under Valgrind.  Initialize the variable to make code
well-defined.

To apply this patch, use:
curl http://cr.i3wm.org/patch/693/raw.patch | git am

b/src/print_battery_info.c

20
@@ -44,7 +44,7 @@ void print_battery_info(yajl_gen json_gen, char *buffer, int number, const char
21
         char consumptionbuf[256];
22
         const char *walk, *last;
23
         char *outwalk = buffer;
24
-        bool watt_as_unit;
25
+        bool watt_as_unit = false;
26
         bool colorful_output = false;
27
         int full_design = -1,
28
             remaining = -1,