Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /branches/tendra5/src/utilities/shared/xalloc.h – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
#ifndef XALLOC_INCLUDED
32
#define XALLOC_INCLUDED
33
 
34
 
35
/*
36
    GENERIC POINTER
37
*/
38
 
39
#if FS_PTR_VOID
40
typedef void *gen_ptr ;
41
#else
42
typedef char *gen_ptr ;
43
#endif
44
 
45
 
46
/*
47
    DECLARATIONS FOR MEMORY ALLOCATION ROUTINES
48
*/
49
 
50
extern gen_ptr xmalloc PROTO_S ( ( long ) ) ;
51
extern gen_ptr xcalloc PROTO_S ( ( long, long ) ) ;
52
extern gen_ptr xrealloc PROTO_S ( ( gen_ptr, long ) ) ;
53
extern void xfree PROTO_S ( ( gen_ptr ) ) ;
54
extern char *xstr PROTO_S ( ( long ) ) ;
55
extern char *xstrcpy PROTO_S ( ( CONST char * ) ) ;
56
extern char *xstrcat PROTO_S ( ( CONST char *, CONST char * ) ) ;
57
 
58
 
59
/*
60
    MACROS FOR ACCESSING MEMORY ALLOCATION ROUTINES
61
 
62
    These macros give a convenient method for accessing the routines above.
63
    For example, xmalloc_nof ( T, N ) allocates space for N objects of
64
    type T.
65
*/
66
 
67
#define xmalloc_nof( T, N )\
68
    ( ( T * ) xmalloc ( ( long ) ( N ) * ( long ) sizeof ( T ) ) )
69
#define xcalloc_nof( T, N )\
70
    ( ( T * ) xcalloc ( ( long ) ( N ), ( long ) sizeof ( T ) ) )
71
#define xrealloc_nof( P, T, N )\
72
    ( ( T * ) xrealloc ( ( gen_ptr ) ( P ),\
73
			 ( long ) ( N ) * ( long ) sizeof ( T ) ) )
74
#define xfree_nof( P )\
75
    xfree ( ( gen_ptr ) ( P ) )
76
 
77
 
78
#endif