about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cgit.h2
-rw-r--r--shared.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h index 7619cbb..3e9d55b 100644 --- a/cgit.h +++ b/cgit.h
@@ -304,6 +304,8 @@ extern char *ensure_end(const char *str, char c);
304extern char *strlpart(char *txt, int maxlen); 304extern char *strlpart(char *txt, int maxlen);
305extern char *strrpart(char *txt, int maxlen); 305extern char *strrpart(char *txt, int maxlen);
306 306
307extern void strbuf_ensure_end(struct strbuf *sb, char c);
308
307extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 309extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
308extern void cgit_free_reflist_inner(struct reflist *list); 310extern void cgit_free_reflist_inner(struct reflist *list);
309extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 311extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
diff --git a/shared.c b/shared.c index 1fa9c99..10be355 100644 --- a/shared.c +++ b/shared.c
@@ -130,6 +130,12 @@ char *ensure_end(const char *str, char c)
130 return result; 130 return result;
131} 131}
132 132
133void strbuf_ensure_end(struct strbuf *sb, char c)
134{
135 if (!sb->len || sb->buf[sb->len - 1] != c)
136 strbuf_addch(sb, c);
137}
138
133char *strlpart(char *txt, int maxlen) 139char *strlpart(char *txt, int maxlen)
134{ 140{
135 char *result; 141 char *result;