#include <csl/csldefs.h>
Go to the source code of this file.
Defines | |
#define | CSL_GNUC_PRINTF(format_idx, arg_idx) |
GCC specific macro. More... | |
#define | CSL_GNUC_NORETURN |
GCC specific macro. More... | |
#define | CSL_UINT_TO_POINTER(ifoo) ((void*) ((unsigned long) (ifoo))) |
Cast unsigned int to pointer. More... | |
#define | CSL_INT_TO_POINTER(ifoo) ((void*) ((signed long) (ifoo))) |
Cast int to pointer. More... | |
#define | CSL_POINTER_TO_INT(pfoo) ((int) ((signed long) (pfoo))) |
Cast pointer to int. More... | |
#define | CSL_POINTER_TO_UINT(pfoo) ((unsigned int) ((unsigned long) (pfoo))) |
Cast pointer to unsigned int. More... | |
#define | csl_new(struct, n) (csl_malloc (sizeof (struct) * n)) |
Allocate storage for structs. More... | |
#define | csl_new0(struct, n) (csl_malloc0 (sizeof (struct) * n)) |
Allocate and clear storage for structs. More... | |
#define | csl_assert(cond) { if (!(cond)) csl_error ("assertion failed: %s", # cond ); } |
Assertion check. More... | |
#define | csl_return_if_fail(cond) { if (!(cond)) { csl_warning ("assertion failed: %s", # cond ); return; } } |
Assertion check with return. More... | |
#define | csl_return_val_if_fail(cond, v) { if (!(cond)) { csl_warning ("assertion failed: %s", # cond ); return (v); } } |
Assertion check with return of a value. More... | |
#define | csl_debug(key) (csl_check_debug (CSL_DEBUG_ ## key)) |
Check debug level. More... | |
Enumerations | |
enum | CslDebugFlags { CSL_DEBUG_NONE = (0), CSL_DEBUG_PCM = (1 << 0), CSL_DEBUG_MISC = (1 << 1) } |
Debugging levels. More... | |
Functions | |
void | csl_error (const char *format,...) CSL_GNUC_PRINTF(1, 2) CSL_GNUC_NORETURN |
Display error message. More... | |
void | csl_warning (const char *format,...) CSL_GNUC_PRINTF(1, 2) |
Display warning message. More... | |
void | csl_message (const char *format,...) CSL_GNUC_PRINTF(1, 2) |
Display informational message. 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... | |
void * | csl_memdup (void const *mem, unsigned int n_bytes) |
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... | |
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... |
|
GCC specific macro.
|
|
GCC specific macro.
|
|
Cast int to pointer.
|
|
Cast pointer to int.
|
|
Cast pointer to unsigned int.
|
|
Cast unsigned int to pointer.
|
|
Assertion check. Check if a condition is true, and if not, call csl_error with a suitable error message.
|
|
Check debug level. Return whether the specified debug level is enabled. e.g. csl_check_debug(PCM);
|
|
Allocate storage for structs. Allocate storage for one or more variables of type struct.
|
|
Allocate and clear storage for structs. Allocate storage for one or more variables of type struct and fill the memory with zeroes.
|
|
Assertion check with return. Check if a condition is true, and if not, call csl_warning and return.
|
|
Assertion check with return of a value. Check if a condition is true, and if not, call csl_warning and return a value.
|
|
Debugging levels. You can enable debug messages for PCM and/or miscellaneous functions.
|
|
Check debug level. Return whether the specified debug level is enabled. e.g. csl_check_debug(CSL_DEBUG_PCM);
|
|
Display error message. Display an error message on standard error and then exit using abort().
|
|
Free dynamically allocated memory. Free memory previously allocated by csl_malloc, csl_malloc0, csl_malloc0, csl_new, or csl_new0.
|
|
Dynamically allocate memory. Dynamically allocate storage. Calls csl_error if memory cannot be allocated.
|
|
Dynamically allocate and clear memory. Dynamically allocate storage. Calls csl_error if memory cannot be allocated. Sets the allocated memory to all zeroes.
|
|
|
|
Display informational message. Display an informational message on standard error.
|
|
Change size of dynamically allocated memory. Changes the size of dynamically allocate storage. Calls csl_error if memory cannot be allocated.
|
|
Set debugging level. Set level of debug messages to be displayed. e.g. csl_set_debug_mask(CSL_DEBUG_PCM|CSL_DEBUG_MISC);
|
|
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.
|
|
Free a group of strings. A group of strings pointed to by pointers stored sequentially in memory are freed using csl_free.
|
|
Display warning message. Display a warning message on standard error.
|