aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
blob: 049e583631bec0418bba31e5f45bd38a872b55c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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