diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-01 01:03:40 +0200 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2021-02-06 16:28:53 +0200 |
commit | 081f559031fed7cde755e006b226cf06f33bd0f8 (patch) | |
tree | f6334b19630d6d9df9074b493c5eaa3c7914954e /src/kconfig_compiler/kconfig_compiler.cpp | |
parent | 5d0dac047384e1f46e2de57f9b9ebf4f6fde0e26 (diff) | |
download | kconfig-081f559031fed7cde755e006b226cf06f33bd0f8.tar.gz kconfig-081f559031fed7cde755e006b226cf06f33bd0f8.tar.bz2 |
General code cleanup
Fix some clazy warnings, and some other minor code optimisations.
NO_CHANGELOG
Diffstat (limited to 'src/kconfig_compiler/kconfig_compiler.cpp')
-rw-r--r-- | src/kconfig_compiler/kconfig_compiler.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp index 4f9fa3f2..a7ecd83e 100644 --- a/src/kconfig_compiler/kconfig_compiler.cpp +++ b/src/kconfig_compiler/kconfig_compiler.cpp @@ -371,20 +371,26 @@ QString defaultValue(const QString &t) QString itemType(const QString &type) { - QString t; + if (type.isEmpty()) { + return QString{}; + } - t = type; - t.replace(0, 1, t.left(1).toUpper()); + QString str = type; + str[0] = str.at(0).toUpper(); - return t; + return str; } QString itemDeclaration(const CfgEntry *e, const KConfigParameters &cfg) { + if (e->name.isEmpty()) { + return QString{}; + } + const QString type = cfg.inherits + "::Item" + itemType(e->type); QString fCap = e->name; - fCap[0] = fCap[0].toUpper(); + fCap[0] = fCap.at(0).toUpper(); const QString argSuffix = (!e->param.isEmpty()) ? (QStringLiteral("[%1]").arg(e->paramMax + 1)) : QString(); QString result; |