]> git.cworth.org Git - scherzo/commitdiff
Add a few initializations to quiet compiler warnings.
authorCarl Worth <cworth@cworth.org>
Mon, 23 Sep 2013 04:10:58 +0000 (21:10 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 23 Sep 2013 04:10:58 +0000 (21:10 -0700)
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.

scherzo.c
score.c

index d6b3af55f8d56cf6dee4cc2fde49ae1c65fc4d59..8c6d394934087dd61da9bab7fbd16dc0a6111d3a 100644 (file)
--- a/scherzo.c
+++ b/scherzo.c
@@ -147,7 +147,8 @@ on_key_press_event (GtkWidget *widget,
 {
     scherzo_t *scherzo = user_data;
     int octave;
 {
     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)
     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;
 {
     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)
     score_pitch_t pitch;
 
     if (scherzo->challenge.note)
diff --git a/score.c b/score.c
index fe7622d85e4acd5c4fc45cd707df961017995380..9ef75bdf69f64e00b7a7ba248adb54e947467902 100644 (file)
--- a/score.c
+++ b/score.c
@@ -425,7 +425,8 @@ score_draw (score_t *score, cairo_t *cr)
 
     if (score->num_braces)
     {
 
     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);
 
        for (i = 0; i < score->num_braces; i++)
            _draw_brace (score, cr, score->braces[i], &brace_width);