From 343a649e42e1c91ca77facb309623b53f69428df Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Wed, 24 Apr 2013 15:04:09 +0000 Subject: [PATCH] Reorder enum. Add enum constant for the size, fix a wrong condition in an assert. git-svn-id: http://root.cern.ch/svn/root/trunk@49320 27541ba8-7e3a-0410-8455-c3a389f83636 --- include/cling/Interpreter/Transaction.h | 5 +++-- lib/Interpreter/Transaction.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/cling/Interpreter/Transaction.h b/include/cling/Interpreter/Transaction.h index aae7a83c..e685105a 100644 --- a/include/cling/Interpreter/Transaction.h +++ b/include/cling/Interpreter/Transaction.h @@ -117,10 +117,11 @@ namespace cling { enum State { kCollecting, kCompleted, + kCommitting, kRolledBack, kRolledBackWithErrors, - kCommitting, - kCommitted + kCommitted, + kNumStates }; enum IssuedDiags { diff --git a/lib/Interpreter/Transaction.cpp b/lib/Interpreter/Transaction.cpp index 71f620ac..663071c9 100644 --- a/lib/Interpreter/Transaction.cpp +++ b/lib/Interpreter/Transaction.cpp @@ -74,7 +74,7 @@ namespace cling { } void Transaction::erase(size_t pos) { - assert(empty() && "Erasing from an empty transaction."); + assert(!empty() && "Erasing from an empty transaction."); m_DeclQueue->erase(decls_begin() + pos); } @@ -129,12 +129,12 @@ namespace cling { } void Transaction::printStructure(size_t nindent) const { - static const char* const stateNames[] = { + static const char* const stateNames[kNumStates] = { "Collecting", "kCompleted", + "Committing", "RolledBack", "RolledBackWithErrors", - "Committing", "Committed" }; std::string indent(nindent, ' ');