main/xutil.h

Sun, 14 Jun 2020 14:53:06 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 14 Jun 2020 14:53:06 +0200
changeset 57
232f318a6b51
parent 18
d969e0fe05dc
permissions
-rw-r--r--

Code cleanup, doxygen comments added.

18
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
1 /**
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
2 * @file xutil.h
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
3 * @brief In memory string manipulation.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
4 */
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
5
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
6
0
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 #ifndef XUTIL_H
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 #define XUTIL_H
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
18
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
10 /**
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
11 * @brief Safe memory allocation. Abort if not enough.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
12 * @param size The amount of memory to allocate.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
13 * @return A pointer to the allocated memory.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
14 */
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
15 char *xmalloc(size_t size);
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
16
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
17 /**
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
18 * @brief Copy string in memory.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
19 * @param src The source string to copy.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
20 * @return A pointer to the string with the copied string.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
21 */
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
22 char *xstrcpy(char *src);
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
23
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
24 /**
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
25 * @brief Add data to a string in memory.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
26 * @param src The original string.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
27 * @param add The string to append to src.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
28 * @return A pointer to the combined string.
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
29 */
d969e0fe05dc Added splash screen and unit zero set menu.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
30 char *xstrcat(char *src, char *add);
0
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
88d965579617 Initial import of the CO2 meter application.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 #endif

mercurial