File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,21 @@ void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2)
259
259
strbuf_setlen (sb , sb -> len + sb2 -> len );
260
260
}
261
261
262
+ const char * strbuf_join_argv (struct strbuf * buf ,
263
+ int argc , const char * * argv , char delim )
264
+ {
265
+ if (!argc )
266
+ return buf -> buf ;
267
+
268
+ strbuf_addstr (buf , * argv );
269
+ while (-- argc ) {
270
+ strbuf_addch (buf , delim );
271
+ strbuf_addstr (buf , * (++ argv ));
272
+ }
273
+
274
+ return buf -> buf ;
275
+ }
276
+
262
277
void strbuf_addchars (struct strbuf * sb , int c , size_t n )
263
278
{
264
279
strbuf_grow (sb , n );
Original file line number Diff line number Diff line change @@ -284,6 +284,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s)
284
284
*/
285
285
extern void strbuf_addbuf (struct strbuf * sb , const struct strbuf * sb2 );
286
286
287
+ /**
288
+ * Join the arguments into a buffer. `delim` is put between every
289
+ * two arguments.
290
+ */
291
+ extern const char * strbuf_join_argv (struct strbuf * buf , int argc ,
292
+ const char * * argv , char delim );
293
+
287
294
/**
288
295
* This function can be used to expand a format string containing
289
296
* placeholders. To that end, it parses the string and calls the specified
You can’t perform that action at this time.
0 commit comments