diff --git a/src/emu/debug/textbuf.c b/src/emu/debug/textbuf.c index 8a7a5d09e87..712c9500593 100644 --- a/src/emu/debug/textbuf.c +++ b/src/emu/debug/textbuf.c @@ -9,7 +9,7 @@ ***************************************************************************/ -#include "osdcore.h" +#include "corealloc.h" #include "textbuf.h" @@ -87,12 +87,12 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) text_buffer *text; /* allocate memory for the text buffer object */ - text = (text_buffer *)global_alloc(sizeof(*text)); + text = (text_buffer *)global_alloc(text_buffer); if (!text) return NULL; /* allocate memory for the buffer itself */ - text->buffer = (char *)global_alloc_array(bytes); + text->buffer = (char *)global_alloc_array(char, bytes); if (!text->buffer) { global_free(text); @@ -100,7 +100,7 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) } /* allocate memory for the lines array */ - text->lineoffs = (INT32 *)global_alloc_array(lines * sizeof(text->lineoffs[0])); + text->lineoffs = (INT32 *)global_alloc_array(INT32, lines); if (!text->lineoffs) { global_free_array(text->buffer); diff --git a/src/emu/sound/wavwrite.c b/src/emu/sound/wavwrite.c index 57892c3ee07..4e21c22d01d 100644 --- a/src/emu/sound/wavwrite.c +++ b/src/emu/sound/wavwrite.c @@ -1,4 +1,4 @@ -#include "osdcore.h" +#include "corealloc.h" #include "sound/wavwrite.h" struct wav_file @@ -16,7 +16,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels) UINT16 align, temp16; /* allocate memory for the wav struct */ - wav = (wav_file *) global_alloc(sizeof(wav_file)); + wav = (wav_file *) global_alloc(wav_file); if (!wav) return NULL; @@ -128,7 +128,7 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift) if (!wav) return; /* allocate temp memory */ - temp = (INT16 *)global_alloc_array(samples * sizeof(temp[0])); + temp = (INT16 *)global_alloc_array(INT16, samples); if (!temp) return; @@ -156,7 +156,7 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples) if (!wav) return; /* allocate temp memory */ - temp = (INT16 *)global_alloc_array(samples * 2 * sizeof(temp[0])); + temp = (INT16 *)global_alloc_array(INT16, samples * 2); if (!temp) return; @@ -181,7 +181,7 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in if (!wav) return; /* allocate temp memory */ - temp = (INT16 *)global_alloc_array(samples * 2 * sizeof(temp[0])); + temp = (INT16 *)global_alloc_array(INT16, samples); if (!temp) return; diff --git a/src/lib/formats/apridisk.c b/src/lib/formats/apridisk.c index 79022f7829c..985177cc916 100644 --- a/src/lib/formats/apridisk.c +++ b/src/lib/formats/apridisk.c @@ -6,6 +6,7 @@ #include "apridisk.h" #include "imageutl.h" +#include "corealloc.h" /*************************************************************************** CONSTANTS @@ -176,7 +177,7 @@ FLOPPY_CONSTRUCT( apridisk_construct ) } else if (compression == APR_COMPRESSED) { - UINT8 *buffer = (UINT8 *)global_alloc(data_size * sizeof(UINT8)); + UINT8 *buffer = (UINT8 *)global_alloc_array(UINT8, data_size); UINT16 length; UINT8 value; @@ -185,7 +186,7 @@ FLOPPY_CONSTRUCT( apridisk_construct ) length = pick_integer_le(buffer, 0, 2); value = pick_integer_le(buffer, 2, 1); - global_free(buffer); + global_free_array(buffer); /* not sure if this is possible */ if (length != 512) {