kb_memory.h File Reference

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

Go to the source code of this file.

Defines

#define KB_ALLOC(type, count)   (type *)kb_alloc(sizeof(type)*(count))
#define KB_REALLOC(ptr, type, count)   (type *)kb_realloc((void*)ptr, sizeof(type)*(count))
#define kb_free(ptr)   free(ptr)

Functions

void * kb_alloc (unsigned long size)
void * kb_realloc (void *ptr, unsigned long size)


Define Documentation

#define KB_ALLOC ( type,
count   )     (type *)kb_alloc(sizeof(type)*(count))

#define kb_free ( ptr   )     free(ptr)

#define KB_REALLOC ( ptr,
type,
count   )     (type *)kb_realloc((void*)ptr, sizeof(type)*(count))

Definition at line 20 of file kb_memory.h.

Referenced by ksock_add_command().


Function Documentation

void* kb_alloc ( unsigned long  size  ) 

This function allocates safely memory. Produces an fatal error when no more memory is available.

Parameters:
size size in bytes
Returns:
pointer to memory allocated

Definition at line 21 of file kb_memory.c.

References KB_ERROR_NOMEM, and KB_FATAL.

Referenced by knet_init(), koa_net_playsound(), and main().

void* kb_realloc ( void *  ptr,
unsigned long  size 
)

This function reallocates safely memory. Produces an fatal error when no more memory is available

Parameters:
ptr Pointer to the block of memory to resize
size New size of the memory block
Returns:
a pointer on the new memory block

Definition at line 40 of file kb_memory.c.

References KB_ERROR_NOMEM, and KB_FATAL.

Referenced by knet_printf(), and knet_vprintf().


Generated on Wed Dec 15 11:49:28 2010 for KoreBot Library by  doxygen 1.5.5