aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorHampus <hampus@hampusmat.com>2022-01-04 18:55:51 +0100
committerHampus <hampus@hampusmat.com>2022-01-05 20:09:27 +0100
commite3690eb85a9456cc1f3ccda751ae7d9fdf2d3b03 (patch)
tree2fdd32726d753495bf562102a0531101eaa1ddfd /src/utils.h
parent1bed3ac57906b26ef05b25c2bc5c1dca424dba4a (diff)
refactor: improve even more
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h22
1 files changed, 22 insertions, 0 deletions
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