Main Page   Compound List   File List   Compound Members   File Members  

cslutils.c File Reference

#include "cslutils.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>

Functions

void csl_error (const char *format,...)
 Display error message. More...

void csl_warning (const char *format,...)
 Display warning message. More...

void csl_message (const char *format,...)
 Display informational message. More...

void csl_set_debug_mask (unsigned int debug_mask)
 Set debugging level. More...

CslBool csl_check_debug (unsigned int debug_key)
 Check debug level. More...

void csl_free (void *mem)
 Free dynamically allocated memory. More...

void* csl_malloc (unsigned int n_bytes)
 Dynamically allocate memory. More...

void* csl_malloc0 (unsigned int n_bytes)
 Dynamically allocate and clear memory. More...

void* csl_realloc (void *mem, unsigned int n_bytes)
 Change size of dynamically allocated memory. More...

char* csl_strdup (const char *string)
 Duplicate a string. More...

void csl_strfreevn (unsigned int n, char **str_p)
 Free a group of strings. More...


Function Documentation

CslBool csl_check_debug ( unsigned int debug_key )
 

Check debug level.

Return whether the specified debug level is enabled. e.g. csl_check_debug(CSL_DEBUG_PCM);

Parameters:
debug_key   One of the elements of the enumerated type CslDebugFlags.
Returns:
TRUE if the given debug level is enabled, otherwise FALSE.
See also:
csl_set_debug_mask , csl_debug
Parameters:
debug_key  

void csl_error ( const char * format,
... )
 

Display error message.

Display an error message on standard error and then exit using abort().

Parameters:
format   A printf() style format string optionally followed by additional arguments. Does not return.
See also:
csl_warning , csl_message
Parameters:
format  

void csl_free ( void * mem )
 

Free dynamically allocated memory.

Free memory previously allocated by csl_malloc, csl_malloc0, csl_malloc0, csl_new, or csl_new0.

Parameters:
mem   Pointer to previously allocated memory.
Returns:
none
See also:
csl_malloc , csl_malloc0 , csl_realloc , csl_new , csl_new0
Parameters:
mem  

void* csl_malloc ( unsigned int n_bytes )
 

Dynamically allocate memory.

Dynamically allocate storage. Calls csl_error if memory cannot be allocated.

Parameters:
n_bytes   The number of bytes of storage to be dynamically allocated.
Returns:
A pointer to the allocated memory.
See also:
csl_free , csl_malloc0 , csl_realloc , csl_new , csl_new0
Parameters:
n_bytes  

void* csl_malloc0 ( unsigned int n_bytes )
 

Dynamically allocate and clear memory.

Dynamically allocate storage. Calls csl_error if memory cannot be allocated. Sets the allocated memory to all zeroes.

Parameters:
n_bytes   The number of bytes of storage to be dynamically allocated.
Returns:
A pointer to the allocated memory.
See also:
csl_free , csl_malloc0 , csl_realloc , csl_new , csl_new0
Parameters:
n_bytes  

void csl_message ( const char * format,
... )
 

Display informational message.

Display an informational message on standard error.

Parameters:
format   A printf() style format string optionally followed by additional arguments.
Returns:
none
See also:
csl_error , csl_warning
Parameters:
format  

void* csl_realloc ( void * mem,
unsigned int n_bytes )
 

Change size of dynamically allocated memory.

Changes the size of dynamically allocate storage. Calls csl_error if memory cannot be allocated.

Parameters:
mem   Pointer to the start of the previously allocated storage. If NULL, the call is equivalent to calling csl_malloc.
n_bytes   The new size of the area of storage to be dynamically allocated, which can be greater or smaller than the current size. If n_bytes is zero, then the call is equivalent to calling csl_free.
Returns:
A pointer to the new area of allocated memory.
See also:
csl_free , csl_malloc , csl_malloc0 , csl_new , csl_new0
Parameters:
mem  
n_bytes  

void csl_set_debug_mask ( unsigned int debug_mask )
 

Set debugging level.

Set level of debug messages to be displayed. e.g. csl_set_debug_mask(CSL_DEBUG_PCM|CSL_DEBUG_MISC);

Parameters:
debug_mask   Debug flags, one or more of the elements of the enumerated type CslDebugFlags, ORed together.
See also:
csl_check_debug , csl_debug
Parameters:
debug_mask  

char* csl_strdup ( const char * string )
 

Duplicate a string.

Returns a pointer to a new string which is a duplicate of string. Memory for the new string is obtained with csl_malloc and can be freed with csl_free.

Parameters:
string   Pointer to the original string
Returns:
A pointer to the new string
See also:
csl_free , csl_strfreevn
Parameters:
string  

void csl_strfreevn ( unsigned int n,
char ** str_p )
 

Free a group of strings.

A group of strings pointed to by pointers stored sequentially in memory are freed using csl_free.

Parameters:
n   Number of string pointers to be freed.
str_p   Pointer to start of a series of pointers to strings to be freed.
See also:
csl_free
Parameters:
n  
str_p  

void csl_warning ( const char * format,
... )
 

Display warning message.

Display a warning message on standard error.

Parameters:
format   A printf() style format string optionally followed by additional arguments.
Returns:
none
See also:
csl_error , csl_message
Parameters:
format  


Generated at Wed Jun 6 17:51:42 2001 for CSL by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001