Centralized template functions to func.h

All right, after the embarrassment produced in #12, I've decided to create smaller pull requests, and this one is quite simple. It removes some helper macros (even the commented ones), replacing them with template functions: `RELEASE`, `SAFE_DELETE`, `SAFE_DELETE_ARRAY` and `sqr`. All of them were kept in "func.h" and removed from other source files.