From 7a447912216e467a402e48be49f143f1b4be8261 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 14 Nov 2009 02:49:38 -0500 Subject: Optimization in the formatting of string values --- src/format.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/format.cc') diff --git a/src/format.cc b/src/format.cc index e910ce3b..f26a86a1 100644 --- a/src/format.cc +++ b/src/format.cc @@ -355,8 +355,11 @@ string format_t::real_calc(scope_t& scope) } DEBUG("format.expr", "value = (" << value << ")"); - value.print(out, static_cast(elem->min_width), -1, - ! elem->has_flags(ELEMENT_ALIGN_LEFT)); + if (elem->min_width > 0) + value.print(out, static_cast(elem->min_width), -1, + ! elem->has_flags(ELEMENT_ALIGN_LEFT)); + else + out << value.to_string(); } catch (const calc_error&) { add_error_context(_("While calculating format expression:")); -- cgit v1.2.3