|
myMPD
Internal API documentation
|
JSON functions for sds strings. More...
#include "src/lib/sds/sds_json.h"#include "dist/sds/sds.h"#include "src/lib/sds/sds_extras.h"#include <string.h>
Functions | |
| static const char * | escape_char (char c) |
| sds | sds_catjson_plain (sds s, const char *p, size_t len) |
| sds | sds_catjson (sds s, const char *p, size_t len) |
| sds | sds_catjsonchar (sds s, const char c) |
| bool | sds_json_unescape (const char *src, size_t slen, sds *dst) |
JSON functions for sds strings.
|
static |
JSON escapes special chars
| c | char to escape |
| sds sds_catjson | ( | sds | s, |
| const char * | p, | ||
| size_t | len ) |
Append to the sds string "s" a quoted json escaped string After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.
| s | sds string |
| p | string to append json escaped |
| len | length of the string to append |
| sds sds_catjson_plain | ( | sds | s, |
| const char * | p, | ||
| size_t | len ) |
Append to the sds string "s" a json escaped string After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.
| s | sds string |
| p | string to append json escaped |
| len | length of the string to append |
| sds sds_catjsonchar | ( | sds | s, |
| const char | c ) |
Append to the sds string "s" an json escaped character After the call, the modified sds string is no longer valid and all the references must be substituted with the new pointer returned by the call.
| s | sds string |
| c | char to escape and append |
| bool sds_json_unescape | ( | const char * | src, |
| size_t | slen, | ||
| sds * | dst ) |
Json unescapes "src" and appends the result to the sds string "dst" "dst" must be a pointer to a allocated sds string.
| src | string to unescape |
| slen | string length to unescape |
| dst | pointer to sds string to append the unescaped string |