diff options
author | René Scharfe <l.s.r@web.de> | 2014-09-07 09:03:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-08 11:26:45 -0700 |
commit | d07235a027e0c7ed2fee1aeb3bee8a858bf5ca58 (patch) | |
tree | 8805b3767a1d86908c448aef92e56036fdeee92b | |
parent | e6aaa393478bf3ee9f4cde8d82cd258c034cd335 (diff) | |
download | git-d07235a027e0c7ed2fee1aeb3bee8a858bf5ca58.tar.gz |
strbuf: export strbuf_addchars()
Move strbuf_addchars() to strbuf.c, where it belongs, and make it
available for other callers.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Documentation/technical/api-strbuf.txt | 4 | ||||
-rw-r--r-- | strbuf.c | 7 | ||||
-rw-r--r-- | strbuf.h | 1 | ||||
-rw-r--r-- | utf8.c | 7 |
4 files changed, 12 insertions, 7 deletions
diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index 3350d97dda..1d83362116 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -142,6 +142,10 @@ then they will free() it. Add a single character to the buffer. +`strbuf_addchars`:: + + Add a character the specified number of times to the buffer. + `strbuf_insert`:: Insert data to the given position of the buffer. The remaining contents @@ -196,6 +196,13 @@ void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len) strbuf_setlen(sb, sb->len + len); } +void strbuf_addchars(struct strbuf *sb, int c, size_t n) +{ + strbuf_grow(sb, n); + memset(sb->buf + sb->len, c, n); + strbuf_setlen(sb, sb->len + n); +} + void strbuf_addf(struct strbuf *sb, const char *fmt, ...) { va_list ap; @@ -121,6 +121,7 @@ static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) { strbuf_add(sb, sb2->buf, sb2->len); } extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len); +extern void strbuf_addchars(struct strbuf *sb, int c, size_t n); typedef size_t (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context); extern void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn, void *context); @@ -302,13 +302,6 @@ int is_utf8(const char *text) return 1; } -static void strbuf_addchars(struct strbuf *sb, int c, size_t n) -{ - strbuf_grow(sb, n); - memset(sb->buf + sb->len, c, n); - strbuf_setlen(sb, sb->len + n); -} - static void strbuf_add_indented_text(struct strbuf *buf, const char *text, int indent, int indent2) { |