Skip to content

Commit cd66696

Browse files
committed
avoid duplicated assignment of simplecpp::Macro::tokenListDefine
1 parent 3901bbe commit cd66696

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

1516-
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1516+
Macro(const Macro &other) : files(other.files), valueDefinedInCode_(other.valueDefinedInCode_) {
15171517
// TODO: remove the try-catch - see #537
15181518
// avoid bugprone-exception-escape clang-tidy warning
15191519
try {
@@ -1531,10 +1531,10 @@ namespace simplecpp {
15311531
if (this != &other) {
15321532
files = other.files;
15331533
valueDefinedInCode_ = other.valueDefinedInCode_;
1534-
if (other.tokenListDefine->empty())
1534+
tokenListDefine = other.tokenListDefine;
1535+
if (!tokenListDefine || tokenListDefine->empty())
15351536
parseDefine(other.nameTokDef);
15361537
else {
1537-
tokenListDefine = other.tokenListDefine;
15381538
parseDefine(tokenListDefine->cfront());
15391539
}
15401540
usageList = other.usageList;

0 commit comments

Comments
 (0)