diff options
author | 2006-02-07 04:11:01 +1000 | |
---|---|---|
committer | 2006-02-07 04:11:01 +1000 | |
commit | 57d53c70e3d1baabbe3207ce0356ca8e38842198 (patch) | |
tree | 0408df190f6dadb7a9315e5420f48634ee2272bb /halloc.h | |
parent | 4e77ee45164f745992dbf575f2b6c0f3797dabf0 (diff) |
Further halloc:ification if fish
darcs-hash:20060206181101-ac50b-db0aac307a81e7f0677acd15a9f38ff8c7ff36d2.gz
Diffstat (limited to 'halloc.h')
-rw-r--r-- | halloc.h | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -1,18 +1,35 @@ -/** \file halloc.h - A hierarchical memory allocation system +/** \file halloc.h + + A hierarchical memory allocation system. Works just like talloc + used in Samba, except that an arbitrary block allocated with + malloc() can be registered to be freed by halloc_free. + */ /** Allocate new memory using specified parent memory context. If \c - context is null, a new root context is created. + context is null, a new root context is created. Context _must_ be + either 0 or the result of a previous call to halloc. + + If \c context is null, the resulting block must be freed with a + call to halloc_free(). + + If \c context is not null, the resulting memory block must never be + explicitly freed, it will be automatically freed whenever the + parent context is freed. */ void *halloc( void *context, size_t size ); /** - Free memory context and all children. Only root contexts may be - freed explicitly. + Free memory context and all children contexts. Only root contexts + may be freed explicitly. */ void halloc_free( void *context ); -wchar_t *halloc_wcsdup( void *context, const wchar_t *str ); -wchar_t *halloc_wcsndup( void *context, const wchar_t *in, int c ); +/** + Free the memory pointed to by \c data when the memory pointed to by + \c context is free:d. Note that this will _not_ turn the specified + memory area into a valid halloc context. Only memory areas created + using a call to halloc() can be used as a context. +*/ +void *halloc_register( void *context, void *data ); |