diff options
| author | 2007-12-17 16:37:57 +0000 | |
|---|---|---|
| committer | 2007-12-17 16:37:57 +0000 | |
| commit | c82a966b3b72d79ac3ce394980d6b5806e752160 (patch) | |
| tree | f46dd63acdd83498db10a0563bb4e874df26d903 /src/osd/windows/winalloc.c | |
| parent | 8a8ccc594989d85f2277c48d3c158f7cee41d06b (diff) | |
Changes for MAME 0.121u2.mame0121u2
Diffstat (limited to 'src/osd/windows/winalloc.c')
| -rw-r--r-- | src/osd/windows/winalloc.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/osd/windows/winalloc.c b/src/osd/windows/winalloc.c index c54eda5e768..8b6b3679519 100644 --- a/src/osd/windows/winalloc.c +++ b/src/osd/windows/winalloc.c @@ -328,7 +328,10 @@ void *realloc_file_line(void *memory, size_t size, const char *file, int line) } else { - newmemory = (void *) GlobalReAlloc(memory, size, GMEM_MOVEABLE); + if (memory != NULL) + newmemory = (void *) GlobalReAlloc(memory, size, GMEM_MOVEABLE); + else + newmemory = (void *) GlobalAlloc(GMEM_FIXED, size); } return newmemory; @@ -380,17 +383,27 @@ void CLIB_DECL free(void *memory) size_t CLIB_DECL _msize(void *memory) { - memory_entry *entry = find_entry(memory); - if (entry == NULL) + size_t result; + + if (use_malloc_tracking()) { - if (winalloc_in_main_code) + memory_entry *entry = find_entry(memory); + if (entry == NULL) { - fprintf(stderr, "Error: msize a non-existant block\n"); - osd_break_into_debugger("Error: msize a non-existant block"); + if (winalloc_in_main_code) + { + fprintf(stderr, "Error: msize a non-existant block\n"); + osd_break_into_debugger("Error: msize a non-existant block"); + } + return 0; } - return 0; + result = entry->size; + } + else + { + result = GlobalSize(memory); } - return entry->size; + return result; } |
