cmark
My personal build of CMark ✏️
- Commit
- 2a9409f587eec1acd7a98cbd5dacc31ac3525812
- Parent
- b018c01fad3b0c6dd9c180b3ba804baee326d9dd
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Removed cmark_strbuf_printf and cmark_strbuf_vprintf.
These are no longer needed, and cause complications for MSVC.
Also removed HAVE_VA_COPY and HAVE_C99_SNPRINTF feature tests.
Diffstat
4 files changed, 0 insertions, 64 deletions
diff --git a/src/buffer.c b/src/buffer.c
@@ -165,54 +165,6 @@ void cmark_strbuf_puts(cmark_strbuf *buf, const char *string)
cmark_strbuf_safe_strlen(string));
}
-void cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap)
-{
- size_t expected_size = strlen(format);
- if (expected_size <= SIZE_MAX / 2)
- expected_size *= 2;
- S_strbuf_grow_by(buf, expected_size);
-
- while (1) {
- va_list args;
- va_copy(args, ap);
-
- int len = vsnprintf(
- (char *)buf->ptr + buf->size,
- buf->asize - buf->size,
- format, args
- );
-#ifndef HAVE_C99_SNPRINTF
- // Assume we're on Windows.
- if (len < 0) {
- len = _vscprintf(format, args);
- }
-#endif
-
- va_end(args);
-
- if (len < 0) {
- perror("vsnprintf in cmark_strbuf_vprintf");
- abort();
- }
-
- if ((size_t)len < (size_t)(buf->asize - buf->size)) {
- buf->size += len;
- break;
- }
-
- S_strbuf_grow_by(buf, len);
- }
-}
-
-void cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- cmark_strbuf_vprintf(buf, format, ap);
- va_end(ap);
-}
-
void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf)
{
bufsize_t copylen;
diff --git a/src/buffer.h b/src/buffer.h
@@ -58,9 +58,6 @@ void cmark_strbuf_sets(cmark_strbuf *buf, const char *string);
void cmark_strbuf_putc(cmark_strbuf *buf, int c);
void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, bufsize_t len);
void cmark_strbuf_puts(cmark_strbuf *buf, const char *string);
-void cmark_strbuf_printf(cmark_strbuf *buf, const char *format, ...)
- CMARK_ATTRIBUTE((format (printf, 2, 3)));
-void cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap);
void cmark_strbuf_clear(cmark_strbuf *buf);
bufsize_t cmark_strbuf_strchr(const cmark_strbuf *buf, int c, bufsize_t pos);