-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathss_stubs.c
More file actions
55 lines (46 loc) · 1.03 KB
/
ss_stubs.c
File metadata and controls
55 lines (46 loc) · 1.03 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdlib.h> /* malloc() */
#include <stdio.h>
#include <string.h>
void g_free(void *ptr) {
free(ptr);
}
/* estrdup: duplicate a string, report if error */
char *g_strdup(char *s)
{
char *t;
t = (char *) malloc(strlen(s)+1);
if (t == NULL)
printf("g_strdup(\"%.20s\") failed:", s);
strcpy(t,s);
return(t);
}
/* g_new0: calloc and report if error */
void *g_new0(size_t n, int count)
{
void *p;
p = (void *) calloc(n, count);
if (p == NULL)
printf("calloc of %u bytes failed:", (unsigned int) n);
return(p);
}
/* g_new: malloc and report if error */
void *g_new(size_t n, int count)
{
void *p;
p = (void *) malloc(n*count);
if (p == NULL)
printf("malloc of %u bytes failed:", (unsigned int) n);
return(p);
}
/* g_realloc: malloc and report if error */
void *g_realloc(void *p, size_t n)
{
void *newp;
newp = (void *) realloc(p, n);
if (newp == NULL)
printf("eralloc of %u bytes failed:", (unsigned int) n);
return(newp);
}
void g_assert(int i) {
;
}