Skip to content

Commit 8d8b017

Browse files
committed
avoid duplicated assignment of simplecpp::Macro::tokenListDefine
1 parent cd5ba3e commit 8d8b017

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

simplecpp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ namespace simplecpp {
15221522
throw std::runtime_error("bad macro syntax. macroname=" + name + " value=" + value);
15231523
}
15241524

1525-
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1525+
Macro(const Macro &other) : files(other.files), valueDefinedInCode_(other.valueDefinedInCode_) {
15261526
// TODO: remove the try-catch - see #537
15271527
// avoid bugprone-exception-escape clang-tidy warning
15281528
try {
@@ -1540,10 +1540,10 @@ namespace simplecpp {
15401540
if (this != &other) {
15411541
files = other.files;
15421542
valueDefinedInCode_ = other.valueDefinedInCode_;
1543-
if (other.tokenListDefine->empty())
1543+
tokenListDefine = other.tokenListDefine;
1544+
if (!tokenListDefine || tokenListDefine->empty())
15441545
parseDefine(other.nameTokDef);
15451546
else {
1546-
tokenListDefine = other.tokenListDefine;
15471547
parseDefine(tokenListDefine->cfront());
15481548
}
15491549
usageList = other.usageList;

0 commit comments

Comments
 (0)