release
[hcoop/zz_old/debian/djbdns.git] / stralloc.h
1 #ifndef STRALLOC_H
2 #define STRALLOC_H
3
4 #include "gen_alloc.h"
5
6 GEN_ALLOC_typedef(stralloc,char,s,len,a)
7
8 extern int stralloc_ready(stralloc *,unsigned int);
9 extern int stralloc_readyplus(stralloc *,unsigned int);
10 extern int stralloc_copy(stralloc *,const stralloc *);
11 extern int stralloc_cat(stralloc *,const stralloc *);
12 extern int stralloc_copys(stralloc *,const char *);
13 extern int stralloc_cats(stralloc *,const char *);
14 extern int stralloc_copyb(stralloc *,const char *,unsigned int);
15 extern int stralloc_catb(stralloc *,const char *,unsigned int);
16 extern int stralloc_append(stralloc *,const char *); /* beware: this takes a pointer to 1 char */
17 extern int stralloc_starts(stralloc *,const char *);
18
19 #define stralloc_0(sa) stralloc_append(sa,"")
20
21 extern int stralloc_catulong0(stralloc *,unsigned long,unsigned int);
22 extern int stralloc_catlong0(stralloc *,long,unsigned int);
23
24 #define stralloc_catlong(sa,l) (stralloc_catlong0((sa),(l),0))
25 #define stralloc_catuint0(sa,i,n) (stralloc_catulong0((sa),(i),(n)))
26 #define stralloc_catint0(sa,i,n) (stralloc_catlong0((sa),(i),(n)))
27 #define stralloc_catint(sa,i) (stralloc_catlong0((sa),(i),0))
28
29 #endif