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

Function replace_spacing

libraries/hoedown/src/document.c:342–358  ·  view source on GitHub ↗

* Replace all spacing characters in data with spaces. As a special * case, this collapses a newline with the previous space, if possible. */

Source from the content-addressed store, hash-verified

340 * case, this collapses a newline with the previous space, if possible.
341 */
342static void
343replace_spacing(hoedown_buffer *ob, const uint8_t *data, size_t size)
344{
345 size_t i = 0, mark;
346 hoedown_buffer_grow(ob, size);
347 while (1) {
348 mark = i;
349 while (i < size && data[i] != '\n') i++;
350 hoedown_buffer_put(ob, data + mark, i - mark);
351
352 if (i >= size) break;
353
354 if (!(i > 0 && data[i-1] == ' '))
355 hoedown_buffer_putc(ob, ' ');
356 i++;
357 }
358}
359
360/****************************
361 * INLINE PARSING FUNCTIONS *

Callers 1

char_linkFunction · 0.85

Calls 3

hoedown_buffer_growFunction · 0.85
hoedown_buffer_putFunction · 0.85
hoedown_buffer_putcFunction · 0.85

Tested by

no test coverage detected