Mercurial > trustbridge
annotate common/strhelp.h @ 120:702033705bb8
Removed trailing whitespace.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Sat, 22 Mar 2014 17:48:42 +0100 |
parents | d6a74464430b |
children | 9104b1b2e4da |
rev | line source |
---|---|
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
1 #ifndef STRHELP_H |
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
2 #define STRHELP_H |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
3 |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
4 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
5 * @file strhelp.h |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
6 * @brief Helper functions for c strings and memory management |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
7 * @details strhelp contains terminating memory allocation functions and |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
8 * some conveniance functions to work with c strings or arrays of c |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
9 * strings. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 */ |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
11 |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 void *xmalloc( size_t n ); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 void *xrealloc( void *a, size_t n ); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 void *xcalloc( size_t n, size_t m ); |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
15 char *xstrndup( const char *string, const size_t len ); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 /** |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
18 * @brief Returns the length of the given %NULL-terminated |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
19 * string array str_array. |
120
702033705bb8
Removed trailing whitespace.
Sascha Wilde <wilde@intevation.de>
parents:
118
diff
changeset
|
20 * @param[in] str_array a %NULL-terminated array of strings |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
21 * @returns length of str_array. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 */ |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 unsigned int strv_length (char **str_array); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
25 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
26 * @brief append a string to a NULL terminated array of strings. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 * |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
28 * @param[inout] pArray pointer to the NULL terminated list of string pointers. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 * @param[in] string pointer to the string to append to the list. |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
30 * @param[in] len length of the string to append to the list |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
31 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
32 void strv_append (char ***pArray, const char *string, const size_t len); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
34 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
35 * @brief append a string to another string. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 * |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 * @param[inout] pDst pointer to the string to be extended. |
91
80ab2168760f
Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents:
60
diff
changeset
|
38 * @param[inout] dst_len length of the dst string. Will be modified. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
39 * @param[in] appendage pointer to the string to append. |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
40 * @param[in] len length of the string to append. |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
41 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
42 void str_append_str (char **pDst, size_t *dst_len, const char *appendage, |
91
80ab2168760f
Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents:
60
diff
changeset
|
43 const size_t len); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
45 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
46 * @brief Frees the given %NULL-terminated string array. |
120
702033705bb8
Removed trailing whitespace.
Sascha Wilde <wilde@intevation.de>
parents:
118
diff
changeset
|
47 * @param[inout] str_array a %NULL-terminated array of strings |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
48 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
49 void strv_free (char **str_array); |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
50 #endif |