| 76 | } |
| 77 | |
| 78 | void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, |
| 79 | bufsize_t len) { |
| 80 | if (len <= 0 || data == NULL) { |
| 81 | cmark_strbuf_clear(buf); |
| 82 | } else { |
| 83 | if (data != buf->ptr) { |
| 84 | if (len >= buf->asize) |
| 85 | cmark_strbuf_grow(buf, len); |
| 86 | memmove(buf->ptr, data, len); |
| 87 | } |
| 88 | buf->size = len; |
| 89 | buf->ptr[buf->size] = '\0'; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | void cmark_strbuf_putc(cmark_strbuf *buf, int c) { |
| 94 | S_strbuf_grow_by(buf, 1); |
no test coverage detected