mirror of
https://github.com/encounter/SDL.git
synced 2025-12-12 06:45:10 +00:00
Christoph Mallon: Remove pointless if (x) before SDL_free(x)
This commit is contained in:
@@ -437,22 +437,13 @@ SDL_JoystickClose(SDL_Joystick * joystick)
|
||||
joysticklist = joysticklist->next;
|
||||
}
|
||||
|
||||
if (joystick->name)
|
||||
SDL_free(joystick->name);
|
||||
SDL_free(joystick->name);
|
||||
|
||||
/* Free the data associated with this joystick */
|
||||
if (joystick->axes) {
|
||||
SDL_free(joystick->axes);
|
||||
}
|
||||
if (joystick->hats) {
|
||||
SDL_free(joystick->hats);
|
||||
}
|
||||
if (joystick->balls) {
|
||||
SDL_free(joystick->balls);
|
||||
}
|
||||
if (joystick->buttons) {
|
||||
SDL_free(joystick->buttons);
|
||||
}
|
||||
SDL_free(joystick->axes);
|
||||
SDL_free(joystick->hats);
|
||||
SDL_free(joystick->balls);
|
||||
SDL_free(joystick->buttons);
|
||||
SDL_free(joystick);
|
||||
}
|
||||
|
||||
|
||||
@@ -231,12 +231,8 @@ extern "C"
|
||||
if (joystick->hwdata) {
|
||||
joystick->hwdata->stick->Close();
|
||||
delete joystick->hwdata->stick;
|
||||
if (joystick->hwdata->new_hats) {
|
||||
SDL_free(joystick->hwdata->new_hats);
|
||||
}
|
||||
if (joystick->hwdata->new_axes) {
|
||||
SDL_free(joystick->hwdata->new_axes);
|
||||
}
|
||||
SDL_free(joystick->hwdata->new_hats);
|
||||
SDL_free(joystick->hwdata->new_axes);
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
}
|
||||
|
||||
@@ -577,10 +577,8 @@ SDL_SYS_JoystickQuit(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_JOYS; i++) {
|
||||
if (joynames[i] != NULL)
|
||||
SDL_free(joynames[i]);
|
||||
if (joydevnames[i] != NULL)
|
||||
SDL_free(joydevnames[i]);
|
||||
SDL_free(joynames[i]);
|
||||
SDL_free(joydevnames[i]);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -657,9 +655,7 @@ report_alloc(struct report *r, struct report_desc *rd, int repind)
|
||||
static void
|
||||
report_free(struct report *r)
|
||||
{
|
||||
if (r->buf != NULL) {
|
||||
SDL_free(r->buf);
|
||||
}
|
||||
SDL_free(r->buf);
|
||||
r->status = SREPORT_UNINIT;
|
||||
}
|
||||
|
||||
|
||||
@@ -834,7 +834,7 @@ void SDL_SYS_JoystickDetect()
|
||||
|
||||
pListNext = pCurList->pNext;
|
||||
SDL_free(pCurList->joystickname);
|
||||
SDL_free( pCurList );
|
||||
SDL_free(pCurList);
|
||||
pCurList = pListNext;
|
||||
}
|
||||
|
||||
@@ -1559,10 +1559,8 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
||||
IDirectInputDevice8_Release(joystick->hwdata->InputDevice);
|
||||
}
|
||||
|
||||
if (joystick->hwdata != NULL) {
|
||||
/* free system specific hardware data */
|
||||
SDL_free(joystick->hwdata);
|
||||
}
|
||||
/* free system specific hardware data */
|
||||
SDL_free(joystick->hwdata);
|
||||
|
||||
joystick->closed = 1;
|
||||
}
|
||||
|
||||
@@ -384,11 +384,9 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
|
||||
void
|
||||
SDL_SYS_JoystickClose(SDL_Joystick * joystick)
|
||||
{
|
||||
if (joystick->hwdata != NULL) {
|
||||
/* free system specific hardware data */
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
}
|
||||
/* free system specific hardware data */
|
||||
SDL_free(joystick->hwdata);
|
||||
joystick->hwdata = NULL;
|
||||
}
|
||||
|
||||
/* Function to perform any system-specific joystick related cleanup */
|
||||
@@ -397,10 +395,8 @@ SDL_SYS_JoystickQuit(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_JOYSTICKS; i++) {
|
||||
if (SYS_JoystickName[i] != NULL) {
|
||||
SDL_free(SYS_JoystickName[i]);
|
||||
SYS_JoystickName[i] = NULL;
|
||||
}
|
||||
SDL_free(SYS_JoystickName[i]);
|
||||
SYS_JoystickName[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user