source: trunk/src/odincrt/odincrt.cpp@ 438

Last change on this file since 438 was 438, checked in by phaller, 26 years ago

Add: ODINCRT initial version

File size: 2.4 KB
Line 
1/************************************************************************/
2/* odincrt.c */
3/************************************************************************/
4/* */
5/* Odin shared C runtime library for IBM VAC++ 3.08 */
6/* */
7/************************************************************************/
8/* Created: 99/08/08 */
9/* Last Edited: 99/00/08 */
10/************************************************************************/
11/* (C)'99 Patrick Haller, Achim Hasenmueller */
12/************************************************************************/
13
14/* we need all prototypes for the C runtime library */
15/****************************************************************************
16 * Includes *
17 ****************************************************************************/
18
19#include <stdio.h>
20#include <stdlib.h>
21#include <odincrt.h>
22
23typedef unsigned short USHORT;
24
25
26/****************************************************************************
27 * Macros *
28 ****************************************************************************/
29
30#define ODIN_TEB_OFF { \
31 USHORT sel = RestoreOS2FS();
32
33#define ODIN_TEB_ON1(rc) SetFS(sel);\
34 return(rc);\
35 }
36
37#define ODIN_TEB_ON0() SetFS(sel);\
38 }
39
40
41/****************************************************************************
42 * Implementation *
43 ****************************************************************************/
44
45void* ODINAPI ODIN_calloc ( size_t s1, size_t s2 )
46 ODIN_TEB_OFF
47 void* rc = calloc(s1,s2);
48 ODIN_TEB_ON1(rc)
49
50void* ODINAPI ODIN_realloc( void * p1, size_t s1 )
51 ODIN_TEB_OFF
52 void* rc = realloc(p1,s1);
53 ODIN_TEB_ON1(rc)
54
55void* ODINAPI ODIN_malloc (size_t size)
56 ODIN_TEB_OFF
57 void *rc = malloc(size);
58 ODIN_TEB_ON1(rc)
59
60void ODINAPI ODIN_free (void *ptr)
61 ODIN_TEB_OFF
62 free(ptr);
63 ODIN_TEB_ON0()
64
65
Note: See TracBrowser for help on using the repository browser.