]> git.kaiwu.me - klib.git/commit
Add allocation wrappers and error checking
authorRussell Belfer <rb@github.com>
Fri, 31 Aug 2012 23:06:32 +0000 (16:06 -0700)
committerRussell Belfer <rb@github.com>
Fri, 31 Aug 2012 23:06:32 +0000 (16:06 -0700)
commit6a7e6f952d55f07fa74098bb758515a909ae9590
tree20079a8f548e634fe8413b13884405dc492d97cd
parentcea612f225516d5706a7aa712538b1f86bb0dba2
Add allocation wrappers and error checking

When embedding khash in another project, it is convenient to be
able to replace the use of malloc/calloc/free with alternatives.
This wraps those calls with kmalloc/kcalloc/kfree, etc. macros
that can be easily redefined by the khash user to override the
allocators.

Additionally, the return value from allocations was not being
checked.  This adds a check whenever an allocation is performed
and a return code of -1 to indicate an allocation failure.
khash.h