libcdio  2.1.0
Macros | Functions
util.h File Reference

Miscellaneous utility functions. More...

#include <stdlib.h>
#include <cdio/types.h>

Go to the source code of this file.

Macros

#define CDIO_INLINE
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define IN(x, low, high)   ((x) >= (low) && (x) <= (high))
 
#define CLAMP(x, low, high)   (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
 
#define CDIO_FREE_IF_NOT_NULL(p_obj)   if (NULL != p_obj) { free(p_obj); p_obj=NULL; };
 

Functions

void * _cdio_memdup (const void *mem, size_t count)
 
char * _cdio_strdup_upper (const char str[])
 
char * _cdio_strdup_fixpath (const char path[])
 
void _cdio_strfreev (char **strv)
 
size_t _cdio_strlenv (char **str_array)
 
char ** _cdio_strsplit (const char str[], char delim)
 
uint8_t cdio_to_bcd8 (uint8_t n)
 
uint8_t cdio_from_bcd8 (uint8_t p)
 
char * cdio_realpath (const char *psz_src, char *psz_dst)
 

Detailed Description

Miscellaneous utility functions.

Warning: this will probably get removed/replaced by using glib.h

Macro Definition Documentation

◆ CDIO_FREE_IF_NOT_NULL

#define CDIO_FREE_IF_NOT_NULL (   p_obj)    if (NULL != p_obj) { free(p_obj); p_obj=NULL; };

free() and NULL out p_obj it is not already null.

◆ CDIO_INLINE

#define CDIO_INLINE

◆ CLAMP

#define CLAMP (   x,
  low,
  high 
)    (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))

◆ IN

#define IN (   x,
  low,
  high 
)    ((x) >= (low) && (x) <= (high))

◆ MAX

#define MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

◆ MIN

#define MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Function Documentation

◆ _cdio_memdup()

void* _cdio_memdup ( const void *  mem,
size_t  count 
)

◆ _cdio_strdup_fixpath()

char* _cdio_strdup_fixpath ( const char  path[])

Duplicate path and make it platform compliant. Typically needed for MinGW/MSYS where a "/c/..." path must be translated to "c:/..." for use with fopen(), etc. Returned string must be freed by the caller using cdio_free().

◆ _cdio_strdup_upper()

char* _cdio_strdup_upper ( const char  str[])

◆ _cdio_strfreev()

void _cdio_strfreev ( char **  strv)

◆ _cdio_strlenv()

size_t _cdio_strlenv ( char **  str_array)

◆ _cdio_strsplit()

char** _cdio_strsplit ( const char  str[],
char  delim 
)

◆ cdio_from_bcd8()

uint8_t cdio_from_bcd8 ( uint8_t  p)

◆ cdio_realpath()

char* cdio_realpath ( const char *  psz_src,
char *  psz_dst 
)

cdio_realpath() same as POSIX.1-2001 realpath if that's around. If not we do poor-man's simulation of that behavior.

◆ cdio_to_bcd8()

uint8_t cdio_to_bcd8 ( uint8_t  n)