source: trunk/src/3rdparty/libmng/libmng_memory.h

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1/* ************************************************************************** */
2/* * For conditions of distribution and use, * */
3/* * see copyright notice in libmng.h * */
4/* ************************************************************************** */
5/* * * */
6/* * project : libmng * */
7/* * file : libmng_memory.h copyright (c) 2000 G.Juyn * */
8/* * version : 1.0.0 * */
9/* * * */
10/* * purpose : Memory management (definition) * */
11/* * * */
12/* * author : G.Juyn * */
13/* * web : http://www.3-t.com * */
14/* * email : mailto:info@3-t.com * */
15/* * * */
16/* * comment : Definition of memory management functions * */
17/* * * */
18/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
19/* * - changed strict-ANSI stuff * */
20/* * * */
21/* * 0.5.3 - 06/12/2000 - G.Juyn * */
22/* * - swapped MNG_COPY parameter-names * */
23/* * 0.5.3 - 06/27/2000 - G.Juyn * */
24/* * - changed size parameter to mng_size_t * */
25/* * * */
26/* * 0.9.2 - 08/05/2000 - G.Juyn * */
27/* * - changed file-prefixes * */
28/* * * */
29/* ************************************************************************** */
30
31#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
32#pragma option -A /* force ANSI-C */
33#endif
34
35#ifndef _libmng_memory_h_
36#define _libmng_memory_h_
37
38/* ************************************************************************** */
39/* * * */
40/* * Generic memory manager macros * */
41/* * * */
42/* ************************************************************************** */
43
44#ifdef MNG_INTERNAL_MEMMNGMT
45#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \
46 if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
47#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); }
48#define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } }
49#define MNG_FREEX(H,P,L) { if (P) free (P); }
50#else
51#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \
52 if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } }
53#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); }
54#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } }
55#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } }
56#endif /* mng_internal_memmngmt */
57
58#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); }
59
60/* ************************************************************************** */
61
62#endif /* _libmng_memory_h_ */
63
64/* ************************************************************************** */
65/* * end of file * */
66/* ************************************************************************** */
Note: See TracBrowser for help on using the repository browser.