X-Git-Url: https://git.cworth.org/git?p=scherzo;a=blobdiff_plain;f=score.c;fp=score.c;h=ecfc2352662194790ec40b39577146fca64c08ee;hp=5c0e0b023545b15c1a5f48c69c94fd6ca5aaa026;hb=aae6b7f55870ab7f9cd41f95e22231e66a673aea;hpb=d38e3c6abf6d5aeb287ec1d1262015d8b4a81198 diff --git a/score.c b/score.c index 5c0e0b0..ecfc235 100644 --- a/score.c +++ b/score.c @@ -596,26 +596,21 @@ score_add_chord (score_staff_t *staff, } void -score_remove_chord (score_chord_t *chord) +score_staff_remove_chords (score_staff_t *staff) { - score_staff_t *staff = chord->staff; - int i; - - for (i = 0; i < staff->num_chords; i++) - if (staff->chords[i] == chord) - break; + talloc_free (staff->chords); + staff->chords = NULL; - if (i == staff->num_chords) - return; + staff->num_chords = 0; +} - if (i < staff->num_chords - 1) - { - memmove (staff->chords + i, - staff->chords + i + 1, - (staff->num_chords - 1 - i) * sizeof (score_chord_t *)); - } +void +score_remove_chords (score_t *score) +{ + int i; - staff->num_chords -= 1; + for (i = 0; i < score->num_staves; i++) + score_staff_remove_chords (score->staves[i]); } void