@@ -17,20 +17,23 @@ extern void strbuf_init(struct strbuf *, size_t);
1717extern void strbuf_release (struct strbuf * );
1818extern char * strbuf_detach (struct strbuf * , size_t * );
1919extern void strbuf_attach (struct strbuf * , void * , size_t , size_t );
20- static inline void strbuf_swap (struct strbuf * a , struct strbuf * b ) {
20+ static inline void strbuf_swap (struct strbuf * a , struct strbuf * b )
21+ {
2122 struct strbuf tmp = * a ;
2223 * a = * b ;
2324 * b = tmp ;
2425}
2526
2627/*----- strbuf size related -----*/
27- static inline size_t strbuf_avail (const struct strbuf * sb ) {
28+ static inline size_t strbuf_avail (const struct strbuf * sb )
29+ {
2830 return sb -> alloc ? sb -> alloc - sb -> len - 1 : 0 ;
2931}
3032
3133extern void strbuf_grow (struct strbuf * , size_t );
3234
33- static inline void strbuf_setlen (struct strbuf * sb , size_t len ) {
35+ static inline void strbuf_setlen (struct strbuf * sb , size_t len )
36+ {
3437 if (len > (sb -> alloc ? sb -> alloc - 1 : 0 ))
3538 die ("BUG: strbuf_setlen() beyond buffer" );
3639 sb -> len = len ;
@@ -97,7 +100,8 @@ static inline struct strbuf **strbuf_split(const struct strbuf *sb,
97100extern void strbuf_list_free (struct strbuf * * );
98101
99102/*----- add data in your buffer -----*/
100- static inline void strbuf_addch (struct strbuf * sb , int c ) {
103+ static inline void strbuf_addch (struct strbuf * sb , int c )
104+ {
101105 strbuf_grow (sb , 1 );
102106 sb -> buf [sb -> len ++ ] = c ;
103107 sb -> buf [sb -> len ] = '\0' ;
@@ -113,10 +117,12 @@ extern void strbuf_splice(struct strbuf *, size_t pos, size_t len,
113117extern void strbuf_add_commented_lines (struct strbuf * out , const char * buf , size_t size );
114118
115119extern void strbuf_add (struct strbuf * , const void * , size_t );
116- static inline void strbuf_addstr (struct strbuf * sb , const char * s ) {
120+ static inline void strbuf_addstr (struct strbuf * sb , const char * s )
121+ {
117122 strbuf_add (sb , s , strlen (s ));
118123}
119- static inline void strbuf_addbuf (struct strbuf * sb , const struct strbuf * sb2 ) {
124+ static inline void strbuf_addbuf (struct strbuf * sb , const struct strbuf * sb2 )
125+ {
120126 strbuf_grow (sb , sb2 -> len );
121127 strbuf_add (sb , sb2 -> buf , sb2 -> len );
122128}
0 commit comments