Skip to content

Commit b452c92

Browse files
committed
abstract-tree: pass reference to getSringValue
... instead of a pointer to pt::ptree to be consistent with getValue.
1 parent 36830eb commit b452c92

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/abstract-tree.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ inline T valueOf(const pt::ptree &node, const char *path, const T &defVal)
6060
return opt.get_value_or(defVal);
6161
}
6262

63-
inline std::string getStringValue(const pt::ptree *const node)
63+
inline std::string getStringValue(const pt::ptree &node)
6464
{
65-
return node->get_value<std::string>();
65+
return node.get_value<std::string>();
6666
}
6767

6868
inline std::string getStringValue(const pt::ptree::const_iterator it)
6969
{
70-
return getStringValue(&it->second);
70+
return getStringValue(it->second);
7171
}
7272

7373
#endif /* H_GUARD_ABSTRACT_TREE_H */

src/xml-parser.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ std::string readMsg(const pt::ptree &defNode)
144144
const pt::ptree *whatNode;
145145
if (findChildOf(&whatNode, defNode, "what"))
146146
// message found in <what>...</what>
147-
return getStringValue(whatNode);
147+
return getStringValue(*whatNode);
148148

149149
if (findChildOf(&whatNode, defNode, "xwhat")
150150
&& findChildOf(&whatNode, *whatNode, "text"))
151151
// message found in <xwhat><text>...</text></xwhat>
152-
return getStringValue(whatNode);
152+
return getStringValue(*whatNode);
153153

154154
// message not found
155155
return "<unknown>";
@@ -195,7 +195,7 @@ void readStack(Defect *pDef, const pt::ptree &stackNode)
195195
const pt::ptree *fileNode;
196196
if (findChildOf(&fileNode, frameNode, "file")) {
197197
// read absolute path of the source file
198-
noteEvt.fileName = getStringValue(fileNode);
198+
noteEvt.fileName = getStringValue(*fileNode);
199199
const std::string dir = valueOf<std::string>(frameNode, "dir", "");
200200
if (!dir.empty())
201201
noteEvt.fileName = dir + "/" + noteEvt.fileName;
@@ -206,12 +206,12 @@ void readStack(Defect *pDef, const pt::ptree &stackNode)
206206
}
207207
else if (findChildOf(&fileNode, frameNode, "obj")) {
208208
// pick path of the object file
209-
noteEvt.fileName = getStringValue(fileNode);
209+
noteEvt.fileName = getStringValue(*fileNode);
210210
keyEventScore = 4;
211211
}
212212
else if (findChildOf(&fileNode, frameNode, "ip")) {
213213
// pick address of the code in memory
214-
noteEvt.fileName = getStringValue(fileNode);
214+
noteEvt.fileName = getStringValue(*fileNode);
215215
keyEventScore = 2;
216216
}
217217
else {
@@ -270,7 +270,7 @@ bool ValgrindTreeDecoder::readNode(Defect *pDef, pt::ptree::const_iterator defIt
270270
DefEvent auxEvent = def.events[def.keyEventIdx];
271271
auxEvent.event = "note";
272272
auxEvent.verbosityLevel = /* note */ 1;
273-
auxEvent.msg = getStringValue(auxwhat);
273+
auxEvent.msg = getStringValue(*auxwhat);
274274
def.events.insert(def.events.begin() + def.keyEventIdx + 1, auxEvent);
275275
}
276276

0 commit comments

Comments
 (0)