main/xutil.h

changeset 18
d969e0fe05dc
parent 0
88d965579617
equal deleted inserted replaced
17:f9eca4a55911 18:d969e0fe05dc
1 /**
2 * @file xutil.h
3 * @brief In memory string manipulation.
4 */
5
6
1 #ifndef XUTIL_H 7 #ifndef XUTIL_H
2 #define XUTIL_H 8 #define XUTIL_H
3 9
4 char *xmalloc(size_t); 10 /**
5 char *xstrcpy(char *); 11 * @brief Safe memory allocation. Abort if not enough.
6 char *xstrcat(char *, char *); 12 * @param size The amount of memory to allocate.
13 * @return A pointer to the allocated memory.
14 */
15 char *xmalloc(size_t size);
16
17 /**
18 * @brief Copy string in memory.
19 * @param src The source string to copy.
20 * @return A pointer to the string with the copied string.
21 */
22 char *xstrcpy(char *src);
23
24 /**
25 * @brief Add data to a string in memory.
26 * @param src The original string.
27 * @param add The string to append to src.
28 * @return A pointer to the combined string.
29 */
30 char *xstrcat(char *src, char *add);
7 31
8 #endif 32 #endif

mercurial