QSslEllipticCurve: enable NRVO in *Name() methods

Make it easier for the compiler to apply the
Named Return Value Optimization (NRVO) in the
shortName()/longName() functions by not returning
different objects in different return statements.

Change-Id: I1b6fa7e6121bc1c843378be33499728c56c97f92
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2015-01-20 14:49:22 +01:00
parent 95e9b93a77
commit 9fab24f877

View File

@ -52,24 +52,20 @@ QT_BEGIN_NAMESPACE
QString QSslEllipticCurve::shortName() const
{
if (id == 0)
return QString();
QString result;
#ifndef OPENSSL_NO_EC
result = QString::fromLatin1(q_OBJ_nid2sn(id));
if (id != 0)
result = QString::fromLatin1(q_OBJ_nid2sn(id));
#endif
return result;
}
QString QSslEllipticCurve::longName() const
{
if (id == 0)
return QString();
QString result;
#ifndef OPENSSL_NO_EC
result = QString::fromLatin1(q_OBJ_nid2ln(id));
if (id != 0)
result = QString::fromLatin1(q_OBJ_nid2ln(id));
#endif
return result;
}