Skip to content

Commit

Permalink
QPlainTextLogger: FixedBufString: simplify appendf()
Browse files Browse the repository at this point in the history
qsnprintf() does not make a difference between lvalue and rvalue
arguments, so the wrapper doesn't need to perfectly forward.

Use decay-copy via by-value arguments to potentially reduce the number
of instantiations required for the existing calls.

Adjust indentation so the continuation line doesn't need to be
re-indented when we'll port qsnprintf() to std::snprintf().

Amends 0e8eb20.

Pick-to: 6.8 6.7 6.5
Change-Id: Idcaa441517fdbf00fefd952db7928731779123ab
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
marcmutz committed Jul 22, 2024
1 parent a90a1eb commit fba6795
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/testlib/qplaintestlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ template <int N> struct FixedBufString
buf[used] = '\0';
}

template <typename... Args> void appendf(const char *format, Args &&... args)
template <typename... Args> void appendf(const char *format, Args... args)
{
// vsnprintf includes the terminating null
used += qsnprintf(buf.data() + used, MaxSize - used + 1, format,
std::forward<Args>(args)...);
args...);
}

template <int Power = 1000> void appendScaled(qreal value, const char *unit)
Expand Down

0 comments on commit fba6795

Please sign in to comment.