nmsg  0.15.1
strbuf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009-2015 by Farsight Security, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef NMSG_STRBUF_H
18 #define NMSG_STRBUF_H
19 
27 struct nmsg_strbuf {
28  char *pos; /*%< end of string */
29  char *data; /*%< buffer for string data */
30  size_t bufsz; /*%< size of data allocation */
31 };
32 
39 
45 void nmsg_strbuf_destroy(struct nmsg_strbuf **sb);
46 
60 nmsg_res nmsg_strbuf_append(struct nmsg_strbuf *sb, const char *fmt, ...);
61 
74 
82 size_t nmsg_strbuf_len(struct nmsg_strbuf *sb);
83 
84 #endif /* NMSG_STRBUF_H */
nmsg_res
nmsg result code
Definition: res.h:25
nmsg_res nmsg_strbuf_append(struct nmsg_strbuf *sb, const char *fmt,...)
Append to a string buffer.
void nmsg_strbuf_destroy(struct nmsg_strbuf **sb)
Destroy all resources associated with a string buffer.
size_t nmsg_strbuf_len(struct nmsg_strbuf *sb)
Find the length of the used portion of the string buffer.
struct nmsg_strbuf * nmsg_strbuf_init(void)
Initialize a string buffer.
nmsg_res nmsg_strbuf_reset(struct nmsg_strbuf *sb)
Reset a string buffer.
String buffer.
Definition: strbuf.h:27
char * data
buffer for string data
Definition: strbuf.h:29
size_t bufsz
size of data allocation
Definition: strbuf.h:30
char * pos
end of string
Definition: strbuf.h:28