Mercurial > trustbridge
comparison common/strhelp.h @ 59:3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
arrays and to have a terminating malloc / realloc
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 18 Mar 2014 10:04:30 +0000 |
parents | |
children | 6acb1dae6185 |
comparison
equal
deleted
inserted
replaced
58:ad61489ce593 | 59:3f6378647371 |
---|---|
1 /* @file Helper functions for c strings and memory management | |
2 * | |
3 * strhelp contains terminating memory allocation functions and | |
4 * some conveniance functions to work with c strings or arrays | |
5 * of c strings. | |
6 */ | |
7 void *xmalloc( size_t n ); | |
8 void *xrealloc( void *a, size_t n ); | |
9 void *xcalloc( size_t n, size_t m ); | |
10 char *xstrdup( const char *string ); | |
11 | |
12 /** | |
13 * strv_length: | |
14 * @str_array: a %NULL-terminated array of strings | |
15 * | |
16 * Returns the length of the given %NULL-terminated | |
17 * string array @str_array. | |
18 * | |
19 * Return value: length of @str_array. | |
20 * | |
21 */ | |
22 unsigned int strv_length (char **str_array); | |
23 | |
24 /* @brief append a string to a NULL terminated array of strings. | |
25 * | |
26 * @param[inout] array pointer to the NULL terminated list of string pointers. | |
27 * @param[in] string pointer to the string to append to the list. | |
28 * */ | |
29 void array_append_str(char ***pArray, const char *string); | |
30 | |
31 /* @brief append a string to another string. | |
32 * | |
33 * @param[inout] pDst pointer to the string to be extended. | |
34 * @param[in] appendage pointer to the string to append. | |
35 * */ | |
36 void str_append_str(char **pDst, const char *appendage); | |
37 | |
38 void strfreev (char **str_array); |