File: strbuild.h

package info (click to toggle)
libsfdo 0.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 736 kB
  • sloc: ansic: 6,491; python: 111; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef STRBUILD_H
#define STRBUILD_H

#include <sfdo-common.h>
#include <stdbool.h>
#include <stddef.h>

struct sfdo_strbuild {
	char *data;
	size_t len, cap;
};

void sfdo_strbuild_init(struct sfdo_strbuild *strbuild);
void sfdo_strbuild_finish(struct sfdo_strbuild *strbuild);

void sfdo_strbuild_reset(struct sfdo_strbuild *strbuild);

bool sfdo_strbuild_add(
		struct sfdo_strbuild *strbuild, const struct sfdo_string *items, size_t n_items);

#define SFDO_STRBUILD_ADD(strbuild, ...) \
	sfdo_strbuild_add(strbuild, (struct sfdo_string[]){__VA_ARGS__}, \
			sizeof((struct sfdo_string[]){__VA_ARGS__}) / sizeof(struct sfdo_string))

#endif