The newly released gcc-4.7.0 complains about "m" being used
uninitialized in change_current_mood(). gcc is wrong, but this is
not obvious to see: In change_current_mood(), "m" is only going to
be used if load_mood() returns non-negative. This happens only on
success, when load_mood() returns 1. In this case "m" was previously
set to mlpd.m which was initialized to NULL at the top of load_mood()
and later set to the newly allocated mood structure.
This patch makes it easier for gcc by initializing "m" to NULL
upfront. This causes the warning to go away.
char *mood_name;
struct osl_object mood_def;
struct mood_line_parser_data mlpd = {.line_num = 0};
- int ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
+ int ret;
+ *m = NULL;
+ ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
if (ret < 0)
return ret;
if (!*mood_name)