diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-10-17 17:48:34 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-10-27 11:10:24 +0000 |
commit | 29a7f5571cb3619898d8d05c09f7df4ece915aed (patch) | |
tree | f8bfe9dfa683b71c829f14a32de3bd7491310680 /src/widgets/graphicsview/qsimplex_p.cpp | |
parent | f8eeabcf5ca4615fcb3ed783dbd321f4998a7651 (diff) |
QtWidgets: use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << "...";
with
qWarning("...");
Change-Id: I1f6869b024103c98262f1deae014e0d7337a541c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/graphicsview/qsimplex_p.cpp')
-rw-r--r-- | src/widgets/graphicsview/qsimplex_p.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp index 1aeade6640..b827ab1400 100644 --- a/src/widgets/graphicsview/qsimplex_p.cpp +++ b/src/widgets/graphicsview/qsimplex_p.cpp @@ -140,7 +140,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints) // Remove constraints of type Var == K and replace them for their value. if (!simplifyConstraints(&constraints)) { - qWarning() << "QSimplex: No feasible solution!"; + qWarning("QSimplex: No feasible solution!"); clearDataStructures(); return false; } @@ -230,7 +230,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints) matrix = (qreal *)malloc(sizeof(qreal) * columns * rows); if (!matrix) { - qWarning() << "QSimplex: Unable to allocate memory!"; + qWarning("QSimplex: Unable to allocate memory!"); return false; } for (int i = columns * rows - 1; i >= 0; --i) @@ -281,7 +281,7 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints) // Otherwise, we clean up our structures and report there is // no feasible solution. if ((valueAt(0, columns - 1) != 0.0) && (qAbs(valueAt(0, columns - 1)) > 0.00001)) { - qWarning() << "QSimplex: No feasible solution!"; + qWarning("QSimplex: No feasible solution!"); clearDataStructures(); return false; } @@ -471,7 +471,7 @@ bool QSimplex::iterate() // Find Pivot row for column int pivotRow = pivotRowForColumn(pivotColumn); if (pivotRow == -1) { - qWarning() << "QSimplex: Unbounded problem!"; + qWarning("QSimplex: Unbounded problem!"); return false; } |