mirror of
https://github.com/holub/mame
synced 2025-05-20 12:48:53 +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;
|
expr->table = table;
|
||||||
|
|
||||||
/* make a copy of the original string */
|
/* 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)
|
if (!expr->original_string)
|
||||||
return MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
return MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
||||||
strcpy(expr->original_string, stringstart);
|
strcpy(expr->original_string, stringstart);
|
||||||
@ -1687,7 +1687,7 @@ static char *add_expression_string(parsed_expression *expr, const char *string,
|
|||||||
expression_string *expstring;
|
expression_string *expstring;
|
||||||
|
|
||||||
/* allocate memory */
|
/* allocate memory */
|
||||||
expstring = (expression_string *)malloc(sizeof(expression_string) + length);
|
expstring = (expression_string *)osd_malloc(sizeof(expression_string) + length);
|
||||||
if (expstring == NULL)
|
if (expstring == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1735,15 +1735,15 @@ static void free_expression_strings(parsed_expression *expr)
|
|||||||
{
|
{
|
||||||
/* free the original expression */
|
/* free the original expression */
|
||||||
if (expr->original_string != NULL)
|
if (expr->original_string != NULL)
|
||||||
free(expr->original_string);
|
osd_free(expr->original_string);
|
||||||
expr->original_string = NULL;
|
expr->original_string = NULL;
|
||||||
|
|
||||||
/* free all strings */
|
/* osd_free all strings */
|
||||||
while (expr->stringlist != NULL)
|
while (expr->stringlist != NULL)
|
||||||
{
|
{
|
||||||
expression_string *string = expr->stringlist;
|
expression_string *string = expr->stringlist;
|
||||||
expr->stringlist = string->next;
|
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;
|
goto cleanup;
|
||||||
|
|
||||||
/* allocate memory for the result */
|
/* allocate memory for the result */
|
||||||
*result = (parsed_expression *)malloc(sizeof(temp_expression));
|
*result = (parsed_expression *)osd_malloc(sizeof(temp_expression));
|
||||||
if (!*result)
|
if (!*result)
|
||||||
{
|
{
|
||||||
exprerr = MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
exprerr = MAKE_EXPRERR_OUT_OF_MEMORY(0);
|
||||||
@ -1860,7 +1860,7 @@ void expression_free(parsed_expression *expr)
|
|||||||
if (expr != NULL)
|
if (expr != NULL)
|
||||||
{
|
{
|
||||||
free_expression_strings(expr);
|
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;
|
symbol_table *table;
|
||||||
|
|
||||||
/* allocate memory for the table */
|
/* allocate memory for the table */
|
||||||
table = (symbol_table *)malloc(sizeof(*table));
|
table = (symbol_table *)osd_malloc(sizeof(*table));
|
||||||
if (!table)
|
if (!table)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -2001,16 +2001,16 @@ int symtable_add(symbol_table *table, const char *name, const symbol_entry *entr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* otherwise, allocate a new entry */
|
/* otherwise, allocate a new entry */
|
||||||
symbol = (internal_symbol_entry *)malloc(sizeof(*symbol));
|
symbol = (internal_symbol_entry *)osd_malloc(sizeof(*symbol));
|
||||||
if (!symbol)
|
if (!symbol)
|
||||||
return 0;
|
return 0;
|
||||||
memset(symbol, 0, sizeof(*symbol));
|
memset(symbol, 0, sizeof(*symbol));
|
||||||
|
|
||||||
/* allocate space for a copy of the string */
|
/* allocate space for a copy of the string */
|
||||||
newstring = (char *)malloc(strlen(name) + 1);
|
newstring = (char *)osd_malloc(strlen(name) + 1);
|
||||||
if (!newstring)
|
if (!newstring)
|
||||||
{
|
{
|
||||||
free(symbol);
|
osd_free(symbol);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2151,13 +2151,13 @@ void symtable_free(symbol_table *table)
|
|||||||
{
|
{
|
||||||
/* free the allocated name */
|
/* free the allocated name */
|
||||||
if (entry->name)
|
if (entry->name)
|
||||||
free((void *)entry->name);
|
osd_free((void *)entry->name);
|
||||||
|
|
||||||
/* remove from this list and put on the free list */
|
/* remove from this list and put on the free list */
|
||||||
next = entry->next;
|
next = entry->next;
|
||||||
free(entry);
|
osd_free(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free the structure */
|
/* free the structure */
|
||||||
free(table);
|
osd_free(table);
|
||||||
}
|
}
|
||||||
|
@ -88,24 +88,24 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines)
|
|||||||
text_buffer *text;
|
text_buffer *text;
|
||||||
|
|
||||||
/* allocate memory for the text buffer object */
|
/* allocate memory for the text buffer object */
|
||||||
text = (text_buffer *)malloc(sizeof(*text));
|
text = (text_buffer *)osd_malloc(sizeof(*text));
|
||||||
if (!text)
|
if (!text)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* allocate memory for the buffer itself */
|
/* allocate memory for the buffer itself */
|
||||||
text->buffer = (char *)malloc(bytes);
|
text->buffer = (char *)osd_malloc(bytes);
|
||||||
if (!text->buffer)
|
if (!text->buffer)
|
||||||
{
|
{
|
||||||
free(text);
|
osd_free(text);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for the lines array */
|
/* 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)
|
if (!text->lineoffs)
|
||||||
{
|
{
|
||||||
free(text->buffer);
|
osd_free(text->buffer);
|
||||||
free(text);
|
osd_free(text);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,10 +126,10 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines)
|
|||||||
void text_buffer_free(text_buffer *text)
|
void text_buffer_free(text_buffer *text)
|
||||||
{
|
{
|
||||||
if (text->lineoffs)
|
if (text->lineoffs)
|
||||||
free(text->lineoffs);
|
osd_free(text->lineoffs);
|
||||||
if (text->buffer)
|
if (text->buffer)
|
||||||
free(text->buffer);
|
osd_free(text->buffer);
|
||||||
free(text);
|
osd_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
|
|||||||
UINT16 align, temp16;
|
UINT16 align, temp16;
|
||||||
|
|
||||||
/* allocate memory for the wav struct */
|
/* 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)
|
if (!wav)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
|
|||||||
wav->file = fopen(filename, "wb");
|
wav->file = fopen(filename, "wb");
|
||||||
if (!wav->file)
|
if (!wav->file)
|
||||||
{
|
{
|
||||||
free(wav);
|
osd_free(wav);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ void wav_close(wav_file *wav)
|
|||||||
fwrite(&temp32, 1, 4, wav->file);
|
fwrite(&temp32, 1, 4, wav->file);
|
||||||
|
|
||||||
fclose(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;
|
if (!wav) return;
|
||||||
|
|
||||||
/* allocate temp memory */
|
/* allocate temp memory */
|
||||||
temp = (INT16 *)malloc(samples * sizeof(temp[0]));
|
temp = (INT16 *)osd_malloc(samples * sizeof(temp[0]));
|
||||||
if (!temp)
|
if (!temp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ void wav_add_data_32(wav_file *wav, INT32 *data, int samples, int shift)
|
|||||||
fflush(wav->file);
|
fflush(wav->file);
|
||||||
|
|
||||||
/* free memory */
|
/* 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;
|
if (!wav) return;
|
||||||
|
|
||||||
/* allocate temp memory */
|
/* allocate temp memory */
|
||||||
temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0]));
|
temp = (INT16 *)osd_malloc(samples * 2 * sizeof(temp[0]));
|
||||||
if (!temp)
|
if (!temp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ void wav_add_data_16lr(wav_file *wav, INT16 *left, INT16 *right, int samples)
|
|||||||
fflush(wav->file);
|
fflush(wav->file);
|
||||||
|
|
||||||
/* free memory */
|
/* 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;
|
if (!wav) return;
|
||||||
|
|
||||||
/* allocate temp memory */
|
/* allocate temp memory */
|
||||||
temp = (INT16 *)malloc(samples * 2 * sizeof(temp[0]));
|
temp = (INT16 *)osd_malloc(samples * 2 * sizeof(temp[0]));
|
||||||
if (!temp)
|
if (!temp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -196,5 +196,5 @@ void wav_add_data_32lr(wav_file *wav, INT32 *left, INT32 *right, int samples, in
|
|||||||
fflush(wav->file);
|
fflush(wav->file);
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
free(temp);
|
osd_free(temp);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user