Skip to content

Commit 41147bd

Browse files
committed
avoid duplicated assignment of simplecpp::Macro::tokenListDefine
1 parent fa29505 commit 41147bd

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

1517-
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1517+
Macro(const Macro &other) : files(other.files), valueDefinedInCode_(other.valueDefinedInCode_) {
15181518
// TODO: remove the try-catch - see #537
15191519
// avoid bugprone-exception-escape clang-tidy warning
15201520
try {
@@ -1532,10 +1532,10 @@ namespace simplecpp {
15321532
if (this != &other) {
15331533
files = other.files;
15341534
valueDefinedInCode_ = other.valueDefinedInCode_;
1535-
if (other.tokenListDefine->empty())
1535+
tokenListDefine = other.tokenListDefine;
1536+
if (!tokenListDefine || tokenListDefine->empty())
15361537
parseDefine(other.nameTokDef);
15371538
else {
1538-
tokenListDefine = other.tokenListDefine;
15391539
parseDefine(tokenListDefine->cfront());
15401540
}
15411541
usageList = other.usageList;

0 commit comments

Comments
 (0)