mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Use SDL stdlib funcs for free/malloc/strcmp
It's always good to have less of a dependency on a libc.
This commit is contained in:
parent
cf8442b12c
commit
e481c75404
1 changed files with 5 additions and 5 deletions
|
@ -27,7 +27,7 @@ void binaryBlob::AddFileToBinaryBlob(const char* _path)
|
||||||
size = ftell(file);
|
size = ftell(file);
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
|
||||||
memblock = (char*) malloc(size);
|
memblock = (char*) SDL_malloc(size);
|
||||||
fread(memblock, 1, size, file);
|
fread(memblock, 1, size, file);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -110,7 +110,7 @@ bool binaryBlob::unPackBinary(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
PHYSFS_seek(handle, offset);
|
PHYSFS_seek(handle, offset);
|
||||||
m_memblocks[i] = (char*) malloc(m_headers[i].size);
|
m_memblocks[i] = (char*) SDL_malloc(m_headers[i].size);
|
||||||
if (m_memblocks[i] == NULL)
|
if (m_memblocks[i] == NULL)
|
||||||
{
|
{
|
||||||
exit(1); /* Oh god we're out of memory, just bail */
|
exit(1); /* Oh god we're out of memory, just bail */
|
||||||
|
@ -141,7 +141,7 @@ void binaryBlob::clear()
|
||||||
{
|
{
|
||||||
if (m_headers[i].valid)
|
if (m_headers[i].valid)
|
||||||
{
|
{
|
||||||
free(m_memblocks[i]);
|
SDL_free(m_memblocks[i]);
|
||||||
m_headers[i].valid = false;
|
m_headers[i].valid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ int binaryBlob::getIndex(const char* _name)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
|
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
|
||||||
{
|
{
|
||||||
if (strcmp(_name, m_headers[i].name) == 0 && m_headers[i].valid)
|
if (SDL_strcmp(_name, m_headers[i].name) == 0 && m_headers[i].valid)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ std::vector<int> binaryBlob::getExtra()
|
||||||
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
|
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
|
||||||
{
|
{
|
||||||
if (m_headers[i].valid
|
if (m_headers[i].valid
|
||||||
#define FOREACH_TRACK(track_name) && strcmp(m_headers[i].name, track_name) != 0
|
#define FOREACH_TRACK(track_name) && SDL_strcmp(m_headers[i].name, track_name) != 0
|
||||||
TRACK_NAMES
|
TRACK_NAMES
|
||||||
#undef FOREACH_TRACK
|
#undef FOREACH_TRACK
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue