Changeset 898
- Timestamp:
- 05/13/08 14:52:05 (4 months ago)
- Files:
-
- trunk/rebuild/Makefile (modified) (2 diffs)
- trunk/rebuild/mars.c (modified) (1 diff)
- trunk/rebuild/mem.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rebuild/Makefile
r888 r898 4 4 CXXFLAGS=-g 5 5 6 GC=-Wl,-Bstatic,-lgc,-Bdynamic7 6 THREADS=-pthread 8 7 … … 10 9 11 10 LDFLAGS= 12 LIBS=$( GC) $(THREADS)11 LIBS=$(THREADS) 13 12 14 13 PREFIX=/usr trunk/rebuild/mars.c
r897 r898 26 26 27 27 #include <pthread.h> 28 #include "gc/gc.h"29 28 30 29 #if _WIN32 trunk/rebuild/mem.c
r888 r898 1 1 2 2 /* Copyright (c) 2000 Digital Mars */ 3 /* Copyright (c) 2008 Gregor Richards*/3 /* All Rights Reserved */ 4 4 5 5 #include <stdio.h> … … 7 7 #include <string.h> 8 8 9 #include " gc/gc.h"9 #include "mem.h" 10 10 11 #include "mem.h" 11 /* This implementation of the storage allocator uses the standard C allocation package. 12 */ 12 13 13 14 Mem mem; … … 15 16 void Mem::init() 16 17 { 17 GC_INIT();18 18 } 19 19 … … 24 24 if (s) 25 25 { 26 p = GC_strdup(s);26 p = ::strdup(s); 27 27 if (p) 28 28 return p; … … 39 39 else 40 40 { 41 p = GC_malloc(size);41 p = ::malloc(size); 42 42 if (!p) 43 43 error(); … … 53 53 else 54 54 { 55 //p = ::calloc(size, n); 56 p = GC_malloc(size*n); 57 memset(p, 0, size*n); 55 p = ::calloc(size, n); 58 56 if (!p) 59 57 error(); … … 66 64 if (!size) 67 65 { if (p) 68 { GC_free(p);66 { ::free(p); 69 67 p = NULL; 70 68 } … … 72 70 else if (!p) 73 71 { 74 p = GC_malloc(size);72 p = ::malloc(size); 75 73 if (!p) 76 74 error(); … … 78 76 else 79 77 { 80 p = GC_realloc(p, size);78 p = ::realloc(p, size); 81 79 if (!p) 82 80 error(); … … 88 86 { 89 87 if (p) 90 GC_free(p);88 ::free(p); 91 89 } 92 90 … … 98 96 else 99 97 { 100 p = GC_malloc(size);98 p = ::malloc(size); 101 99 if (!p) 102 100 error(); … … 115 113 void Mem::fullcollect() 116 114 { 117 GC_gcollect();118 115 } 119 116 … … 127 124 void * operator new(size_t m_size) 128 125 { 129 void *p = GC_malloc(m_size);126 void *p = malloc(m_size); 130 127 if (p) 131 128 return p; … … 137 134 void operator delete(void *p) 138 135 { 139 GC_free(p);136 free(p); 140 137 } 141 138
