NativeEnumerated.c vars NULL init and check
[com/asn1c.git] / libasn1common / asn1_buffer.h
1 #ifndef ASN1_BUFFER_H
2 #define ASN1_BUFFER_H
3
4 #include <stdarg.h>
5
6 /*
7  * Your typical dynamic character string buffer.
8  */
9 typedef struct {
10     const char *buffer;
11     size_t length;
12     size_t size;
13 } abuf;
14
15 /*
16  * Create and destroy the buffer.
17  */
18 abuf *abuf_new(void);
19 void abuf_free(abuf *);
20
21 /*
22  * Erase contents of the buffer (without destroying it).
23  */
24 void abuf_clear(abuf *);
25
26 /*
27  * Add characters to the buffer.
28  */
29 void abuf_str(abuf *, const char *str);
30 void abuf_buf(abuf *, const abuf *);
31 void abuf_add_bytes(abuf *, const char *, size_t);
32 int abuf_printf(abuf *, const char *fmt, ...)
33     __attribute__((format(printf, 2, 3)));
34 int abuf_vprintf(abuf *, const char *fmt, va_list);
35
36 #endif  /* ASN1_BUFFER_H */