Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2006 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1996
32
    		 Crown Copyright (c) 1996
3
 
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
Line 77... Line 107...
77
#endif
107
#endif
78
#include "common_types.h"
108
#include "common_types.h"
79
#include "basicread.h"
109
#include "basicread.h"
80
#include "instrs.h"
110
#include "instrs.h"
81
#include "utility.h"
111
#include "utility.h"
82
extern long crt_line_num ;
112
extern long crt_line_num;
83
extern char *crt_fname ;
113
extern char *crt_fname;
84
extern char *progname ;
114
extern char *progname;
85
long total_calloced ;
115
long total_calloced;
86
#if 0
116
#if 0
87
/* Makes automatically generated makefile work */
117
/* Makes automatically generated makefile work */
88
#include "xalloc.c"
118
#include "xalloc.c"
89
#endif
119
#endif
90
 
120
 
91
 
121
 
92
/*
122
/*
93
    FIND THE BASENAME OF A FILE
123
    FIND THE BASENAME OF A FILE
94
 
124
 
95
    The string nm is analysed and a pointer to the character after the
125
    The string nm is analysed and a pointer to the character after the
96
    last '/' is returned.
126
    last '/' is returned.
97
*/
127
*/
98
 
128
 
99
char *basename
129
char *
100
    PROTO_N ( ( nm ) )
-
 
101
    PROTO_T ( char *nm )
130
basename(char *nm)
102
{
131
{
103
    char *bn = nm ;
132
	char *bn = nm;
104
    for ( ; *nm ; nm++ ) if ( *nm == '/' ) bn = nm + 1 ;
133
	for (; *nm; nm++) {
-
 
134
		if (*nm == '/') {
-
 
135
			bn = nm + 1;
-
 
136
		}
-
 
137
	}
105
    return ( bn ) ;
138
	return (bn);
106
}
139
}
107
 
140
 
108
 
141
 
109
/*
142
/*
110
    FIND THE FIRST NONZERO BIT
143
    FIND THE FIRST NONZERO BIT
111
 
144
 
112
    This routine returns the bit number of the least significant set
145
    This routine returns the bit number of the least significant set
113
    bit in n.  For 0 it returns -1.
146
    bit in n.  For 0 it returns -1.
114
*/
147
*/
115
 
148
 
116
int bit_one
149
int
117
    PROTO_N ( ( n ) )
-
 
118
    PROTO_T ( bitpattern n )
150
bit_one(bitpattern n)
119
{
151
{
120
    int c = 0 ;
152
	int c = 0;
121
    bitpattern m ;
153
	bitpattern m;
122
    for ( m = n ; m ; m >>= 1, c++ ) if ( m & 1 ) return ( c ) ;
154
	for (m = n; m; m >>= 1, c++) {
-
 
155
		if (m & 1) {
-
 
156
			return (c);
-
 
157
		}
-
 
158
	}
123
    return ( -1 ) ;
159
	return (-1);
124
}
160
}
125
 
161
 
126
 
162
 
127
/*
163
/*
128
    FIND THE NUMBER OF SET BITS
164
    FIND THE NUMBER OF SET BITS
129
 
165
 
130
    The number of set bits in n is returned.
166
    The number of set bits in n is returned.
131
*/
167
*/
132
 
168
 
133
int bits_in
169
int
134
    PROTO_N ( ( n ) )
-
 
135
    PROTO_T ( bitpattern n )
170
bits_in(bitpattern n)
136
{
171
{
137
    /* Table of bits in : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */
172
	/* Table of bits in : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F */
138
    static int b [16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 } ;
173
	static int b[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
139
    int c = 0 ;
174
	int c = 0;
140
    while ( n ) {
175
	while (n) {
141
	c += b [ n & 0xf ] ;
176
		c += b[n & 0xf];
142
	n >>= 4 ;
177
		n >>= 4;
143
    }
178
	}
144
    return ( c ) ;
179
	return (c);
145
}
180
}
146
 
181
 
147
 
182
 
148
/*
183
/*
149
    BIT PATTERNS
184
    BIT PATTERNS
150
 
185
 
151
    lo_bits [n] is the number with its bottom n bits set and the rest
186
    lo_bits [n] is the number with its bottom n bits set and the rest
152
    zero.  hi_bits [n] is the number with its top n bits set and the rest
187
    zero.  hi_bits [n] is the number with its top n bits set and the rest
153
    zero.
188
    zero.
154
*/
189
*/
155
 
190
 
156
bitpattern lo_bits [] = { 0,
191
bitpattern lo_bits[] = { 0,
157
    0x00000001, 0x00000003, 0x00000007, 0x0000000f,
192
	0x00000001, 0x00000003, 0x00000007, 0x0000000f,
158
    0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
193
	0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
159
    0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
194
	0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
160
    0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
195
	0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
161
    0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
196
	0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
162
    0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
197
	0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
163
    0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
198
	0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
164
    0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff } ;
199
	0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff };
165
 
200
 
166
bitpattern hi_bits [] = { 0,
201
bitpattern hi_bits[] = { 0,
167
    0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
202
	0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
168
    0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
203
	0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
169
    0xff800000, 0xffc00000, 0xffe00000, 0xfff00000,
204
	0xff800000, 0xffc00000, 0xffe00000, 0xfff00000,
170
    0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000,
205
	0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000,
171
    0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000,
206
	0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000,
172
    0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00,
207
	0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00,
173
    0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
208
	0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
174
    0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff } ;
209
	0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff };
175
 
-
 
176
 
-
 
177
/*
-
 
178
    NUMBER OF ERRORS
-
 
179
 
-
 
180
    errors is the number of errors which have occurred.  max_errors is
-
 
181
    the maximum number of errors that will be tolerated before exiting.
-
 
182
*/
-
 
183
 
-
 
184
int errors = 0 ;
-
 
185
#ifdef EBUG
-
 
186
int max_errors = 10 ;
-
 
187
#else
-
 
188
int max_errors = 1 ;
-
 
189
#endif
-
 
190
 
210
 
191
 
211
 
192
/*
212
/*
193
    PRINT AN ERROR REPORT
213
   NUMBER OF ERRORS
194
 
214
 
195
    This routine prints the error report s together with any additional
215
   errors is the number of errors which have occurred.  max_errors is
196
    arguments.
216
   the maximum number of errors that will be tolerated before exiting.
197
*/
217
 */
198
 
218
 
199
void error
-
 
200
    PROTO_V ( ( char *s, ... ) )
-
 
201
{
-
 
202
    char c ;
219
int errors = 0;
203
    char *p ;
-
 
204
    va_list args ;
-
 
205
#if FS_STDARG
220
#ifdef EBUG
206
    va_start ( args, s ) ;
221
int max_errors = 10;
207
    p = s ;
-
 
208
#else
222
#else
209
    va_start ( args ) ;
223
int max_errors = 1;
210
    p = va_arg ( args, char * ) ;
-
 
211
#endif
224
#endif
-
 
225
 
-
 
226
 
-
 
227
/*
-
 
228
   PRINT AN ERROR REPORT
-
 
229
 
-
 
230
   This routine prints the error report s together with any additional
-
 
231
   arguments.
-
 
232
 */
-
 
233
 
-
 
234
void
-
 
235
error(char *s, ...)
-
 
236
{
-
 
237
	char c;
-
 
238
	char *p;
-
 
239
	va_list args;
-
 
240
#if FS_STDARG
-
 
241
	va_start(args, s);
-
 
242
	p = s;
-
 
243
#else
-
 
244
	va_start(args);
-
 
245
	p = va_arg(args, char *);
-
 
246
#endif
-
 
247
	if (progname) {
212
    if ( progname ) fprintf ( stderr, "%s : ", progname ) ;
248
		fprintf(stderr, "%s : ", progname);
-
 
249
	}
213
    fprintf ( stderr, "Error : " ) ;
250
	fprintf(stderr, "Error : ");
214
    c = *p ;
251
	c = *p;
215
    if ( c >= 'a' && c <= 'z' ) {
252
	if (c >= 'a' && c <= 'z') {
216
	c += ( 'A' - 'a' ) ;
253
		c += ('A' - 'a');
217
	fputc ( c, stderr ) ;
254
		fputc(c, stderr);
218
	p++ ;
255
		p++;
219
    }
256
	}
220
    vfprintf ( stderr, p, args ) ;
257
	vfprintf(stderr, p, args);
221
    if ( crt_line_num != -1 && crt_fname ) {
258
	if (crt_line_num != -1 && crt_fname) {
222
	fprintf ( stderr, ", %s, line %ld", crt_fname, crt_line_num ) ;
259
		fprintf(stderr, ", %s, line %ld", crt_fname, crt_line_num);
223
    }
260
	}
224
    fprintf ( stderr, ".\n" ) ;
261
	fprintf(stderr, ".\n");
225
    va_end ( args ) ;
262
	va_end(args);
226
#ifdef IGNORE_ERRORS
263
#ifdef IGNORE_ERRORS
227
    return ;
264
	return;
228
#endif
265
#endif
229
    if ( max_errors == 0 ) exit ( EXIT_FAILURE ) ;
266
	if (max_errors == 0) {
-
 
267
		exit(EXIT_FAILURE);
-
 
268
	}
230
    if ( ++errors > max_errors ) {
269
	if (++errors > max_errors) {
231
	fprintf ( stderr, "%s : Too many errors.\n", progname ) ;
270
		fprintf(stderr, "%s : Too many errors.\n", progname);
232
	exit ( EXIT_FAILURE ) ;
271
		exit(EXIT_FAILURE);
233
    }
272
	}
234
    return ;
273
	return;
235
}
274
}
236
 
275
 
237
/*
276
/*
238
    PRINT A SIMPLE ERROR
277
    PRINT A SIMPLE ERROR
239
 
278
 
240
    This routine prints the simple error report s.
279
    This routine prints the simple error report s.
241
*/
280
*/
242
 
281
 
243
void failer
282
void
244
    PROTO_N ( ( s ) )
-
 
245
    PROTO_T ( char *s )
283
failer(char *s)
246
{
284
{
247
    error ( s ) ;
285
	error(s);
248
    return ;
286
	return;
249
}
287
}
250
 
288
 
251
 
289
 
252
/*
290
/*
253
    PRINT A WARNING
291
    PRINT A WARNING
254
 
292
 
255
    This routine prints the warning message s together with any additional
293
    This routine prints the warning message s together with any additional
256
    arguments.
294
    arguments.
257
*/
295
*/
258
 
296
 
259
void warning
297
void
260
    PROTO_V ( ( char *s, ... ) )
298
warning(char *s, ...)
261
{
299
{
262
    char c ;
300
	char c;
263
    char *p ;
301
	char *p;
264
    va_list args ;
302
	va_list args;
265
#if FS_STDARG
303
#if FS_STDARG
266
    va_start ( args, s ) ;
304
	va_start(args, s);
267
    p = s ;
305
	p = s;
268
#else
306
#else
269
    va_start ( args ) ;
307
	va_start(args);
270
    p = va_arg ( args, char * ) ;
308
	p = va_arg(args, char *);
271
#endif
309
#endif
-
 
310
	if (progname) {
272
    if ( progname ) ( void ) fprintf ( stderr, "%s : ", progname ) ;
311
		(void)fprintf(stderr, "%s : ", progname);
-
 
312
	}
273
    fprintf ( stderr, "Warning : " ) ;
313
	fprintf(stderr, "Warning : ");
274
    c = *p ;
314
	c = *p;
275
    if ( c >= 'a' && c <= 'z' ) {
315
	if (c >= 'a' && c <= 'z') {
276
	c += ( 'A' - 'a' ) ;
316
		c += ('A' - 'a');
277
	fputc ( c, stderr ) ;
317
		fputc(c, stderr);
278
	p++ ;
318
		p++;
279
    }
319
	}
280
    ( void ) vfprintf ( stderr, p, args ) ;
320
	(void)vfprintf(stderr, p, args);
281
    ( void ) fprintf ( stderr, ".\n" ) ;
321
	(void)fprintf(stderr, ".\n");
282
    va_end ( args ) ;
322
	va_end(args);
283
    return ;
323
	return;
284
}
324
}
285
 
325
 
286
 
326
 
287
/*
327
/*
288
    MEMORY HACK VALUE
328
    MEMORY HACK VALUE
289
*/
329
*/
290
 
330
 
291
#define memhack 0
331
#define memhack 0
292
 
332
 
293
/*
333
/*
294
    ALLOCATE A BLOCK OF MEMORY
334
    ALLOCATE A BLOCK OF MEMORY
295
 
335
 
296
    A pointer to a block of memory of size sz is returned.  Failure to
336
    A pointer to a block of memory of size sz is returned.  Failure to
297
    allocate this memory gives an immediate fatal error.
337
    allocate this memory gives an immediate fatal error.
298
*/
338
*/
299
 
339
 
300
voidstar xmalloc
340
voidstar
301
    PROTO_N ( ( sz ) )
-
 
302
    PROTO_T ( size_t sz )
341
xmalloc(size_t sz)
303
{
342
{
304
    voidstar res ;
343
	voidstar res;
-
 
344
	if (sz == 0) {
305
    if ( sz == 0 ) return ( null ) ;
345
		return (null);
-
 
346
	}
306
    res = ( voidstar ) malloc ( sz + memhack ) ;
347
	res = (voidstar)malloc(sz + memhack);
307
    if ( res == null ) {
348
	if (res == null) {
308
	error ( "Can't allocate memory" ) ;
349
		error("Can't allocate memory");
309
	exit ( EXIT_FAILURE ) ;
350
		exit(EXIT_FAILURE);
310
    }
351
	}
311
#ifdef MEM_DEBUG
352
#ifdef MEM_DEBUG
312
    printf ( "%d (malloc, %d bytes)\n", res, sz ) ;
353
	printf("%d (malloc, %d bytes)\n", res, sz);
313
    fflush ( stdout ) ;
354
	fflush(stdout);
314
#endif
355
#endif
315
    return ( res ) ;
356
	return (res);
316
}
357
}
317
 
358
 
318
 
359
 
319
/*
360
/*
320
    ALLOCATE ROOM IN MEMORY
361
    ALLOCATE ROOM IN MEMORY
321
 
362
 
322
    A pointer to a block of memory of size n * sz is returned.  This
363
    A pointer to a block of memory of size n * sz is returned.  This
323
    memory is initialized to 0.  Failure to allocate memory gives an
364
    memory is initialized to 0.  Failure to allocate memory gives an
324
    immediate fatal error.
365
    immediate fatal error.
325
*/
366
*/
326
 
367
 
327
voidstar xcalloc
368
voidstar
328
    PROTO_N ( ( n, sz ) )
-
 
329
    PROTO_T ( int n X size_t sz )
369
xcalloc(int n, size_t sz)
330
{
370
{
331
    voidstar res ;
371
	voidstar res;
332
    if ( n == 0 || sz == 0 ) return ( null ) ;
372
	if (n == 0 || sz == 0) {
-
 
373
		return (null);
-
 
374
	}
333
    if ( sz == sizeof ( char ) && n < 100 ) {
375
	if (sz == sizeof(char) && n < 100) {
334
	/* Be careful not to free character arrays */
376
		/* Be careful not to free character arrays */
335
	static char *cbuffer = null ;
377
		static char *cbuffer = null;
336
	static size_t cbuffsz = 0 ;
378
		static size_t cbuffsz = 0;
337
	if ( n + memhack >= cbuffsz ) {
379
		if (n + memhack >= cbuffsz) {
338
	    cbuffsz = 2000 ;
380
			cbuffsz = 2000;
339
	    cbuffer = ( char * ) calloc ( cbuffsz, sizeof ( char ) ) ;
381
			cbuffer = (char *)calloc(cbuffsz, sizeof(char));
340
	    if ( cbuffer == null ) {
382
			if (cbuffer == null) {
341
		error ( "Can't allocate memory" ) ;
383
				error("Can't allocate memory");
342
		exit ( EXIT_FAILURE ) ;
384
				exit(EXIT_FAILURE);
343
	    }
385
			}
344
	}
386
		}
345
	res = ( voidstar ) cbuffer ;
387
		res = (voidstar)cbuffer;
346
	cbuffer += ( n + memhack ) ;
388
		cbuffer += (n + memhack);
347
	cbuffsz -= ( n + memhack ) ;
389
		cbuffsz -= (n + memhack);
348
    } else {
390
	} else {
349
	res = ( voidstar ) calloc ( n + memhack, sz ) ;
391
		res = (voidstar)calloc(n + memhack, sz);
350
	if ( res == null ) {
392
		if (res == null) {
351
	    error ( "Can't allocate memory" ) ;
393
			error("Can't allocate memory");
352
	    exit ( EXIT_FAILURE ) ;
394
			exit(EXIT_FAILURE);
353
	}
395
		}
354
    }
396
	}
355
#ifdef MEM_DEBUG
397
#ifdef MEM_DEBUG
356
    printf ( "%d (calloc, %d bytes)\n", res, n * sz ) ;
398
	printf("%d (calloc, %d bytes)\n", res, n * sz);
357
    fflush ( stdout ) ;
399
	fflush(stdout);
358
#endif
400
#endif
359
    return ( res ) ;
401
	return (res);
360
}
402
}
361
 
403
 
362
 
404
 
363
/*
405
/*
364
    REALLOCATE A BLOCK OF MEMORY
406
    REALLOCATE A BLOCK OF MEMORY
365
 
407
 
366
    The previously allocated memory pointed to by p is reallocated
408
    The previously allocated memory pointed to by p is reallocated
367
    to size n.  A pointer to the new block of memory is returned.
409
    to size n.  A pointer to the new block of memory is returned.
368
    Failure to allocate memory gives an immediate fatal error.
410
    Failure to allocate memory gives an immediate fatal error.
369
*/
411
*/
370
 
412
 
371
voidstar xrealloc
413
voidstar
372
    PROTO_N ( ( p, sz ) )
-
 
373
    PROTO_T ( voidstar p X size_t sz )
414
xrealloc(voidstar p, size_t sz)
374
{
415
{
375
    voidstar res ;
416
	voidstar res;
-
 
417
	if (p == null) {
376
    if ( p == null ) return ( xmalloc ( sz ) ) ;
418
		return (xmalloc(sz));
-
 
419
	}
-
 
420
	if (sz == 0) {
377
    if ( sz == 0 ) return ( null ) ;
421
		return (null);
-
 
422
	}
378
    res = ( voidstar ) realloc ( p, sz + memhack ) ;
423
	res = (voidstar)realloc(p, sz + memhack);
379
    if ( res == null ) {
424
	if (res == null) {
380
	error ( "Can't reallocate memory" ) ;
425
		error("Can't reallocate memory");
381
	exit ( EXIT_FAILURE ) ;
426
		exit(EXIT_FAILURE);
382
    }
427
	}
383
#ifdef MEM_DEBUG
428
#ifdef MEM_DEBUG
384
    printf ( "%d (realloc, %d bytes)\n", res, sz ) ;
429
	printf("%d (realloc, %d bytes)\n", res, sz);
385
    fflush ( stdout ) ;
430
	fflush(stdout);
386
#endif
431
#endif
387
    return ( res ) ;
432
	return (res);
388
}
433
}
389
 
434
 
390
 
435
 
391
/*
436
/*
392
    FREE A BLOCK OF MEMORY
437
    FREE A BLOCK OF MEMORY
393
 
438
 
394
    The block of memory pointed to by p is returned to free.  p must
439
    The block of memory pointed to by p is returned to free.  p must
395
    previously have been allocated using one of the routines above.
440
    previously have been allocated using one of the routines above.
396
*/
441
*/
397
 
442
 
398
void xfree
443
void
399
    PROTO_N ( ( p ) )
-
 
400
    PROTO_T ( voidstar p )
444
xfree(voidstar p)
401
{
445
{
402
    if ( p == null ) return ;
446
	if (p == null) {
-
 
447
		return;
-
 
448
	}
403
    free ( p ) ;
449
	free(p);
404
    return ;
450
	return;
405
}
451
}
406
 
452