From 0a3362831a7b2141e01810eca91c9adb0c2749ec Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 29 Sep 2013 17:25:19 -0700 Subject: [PATCH] Change the various score add_note functions to not return a score_note_t. With the callers no longer doing anything with this return value, we can now drop it entirely. --- score.c | 16 +++++++--------- score.h | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/score.c b/score.c index ba27844..5772c0f 100644 --- a/score.c +++ b/score.c @@ -605,7 +605,7 @@ score_remove_chord (score_chord_t *chord) staff->num_chords -= 1; } -score_note_t * +void score_staff_add_note (score_staff_t *staff, pitch_t pitch, score_duration_t duration) @@ -620,13 +620,13 @@ score_staff_add_note (score_staff_t *staff, if (note->pitch == pitch && note->duration == duration) { - return note; + return; } } note = talloc (staff, score_note_t); if (note == NULL) - return NULL; + return; note->staff = staff; note->pitch = pitch; @@ -654,15 +654,13 @@ score_staff_add_note (score_staff_t *staff, staff->num_notes); if (staff->notes == NULL) { staff->num_notes = 0; - return NULL; + return; } staff->notes[staff->num_notes - 1] = note; - - return note; } -score_note_t * +void score_add_note (score_t *score, pitch_t pitch, score_duration_t duration) { score_staff_t *staff, *nearest_staff = NULL; @@ -671,7 +669,7 @@ score_add_note (score_t *score, pitch_t pitch, score_duration_t duration) /* Nothing to do if we have no staff, (there's no place to add a note) . */ if (score->num_staves == 0) - return NULL; + return; /* Find the staff where the note will be closest to the center of * the staff. */ @@ -684,7 +682,7 @@ score_add_note (score_t *score, pitch_t pitch, score_duration_t duration) } } - return score_staff_add_note (nearest_staff, pitch, duration); + score_staff_add_note (nearest_staff, pitch, duration); } void diff --git a/score.h b/score.h index b8791f6..573af22 100644 --- a/score.h +++ b/score.h @@ -114,14 +114,14 @@ score_add_staff (score_t *score, score_clef_t clef); * _EIGHTH, etc.) or numerical as simply the denominator (WHOLE=1, * QUARTER=4, EIGHTH=8, etc.) */ -score_note_t * +void score_staff_add_note (score_staff_t *staff, pitch_t pitch, score_duration_t duration); /* Add a note to the score, (automatically selecting the nearest * staff) */ -score_note_t * +void score_add_note (score_t *score, pitch_t pitch, score_duration_t duration); /* Add a chord symbol of 'name' to a staff. -- 2.43.0