satyr 0.30
strbuf.h
Go to the documentation of this file.
1/*
2 strbuf.h - a string buffer
3
4 Copyright (C) 2010 Red Hat, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20#ifndef SATYR_STRBUF_H
21#define SATYR_STRBUF_H
22
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <stdarg.h>
33#include "utils.h"
34
39{
43 size_t alloc;
47 size_t len;
48 char *buf;
49};
50
57struct sr_strbuf *
59
65void
66sr_strbuf_init(struct sr_strbuf *strbuf);
67
73void
74sr_strbuf_free(struct sr_strbuf *strbuf);
75
81char *
83
88void
89sr_strbuf_clear(struct sr_strbuf *strbuf);
90
95void
96sr_strbuf_grow(struct sr_strbuf *strbuf, size_t num);
97
102struct sr_strbuf *
104 char c);
105
110struct sr_strbuf *
112 const char *str);
113
118struct sr_strbuf *
120 const char *str);
121
126struct sr_strbuf *
128 const char *format, ...) __sr_printf(2, 3);
129
134struct sr_strbuf *
136 const char *format, va_list p);
137
143struct sr_strbuf *
145 const char *format, ...) __sr_printf(2, 3);
146
151struct sr_strbuf *
153 const char *format, va_list p);
154
155#ifdef __cplusplus
156}
157#endif
158
159#endif
char * sr_strbuf_free_nobuf(struct sr_strbuf *strbuf)
void sr_strbuf_free(struct sr_strbuf *strbuf)
struct sr_strbuf * sr_strbuf_append_str(struct sr_strbuf *strbuf, const char *str)
struct sr_strbuf * sr_strbuf_append_char(struct sr_strbuf *strbuf, char c)
struct sr_strbuf struct sr_strbuf * sr_strbuf_append_strfv(struct sr_strbuf *strbuf, const char *format, va_list p)
struct sr_strbuf * sr_strbuf_new(void)
void sr_strbuf_clear(struct sr_strbuf *strbuf)
struct sr_strbuf * sr_strbuf_prepend_str(struct sr_strbuf *strbuf, const char *str)
struct sr_strbuf * sr_strbuf_prepend_strf(struct sr_strbuf *strbuf, const char *format,...) __sr_printf(2
void sr_strbuf_init(struct sr_strbuf *strbuf)
struct sr_strbuf * sr_strbuf_append_strf(struct sr_strbuf *strbuf, const char *format,...) __sr_printf(2
void sr_strbuf_grow(struct sr_strbuf *strbuf, size_t num)
struct sr_strbuf struct sr_strbuf * sr_strbuf_prepend_strfv(struct sr_strbuf *strbuf, const char *format, va_list p)
A resizable string buffer.
Definition: strbuf.h:39
size_t len
Definition: strbuf.h:47
size_t alloc
Definition: strbuf.h:43
Various utility functions, macros and variables that do not fit elsewhere.