MCPcopy Create free account
hub / github.com/ByConity/ByConity / copyText

Function copyText

src/Functions/extractTextFromHTML.cpp:226–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226void copyText(const char * __restrict & src, const char * end, char * __restrict & dst, bool needs_whitespace)
227{
228 while (src < end && isWhitespaceASCII(*src))
229 ++src;
230
231 const char * lt = find_first_symbols<'<'>(src, end);
232
233 if (needs_whitespace && src < lt)
234 {
235 *dst = ' ';
236 ++dst;
237 }
238
239 while (true)
240 {
241 const char * ws = find_first_symbols<' ', '\t', '\n', '\r', '\f', '\v'>(src, lt);
242 size_t bytes_to_copy = ws - src;
243 memcpy(dst, src, bytes_to_copy);
244 dst += bytes_to_copy;
245
246 src = ws;
247 while (src < lt && isWhitespaceASCII(*src))
248 ++src;
249
250 if (src < lt)
251 {
252 *dst = ' ';
253 ++dst;
254 }
255 else
256 {
257 break;
258 }
259 }
260
261 src = lt;
262}
263
264size_t extract(const char * __restrict src, size_t size, char * __restrict dst)
265{

Callers 1

extractFunction · 0.85

Calls 2

isWhitespaceASCIIFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected