125
|
1 /* buffer.h - String buffer manipulation tools header.
|
|
2 * Originally developped for the GeeXboX project.
|
|
3 * Copyright (C) 2005-2007 Benjamin Zores <ben@geexbox.org>
|
|
4 *
|
|
5 * This program is free software; you can redistribute it and/or modify
|
|
6 * it under the terms of the GNU General Public License as published by
|
|
7 * the Free Software Foundation; either version 2 of the License, or
|
|
8 * (at your option) any later version.
|
|
9 *
|
|
10 * This program is distributed in the hope that it will be useful,
|
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 * GNU Library General Public License for more details.
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License along
|
|
16 * with this program; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
18 *
|
|
19 */
|
|
20
|
|
21 #ifndef _STRING_BUFFER_H_
|
|
22 #define _STRING_BUFFER_H_
|
|
23
|
|
24 struct buffer_t {
|
|
25 char *buf;
|
|
26 size_t len;
|
|
27 size_t capacity;
|
|
28 };
|
|
29
|
|
30 struct buffer_t *buffer_new (void)
|
|
31 __attribute__ ((malloc));
|
|
32 void buffer_free (struct buffer_t *buffer);
|
|
33
|
|
34 void buffer_append (struct buffer_t *buffer, const char *str);
|
|
35 void buffer_appendf (struct buffer_t *buffer, const char *format, ...)
|
|
36 __attribute__ ((format (printf , 2, 3)));
|
|
37
|
|
38 #endif /* _STRING_BUFFER_H_ */
|