]> andersk Git - splint.git/blame - src/Headers/general.h
Fixed problem with NULL being changed.
[splint.git] / src / Headers / general.h
CommitLineData
885824d3 1/*
c0de361f 2** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003.
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
86d93ed3 29extern /*@out@*/ /*@only@*/ void *dimalloc (size_t p_size, const char *p_name, int p_line) /*@ensures maxSet(result) == (p_size - 1); @*/ ;
28bf4b0b 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
86d93ed3 41extern /*@out@*/ /*@only@*/ void *dmalloc (/*@sef@*/ size_t p_size) /*@*/
42 /*@ensures maxSet(result) == (p_size - 1); @*/ ;
43
44
45 /*drl 12/28/01 Work around for self checking */
46#ifndef LINTBUFFERCHECK
885824d3 47
48# ifdef USEDMALLOC
49# define dmalloc(s) (malloc(s))
50# define drealloc(s,l) (realloc(s,l))
51# else
52# define dmalloc(s) (dimalloc(s, __FILE__, __LINE__))
53# define drealloc(s,l) (direalloc(s, l, __FILE__, __LINE__))
54# endif
55
86d93ed3 56#endif
57
885824d3 58# include "system_constants.h"
59
60# ifdef USEGC
61# include <gc.h>
62# define NOFREE
63# define free(s) ; /* nothing */
64# else
65# endif
66
67# ifdef USEDMALLOC
68# include "dmalloc.h"
69# endif
70
71/*
72** no file except general.c should use primitive
73** memory operations:
74*/
75
76/*@-exportlocal@*/
77# ifndef USEDMALLOC
78# undef malloc
79# undef realloc
80# undef calloc
81# define malloc(s) (dimalloc(s, __FILE__, __LINE__))
82# define calloc(n, s) (dicalloc(n, s, __FILE__, __LINE__))
83# define realloc(v, s) (direalloc(v, s, __FILE__, __LINE__))
84# endif
85/*@=exportlocal@*/
86
87# ifndef NULL
88# define NULL 0
89# endif
90
91extern void sfreeEventually (/*@owned@*/ /*@null@*/ void *p_x)
92 /*@modifies internalState@*/;
93
94typedef /*@dependent@*/ char *d_char;
95
96/*@constant int NOT_FOUND;@*/
97# define NOT_FOUND (-23)
98
86d93ed3 99unsigned int int_toNonNegative (int p_x) /*@*/;
100
885824d3 101# else
102# error "Multiple include"
103# endif
104
105
106
107
108
109
This page took 0.092826 seconds and 5 git commands to generate.