]> andersk Git - splint.git/blob - src/Headers/general.h
39cf84f841357d004accebf69167a080887792d4
[splint.git] / src / Headers / general.h
1 /*
2 ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000.
3 ** See ../LICENSE for license information.
4 **
5 */
6
7 # ifndef GENERAL_H
8 # define GENERAL_H
9
10 /* sgi's don't let you undef NULL */
11 # ifndef IRIX 
12 # ifdef NULL
13 # undef NULL
14 # endif
15 # endif
16
17 # include "forwardTypes.h"
18
19 # ifdef USEDMALLOC
20 # define sfree(x) do { if (x != NULL) free(x); } while (FALSE)
21 # else
22 extern void sfree (/*@out@*/ /*@only@*/ /*@null@*/ void *p_x) /*@modifies *p_x@*/; 
23 # endif
24
25 # include "misc.h"
26 # include "cstring.h"
27 # include "bool.h"
28
29 # define getStringWord(s)     (cstring_fromChars(getWord(s)))
30
31 extern /*@out@*/ /*@only@*/ void *dimalloc  (size_t p_size, char *p_name, int p_line);
32 extern /*@only@*/ void *dicalloc  (size_t p_num, size_t p_size, char *p_name, int p_line);
33 extern /*@notnull@*/ /*@out@*/ /*@only@*/ void *
34   direalloc (/*@returned@*/ /*@only@*/ /*@out@*/ /*@null@*/ void *p_x, 
35              size_t p_size, char *p_name, int p_line);
36
37 extern /*@only@*/ void *
38   drealloc (/*@special@*/ /*@null@*/ /*@sef@*/ void *p_x,
39             /*@sef@*/ size_t p_size)
40   /*@releases p_x@*/
41   /*@modifies *p_x@*/ ;
42
43 extern /*@out@*/ /*@only@*/ void *dmalloc  (/*@sef@*/ size_t p_size) /*@*/ ;
44
45 # ifdef USEDMALLOC
46 # define dmalloc(s)    (malloc(s))
47 # define drealloc(s,l) (realloc(s,l))
48 # else
49 # define dmalloc(s)    (dimalloc(s, __FILE__, __LINE__))
50 # define drealloc(s,l) (direalloc(s, l, __FILE__, __LINE__))
51 # endif
52
53 # include "system_constants.h"
54
55 # ifdef USEGC
56 # include <gc.h>
57 # define NOFREE
58 # define free(s) ; /* nothing */ 
59 # else
60 # endif
61
62 # ifdef USEDMALLOC
63 # include "dmalloc.h"
64 # endif
65
66 /*
67 ** no file except general.c should use primitive
68 ** memory operations:
69 */
70
71 /*@-exportlocal@*/
72 # ifndef USEDMALLOC
73 # undef malloc
74 # undef realloc
75 # undef calloc
76 # define malloc(s)     (dimalloc(s, __FILE__, __LINE__))
77 # define calloc(n, s)  (dicalloc(n, s, __FILE__, __LINE__))
78 # define realloc(v, s) (direalloc(v, s, __FILE__, __LINE__))
79 # endif
80 /*@=exportlocal@*/
81
82 # ifndef NULL
83 # define NULL 0
84 # endif 
85
86 extern void sfreeEventually (/*@owned@*/ /*@null@*/ void *p_x) 
87    /*@modifies internalState@*/; 
88
89 typedef /*@dependent@*/ char *d_char;
90
91 /*@constant int NOT_FOUND;@*/
92 # define NOT_FOUND (-23)
93
94 # else
95 # error "Multiple include"
96 # endif
97
98
99
100
101
102
This page took 0.368686 seconds and 3 git commands to generate.