comparison src/joystick/dc/SDL_sysjoystick.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
88 It returns 0, or -1 if there is an error. 88 It returns 0, or -1 if there is an error.
89 */ 89 */
90 int SDL_SYS_JoystickOpen(SDL_Joystick *joystick) 90 int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
91 { 91 {
92 /* allocate memory for system specific hardware data */ 92 /* allocate memory for system specific hardware data */
93 joystick->hwdata = (struct joystick_hwdata *) malloc(sizeof(*joystick->hwdata)); 93 joystick->hwdata = (struct joystick_hwdata *) SDL_malloc(sizeof(*joystick->hwdata));
94 if (joystick->hwdata == NULL) 94 if (joystick->hwdata == NULL)
95 { 95 {
96 SDL_OutOfMemory(); 96 SDL_OutOfMemory();
97 return(-1); 97 return(-1);
98 } 98 }
99 memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); 99 SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
100 100
101 /* fill nbuttons, naxes, and nhats fields */ 101 /* fill nbuttons, naxes, and nhats fields */
102 joystick->nbuttons = MAX_BUTTONS; 102 joystick->nbuttons = MAX_BUTTONS;
103 joystick->naxes = MAX_AXES; 103 joystick->naxes = MAX_AXES;
104 joystick->nhats = MAX_HATS; 104 joystick->nhats = MAX_HATS;
180 /* Function to close a joystick after use */ 180 /* Function to close a joystick after use */
181 void SDL_SYS_JoystickClose(SDL_Joystick *joystick) 181 void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
182 { 182 {
183 if (joystick->hwdata != NULL) { 183 if (joystick->hwdata != NULL) {
184 /* free system specific hardware data */ 184 /* free system specific hardware data */
185 free(joystick->hwdata); 185 SDL_free(joystick->hwdata);
186 } 186 }
187 } 187 }
188 188
189 /* Function to perform any system-specific joystick related cleanup */ 189 /* Function to perform any system-specific joystick related cleanup */
190 void SDL_SYS_JoystickQuit(void) 190 void SDL_SYS_JoystickQuit(void)