]> andersk Git - splint.git/blame - src/Headers/general.h
*** empty log message ***
[splint.git] / src / Headers / general.h
CommitLineData
885824d3 1/*
28bf4b0b 2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001.
885824d3 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
ccf0a4a8 22extern void sfree (/*@out@*/ /*@only@*/ /*@null@*/ void *p_x) /*@modifies p_x@*/;
885824d3 23# endif
24
25# include "misc.h"
26# include "cstring.h"
27# include "bool.h"
28
28bf4b0b 29extern /*@out@*/ /*@only@*/ void *dimalloc (size_t p_size, const char *p_name, int p_line);
30extern /*@only@*/ void *dicalloc (size_t p_num, size_t p_size, const char *p_name, int p_line);
885824d3 31extern /*@notnull@*/ /*@out@*/ /*@only@*/ void *
32 direalloc (/*@returned@*/ /*@only@*/ /*@out@*/ /*@null@*/ void *p_x,
33 size_t p_size, char *p_name, int p_line);
34
35extern /*@only@*/ void *
36 drealloc (/*@special@*/ /*@null@*/ /*@sef@*/ void *p_x,
37 /*@sef@*/ size_t p_size)
38 /*@releases p_x@*/
39 /*@modifies *p_x@*/ ;
40
41extern /*@out@*/ /*@only@*/ void *dmalloc (/*@sef@*/ size_t p_size) /*@*/ ;
42
43# ifdef USEDMALLOC
44# define dmalloc(s) (malloc(s))
45# define drealloc(s,l) (realloc(s,l))
46# else
47# define dmalloc(s) (dimalloc(s, __FILE__, __LINE__))
48# define drealloc(s,l) (direalloc(s, l, __FILE__, __LINE__))
49# endif
50
51# include "system_constants.h"
52
53# ifdef USEGC
54# include <gc.h>
55# define NOFREE
56# define free(s) ; /* nothing */
57# else
58# endif
59
60# ifdef USEDMALLOC
61# include "dmalloc.h"
62# endif
63
64/*
65** no file except general.c should use primitive
66** memory operations:
67*/
68
69/*@-exportlocal@*/
70# ifndef USEDMALLOC
71# undef malloc
72# undef realloc
73# undef calloc
74# define malloc(s) (dimalloc(s, __FILE__, __LINE__))
75# define calloc(n, s) (dicalloc(n, s, __FILE__, __LINE__))
76# define realloc(v, s) (direalloc(v, s, __FILE__, __LINE__))
77# endif
78/*@=exportlocal@*/
79
80# ifndef NULL
81# define NULL 0
82# endif
83
84extern void sfreeEventually (/*@owned@*/ /*@null@*/ void *p_x)
85 /*@modifies internalState@*/;
86
87typedef /*@dependent@*/ char *d_char;
88
89/*@constant int NOT_FOUND;@*/
90# define NOT_FOUND (-23)
91
92# else
93# error "Multiple include"
94# endif
95
96
97
98
99
100
This page took 0.328495 seconds and 5 git commands to generate.