annotate common/strhelp.h @ 111:36ac0697339e

Merged
author Sascha Wilde <wilde@intevation.de>
date Fri, 21 Mar 2014 15:59:46 +0100
parents 80ab2168760f
children c602d8cfa619
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
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3 /* @file Helper functions for c strings and memory management
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
4 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 * strhelp contains terminating memory allocation functions and
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 * some conveniance functions to work with c strings or arrays
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
7 * of c strings.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 */
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 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
10 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
11 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
12 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
13
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 /**
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15 * strv_length:
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 * @str_array: a %NULL-terminated array of strings
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
18 * Returns the length of the given %NULL-terminated
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 * string array @str_array.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
21 * Return value: length of @str_array.
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 */
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 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
25
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 /* @brief append a string to a NULL terminated array of strings.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 * @param[inout] array pointer to the NULL terminated list of string pointers.
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
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31 * */
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
32 void array_append_str(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
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 /* @brief append a string to another string.
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 *
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
36 * @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
37 * @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
38 * @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
39 * @param[in] len length of the string to append.
59
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 * */
91
80ab2168760f Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
41 void str_append_str(char **pDst, size_t *dst_len, const char *appendage,
80ab2168760f Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents: 60
diff changeset
42 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
43
3f6378647371 Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44 void strfreev (char **str_array);
60
6acb1dae6185 Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents: 59
diff changeset
45 #endif

http://wald.intevation.org/projects/trustbridge/