diff -r f9eca4a55911 -r d969e0fe05dc main/xutil.h --- a/main/xutil.h Thu Oct 31 22:22:22 2019 +0100 +++ b/main/xutil.h Fri Nov 01 13:13:14 2019 +0100 @@ -1,8 +1,32 @@ +/** + * @file xutil.h + * @brief In memory string manipulation. + */ + + #ifndef XUTIL_H #define XUTIL_H -char *xmalloc(size_t); -char *xstrcpy(char *); -char *xstrcat(char *, char *); +/** + * @brief Safe memory allocation. Abort if not enough. + * @param size The amount of memory to allocate. + * @return A pointer to the allocated memory. + */ +char *xmalloc(size_t size); + +/** + * @brief Copy string in memory. + * @param src The source string to copy. + * @return A pointer to the string with the copied string. + */ +char *xstrcpy(char *src); + +/** + * @brief Add data to a string in memory. + * @param src The original string. + * @param add The string to append to src. + * @return A pointer to the combined string. + */ +char *xstrcat(char *src, char *add); #endif