From 4dbac23e5354638224d8d99ba3342067c015a04b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 11 Dec 2019 18:13:28 +0100 Subject: Normalize types at compile time This also fix the normalization algorithm: - Some 'const' after pointers were not removed as they should. - No need to keep the space in '> >' and '< :' in C++11 anymore - Fix normalization of 'long unsigned int' and similar Change-Id: I2b72f0fede96c1063e7b155d9f25a85fccfc7bf9 Reviewed-by: Simon Hausmann --- src/tools/moc/moc.cpp | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'src/tools/moc/moc.cpp') diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 5e2e492f94..b37674320d 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -43,30 +43,9 @@ QT_BEGIN_NAMESPACE // only moc needs this function -static QByteArray normalizeType(const QByteArray &ba, bool fixScope = false) +static QByteArray normalizeType(const QByteArray &ba) { - const char *s = ba.constData(); - int len = ba.size(); - char stackbuf[64]; - char *buf = (len >= 64 ? new char[len + 1] : stackbuf); - char *d = buf; - char last = 0; - while(*s && is_space(*s)) - s++; - while (*s) { - while (*s && !is_space(*s)) - last = *d++ = *s++; - while (*s && is_space(*s)) - s++; - if (*s && ((is_ident_char(*s) && is_ident_char(last)) - || ((*s == ':') && (last == '<')))) { - last = *d++ = ' '; - } - } - *d = '\0'; - QByteArray result = normalizeTypeInternal(buf, d, fixScope); - if (buf != stackbuf) - delete [] buf; + QByteArray result = normalizeTypeInternal(ba.constBegin(), ba.constEnd()); return result; } -- cgit v1.2.3