ks_malloc.c File Reference

libkarmaclient memory management. More...

#include "ks_config.h"
#include "ks_malloc.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

void ks_malloc_set (ks_malloc_t m, ks_realloc_t r, ks_free_t f)
void * ks_malloc (size_t size)
void * ks_realloc (void *ptr, size_t size)
void ks_free (void *ptr)


Detailed Description

libkarmaclient memory management.

Definitions of the libkarmaclient memory management functions. These functions provide wrappers around memory management functions that share the malloc(3), realloc(3) and free(3) prototypes.

Definition in file ks_malloc.c.


Function Documentation

void ks_free ( void *  ptr  ) 

Free the memory pointed to by ptr.

Parameters:
ptr a pointer to the memory we want to free
Returns:
Nothing

Definition at line 122 of file ks_malloc.c.

Referenced by ks_array_fini(), ks_array_free(), ks_assoc_free(), ks_bquery_free(), ks_number_free(), ks_response_free(), ks_socket_free(), ks_socket_send(), ks_socket_set_auth(), and ks_string_free().

void* ks_malloc ( size_t  size  ) 

Allocate a size bytes of memory using the allocation function given to ks_malloc_set().

Parameters:
size the size of the block of memory to be allocated (in bytes)
Returns:
A pointer to the newly allocated memory on success, or NULL on failure

Definition at line 92 of file ks_malloc.c.

Referenced by ks_array_init(), ks_array_new(), ks_assoc_new(), ks_bquery_new(), ks_number_new(), ks_socket_new(), ks_socket_send(), ks_socket_set_auth(), and ks_string_new().

void ks_malloc_set ( ks_malloc_t  m,
ks_realloc_t  r,
ks_free_t  f 
)

Initialise the functions that are actually used for allocating reallocating and freeing allocated memory. If this function is not called, libkarmaclient defaults to using malloc(3), realloc(3) and free(3).

Parameters:
m a pointer to a memory allocation function.
r a pointer to a reallocation function.
f a pointer to a memory freeing function
Returns:
Nothing

Definition at line 75 of file ks_malloc.c.

void* ks_realloc ( void *  ptr,
size_t  size 
)

Allocate a new block of size bytes memory for the object pointed to be ptr.

Parameters:
ptr a pointer to the memory currently allocated for the object.
size the size of the block of memory we wish to allocate for the object pointed to by ptr.
Returns:
a pointer to the newly allocated block of memory on success, or NULL on failure.

Definition at line 109 of file ks_malloc.c.

Referenced by ks_array_extend(), and ks_string_append().


Generated on Wed May 9 01:01:57 2007 for libkarmaclient by  doxygen 1.5.1