From e3690eb85a9456cc1f3ccda751ae7d9fdf2d3b03 Mon Sep 17 00:00:00 2001 From: Hampus Date: Tue, 4 Jan 2022 18:55:51 +0100 Subject: refactor: improve even more --- src/utils.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h index a1b69e1..049e583 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,6 +1,28 @@ #ifndef UTILS_H #define UTILS_H +/** + * Returns whether or not a string is a number. + * + * @param str A string + */ int is_number(char *str); +/** + * Safely allocates memory to the heap. + * + * @param amount The amount of memory to allocate + * @returns The allocated memory. + */ +void *malloc_s(unsigned long amount); + +/** + * Converts a string to a unsigned integer. + * + * @param str A string + * @param err A error destination + * @returns A unsigned integer. + */ +unsigned int str_to_uint(char *str, char **err); + #endif -- cgit v1.2.3-18-g5258