diff options
author | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-31 15:41:04 -0700 |
---|---|---|
committer | Emiel Bruijntjes <emiel.bruijntjes@copernica.com> | 2013-08-31 15:41:04 -0700 |
commit | d762ee103bee45bcd18df457c2c7a9f36991c75f (patch) | |
tree | bd8937a36a205a8755ac485c4ede65c10078b375 /src/function.cpp | |
parent | 708e9cf9da9571a38ac8d2529d016cd78ce8ec54 (diff) |
Work in progress on a simpler api
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; } /** |