From a06898dc8e70a8ec109126841618409af859c7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 19 Mar 2022 12:27:24 +0100 Subject: [PATCH] cppcheckdata.py: code cleanup --- addons/cppcheckdata.py | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index 0a2a51f35..6c8d9f6c5 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -143,21 +143,11 @@ class ValueType: def __init__(self, element): self.type = element.get('valueType-type') self.sign = element.get('valueType-sign') - bits = element.get('valueType-bits') - if bits: - self.bits = int(bits) + self.bits = int(element.get('valueType-bits', 0)) self.typeScopeId = element.get('valueType-typeScope') self.originalTypeName = element.get('valueType-originalTypeName') - constness = element.get('valueType-constness') - if constness: - self.constness = int(constness) - else: - self.constness = 0 - pointer = element.get('valueType-pointer') - if pointer: - self.pointer = int(pointer) - else: - self.pointer = 0 + self.constness = int(element.get('valueType-constness', 0)) + self.pointer = int(element.get('valueType-pointer', 0)) def __repr__(self): attrs = ["type", "sign", "bits", "typeScopeId", "originalTypeName", @@ -620,11 +610,7 @@ class Variable: self.isPointer = element.get('isPointer') == 'true' self.isReference = element.get('isReference') == 'true' self.isStatic = element.get('isStatic') == 'true' - constness = element.get('constness') - if constness: - self.constness = int(constness) - else: - self.constness = 0 + self.constness = int(element.get('constness',0)) def __repr__(self): attrs = ["Id", "nameTokenId", "typeStartTokenId", "typeEndTokenId",