Skip to content

Commit eb6cb69

Browse files
committed
avoid duplicated assignment of simplecpp::Macro::tokenListDefine
1 parent c07e3e5 commit eb6cb69

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
@@ -1511,7 +1511,7 @@ namespace simplecpp {
15111511
throw std::runtime_error("bad macro syntax. macroname=" + name + " value=" + value);
15121512
}
15131513

1514-
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1514+
Macro(const Macro &other) : files(other.files), valueDefinedInCode_(other.valueDefinedInCode_) {
15151515
// TODO: remove the try-catch - see #537
15161516
// avoid bugprone-exception-escape clang-tidy warning
15171517
try {
@@ -1529,10 +1529,10 @@ namespace simplecpp {
15291529
if (this != &other) {
15301530
files = other.files;
15311531
valueDefinedInCode_ = other.valueDefinedInCode_;
1532-
if (other.tokenListDefine->empty())
1532+
tokenListDefine = other.tokenListDefine;
1533+
if (!tokenListDefine || tokenListDefine->empty())
15331534
parseDefine(other.nameTokDef);
15341535
else {
1535-
tokenListDefine = other.tokenListDefine;
15361536
parseDefine(tokenListDefine->cfront());
15371537
}
15381538
usageList = other.usageList;

0 commit comments

Comments
 (0)