QDomNode: don't needlessly call virtual functions
Commit 4dabe78387
changed
these functions from virtuals to inlines that check the
return value of the remaining virtual function nodeType().
However, two of the functions call nodeType() more than
once, which we know will return the same result each time,
but requires a compiler with interprocedural optimization
capabilities to figure out by itself.
So instead of repeatedly calling nodeType(), call it once
and store its return value in a temporary, and use the
temp for further comparisions.
Change-Id: Idbeafb7fd93d275d475218c6df2ad7fdc9162cc5
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
f220f99a6d
commit
3518db0bbe
@ -172,14 +172,16 @@ public:
|
||||
bool isDocumentType() const { return nodeType() == QDomNode::DocumentTypeNode; }
|
||||
bool isElement() const { return nodeType() == QDomNode::ElementNode; }
|
||||
bool isEntityReference() const { return nodeType() == QDomNode::EntityReferenceNode; }
|
||||
bool isText() const { return (nodeType() == QDomNode::TextNode)
|
||||
|| (nodeType() == QDomNode::CDATASectionNode); }
|
||||
bool isText() const { const QDomNode::NodeType nt = nodeType();
|
||||
return (nt == QDomNode::TextNode)
|
||||
|| (nt == QDomNode::CDATASectionNode); }
|
||||
bool isEntity() const { return nodeType() == QDomNode::EntityNode; }
|
||||
bool isNotation() const { return nodeType() == QDomNode::NotationNode; }
|
||||
bool isProcessingInstruction() const { return nodeType() == QDomNode::ProcessingInstructionNode; }
|
||||
bool isCharacterData() const { return (nodeType() == QDomNode::CharacterDataNode)
|
||||
|| (nodeType() == QDomNode::TextNode)
|
||||
|| (nodeType() == QDomNode::CommentNode); }
|
||||
bool isCharacterData() const { const QDomNode::NodeType nt = nodeType();
|
||||
return (nt == QDomNode::CharacterDataNode)
|
||||
|| (nt == QDomNode::TextNode)
|
||||
|| (nt == QDomNode::CommentNode); }
|
||||
bool isComment() const { return nodeType() == QDomNode::CommentNode; }
|
||||
|
||||
virtual QDomNode::NodeType nodeType() const { return QDomNode::BaseNode; }
|
||||
|
Loading…
Reference in New Issue
Block a user