Mercurial > sdl-ios-xcode
diff src/joystick/bsd/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 |
line wrap: on
line diff
--- a/src/joystick/bsd/SDL_sysjoystick.c Mon Feb 06 17:28:04 2006 +0000 +++ b/src/joystick/bsd/SDL_sysjoystick.c Tue Feb 07 06:59:48 2006 +0000 @@ -139,8 +139,8 @@ SDL_numjoysticks = 0; - memset(joynames, 0, sizeof(joynames)); - memset(joydevnames, 0, sizeof(joydevnames)); + SDL_memset(joynames, 0, sizeof(joynames)); + SDL_memset(joydevnames, 0, sizeof(joydevnames)); for (i = 0; i < MAX_UHID_JOYS; i++) { SDL_Joystick nj; @@ -154,7 +154,7 @@ SDL_SYS_JoystickClose(&nj); SDL_numjoysticks++; } else { - free(joynames[nj.index]); + SDL_free(joynames[nj.index]); joynames[nj.index] = NULL; } } @@ -241,7 +241,7 @@ return (-1); } - hw = (struct joystick_hwdata *)malloc(sizeof(struct joystick_hwdata)); + hw = (struct joystick_hwdata *)SDL_malloc(sizeof(struct joystick_hwdata)); if (hw == NULL) { SDL_OutOfMemory(); close(fd); @@ -250,7 +250,7 @@ joy->hwdata = hw; hw->fd = fd; hw->path = strdup(path); - if (! strncmp(path, "/dev/joy", 8)) { + if (! SDL_strncmp(path, "/dev/joy", 8)) { hw->type = BSDJOY_JOY; joy->naxes = 2; joy->nbuttons = 2; @@ -311,7 +311,7 @@ case HUG_JOYSTICK: case HUG_GAME_PAD: s = hid_usage_in_page(hitem.usage); - sp = malloc(strlen(s) + 5); + sp = SDL_malloc(SDL_strlen(s) + 5); sprintf(sp, "%s (%d)", s, joy->index); joydevnames[joy->index] = sp; @@ -351,8 +351,8 @@ return (0); usberr: close(hw->fd); - free(hw->path); - free(hw); + SDL_free(hw->path); + SDL_free(hw); return (-1); } @@ -482,13 +482,13 @@ void SDL_SYS_JoystickClose(SDL_Joystick *joy) { - if (strncmp(joy->hwdata->path, "/dev/joy", 8)) { + if (SDL_strncmp(joy->hwdata->path, "/dev/joy", 8)) { report_free(&joy->hwdata->inreport); hid_dispose_report_desc(joy->hwdata->repdesc); } close(joy->hwdata->fd); - free(joy->hwdata->path); - free(joy->hwdata); + SDL_free(joy->hwdata->path); + SDL_free(joy->hwdata); return; } @@ -500,9 +500,9 @@ for (i = 0; i < MAX_JOYS; i++) { if (joynames[i] != NULL) - free(joynames[i]); + SDL_free(joynames[i]); if (joydevnames[i] != NULL) - free(joydevnames[i]); + SDL_free(joydevnames[i]); } return; @@ -538,7 +538,7 @@ r->size = len; if (r->size > 0) { - r->buf = malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) + + r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) + r->size); if (r->buf == NULL) { SDL_OutOfMemory(); @@ -556,7 +556,7 @@ report_free(struct report *r) { if (r->buf != NULL) { - free(r->buf); + SDL_free(r->buf); } r->status = SREPORT_UNINIT; }