mirror of https://github.com/qt/qtbase.git
QString: fix unintended copy in asprintf() return
On GCC, this function is NRVO'd, but depending on the definition of
va_list, a compiler may be unable to NRVO this function, in which case
the const on 's' prevents the implicit return by move.
Found by Coverity.
Fix by dropping the const. It doesn't hurt readability in such a short
function, shuts up Coverity, and may improve codegen on some
platforms.
Amends d251cae7b7
.
Coverity-Id: 474158
Pick-to: 6.10 6.9 6.8
Change-Id: I4f842f690ea45c8db4c02f32f858d2700f57d128
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
eaeeb6b5d3
commit
a31a8da004
|
@ -7389,7 +7389,7 @@ QString QString::asprintf(const char *cformat, ...)
|
|||
{
|
||||
va_list ap;
|
||||
va_start(ap, cformat);
|
||||
const QString s = vasprintf(cformat, ap);
|
||||
QString s = vasprintf(cformat, ap);
|
||||
va_end(ap);
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue