ext/redcarpet/buffer.c in redcarpet-3.0.0 vs ext/redcarpet/buffer.c in redcarpet-3.1.0

- old
+ new

@@ -92,11 +92,11 @@ return ret; } /* bufnullterm: NULL-termination of the string array */ const char * -bufcstr(struct buf *buf) +bufcstr(const struct buf *buf) { assert(buf && buf->unit); if (buf->size < buf->asize && buf->data[buf->size] == 0) return (char *)buf->data; @@ -118,11 +118,11 @@ assert(buf && buf->unit); if (buf->size >= buf->asize && bufgrow(buf, buf->size + 1) < 0) return; - + va_start(ap, fmt); n = _buf_vsnprintf((char *)buf->data + buf->size, buf->asize - buf->size, fmt, ap); va_end(ap); if (n < 0) { @@ -192,34 +192,5 @@ return; free(buf->data); free(buf); } - - -/* bufreset: frees internal data of the buffer */ -void -bufreset(struct buf *buf) -{ - if (!buf) - return; - - free(buf->data); - buf->data = NULL; - buf->size = buf->asize = 0; -} - -/* bufslurp: removes a given number of bytes from the head of the array */ -void -bufslurp(struct buf *buf, size_t len) -{ - assert(buf && buf->unit); - - if (len >= buf->size) { - buf->size = 0; - return; - } - - buf->size -= len; - memmove(buf->data, buf->data + len, buf->size); -} -