Skip to content

Commit

Permalink
Some things were renamed from Alloc/Free to Create/Destroy.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Dec 31, 2022
1 parent 0d09049 commit b7ca736
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/sdl2_compat.c
Expand Up @@ -1766,15 +1766,15 @@ static Sint64 SDLCALL RWops2to3_write(struct SDL_RWops *rwops3, const void *ptr,
static int SDLCALL RWops2to3_close(struct SDL_RWops *rwops3)
{
const int retval = SDL_RWclose((SDL2_RWops *) rwops3->hidden.unknown.data1);
SDL3_FreeRW(rwops3); /* !!! FIXME: _should_ we free this if SDL_RWclose failed? */
SDL3_DestroyRW(rwops3); /* !!! FIXME: _should_ we free this if SDL_RWclose failed? */
return retval;
}

static SDL_RWops *RWops2to3(SDL2_RWops *rwops2)
{
SDL_RWops *rwops3 = NULL;
if (rwops2) {
rwops3 = SDL3_AllocRW();
rwops3 = SDL3_CreateRW();
if (!rwops3) {
SDL_RWclose(rwops2);
return NULL;
Expand All @@ -1801,7 +1801,7 @@ SDL_LoadFile_RW(SDL2_RWops *rwops2, size_t *datasize, int freesrc)
if (rwops3) {
retval = SDL3_LoadFile_RW(rwops3, datasize, freesrc);
if (!freesrc) {
SDL3_FreeRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
SDL3_DestroyRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
}
} else {
if (freesrc) {
Expand All @@ -1819,7 +1819,7 @@ SDL_LoadWAV_RW(SDL2_RWops *rwops2, int freesrc, SDL_AudioSpec *spec, Uint8 **aud
if (rwops3) {
retval = SDL3_LoadWAV_RW(rwops3, freesrc, spec, audio_buf, audio_len);
if (!freesrc) {
SDL3_FreeRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
SDL3_DestroyRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
}
} else {
if (freesrc) {
Expand All @@ -1837,7 +1837,7 @@ SDL_LoadBMP_RW(SDL2_RWops *rwops2, int freesrc)
if (rwops3) {
retval = SDL3_LoadBMP_RW(rwops3, freesrc);
if (!freesrc) {
SDL3_FreeRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
SDL3_DestroyRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
}
} else {
if (freesrc) {
Expand All @@ -1855,7 +1855,7 @@ SDL_SaveBMP_RW(SDL_Surface *surface, SDL2_RWops *rwops2, int freedst)
if (rwops3) {
retval = SDL3_SaveBMP_RW(surface, rwops3, freedst);
if (!freedst) {
SDL3_FreeRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
SDL3_DestroyRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
}
} else {
if (freedst) {
Expand All @@ -1873,7 +1873,7 @@ SDL_GameControllerAddMappingsFromRW(SDL2_RWops *rwops2, int freerw)
if (rwops3) {
retval = SDL3_AddGamepadMappingsFromRW(rwops3, freerw);
if (!freerw) {
SDL3_FreeRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
SDL3_DestroyRW(rwops3); /* don't close it because that'll close the SDL2_RWops. */
}
} else {
if (freerw) {
Expand Down
6 changes: 3 additions & 3 deletions src/sdl3_syms.h
Expand Up @@ -261,7 +261,7 @@ SDL3_SYM_PASSTHROUGH(SDL_Cursor*,CreateSystemCursor,(SDL_SystemCursor a),(a),ret
SDL3_SYM_PASSTHROUGH(void,SetCursor,(SDL_Cursor *a),(a),)
SDL3_SYM_PASSTHROUGH(SDL_Cursor*,GetCursor,(void),(),return)
SDL3_SYM_PASSTHROUGH(SDL_Cursor*,GetDefaultCursor,(void),(),return)
SDL3_SYM_PASSTHROUGH(void,FreeCursor,(SDL_Cursor *a),(a),)
SDL3_SYM_RENAMED(void,FreeCursor,DestroyCursor,(SDL_Cursor *a),(a),)
SDL3_SYM_PASSTHROUGH(SDL_mutex*,CreateMutex,(void),(),return)
SDL3_SYM_PASSTHROUGH(int,LockMutex,(SDL_mutex *a),(a),return)
SDL3_SYM_PASSTHROUGH(int,TryLockMutex,(SDL_mutex *a),(a),return)
Expand Down Expand Up @@ -356,8 +356,8 @@ SDL3_SYM_PASSTHROUGH(int,GL_UnbindTexture,(SDL_Texture *a),(a),return)
SDL3_SYM(SDL_RWops*,RWFromFile,(const char *a, const char *b),(a,b),return)
SDL3_SYM(SDL_RWops*,RWFromMem,(void *a, int b),(a,b),return)
SDL3_SYM(SDL_RWops*,RWFromConstMem,(const void *a, int b),(a,b),return)
SDL3_SYM(SDL_RWops*,AllocRW,(void),(),return)
SDL3_SYM(void,FreeRW,(SDL_RWops *a),(a),)
SDL3_SYM(SDL_RWops*,CreateRW,(void),(),return)
SDL3_SYM(void,DestroyRW,(SDL_RWops *a),(a),)
SDL3_SYM(Uint8,ReadU8,(SDL_RWops *a),(a),return)
SDL3_SYM(Uint16,ReadLE16,(SDL_RWops *a),(a),return)
SDL3_SYM(Uint16,ReadBE16,(SDL_RWops *a),(a),return)
Expand Down

0 comments on commit b7ca736

Please sign in to comment.