mirror of
https://github.com/holub/mame
synced 2025-05-17 19:24:59 +03:00
free_file_line no longer complains about NULL free's not existing.
Removed unnecessary checks for NULL that were added due to the previous problem.
This commit is contained in:
parent
1db230096b
commit
a33c799e22
@ -191,6 +191,10 @@ void *malloc_array_file_line(size_t size, const char *file, int line)
|
|||||||
|
|
||||||
void free_file_line(void *memory, const char *file, int line)
|
void free_file_line(void *memory, const char *file, int line)
|
||||||
{
|
{
|
||||||
|
// ignore NULL frees/deletes
|
||||||
|
if (memory == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
// find the memory entry
|
// find the memory entry
|
||||||
memory_entry *entry = memory_entry::find(memory);
|
memory_entry *entry = memory_entry::find(memory);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
|
void append(const _ElementType &element) { if (m_count == m_allocated) expand_internal((m_allocated == 0) ? 16 : (m_allocated << 1), true); m_array[m_count++] = element; }
|
||||||
void reset() { if (m_array) delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
|
void reset() { delete[] m_array; m_array = NULL; m_count = m_allocated = 0; }
|
||||||
void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; }
|
void resize(int count, bool keepdata = false) { if (count > m_allocated) expand_internal(count, keepdata); m_count = count; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -89,7 +89,7 @@ private:
|
|||||||
if (keepdata)
|
if (keepdata)
|
||||||
for (int index = 0; index < m_count; index++)
|
for (int index = 0; index < m_count; index++)
|
||||||
newarray[index] = m_array[index];
|
newarray[index] = m_array[index];
|
||||||
if (m_array) delete[] m_array;
|
delete[] m_array;
|
||||||
m_array = newarray;
|
m_array = newarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user