X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.h;h=36d61db65728f61188ef3bedbdbe88d0f2d9a0b9;hb=6bc4c72132adbdc06c428f86a96f27e4f8173b99;hp=9b9e861d3d5e24477459eec1ab4007cfb35f52b9;hpb=3e4bb087a18435b12eb82116e93af2887578e816;p=git.git diff --git a/strbuf.h b/strbuf.h index 9b9e861d3..36d61db65 100644 --- a/strbuf.h +++ b/strbuf.h @@ -23,12 +23,12 @@ * that way: * * strbuf_grow(sb, SOME_SIZE); - * // ... here the memory areay starting at sb->buf, and of length - * // sb_avail(sb) is all yours, and you are sure that sb_avail(sb) is at - * // least SOME_SIZE + * ... Here, the memory array starting at sb->buf, and of length + * ... strbuf_avail(sb) is all yours, and you are sure that + * ... strbuf_avail(sb) is at least SOME_SIZE. * strbuf_setlen(sb, sb->len + SOME_OTHER_SIZE); * - * Of course, SOME_OTHER_SIZE must be smaller or equal to sb_avail(sb). + * Of course, SOME_OTHER_SIZE must be smaller or equal to strbuf_avail(sb). * * Doing so is safe, though if it has to be done in many places, adding the * missing API to the strbuf module is the way to go. @@ -101,6 +101,10 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s) { static inline void strbuf_addbuf(struct strbuf *sb, struct strbuf *sb2) { strbuf_add(sb, sb2->buf, sb2->len); } +extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len); + +typedef void (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context); +extern void strbuf_expand(struct strbuf *sb, const char *format, const char **placeholders, expand_fn_t fn, void *context); __attribute__((format(printf,2,3))) extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...); @@ -113,5 +117,6 @@ extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint); extern int strbuf_getline(struct strbuf *, FILE *, int); extern void stripspace(struct strbuf *buf, int skip_comments); +extern void launch_editor(const char *path, struct strbuf *buffer, const char *const *env); #endif /* STRBUF_H */