From b0a0cabbee704740169c9e493d61fcf786251601 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sun, 7 Jun 2015 15:01:43 +0200 Subject: Remove unused function cmark_strbuf_attach This function was missing a couple of range checks that I'm too lazy to fix. --- src/buffer.c | 18 ------------------ src/buffer.h | 1 - 2 files changed, 19 deletions(-) (limited to 'src') diff --git a/src/buffer.c b/src/buffer.c index 08192da..bc2e38f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -250,24 +250,6 @@ unsigned char *cmark_strbuf_detach(cmark_strbuf *buf) return data; } -void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, bufsize_t asize) -{ - cmark_strbuf_free(buf); - - if (ptr) { - buf->ptr = ptr; - buf->size = strlen((char *)ptr); - if (asize > 0) - // TODO: Check for overflow. - buf->asize = (asize < buf->size) ? buf->size + 1 : asize; - else /* pass 0 to fall back on strlen + 1 */ - // TODO: Check for overflow. - buf->asize = buf->size + 1; - } else { - cmark_strbuf_grow(buf, asize); - } -} - int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b) { int result = memcmp(a->ptr, b->ptr, MIN(a->size, b->size)); diff --git a/src/buffer.h b/src/buffer.h index 526276d..d125207 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -42,7 +42,6 @@ size_t cmark_strbuf_len(const cmark_strbuf *buf); int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b); -void cmark_strbuf_attach(cmark_strbuf *buf, unsigned char *ptr, bufsize_t asize); unsigned char *cmark_strbuf_detach(cmark_strbuf *buf); void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf); -- cgit v1.2.3