From: Carl Worth Date: Mon, 23 Sep 2013 04:10:58 +0000 (-0700) Subject: Add a few initializations to quiet compiler warnings. X-Git-Url: https://git.cworth.org/git?p=scherzo;a=commitdiff_plain;h=68466b09f103fd72188afe18f8d01f11f2163fde Add a few initializations to quiet compiler warnings. My manual analysis says that none of these are strictly necessary, (the various conditionals currently ensure that none of the variables are ever used uninitialized). But "gcc -O2" likes to complain, so these initializations keep it quiet. --- diff --git a/scherzo.c b/scherzo.c index d6b3af5..8c6d394 100644 --- a/scherzo.c +++ b/scherzo.c @@ -147,7 +147,8 @@ on_key_press_event (GtkWidget *widget, { scherzo_t *scherzo = user_data; int octave; - score_pitch_name_t pitch_name; + /* Initialize to keep the compiler quiet. */ + score_pitch_name_t pitch_name = SCORE_PITCH_C; score_pitch_t pitch; if (scherzo->challenge.note) @@ -253,7 +254,8 @@ on_key_release_event (unused (GtkWidget *widget), { scherzo_t *scherzo = user_data; int octave; - score_pitch_name_t pitch_name; + /* Initialize to keep the compiler quiet. */ + score_pitch_name_t pitch_name = SCORE_PITCH_NAME_C; score_pitch_t pitch; if (scherzo->challenge.note) diff --git a/score.c b/score.c index fe7622d..9ef75bd 100644 --- a/score.c +++ b/score.c @@ -425,7 +425,8 @@ score_draw (score_t *score, cairo_t *cr) if (score->num_braces) { - int brace_width; + /* Initialize to keep the compiler quiet. */ + int brace_width = 0; for (i = 0; i < score->num_braces; i++) _draw_brace (score, cr, score->braces[i], &brace_width);