This source file includes following definitions.
- xmalloc
- xfree
- xrealloc
- emacs_abort
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef TEST_COMPAT_H
21 #define TEST_COMPAT_H
22
23 #include <limits.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26
27 typedef int Lisp_Object;
28
29 void *
30 xmalloc (size_t size)
31 {
32 return malloc (size);
33 }
34
35 void
36 xfree (void *ptr)
37 {
38 free (ptr);
39 }
40
41 void *
42 xrealloc (void *block, size_t size)
43 {
44 return realloc (block, size);
45 }
46
47 void
48 emacs_abort ()
49 {
50 fprintf (stderr, "Aborting...\n");
51 exit (EXIT_FAILURE);
52 }
53
54 #ifndef eassert
55 #define eassert(cond) \
56 do { \
57 if (! (cond)) { \
58 fprintf (stderr, "%s:%d:eassert condition failed: %s\n", \
59 __FILE__, __LINE__ , # cond); \
60 exit (EXIT_FAILURE); \
61 } \
62 } while (0)
63 #endif
64
65 #ifndef eassume
66 #define eassume eassert
67 #endif
68
69 #ifndef max
70 #define max(x,y) ((x) >= (y) ? (x) : (y))
71 #endif
72 #ifndef min
73 #define min(x,y) ((x) <= (y) ? (x) : (y))
74 #endif
75
76 #endif