path: root/strbuf.h
diff options
authorJunio C Hamano <>2019-04-22 02:14:43 (GMT)
committerJunio C Hamano <>2019-04-22 02:14:43 (GMT)
commite36adf712251a19bd2ada0016764d340dfcf2ba0 (patch)
tree0b58e0a8e315bb737fdcdb16cf8f30d262025f76 /strbuf.h
parentffac537e6cbbf934b08745a378932722df287a53 (diff)
parent7906af0cb84c8e65656347909abd4e22b04d1c1e (diff)
Merge branch 'ps/stash-in-c'
"git stash" rewritten in C. * ps/stash-in-c: (28 commits) tests: add a special setup where stash.useBuiltin is off stash: optionally use the scripted version again stash: add back the original, scripted `git stash` stash: convert `stash--helper.c` into `stash.c` stash: replace all `write-tree` child processes with API calls stash: optimize `get_untracked_files()` and `check_changes()` stash: convert save to builtin stash: make push -q quiet stash: convert push to builtin stash: convert create to builtin stash: convert store to builtin stash: convert show to builtin stash: convert list to builtin stash: convert pop to builtin stash: convert branch to builtin stash: convert drop and clear to builtin stash: convert apply to builtin stash: mention options in `show` synopsis stash: add tests for `git stash show` config stash: rename test cases to be more descriptive ...
Diffstat (limited to 'strbuf.h')
1 files changed, 16 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index 52e44c9..c8d98df 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -245,6 +245,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.
void strbuf_remove(struct strbuf *sb, size_t pos, size_t len);
@@ -289,6 +298,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s)
void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2);
+ * Join the arguments into a buffer. `delim` is put between every
+ * two arguments.
+ */
+const char *strbuf_join_argv(struct strbuf *buf, int argc,
+ const char **argv, char delim);
* This function can be used to expand a format string containing
* placeholders. To that end, it parses the string and calls the specified
* function for every percent sign found.