diff --git a/lib/library.cpp b/lib/library.cpp index 4a104bf03..31933fcb3 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -679,6 +679,21 @@ static std::string functionName(const Token *ftok) return ret; } +/** get allocation id for function */ +int Library::alloc(const Token *tok) const +{ + const std::string funcname = functionName(tok); + return isNotLibraryFunction(tok) && argumentChecks.find(funcname) != argumentChecks.end() ? 0 : getid(_alloc, funcname); +} + +/** get deallocation id for function */ +int Library::dealloc(const Token *tok) const +{ + const std::string funcname = functionName(tok); + return isNotLibraryFunction(tok) && argumentChecks.find(funcname) != argumentChecks.end() ? 0 : getid(_dealloc, funcname); +} + + const Library::ArgumentChecks * Library::getarg(const Token *ftok, int argnr) const { if (isNotLibraryFunction(ftok)) diff --git a/lib/library.h b/lib/library.h index 883853c2b..5de815421 100644 --- a/lib/library.h +++ b/lib/library.h @@ -63,22 +63,18 @@ public: /** this is primarily meant for unit tests. it only returns true/false */ bool loadxmldata(const char xmldata[], std::size_t len); - /** get allocation id for function by name */ + /** get allocation id for function by name (deprecated, use other alloc) */ int alloc(const char name[]) const { return getid(_alloc, name); } /** get allocation id for function */ - int alloc(const Token *tok) const { - return isNotLibraryFunction(tok) && argumentChecks.find(tok->str()) != argumentChecks.end() ? 0 : getid(_alloc, tok->str()); - } + int alloc(const Token *tok) const; /** get deallocation id for function */ - int dealloc(const Token *tok) const { - return isNotLibraryFunction(tok) && argumentChecks.find(tok->str()) != argumentChecks.end() ? 0 : getid(_dealloc, tok->str()); - } + int dealloc(const Token *tok) const; - /** get deallocation id for function by name */ + /** get deallocation id for function by name (deprecated, use other alloc) */ int dealloc(const char name[]) const { return getid(_dealloc, name); }