summaryrefslogtreecommitdiff
path: root/other/burneye/src/common.c
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /other/burneye/src/common.c
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'other/burneye/src/common.c')
-rw-r--r--other/burneye/src/common.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/other/burneye/src/common.c b/other/burneye/src/common.c
new file mode 100644
index 0000000..51eabad
--- /dev/null
+++ b/other/burneye/src/common.c
@@ -0,0 +1,53 @@
1
2#include <stdio.h>
3#include <string.h>
4#include <stdlib.h>
5#include "common.h"
6
7
8void *
9xrealloc (void *m_ptr, size_t newsize)
10{
11 void *n_ptr;
12
13 n_ptr = realloc (m_ptr, newsize);
14 if (n_ptr == NULL) {
15 fprintf (stderr, "realloc failed\n");
16 exit (EXIT_FAILURE);
17 }
18
19 return (n_ptr);
20}
21
22
23char *
24xstrdup (char *str)
25{
26 char *b;
27
28 b = strdup (str);
29 if (b == NULL) {
30 fprintf (stderr, "strdup failed\n");
31 exit (EXIT_FAILURE);
32 }
33
34 return (b);
35}
36
37
38void *
39xcalloc (int factor, size_t size)
40{
41 void *bla;
42
43 bla = calloc (factor, size);
44
45 if (bla == NULL) {
46 fprintf (stderr, "no memory left\n");
47 exit (EXIT_FAILURE);
48 }
49
50 return (bla);
51}
52
53