Skip to content

Commit

Permalink
simplify allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Apr 3, 2023
1 parent ecba830 commit 29e085a
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/sbml/SBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2361,11 +2361,8 @@ SBase::setCreatedDate(Date* date)
}
else
{
ModelHistory* mh = new ModelHistory();
// we want to set it regardless of content
mHistory = static_cast<ModelHistory*>(mh->clone());
mHistory = new ModelHistory();
mHistoryChanged = true;
delete mh;

return mHistory->setCreatedDate(date);

Expand All @@ -2381,11 +2378,8 @@ SBase::addModifiedDate(Date* date)
}
else
{
ModelHistory* mh = new ModelHistory();
// we want to set it regardless of content
mHistory = static_cast<ModelHistory*>(mh->clone());
mHistory = new ModelHistory();
mHistoryChanged = true;
delete mh;

return mHistory->addModifiedDate(date);

Expand Down Expand Up @@ -2979,7 +2973,7 @@ SBase::unsetCreatedDate()
if (mHistory != NULL && mHistory->isSetCreatedDate())
{
mHistoryChanged = true;
}
}
else
{
return LIBSBML_UNEXPECTED_ATTRIBUTE;
Expand Down Expand Up @@ -3014,7 +3008,7 @@ SBase::unsetModifiedDates()
if (mHistory != NULL && mHistory->isSetModifiedDate())
{
mHistoryChanged = true;
}
}
else
{
return LIBSBML_UNEXPECTED_ATTRIBUTE;
Expand Down

0 comments on commit 29e085a

Please sign in to comment.