aboutsummaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-16 17:49:53 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-16 17:49:53 -0700
commit0513f241cc2d757371dc7ba6b065366de044862e (patch)
tree2e3723b7eaff31f7ece63461c1f8fa0989fcd90f /strbuf.h
parente38953ab00bfb150822d2d92d2dc8e4ce31ef9a4 (diff)
parent3b6121f69b2a27c3bbff5cc3056c30b15394441b (diff)
downloadgit-0513f241cc2d757371dc7ba6b065366de044862e.tar.gz
git-0513f241cc2d757371dc7ba6b065366de044862e.tar.xz
Merge branch 'ls/mailinfo'
* ls/mailinfo: git-mailinfo: use strbuf's instead of fixed buffers Add some useful functions for strbuf manipulation. Make some strbuf_*() struct strbuf arguments const. Conflicts: builtin-mailinfo.c
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/strbuf.h b/strbuf.h
index faec2291d..0c6ffad53 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -61,7 +61,7 @@ static inline void strbuf_swap(struct strbuf *a, struct strbuf *b) {
}
/*----- strbuf size related -----*/
-static inline size_t strbuf_avail(struct strbuf *sb) {
+static inline size_t strbuf_avail(const struct strbuf *sb) {
return sb->alloc ? sb->alloc - sb->len - 1 : 0;
}
@@ -77,8 +77,14 @@ static inline void strbuf_setlen(struct strbuf *sb, size_t len) {
#define strbuf_reset(sb) strbuf_setlen(sb, 0)
/*----- content related -----*/
+extern void strbuf_trim(struct strbuf *);
extern void strbuf_rtrim(struct strbuf *);
-extern int strbuf_cmp(struct strbuf *, struct strbuf *);
+extern void strbuf_ltrim(struct strbuf *);
+extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
+extern void strbuf_tolower(struct strbuf *);
+
+extern struct strbuf **strbuf_split(const struct strbuf *, int delim);
+extern void strbuf_list_free(struct strbuf **);
/*----- add data in your buffer -----*/
static inline void strbuf_addch(struct strbuf *sb, int c) {
@@ -98,7 +104,7 @@ extern void strbuf_add(struct strbuf *, const void *, size_t);
static inline void strbuf_addstr(struct strbuf *sb, const char *s) {
strbuf_add(sb, s, strlen(s));
}
-static inline void strbuf_addbuf(struct strbuf *sb, struct strbuf *sb2) {
+static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) {
strbuf_add(sb, sb2->buf, sb2->len);
}
extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len);