MCPcopy Create free account
hub / github.com/antirez/botlib / buffer_skip_whitespace

Function buffer_skip_whitespace

cJSON.c:1034–1057  ·  view source on GitHub ↗

Utility to jump whitespace and cr/lf */

Source from the content-addressed store, hash-verified

1032
1033/* Utility to jump whitespace and cr/lf */
1034static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer)
1035{
1036 if ((buffer == NULL) || (buffer->content == NULL))
1037 {
1038 return NULL;
1039 }
1040
1041 if (cannot_access_at_index(buffer, 0))
1042 {
1043 return buffer;
1044 }
1045
1046 while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
1047 {
1048 buffer->offset++;
1049 }
1050
1051 if (buffer->offset == buffer->length)
1052 {
1053 buffer->offset--;
1054 }
1055
1056 return buffer;
1057}
1058
1059/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */
1060static parse_buffer *skip_utf8_bom(parse_buffer * const buffer)

Callers 3

parse_arrayFunction · 0.85
parse_objectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected