Function

judo_stringify

Lexeme to decoded string.

Since v1.0
enum judo_result judo_stringify(
const char *lexeme, int32_t length, char *buf, int32_t *buflen)

Parameters 🔗

lexeme in

Lexeme of a string or object member name.

length in

Number of UTF-8 code units in lexeme.

buf out

Buffer to receive the decoded string.

buflen inout

Code unit capacity of buf on input; code units written to buf on output if buf is not NULL else number of code units in the decoded string.

Return Value 🔗

JUDO_SUCCESS

If the numeric value was written to number.

JUDO_INVALID_OPERATION

If stream, string, or number are NULL.

JUDO_NO_BUFFER_SPACE

If buf is too small to accommodate the string.

JUDO_MALFUNCTION

If there is a defect in the implementation.

Discussion 🔗

The judo_stringify function decodes (i.e. unescapes) the string or object member name referenced by lexeme and writes it to buf. The number of code units in lexeme is specified by length.

The buflen parameter must be the capacity of buf. The implementation will update buflen with the number of code units written to buf.

If buf is null, then buflen must be zero and the implementation will write to buflen the number of code units in the decoded lexeme. Calling the function this way is useful for calculating the total size of buf.