commit 4892f24a05bd9c6466faa19bdcc99f5f4647661e
parent 2a5b102a973f7813b95ce7e6e14d18d124e08d62
Author: nibo <nibo@relim.de>
Date: Sat, 25 Jan 2025 11:11:18 +0100
Save a few if checks
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/out_pdf.c b/out_pdf.c
@@ -2208,10 +2208,12 @@ pdf_content_create(
struct PDFImage ***imgs;
struct PDFContext ctx;
struct ChordDiagram ***diagrams, **dgrams, **dgrams_begin;
+ bool show_diagram = config->output->diagram->show;
+ bool start_song_on_new_page = config->output->start_song_on_new_page;
double width, height;
pdf_context_init(&ctx);
- if (config->output->diagram->show) {
+ if (show_diagram) {
ctx.margin_bottom = 150.0;
}
ctx.content = pdf_content_new();
@@ -2228,7 +2230,7 @@ pdf_content_create(
}
int s;
for (s = 0; songs[s]; s++) {
- if (config->output->diagram->show) {
+ if (show_diagram) {
struct ChoChord **chords = NULL;
if (!pdf_get_chords(songs[s], &chords)) {
LOG_DEBUG("pdf_get_chords failed.");
@@ -2530,7 +2532,7 @@ pdf_content_create(
}
ctx.y -= SECTION_GAP_WIDTH;
}
- if (config->output->start_song_on_new_page) {
+ if (start_song_on_new_page) {
if (!pdf_page_close_then_add(&ctx, NUS_WESTERN_ARABIC)) {
LOG_DEBUG("pdf_page_close_then_add failed.");
return false;