commit e8dd88aff314f5354b039f6afb08efc19abd54eb
parent 27fe59799de8ec440007987e0da7eb51dc01b5cd
Author: nibo <nibo@relim.de>
Date: Fri, 3 Jan 2025 20:24:55 +0100
Refactor config.c
Diffstat:
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/config.c b/config.c
@@ -212,9 +212,9 @@ config_note_free(struct Note *note)
static void
config_notes_free(struct Note **notes)
{
- struct Note **no;
- for (no = notes; *no; no++) {
- config_note_free(*no);
+ int i;
+ for (i = 0; i<7; i++) {
+ config_note_free(notes[i]);
}
free(notes);
}
@@ -257,7 +257,7 @@ config_notes_new_default(enum NamingSystem system)
notes_default[i]->flat = strdup(notes[i].flat);
}
}
- notes_default[7] = NULL; // TODO: This is probably needless
+ // notes_default[7] = NULL; // TODO: This is probably needless
return notes_default;
}
@@ -817,7 +817,6 @@ void
config_free(struct Config *config)
{
struct OutputStyle **os;
- struct Note **no;
free(config->output->toc->title);
free(config->output->toc);
free(config->output->chorus->label);
@@ -826,17 +825,11 @@ config_free(struct Config *config)
config_output_style_free(*os);
}
free(config->output->styles);
- for (no = config->output->notes; *no; no++) {
- config_note_free(*no);
- }
- free(config->output->notes);
+ config_notes_free(config->output->notes);
free(config->output->diagram);
free(config->output);
free(config->parser->chords);
- for (no = config->parser->notes; *no; no++) {
- config_note_free(*no);
- }
- free(config->parser->notes);
+ config_notes_free(config->parser->notes);
free(config->parser);
free(config);
}
diff --git a/out_pdf.c b/out_pdf.c
@@ -1620,7 +1620,6 @@ pdf_texts_add_toc_entry(
double width, page_no_x;
int index, line_count;
char tmp[strlen(entry->title)+1];
- // char page_no[5+1];
char page_no[11+1];
strcpy((char *)&tmp, entry->title);
width = text_width(entry->title, style);