Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

halloc_util.c File Reference

A hierarchical memory allocation system. More...

#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "fallback.h"
#include "util.h"
#include "common.h"
#include "halloc.h"

This graph shows which files directly or indirectly include this file:


Functions

void halloc_util_init ()
 Create the global_context halloc object.
void halloc_util_destroy ()
 Free the global_context halloc object.
array_list_tal_halloc (void *context)
 Allocate a array_list_t that will be automatically disposed of when the specified context is free'd.
string_buffer_tsb_halloc (void *context)
 Allocate a string_buffer_t that will be automatically disposed of when the specified context is free'd.
static void halloc_passthrough (void *f)
 A function that takes a single parameter, which is a function pointer, and calls it.
void halloc_register_function_void (void *context, void(*func)())
 Register the specified function to run when the specified context is free'd.
void * halloc_register (void *context, void *data)
 Free the memory pointed to by data when the memory pointed to by context is free:d.
wchar_t * halloc_wcsdup (void *context, const wchar_t *in)
 Make a copy of the specified string using memory allocated using halloc and the specified context.
wchar_t * halloc_wcsndup (void *context, const wchar_t *in, int c)
 Make a copy of the specified substring using memory allocated using halloc and the specified context.

Variables

void * global_context = 0
 This pointer is a valid halloc context that will be freed right before program shutdown.

Detailed Description

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.


Function Documentation

void* halloc_register void *  context,
void *  data
 

Free the memory pointed to by data when the memory pointed to by 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( 0, size ) can be used as a context.

void halloc_register_function_void void *  context,
void(*)()  func
 

Register the specified function to run when the specified context is free'd.

This function is related to halloc_register_function, but the specified function dowes not take an argument.


Variable Documentation

void* global_context = 0
 

This pointer is a valid halloc context that will be freed right before program shutdown.

It may be used to allocate memory that should be freed when the program shuts down.


Generated on Sun Jan 13 02:52:51 2008 for fish by  doxygen 1.4.4