-
Notifications
You must be signed in to change notification settings - Fork 0
/
strbld.h
41 lines (33 loc) · 921 Bytes
/
strbld.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/** \file strbld.h - string builder */
/** \mainpage
Efficient C string building functions.
*/
#ifndef STRBLD_H_INCLUDED
#define STRBLD_H_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
char *strbld(char *dest, char const *src);
char *strbld_array(char *dest, char const *src[]);
char *strnbld(char *dest, char const *src, size_t n);
#ifdef __cplusplus
}
#endif
#if __STDC_VERSION__ >= 199901L
// c99 or better
/**
* multi_strbld - macro to build up a string from source string parameters
*
* This macro calls uses strbld_array() to build up the destination string.
*
* \param dest - The destination pointer - must be large enough to handle
* all the strings sent in the parameter list
* \param ... - The source pointers
*/
#define multi_strbld(dest, ...) {\
strbld_array(dest, (char const *[]){__VA_ARGS__, NULL});\
}
#endif
#endif /* STRBLD_H_INCLUDED */