From 2f3c7990e06fc55e75f1950300e3178d5a94ba45 Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Sat, 29 Dec 2018 13:59:53 +0100 Subject: [PATCH] Use default value of Rules::getInteger --- src/commands/CmdChart.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/commands/CmdChart.cpp b/src/commands/CmdChart.cpp index ecdc84ae..5cae1434 100644 --- a/src/commands/CmdChart.cpp +++ b/src/commands/CmdChart.cpp @@ -155,7 +155,7 @@ int renderChart ( // Determine how much space is occupied by the left-margin labels. - auto cell = rules.getInteger ("reports." + type + ".cell"); + auto cell = rules.getInteger ("reports." + type + ".cell", 15); if (cell < 1) throw format ("The value for 'reports.{1}.cell' must be at least 1.", type); @@ -166,16 +166,12 @@ int renderChart ( for (Datetime day = filter.start; day < filter.end; day++) { // Render the exclusion blocks. - int num_lines = 1; - if (rules.has ("reports." + type + ".lines")) - num_lines = rules.getInteger ("reports." + type + ".lines", num_lines); + auto num_lines = rules.getInteger ("reports." + type + ".lines", 1); if (num_lines < 1) throw format ("Invalid value for 'reports.{1}.lines': '{2}'", type, rules.get ("reports." + type + ".lines")); - int spacing = 1; - if (rules.has ("reports." + type + ".spacing")) - spacing = rules.getInteger ("reports." + type + ".spacing"); + auto spacing = rules.getInteger ("reports." + type + ".spacing", 1); // Add an empty string with no color, to reserve width, so this function // can simply concatenate to lines[i].str ().