forked from vonj/snippets.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
big_mall.h
36 lines (32 loc) · 1.04 KB
/
big_mall.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
** void FAR *BigMalloc(Size_T num_elem, Size_T size_elem);
** void BigFree(void FAR *ptr);
*/
#ifndef BIG_MALL__H
#define BIG_MALL__H
#include "extkword.h"
#if (defined(MSDOS) || defined(__MSDOS__)) && !defined(__FLAT__)
#if defined(__TURBOC__) || defined(__POWERC) || defined(__ZTC__)
#if defined(__ZTC__)
#include <dos.h>
#else /* Borland or Mix */
#include <alloc.h>
#endif
typedef unsigned long Size_T;
#define BigMalloc(i,n) (void FAR *)farmalloc((Size_T)(i)*(Size_T)(n))
#define BigFree(p) farfree(p)
#else /* MSC, Watcom */
#include <malloc.h>
#include <stddef.h> /* for size_t */
typedef size_t Size_T;
#define BigMalloc(i,n) (void FAR *)halloc((Size_T)(i),(Size_T)(n))
#define BigFree(p) hfree(p)
#endif
#else
#include <stdlib.h>
#include <stddef.h> /* for size_t */
typedef size_t Size_T;
#define BigMalloc(i,n) malloc((Size_T)(i)*(Size_T)(n))
#define BigFree(p) free(p)
#endif
#endif /* BIG_MALL__H */