MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / htmlblock_is_end

Function htmlblock_is_end

libraries/hoedown/src/document.c:2035–2058  ·  view source on GitHub ↗

htmlblock_is_end • check for end of HTML block : ( *)\n */ returns tag length on match, 0 otherwise */ assumes data starts with "<" */

Source from the content-addressed store, hash-verified

2033/* returns tag length on match, 0 otherwise */
2034/* assumes data starts with "<" */
2035static size_t
2036htmlblock_is_end(
2037 const char *tag,
2038 size_t tag_len,
2039 hoedown_document *doc,
2040 uint8_t *data,
2041 size_t size)
2042{
2043 size_t i = tag_len + 3, w;
2044
2045 /* try to match the end tag */
2046 /* note: we're not considering tags like "</tag >" which are still valid */
2047 if (i > size ||
2048 data[1] != '/' ||
2049 strncasecmp((char *)data + 2, tag, tag_len) != 0 ||
2050 data[tag_len + 2] != '>')
2051 return 0;
2052
2053 /* rest of the line must be empty */
2054 if ((w = is_empty(data + i, size - i)) == 0 && i < size)
2055 return 0;
2056
2057 return i + w;
2058}
2059
2060/* htmlblock_find_end • try to find HTML block ending tag */
2061/* returns the length on match, 0 otherwise */

Callers 1

htmlblock_find_endFunction · 0.85

Calls 1

is_emptyFunction · 0.85

Tested by

no test coverage detected