@@ -81,7 +81,7 @@ void SimpleTreeEncoder::appendDef(const Defect &def)
8181 evtNode.put <int >(" verbosity_level" , evt.verbosityLevel );
8282
8383 // append the event to the list
84- evtList. push_back ( std::make_pair ( " " , evtNode) );
84+ appendNode (&evtList , evtNode);
8585 }
8686
8787 // create a node for a single defect
@@ -110,7 +110,7 @@ void SimpleTreeEncoder::appendDef(const Defect &def)
110110 pDefects_ = &root_.put_child (" defects" , PTree ());
111111
112112 // append the node to the list
113- pDefects_-> push_back ( std::make_pair ( " " , defNode) );
113+ appendNode (pDefects_ , defNode);
114114}
115115
116116void SimpleTreeEncoder::writeTo (std::ostream &str)
@@ -213,11 +213,11 @@ static void sarifEncodeEvt(PTree *pDst, const Defect &def, unsigned idx)
213213 PTree kind;
214214 kind.put <std::string>(" " , evt.event );
215215 PTree kindList;
216- kindList. put_child ( " " , kind);
216+ appendNode (&kindList , kind);
217217 tfLoc.put_child (" kinds" , kindList);
218218
219219 // append the threadFlowLocation object to the destination array
220- pDst-> push_back ( std::make_pair ( " " , tfLoc) );
220+ appendNode (pDst , tfLoc);
221221}
222222
223223void SarifTreeEncoder::appendDef (const Defect &def)
@@ -233,7 +233,7 @@ void SarifTreeEncoder::appendDef(const Defect &def)
233233 PTree loc;
234234 sarifEncodeLoc (&loc, def, def.keyEventIdx );
235235 PTree keyLocs;
236- keyLocs. put_child ( " " , loc);
236+ appendNode (&keyLocs , loc);
237237 result.put_child (" locations" , keyLocs);
238238
239239 // key msg
@@ -250,17 +250,17 @@ void SarifTreeEncoder::appendDef(const Defect &def)
250250
251251 // threadFlows
252252 PTree tfList;
253- tfList. put_child ( " " , tf);
253+ appendNode (&tfList , tf);
254254 PTree cf;
255255 cf.put_child (" threadFlows" , tfList);
256256
257257 // codeFlows
258258 PTree cfList;
259- cfList. put_child ( " " , cf);
259+ appendNode (&cfList , cf);
260260 result.put_child (" codeFlows" , cfList);
261261
262262 // append the `result` object to the `results` array
263- results_. push_back ( std::make_pair ( " " , result) );
263+ appendNode (&results_ , result);
264264}
265265
266266void SarifTreeEncoder::writeTo (std::ostream &str)
@@ -281,7 +281,7 @@ void SarifTreeEncoder::writeTo(std::ostream &str)
281281 PTree extProps;
282282 extProps.put_child (" externalizedProperties" , props);
283283 PTree propsList;
284- propsList. put_child ( " " , extProps);
284+ appendNode (&propsList , extProps);
285285 root.put_child (" inlineExternalProperties" , propsList);
286286 }
287287
@@ -291,7 +291,7 @@ void SarifTreeEncoder::writeTo(std::ostream &str)
291291
292292 // mandatory: runs
293293 PTree runs;
294- runs. put_child ( " " , run0_);
294+ appendNode (&runs , run0_);
295295 root.put_child (" runs" , runs);
296296
297297 // encode as JSON
0 commit comments