fieker-DuValspielwiese
Last change
on this file since 1c3523c was
1c3523c,
checked in by Wilfred Pohl <pohl@…>, 21 years ago
|
macro ppcMac_darwin
git-svn-id: file:///usr/local/Singular/svn/trunk@6439 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[558fb3c] | 1 | /**************************************** |
---|
| 2 | * Computer Algebra System SINGULAR * |
---|
| 3 | ****************************************/ |
---|
[1c3523c] | 4 | /* $Id: mmstd.c,v 1.6 2003-01-28 09:10:51 pohl Exp $ */ |
---|
[558fb3c] | 5 | /* |
---|
[f8dcbcb] | 6 | * ABSTRACT: standard version of C-memory management alloc func |
---|
| 7 | * i.e. (malloc/realloc/free) |
---|
[558fb3c] | 8 | */ |
---|
| 9 | |
---|
| 10 | #include "mod2.h" |
---|
| 11 | |
---|
[f8dcbcb] | 12 | #define OM_NO_MALLOC_MACROS |
---|
[747dce] | 13 | #ifdef ix86_Win |
---|
| 14 | #define OMALLOC_USES_MALLOC |
---|
| 15 | #endif |
---|
[1c3523c] | 16 | #ifdef ppcMac_darwin |
---|
[bd5917] | 17 | #define OMALLOC_USES_MALLOC |
---|
| 18 | #endif |
---|
[f8dcbcb] | 19 | #include "omalloc.h" |
---|
| 20 | |
---|
| 21 | // we provide these functions, so that the settings of OM_CHECK |
---|
| 22 | // and OM_TRACK are used, but only provide them if omalloc is not based |
---|
| 23 | // on them |
---|
| 24 | #ifndef OMALLOC_USES_MALLOC |
---|
[558fb3c] | 25 | |
---|
| 26 | // define this so that all addr allocated there are marked |
---|
| 27 | // as static, i.e. not metioned by omPrintUsedAddr |
---|
| 28 | #define OM_MALLOC_MARK_AS_STATIC |
---|
| 29 | #include <omalloc.c> |
---|
[747dce] | 30 | #else |
---|
| 31 | #include <stdlib.h> |
---|
| 32 | void freeSize(void* addr, size_t size) |
---|
| 33 | { |
---|
| 34 | if (addr) free(addr); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | void* reallocSize(void* old_addr, size_t old_size, size_t new_size) |
---|
| 38 | { |
---|
| 39 | if (old_addr && new_size) |
---|
| 40 | { |
---|
| 41 | return realloc(old_addr, new_size); |
---|
| 42 | } |
---|
| 43 | else |
---|
| 44 | { |
---|
| 45 | freeSize(old_addr, old_size); |
---|
| 46 | return malloc(new_size); |
---|
| 47 | } |
---|
| 48 | } |
---|
[4b24dc8] | 49 | #endif |
---|
[747dce] | 50 | |
---|
Note: See
TracBrowser
for help on using the repository browser.