summaryrefslogtreecommitdiff
path: root/lib/stringbuf.h
blob: 9b658ba8e2287b124bcd5138247702e7960fd576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef _STRINGBUF_H_
#define _STRINGBUF_H_

typedef /*@abstract@*/ struct StringBufRec *StringBuf;

#ifdef __cplusplus
extern "C" {
#endif

/*@only@*/ StringBuf newStringBuf(void);
void freeStringBuf( /*@only@*/ StringBuf sb);
void truncStringBuf(StringBuf sb);
/*@observer@*/ char *getStringBuf(StringBuf sb);
void stripTrailingBlanksStringBuf(StringBuf sb);

#define appendStringBuf(sb, s)     appendStringBufAux(sb, s, 0)
#define appendLineStringBuf(sb, s) appendStringBufAux(sb, s, 1)

void appendStringBufAux(StringBuf sb, const char *s, int nl);

#ifdef __cplusplus
}
#endif

#endif	/* _STRINGBUF_H_ */