mirror of
https://github.com/holub/mame
synced 2025-05-19 20:29:09 +03:00
All files modified here solely depend on osdcore.h. Therefore changed all malloc/free to osd_malloc and osd_free.
This commit is contained in:
parent
865ef1e9fc
commit
91c5f19bf3
@ -635,7 +635,7 @@ static EXPRERR parse_string_into_tokens(const char *stringstart, parsed_expressi
|
||||
expr->table = table;
|
||||
|
||||
/* make a copy of the original string */
|
||||
expr->original_string = (char *)malloc(strlen(stringstart) + 1);
|
||||
expr->original_string = (char *)osd_malloc(strlen(stringstart) + 1);
|
||||
if (!expr->original_string)
|
||||
return MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
||||
strcpy(expr->original_string, stringstart);
|
||||
@ -1687,7 +1687,7 @@ static char *add_expression_string(parsed_expression *expr, const char *string,
|
||||
expression_string *expstring;
|
||||
|
||||
/* allocate memory */
|
||||
expstring = (expression_string *)malloc(sizeof(expression_string) + length);
|
||||
expstring = (expression_string *)osd_malloc(sizeof(expression_string) + length);
|
||||
if (expstring == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -1735,15 +1735,15 @@ static void free_expression_strings(parsed_expression *expr)
|
||||
{
|
||||
/* free the original expression */
|
||||
if (expr->original_string != NULL)
|
||||
free(expr->original_string);
|
||||
osd_free(expr->original_string);
|
||||
expr->original_string = NULL;
|
||||
|
||||
/* free all strings */
|
||||
/* osd_free all strings */
|
||||
while (expr->stringlist != NULL)
|
||||
{
|
||||
expression_string *string = expr->stringlist;
|
||||
expr->stringlist = string->next;
|
||||
free(string);
|
||||
osd_free(string);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1821,7 +1821,7 @@ EXPRERR expression_parse(const char *expression, const symbol_table *table, cons
|
||||
goto cleanup;
|
||||
|
||||
/* allocate memory for the result */
|
||||
*result = (parsed_expression *)malloc(sizeof(temp_expression));
|
||||
*result = (parsed_expression *)osd_malloc(sizeof(temp_expression));
|
||||
if (!*result)
|
||||
{
|
||||
exprerr = MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
||||
@ -1860,7 +1860,7 @@ void expression_free(parsed_expression *expr)
|
||||
if (expr != NULL)
|
||||
{
|
||||
free_expression_strings(expr);
|
||||
free(expr);
|
||||
osd_free(expr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1941,7 +1941,7 @@ symbol_table *symtable_alloc(symbol_table *parent, void *globalref)
|
||||
symbol_table *table;
|
||||
|
||||
/* allocate memory for the table */
|
||||
table = (symbol_table *)malloc(sizeof(*table));
|
||||
table = (symbol_table *)osd_malloc(sizeof(*table));
|
||||
if (!table)
|
||||
return NULL;
|
||||
|
||||
@ -2001,16 +2001,16 @@ int symtable_add(symbol_table *table, const char *name, const symbol_entry *entr
|
||||
}
|
||||
|
||||
/* otherwise, allocate a new entry */
|
||||
symbol = (internal_symbol_entry *)malloc(sizeof(*symbol));
|
||||
symbol = (internal_symbol_entry *)osd_malloc(sizeof(*symbol));
|
||||
if (!symbol)
|
||||
return 0;
|
||||
memset(symbol, 0, sizeof(*symbol));
|
||||
|
||||
/* allocate space for a copy of the string */
|
||||
newstring = (char *)malloc(strlen(name) + 1);
|
||||
newstring = (char *)osd_malloc(strlen(name) + 1);
|
||||
if (!newstring)
|
||||
{
|
||||
free(symbol);
|
||||
osd_free(symbol);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2151,13 +2151,13 @@ void symtable_free(symbol_table *table)
|
||||
{
|
||||
/* free the allocated name */
|
||||
if (entry->name)
|
||||
free((void *)entry->name);
|
||||
osd_free((void *)entry->name);
|
||||
|
||||
/* remove from this list and put on the free list */
|
||||
next = entry->next;
|
||||
free(entry);
|
||||
osd_free(entry);
|
||||
}
|
||||
|
||||
/* free the structure */
|
||||
free(table);
|
||||
osd_free(table);
|
||||
}
|
||||
|
@ -88,24 +88,24 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines)
|
||||
text_buffer *text;
|
||||
|
||||
/* allocate memory for the text buffer object */
|
||||
text = (text_buffer *)malloc(sizeof(*text));
|
||||
text = (text_buffer *)osd_malloc(sizeof(*text));
|
||||
if (!text)
|
||||
return NULL;
|
||||
|
||||
/* allocate memory for the buffer itself */
|
||||
text->buffer = (char *)malloc(bytes);
|
||||
text->buffer = (char *)osd_malloc(bytes);
|
||||
if (!text->buffer)
|
||||
{
|
||||
free(text);
|
||||
osd_free(text);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate memory for the lines array */
|
||||
text->lineoffs = (INT32 *)malloc(lines * sizeof(text->lineoffs[0]));
|
||||
text->lineoffs = (INT32 *)osd_malloc(lines * sizeof(text->lineoffs[0]));
|
||||
if (!text->lineoffs)
|
||||
{
|
||||
free(text->buffer);
|
||||
free(text);
|
||||
osd_free(text->buffer);
|
||||
osd_free(text);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -126,10 +126,10 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines)
|
||||
void text_buffer_free(text_buffer *text)
|
||||
{
|
||||
if (text->lineoffs)
|
||||
free(text->lineoffs);
|
||||
osd_free(text->lineoffs);
|
||||
if (text->buffer)
|
||||
free(text->buffer);
|
||||
free(text);
|
||||
osd_free(text->buffer);
|
||||
osd_free(text);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 *) malloc(sizeof(struct _wav_file));
|
||||
wav = (wav_file *) osd_malloc(sizeof(struct _wav_file));
|
||||
if (!wav)
|
||||
return NULL;
|
||||
|
||||
@ -24,7 +24,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
|
||||
wav->file = fopen(filename, "wb");
|
||||
if (!wav->file)
|
||||
{
|
||||
free(wav);
|
||||
osd_free(wav);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ void wav_close(wav_file *wav)
|
||||
fwrite(&temp32, 1, 4, wav->file);
|
||||
|
||||
fclose(wav->file);
|
||||
free(wav);
|
||||
osd_free(wav);
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
|
||||
if (!wav) return;
|
||||
|
||||
/* allocate temp memory */
|
||||
temp = (INT16 *)malloc(samples * sizeof(temp[0]));
|
||||
temp = (INT16 *)osd_malloc(samples * sizeof(temp[0]));
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
@ -142,7 +142,7 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
|
||||
fflush(wav->file);
|
||||
|
||||
/* free memory */
|
||||
free(temp);
|
||||
osd_free(temp);
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
|
||||
if (!wav) return;
|
||||
|
||||
/* allocate temp memory */
|
||||
temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0]));
|
||||
temp = (INT16 *)osd_malloc(samples * 2 * sizeof(temp[0]));
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
@ -167,7 +167,7 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
|
||||
fflush(wav->file);
|
||||
|
||||
/* free memory */
|
||||
free(temp);
|
||||
osd_free(temp);
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in
|
||||
if (!wav) return;
|
||||
|
||||
/* allocate temp memory */
|
||||
temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0]));
|
||||
temp = (INT16 *)osd_malloc(samples * 2 * sizeof(temp[0]));
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
@ -196,5 +196,5 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in
|
||||
fflush(wav->file);
|
||||
|
||||
/* free memory */
|
||||
free(temp);
|
||||
osd_free(temp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user