mirror of
https://github.com/holub/mame
synced 2025-05-30 01:23:07 +03:00
Various memory leaks and unnecessary checks removed by Oliver Stoneberg (no whatsnew)
This commit is contained in:
parent
b0e77ca0ee
commit
1d67e27539
@ -81,7 +81,7 @@ void device_sound_interface::static_add_route(device_t &device, UINT32 output, c
|
|||||||
// append a new route to the list
|
// append a new route to the list
|
||||||
astring devtag;
|
astring devtag;
|
||||||
device.siblingtag(devtag, target);
|
device.siblingtag(devtag, target);
|
||||||
sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, core_strdup(devtag.cstr()))));
|
sound->m_route_list.append(*global_alloc(sound_route(output, input, gain, devtag.cstr())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -229,10 +229,10 @@ bool device_sound_interface::interface_validity_check(emu_options &options, cons
|
|||||||
for (const sound_route *route = first_route(); route != NULL; route = route->next())
|
for (const sound_route *route = first_route(); route != NULL; route = route->next())
|
||||||
{
|
{
|
||||||
// find a device with the requested tag
|
// find a device with the requested tag
|
||||||
const device_t *target = device().mconfig().devicelist().find(route->m_target);
|
const device_t *target = device().mconfig().devicelist().find(route->m_target.cstr());
|
||||||
if (target == NULL)
|
if (target == NULL)
|
||||||
{
|
{
|
||||||
mame_printf_error("%s: %s attempting to route sound to non-existant device '%s'\n", driver.source_file, driver.name, route->m_target);
|
mame_printf_error("%s: %s attempting to route sound to non-existant device '%s'\n", driver.source_file, driver.name, route->m_target.cstr());
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ bool device_sound_interface::interface_validity_check(emu_options &options, cons
|
|||||||
const device_sound_interface *sound;
|
const device_sound_interface *sound;
|
||||||
if (target != NULL && target->type() != SPEAKER && !target->interface(sound))
|
if (target != NULL && target->type() != SPEAKER && !target->interface(sound))
|
||||||
{
|
{
|
||||||
mame_printf_error("%s: %s attempting to route sound to a non-sound device '%s' (%s)\n", driver.source_file, driver.name, route->m_target, target->name());
|
mame_printf_error("%s: %s attempting to route sound to a non-sound device '%s' (%s)\n", driver.source_file, driver.name, route->m_target.cstr(), target->name());
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,13 +316,13 @@ void device_sound_interface::interface_post_start()
|
|||||||
int streamoutputnum;
|
int streamoutputnum;
|
||||||
sound_stream *outputstream = sound->output_to_stream_output(outputnum, streamoutputnum);
|
sound_stream *outputstream = sound->output_to_stream_output(outputnum, streamoutputnum);
|
||||||
if (outputstream == NULL)
|
if (outputstream == NULL)
|
||||||
fatalerror("Sound device '%s' specifies route for non-existant output #%d", route->m_target, outputnum);
|
fatalerror("Sound device '%s' specifies route for non-existant output #%d", route->m_target.cstr(), outputnum);
|
||||||
|
|
||||||
// find the input stream to connect to
|
// find the input stream to connect to
|
||||||
int streaminputnum;
|
int streaminputnum;
|
||||||
sound_stream *inputstream = input_to_stream_input(inputnum++, streaminputnum);
|
sound_stream *inputstream = input_to_stream_input(inputnum++, streaminputnum);
|
||||||
if (inputstream == NULL)
|
if (inputstream == NULL)
|
||||||
fatalerror("Sound device '%s' targeted output #%d to non-existant device '%s' input %d", route->m_target, outputnum, m_device.tag(), inputnum - 1);
|
fatalerror("Sound device '%s' targeted output #%d to non-existant device '%s' input %d", route->m_target.cstr(), outputnum, m_device.tag(), inputnum - 1);
|
||||||
|
|
||||||
// set the input
|
// set the input
|
||||||
inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route->m_gain);
|
inputstream->set_input(streaminputnum, outputstream, streamoutputnum, route->m_gain);
|
||||||
|
@ -109,7 +109,7 @@ public:
|
|||||||
UINT32 m_output; // output index, or ALL_OUTPUTS
|
UINT32 m_output; // output index, or ALL_OUTPUTS
|
||||||
UINT32 m_input; // target input index
|
UINT32 m_input; // target input index
|
||||||
float m_gain; // gain
|
float m_gain; // gain
|
||||||
const char * m_target; // target tag
|
astring m_target; // target tag
|
||||||
};
|
};
|
||||||
|
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
|
@ -999,12 +999,9 @@ static STREAM_UPDATE( custom_stream_callback )
|
|||||||
rightand = (ldcore->audiosquelch & 2) ? 0x0000 : 0xffff;
|
rightand = (ldcore->audiosquelch & 2) ? 0x0000 : 0xffff;
|
||||||
|
|
||||||
/* see if we have enough samples to fill the buffer; if not, drop out */
|
/* see if we have enough samples to fill the buffer; if not, drop out */
|
||||||
if (ld != NULL)
|
samples_avail = ldcore->audiobufin - ldcore->audiobufout;
|
||||||
{
|
if (samples_avail < 0)
|
||||||
samples_avail = ldcore->audiobufin - ldcore->audiobufout;
|
samples_avail += ldcore->audiobufsize;
|
||||||
if (samples_avail < 0)
|
|
||||||
samples_avail += ldcore->audiobufsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if no attached ld, just clear the buffers */
|
/* if no attached ld, just clear the buffers */
|
||||||
if (samples_avail < samples)
|
if (samples_avail < samples)
|
||||||
|
@ -224,7 +224,11 @@ core_options::~core_options()
|
|||||||
{
|
{
|
||||||
// delete all entries from the list
|
// delete all entries from the list
|
||||||
while (m_entrylist != NULL)
|
while (m_entrylist != NULL)
|
||||||
|
{
|
||||||
|
core_options::entry *e = m_entrylist;
|
||||||
remove_entry(*m_entrylist);
|
remove_entry(*m_entrylist);
|
||||||
|
delete e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +294,11 @@ void core_options::add_entries(const options_entry *entrylist, bool override_exi
|
|||||||
{
|
{
|
||||||
// if we're overriding existing entries, then remove the old one
|
// if we're overriding existing entries, then remove the old one
|
||||||
if (override_existing)
|
if (override_existing)
|
||||||
|
{
|
||||||
|
core_options::entry *e = m_entrylist;
|
||||||
remove_entry(*existing);
|
remove_entry(*existing);
|
||||||
|
delete e;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise, just override the default and current values and throw out the new entry
|
// otherwise, just override the default and current values and throw out the new entry
|
||||||
else
|
else
|
||||||
@ -608,7 +616,11 @@ void core_options::reset()
|
|||||||
{
|
{
|
||||||
// remove all entries from the list
|
// remove all entries from the list
|
||||||
while (m_entrylist != NULL)
|
while (m_entrylist != NULL)
|
||||||
|
{
|
||||||
|
core_options::entry *e = m_entrylist;
|
||||||
remove_entry(*m_entrylist);
|
remove_entry(*m_entrylist);
|
||||||
|
delete e;
|
||||||
|
}
|
||||||
|
|
||||||
// reset the map
|
// reset the map
|
||||||
m_entrymap.reset();
|
m_entrymap.reset();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//============================================================
|
//============================================================
|
||||||
//
|
//
|
||||||
// watchdog.h - watchdog handling
|
// watchdog.c - watchdog handling
|
||||||
//
|
//
|
||||||
// Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team.
|
// Copyright (c) 1996-2011, Nicola Salmoria and the MAME Team.
|
||||||
// Visit http://mamedev.org for licensing and usage restrictions.
|
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
@ -99,6 +99,7 @@ static const translation_info gcc_translate[] =
|
|||||||
{ VS2005, "-fno-strict-aliasing", "" }, // deprecated in VS2005
|
{ VS2005, "-fno-strict-aliasing", "" }, // deprecated in VS2005
|
||||||
{ 0, "-fno-strict-aliasing", "/Oa" },
|
{ 0, "-fno-strict-aliasing", "/Oa" },
|
||||||
{ 0, "-fno-omit-frame-pointer", "" },
|
{ 0, "-fno-omit-frame-pointer", "" },
|
||||||
|
{ 0, "-fomit-frame-pointer", "" },
|
||||||
{ 0, "-Werror", "/WX" },
|
{ 0, "-Werror", "/WX" },
|
||||||
{ VS7, "-Wall", "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
|
{ VS7, "-Wall", "/Wall /W3 /wd4003 /wd4018 /wd4146 /wd4242 /wd4244 /wd4619 /wd4702 /wd4706 /wd4710 /wd4711 /wd4738 /wd4826" },
|
||||||
{ 0, "-Wall", "/W0" },
|
{ 0, "-Wall", "/W0" },
|
||||||
|
@ -642,8 +642,10 @@ void windows_osd_interface::init(running_machine &machine)
|
|||||||
astring tempstring;
|
astring tempstring;
|
||||||
for (win_window_info *info = win_window_list; info != NULL; info = info->next)
|
for (win_window_info *info = win_window_list; info != NULL; info = info->next)
|
||||||
{
|
{
|
||||||
tempstring.printf("Orientation(%s)", utf8_from_tstring(info->monitor->info.szDevice));
|
char *tmp = utf8_from_tstring(info->monitor->info.szDevice);
|
||||||
|
tempstring.printf("Orientation(%s)", tmp);
|
||||||
output_set_value(tempstring, info->targetorient);
|
output_set_value(tempstring, info->targetorient);
|
||||||
|
osd_free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook up the debugger log
|
// hook up the debugger log
|
||||||
|
@ -279,6 +279,14 @@ INLINE void scalable_lock_release(scalable_lock *lock, INT32 myslot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
INLINE void scalable_lock_delete(scalable_lock *lock)
|
||||||
|
{
|
||||||
|
#if USE_SCALABLE_LOCKS
|
||||||
|
#else
|
||||||
|
DeleteCriticalSection(&lock->section);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
// osd_work_queue_alloc
|
// osd_work_queue_alloc
|
||||||
@ -486,6 +494,8 @@ void osd_work_queue_free(osd_work_queue *queue)
|
|||||||
// free the list
|
// free the list
|
||||||
if (queue->thread != NULL)
|
if (queue->thread != NULL)
|
||||||
free(queue->thread);
|
free(queue->thread);
|
||||||
|
|
||||||
|
scalable_lock_delete(&queue->lock);
|
||||||
|
|
||||||
// free all the events
|
// free all the events
|
||||||
if (queue->doneevent != NULL)
|
if (queue->doneevent != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user