From: Kevin McCarthy Date: Mon, 3 Dec 2018 04:26:27 +0000 (-0800) Subject: Add mutt_buffer_addstr_n(). X-Git-Tag: mutt-1-12-rel~201 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56098c840037449ffc1b3a510fc8abf80846a509;p=mutt Add mutt_buffer_addstr_n(). --- diff --git a/buffer.c b/buffer.c index 3142d00c..3e0b78f4 100644 --- a/buffer.c +++ b/buffer.c @@ -172,7 +172,7 @@ int mutt_buffer_add_printf (BUFFER* buf, const char* fmt, ...) /* Dynamically grows a BUFFER to accommodate s, in increments of 128 bytes. * Always one byte bigger than necessary for the null terminator, and * the buffer is always null-terminated */ -static void mutt_buffer_add (BUFFER* buf, const char* s, size_t len) +void mutt_buffer_addstr_n (BUFFER* buf, const char* s, size_t len) { if (buf->dptr + len + 1 > buf->data + buf->dsize) mutt_buffer_increase_size (buf, buf->dsize + (len < 128 ? 128 : len + 1)); @@ -183,12 +183,12 @@ static void mutt_buffer_add (BUFFER* buf, const char* s, size_t len) void mutt_buffer_addstr (BUFFER* buf, const char* s) { - mutt_buffer_add (buf, s, mutt_strlen (s)); + mutt_buffer_addstr_n (buf, s, mutt_strlen (s)); } void mutt_buffer_addch (BUFFER* buf, char c) { - mutt_buffer_add (buf, &c, 1); + mutt_buffer_addstr_n (buf, &c, 1); } void mutt_buffer_strcpy (BUFFER *buf, const char *s) diff --git a/buffer.h b/buffer.h index 3312ad86..fae26d34 100644 --- a/buffer.h +++ b/buffer.h @@ -47,6 +47,7 @@ void mutt_buffer_strcpy (BUFFER *, const char *); /* These append to the buffer. */ int mutt_buffer_add_printf (BUFFER*, const char*, ...); +void mutt_buffer_addstr_n (BUFFER*, const char*, size_t); void mutt_buffer_addstr (BUFFER*, const char*); void mutt_buffer_addch (BUFFER*, char);