Skip to content

Commit e33d54d

Browse files
committed
avoid duplicated assignment of simplecpp::Macro::tokenListDefine
1 parent 881ebbb commit e33d54d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

simplecpp.cpp

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

1515-
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1515+
Macro(const Macro &other) : files(other.files), valueDefinedInCode_(other.valueDefinedInCode_) {
15161516
// TODO: remove the try-catch - see #537
15171517
// avoid bugprone-exception-escape clang-tidy warning
15181518
try {
@@ -1530,10 +1530,10 @@ namespace simplecpp {
15301530
if (this != &other) {
15311531
files = other.files;
15321532
valueDefinedInCode_ = other.valueDefinedInCode_;
1533-
if (other.tokenListDefine->empty())
1533+
tokenListDefine = other.tokenListDefine;
1534+
if (!tokenListDefine || tokenListDefine->empty())
15341535
parseDefine(other.nameTokDef);
15351536
else {
1536-
tokenListDefine = other.tokenListDefine;
15371537
parseDefine(tokenListDefine->cfront());
15381538
}
15391539
usageList = other.usageList;

0 commit comments

Comments
 (0)