strbuf.c: add strbuf_insertf()
and strbuf_vinsertf()
Implement `strbuf_insertf()` and `strbuf_vinsertf()` to insert data using a printf format string. Original-idea-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e71c4a88f6
commit
5ef264dbdb
9
strbuf.h
9
strbuf.h
@ -244,6 +244,15 @@ void strbuf_addchars(struct strbuf *sb, int c, size_t n);
|
||||
*/
|
||||
void strbuf_insert(struct strbuf *sb, size_t pos, const void *, size_t);
|
||||
|
||||
/**
|
||||
* Insert data to the given position of the buffer giving a printf format
|
||||
* string. The contents will be shifted, not overwritten.
|
||||
*/
|
||||
void strbuf_vinsertf(struct strbuf *sb, size_t pos, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
void strbuf_insertf(struct strbuf *sb, size_t pos, const char *fmt, ...);
|
||||
|
||||
/**
|
||||
* Remove given amount of data from a given position of the buffer.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user