diff --git a/src/context.cc b/src/context.cc index 7d324168..29914d9a 100644 --- a/src/context.cc +++ b/src/context.cc @@ -49,7 +49,7 @@ static bool is_config_variable(const std::string &name) { created, and all children will share the root parent's stack. */ Context::Context(const Context *parent) - : parent(parent), stack_ptr(0), stack_max(0) + : parent(parent) { if (parent) { assert(parent->ctx_stack && "Parent context stack was null!"); @@ -70,49 +70,6 @@ Context::~Context() if (!parent) delete this->ctx_stack; } -unsigned long Context::stackUsage() const -{ - if (parent == NULL) { - unsigned long ret = std::labs((unsigned long)stack_ptr - (unsigned long)stack_max); - ((Context *)this)->stack_ptr = 0; - ((Context *)this)->stack_max = 0; - return ret; - } else { - return parent->stackUsage(); - } -} - -bool Context::setStack(const void* stack_cur) const -{ - if (parent == NULL) { - bool ret = this->stack_ptr == 0; - if (ret) { - ((Context *)this)->stack_ptr = stack_cur; - ((Context *)this)->stack_max = stack_cur; - } - return ret; - } else { - return parent->setStack(stack_cur); - } -} - -void Context::checkStack(const void *stack_cur) const -{ - if (parent == NULL) { - if (stack_cur < this->stack_ptr) { - if (stack_cur < this->stack_max) { - ((Context *)this)->stack_max = stack_cur; - } - } else { - if (stack_cur > this->stack_max) { - ((Context *)this)->stack_max = stack_cur; - } - } - } else { - parent->checkStack(stack_cur); - } -} - /*! Initialize context from a module argument list and a evaluation context which may pass variables which will be preferred over default values. diff --git a/src/context.h b/src/context.h index 9caae1d7..639973bb 100644 --- a/src/context.h +++ b/src/context.h @@ -33,17 +33,11 @@ public: const std::string &documentPath() const { return this->document_path; } std::string getAbsolutePath(const std::string &filename) const; - unsigned long stackUsage() const; - bool setStack(const void *stack_cur) const; - void checkStack(const void *stack_cur) const; - public: protected: const Context *parent; Stack *ctx_stack; - const void *stack_ptr; - const void *stack_max; typedef boost::unordered_map ValueMap; ValueMap constants;