Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
log: diagnose empty HEAD more clearly
[gitweb.git]
/
strbuf.h
diff --git
a/strbuf.h
b/strbuf.h
index 1883494ca3ad4931640c2a295c94800e287c1664..01c5c6371b8e43686f335704a67a59a1d82dbe3b 100644
(file)
--- a/
strbuf.h
+++ b/
strbuf.h
@@
-205,7
+205,8
@@
extern int strbuf_cmp(const struct strbuf *, const struct strbuf *);
*/
static inline void strbuf_addch(struct strbuf *sb, int c)
{
- strbuf_grow(sb, 1);
+ if (!strbuf_avail(sb))
+ strbuf_grow(sb, 1);
sb->buf[sb->len++] = c;
sb->buf[sb->len] = '\0';
}