nmsg 1.1.2
strbuf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 DomainTools LLC
3 * Copyright (c) 2009-2015 by Farsight Security, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef NMSG_STRBUF_H
19#define NMSG_STRBUF_H
20
29 char *pos; /*%< end of string */
30 char *data; /*%< buffer for string data */
31 size_t bufsz; /*%< size of data allocation */
32};
33
40
47
60nmsg_res nmsg_strbuf_append_str_json(struct nmsg_strbuf *sb, const char *str, size_t len);
61
74nmsg_res nmsg_strbuf_append_str(struct nmsg_strbuf *sb, const char *str, size_t len);
75
89nmsg_res nmsg_strbuf_append(struct nmsg_strbuf *sb, const char *fmt, ...);
90
102
110size_t nmsg_strbuf_len(struct nmsg_strbuf *sb);
111
112#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 formatted string 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_append_str_json(struct nmsg_strbuf *sb, const char *str, size_t len)
Append to a string buffer.
nmsg_res nmsg_strbuf_reset(struct nmsg_strbuf *sb)
Reset a string buffer.
nmsg_res nmsg_strbuf_append_str(struct nmsg_strbuf *sb, const char *str, size_t len)
Append to a string buffer.
String buffer.
Definition strbuf.h:28
char * data
buffer for string data
Definition strbuf.h:30
size_t bufsz
size of data allocation
Definition strbuf.h:31
char * pos
end of string
Definition strbuf.h:29