MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / pointer_encoded_length

Function pointer_encoded_length

cJSON_Utils.c:157–170  ·  view source on GitHub ↗

calculate the length of a string if encoded as JSON pointer with ~0 and ~1 escape sequences */

Source from the content-addressed store, hash-verified

155
156/* calculate the length of a string if encoded as JSON pointer with ~0 and ~1 escape sequences */
157static size_t pointer_encoded_length(const unsigned char *string)
158{
159 size_t length;
160 for (length = 0; *string != '\0'; (void)string++, length++)
161 {
162 /* character needs to be escaped? */
163 if ((*string == '~') || (*string == '/'))
164 {
165 length++;
166 }
167 }
168
169 return length;
170}
171
172/* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */
173static void encode_string_as_pointer(unsigned char *destination, const unsigned char *source)

Callers 3

compose_patchFunction · 0.85
create_patchesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…