Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dmake / alloc.h
blob876284de06a832ad6b798fafa30798e5fb6c9764
1 /* RCS $Id: alloc.h,v 1.1.1.1 2000-09-22 15:33:25 hr Exp $
2 --
3 -- SYNOPSIS
4 -- Macros for allocating memory.
5 --
6 -- DESCRIPTION
7 -- A somewhat nicer interface to malloc and calloc.
8 -- Here we standardise the calling convention with a common macro
9 -- interface.
11 -- AUTHOR
12 -- Dennis Vadura, dvadura@dmake.wticorp.com
14 -- WWW
15 -- http://dmake.wticorp.com/
17 -- COPYRIGHT
18 -- Copyright (c) 1996,1997 by WTI Corp. All rights reserved.
20 -- This program is NOT free software; you can redistribute it and/or
21 -- modify it under the terms of the Software License Agreement Provided
22 -- in the file <distribution-root>/readme/license.txt.
24 -- LOG
25 -- Use cvs log to obtain detailed change logs.
28 #ifndef ALLOC_h
29 #define ALLOC_h
31 /* DO NOT CHANGE these! These are the definitions that the make source
32 * uses for allocating memory. They must be defined for make to compile
33 * properly.
36 /* This is the only place that we define size_t now. This should be more
37 * than enough! */
38 #if __STDC__
39 #else
40 # if !defined(_TYPES_) && !defined(M_XENIX) && !defined(atarist) && !defined(_MPW) && !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(__size_t) && !defined(_WIN32)
41 # if defined(MSDOS) || defined(__MSDOS__)
42 # undef size_t
43 typedef unsigned size_t;
44 # else
45 typedef long size_t;
46 # endif
47 # endif
48 #endif
50 #define usizeof(t) (size_t)sizeof(t)
52 #define FREE(p) free((char*)(p))
53 #define MALLOC(n, t) (t*) malloc((unsigned int)(n)*usizeof(t))
54 #define CALLOC(n, t) (t*) calloc((unsigned int)(n), usizeof(t))
56 #define TALLOC(p, n, t) if ((p = CALLOC(n, t)) == (t*)0) {No_ram();}
58 #endif