fieker-DuValspielwiese
Last change
on this file since e73abe2 was
ccd333,
checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
|
- seperated public config macros in omalloc from private ones
- deleted OM_PROVIDE_MALLOC and OM_EMULATE_OMALLOC
- protect libpolys/misc/mylimits.h from double-include
- enlarged .gitignore :)
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | /******************************************************************* |
---|
2 | * File: omAllocEmulate.c |
---|
3 | * Purpose: implementation of emulated omalloc routines |
---|
4 | * Author: obachman (Olaf Bachmann) |
---|
5 | * Created: 11/99 |
---|
6 | * Version: $Id$ |
---|
7 | *******************************************************************/ |
---|
8 | #include <stdlib.h> |
---|
9 | #include <string.h> |
---|
10 | |
---|
11 | #include <omalloc/omMalloc.h> |
---|
12 | |
---|
13 | void* omEmulateAlloc0(size_t size) |
---|
14 | { |
---|
15 | void* addr = OM_MALLOC_MALLOC(size); |
---|
16 | memset(addr, 0, size); |
---|
17 | return addr; |
---|
18 | } |
---|
19 | |
---|
20 | void* omEmulateRealloc0Size(void* o_addr, size_t o_size, size_t n_size) |
---|
21 | { |
---|
22 | void* addr = OM_MALLOC_REALLOC(o_addr, n_size); |
---|
23 | |
---|
24 | if (n_size > o_size) |
---|
25 | memset((char *)addr + o_size, 0, n_size - o_size); |
---|
26 | |
---|
27 | return addr; |
---|
28 | } |
---|
29 | |
---|
30 | void* omEmulateRealloc0(void* o_addr, size_t n_size) |
---|
31 | { |
---|
32 | #ifdef OM_MALLOC_SIZEOF_ADDR |
---|
33 | size_t o_size = OM_MALLOC_SIZEOF_ADDR(o_addr); |
---|
34 | #endif |
---|
35 | void* addr = OM_MALLOC_REALLOC(o_addr, n_size); |
---|
36 | #ifdef OM_MALLOC_SIZEOF_ADDR |
---|
37 | if (n_size > o_size) |
---|
38 | memset((char *)addr + o_size, 0, n_size - o_size); |
---|
39 | #endif |
---|
40 | return addr; |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.