diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-11-04 13:59:10 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-11-19 11:30:30 +0000 |
commit | 110e82f5e916b6171ca257777ce5cbbbceb35714 (patch) | |
tree | fd9b325e2c41c4dae827a86d358a68e0d982bd2f /src/corelib/codecs | |
parent | e17629e32dff5a85110a1785a98768cdbe3f091d (diff) |
QString::vasprintf: avoid allocating memory just to parse a number
Port parse_field_width from constructing a QString and
then calling toInt() on it to use qstrtoull().
Not only do we not allocate memory anymore, we even
don't need to copy the digits out of the format
string - qstrtoull() does it all for us.
In order to preserve behavior with the previous code,
which consumed all digits before performing error
checking on them, we also consume all digits, even if
qstrtoull() would have returned the start of the range
as the end pointer.
Change-Id: Ief941ce3a8ea43d2e5475d9eab77d7d0d7abc450
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/codecs')
0 files changed, 0 insertions, 0 deletions