diff options
Diffstat (limited to 'src/function.cpp')
-rw-r--r-- | src/function.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/function.cpp b/src/function.cpp index 54f0717..cb56d78 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -20,25 +20,16 @@ namespace PhpCpp { */ Function::Function(const std::string &name, const std::initializer_list<Argument> &arguments) { - // one reference to the callable - _refcount = new int(1); + // create callable object _callable = new Callable(name, arguments); } /** - * Remove one reference + * Destructor */ -void Function::cleanup() +Function::~Function() { - // decrease number of references - (*_refcount)--; - - // leap out if there are still other references - if (*_refcount > 0) return; - - // release memory - delete _refcount; - delete _callable; + if (_callable) delete _callable; } /** |