ccollections · Section 3
ccol_retval_to_str
NAME
ccol_retval_to_str - name of a ccol_retval code as a string
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/common.h> static inline const char *ccol_retval_to_str(ccol_retval r);
DESCRIPTION
Returns the name of the enumerator r as a string literal, so ccol_key_not_found gives "ccol_key_not_found". It's meant for diagnostic messages and log records. ccollections(7) lists every code with its value.
PARAMETERS
r The code to name
RETURN VALUE
A pointer to a string literal with static storage duration. A value that is not an enumerator of ccol_retval gives "unknown". The function never returns NULL.
THREAD SAFETY
Thread-safe. The function reads no state.
EXAMPLES
#include <stdio.h> #include <ccollections/cthreadcomm.h> int main(void) { ccircq *q = ccircq_create(4, NULL); if (!q) return 1; cmessage msg; ccol_retval rv = ccircq_try_recv(q, &msg); printf("%s\n", ccol_retval_to_str(rv)); /* ccol_container_empty */ ccircq_destroy(q); return 0; }