Utility functions.
More...
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "util.h"
◆ CYAML_RELEASE_FLAG
#define CYAML_RELEASE_FLAG (1u << 31) |
◆ CYAML_STR
◆ CYAML_STR_HELPER
#define CYAML_STR_HELPER |
( |
|
_x | ) |
#_x |
Stringification helper macro.
◆ CYAML_VERSION_STR
#define CYAML_VERSION_STR |
Value:
CYAML_STR(VERSION_MINOR) "." \
CYAML_STR(VERSION_PATCH)
#define CYAML_STR(_x)
Definition: util.c:26
Version string is composed from components in Makefile.
◆ cyaml_log()
void cyaml_log |
( |
cyaml_log_t |
level, |
|
|
void * |
ctx, |
|
|
const char * |
fmt, |
|
|
va_list |
args |
|
) |
| |
Standard CYAML logging function.
This logs to stderr
. It clients want to log elsewhere they must implement their own logging function, and pass it to CYAML in the cyaml_config_t structure.
- Note
- This default logging function composes single log messages from multiple separate fprintfs to
stderr
. If the client application writes to stderr
from multiple threads, individual cyaml_log messages may get broken up by the client applications logging. To avoid this, clients should implement their own cyaml_log_fn_t and pass it in via cyaml_config_t.
- Parameters
-
[in] | level | Log level of message to log. |
[in] | ctx | Logging context, unused. |
[in] | fmt | Format string for message to log. |
[in] | args | Additional arguments used by fmt. |
◆ cyaml_strerror()
Convert a cyaml error code to a human-readable string.
- Parameters
-
[in] | err | Error code code to convert. |
- Returns
- String representing err. The string is '\0' terminated, and owned by libcyaml.
◆ cyaml_version
const uint32_t cyaml_version |
Initial value:=
((VERSION_MAJOR << 16) |
(VERSION_MINOR << 8) |
(VERSION_PATCH << 0) |
#define CYAML_RELEASE_FLAG
Definition: util.c:20
CYAML library version number suitable for comparisons.
Version number binary composition is 0bRUUUUUUUJJJJJJJJNNNNNNNNPPPPPPPP
.
Character | Meaning |
R | Release flag. If set, it's a release. |
U | Unused / reserved. |
J | Major component of version. |
N | Minor component of version. |
P | Patch component of version. |
◆ cyaml_version_str
CYAML library version string.