
Topics | |
| Private codec API | |
| Store interface module | |
Macros | |
| #define | CALLOC_GUARD(var, rc) |
| Allocate one pointer with calloc and return rc if it fails. | |
| #define | CHECK(exp, marker) |
| Jump to marker if exp does not return VOLK_OK. | |
| #define | log_debug(...) |
| #define | LOG_RC(rc) |
| Log an error or warning for return codes that are not VOLK_OK. | |
| #define | log_trace(...) |
| #define | MALLOC_GUARD(var, rc) |
| Allocate one pointer with malloc and return rc if it fails. | |
| #define | NLCHECK(exp, marker) |
| Log error and jump to marker if exp is NULL. | |
| #define | NLNL(exp) |
| Log error and return NULL if exp is NULL. | |
| #define | NLRCCK(exp, _rc) |
| Return return codes return code if exp is NULL. | |
| #define | PCHECK(exp, marker) |
| Jump to marker if exp returns a negative value (skip warnings). | |
| #define | PRCCK(exp) |
| Return exp return value if it is of VOLK_rc type and negative (=error). | |
| #define | PRCNL(exp) |
| Return NULL if exp returns a negative value (=error). | |
| #define | RCCK(exp) |
| Return exp return value if it is of VOLK_rc type and nonzero. | |
| #define | RCNL(exp) |
| Return NULL if exp returns a nonzero value. | |
| #define | VOLK_MAX_ERROR -88000 |
| #define | VOLK_MAX_WARNING 88899 |
| #define | VOLK_MIN_ERROR VOLK_ERROR |
| Minimum error value. | |
| #define | VOLK_MIN_WARNING VOLK_NOACTION |
| First warning value. | |
Functions | |
| VOLK_rc | mkdir_p (const char *path, mode_t mode) |
| Make recursive directories. | |
| VOLK_rc | rm_r (const char *path) |
| Remove a directory recursively, as in Unix "rm -r". | |
| char * | strdup (const char *src) |
| Replacement for GNU strdup. | |
| char * | strndup (const char *src, size_t max) |
| Replacement for GNU strndup. | |
| int | utf8_encode (const uint32_t utf, unsigned char *out) |
| Encode a code point using UTF-8. | |
| #define CALLOC_GUARD | ( | var, | |
| rc ) |
| #define CHECK | ( | exp, | |
| marker ) |
Jump to marker if exp does not return VOLK_OK.
| #define LOG_RC | ( | rc | ) |
Log an error or warning for return codes that are not VOLK_OK.
Note that, if used outside of the other macros below, care must be taken to pass it an actual return code rather than an expression, otherwise the expression will be evaluated multiple times.
| #define MALLOC_GUARD | ( | var, | |
| rc ) |
| #define NLCHECK | ( | exp, | |
| marker ) |
| #define NLNL | ( | exp | ) |
| #define NLRCCK | ( | exp, | |
| _rc ) |
Return return codes return code if exp is NULL.
| #define PCHECK | ( | exp, | |
| marker ) |
| #define PRCCK | ( | exp | ) |
Return exp return value if it is of VOLK_rc type and negative (=error).
| #define PRCNL | ( | exp | ) |
| #define RCCK | ( | exp | ) |
| #define RCNL | ( | exp | ) |
| #define VOLK_MAX_ERROR -88000 |
| #define VOLK_MAX_WARNING 88899 |
| #define VOLK_MIN_ERROR VOLK_ERROR |
| #define VOLK_MIN_WARNING VOLK_NOACTION |
| VOLK_rc mkdir_p | ( | const char * | path, |
| mode_t | mode ) |
Make recursive directories.
Modified from https://gist.github.com/JonathonReinhart/8c0d90191c38af2dcadb102c4e202950
| VOLK_rc rm_r | ( | const char * | path | ) |
Remove a directory recursively, as in Unix "rm -r".
| [in] | path | Path of directory to remove. |
Remove a directory recursively, as in Unix "rm -r".
Adapted from https://stackoverflow.com/questions/5467725/how-to-delete-a-directory-and-its-contents-in-posix-c/42596507#42596507
| char * strdup | ( | const char * | src | ) |
| char * strndup | ( | const char * | src, |
| size_t | max ) |
Replacement for GNU strndup.
param[in] src String to duplicate. param[in] max Max number of characters to duplicate. The length is capped to the smaller value between this and the source string length (characters up to the trailing \0).
return Duplicated string. The caller is in charge of freeing it after use.
|
inline |
Encode a code point using UTF-8.
https://gist.github.com/MightyPork/52eda3e5677b4b03524e40c9f0ab1da5
| out | - output buffer (min 5 characters), will be 0-terminated |
| utf | - code point 0-0x10FFFF |