Mercurial > sdl-ios-xcode
comparison include/SDL_stdlib.h @ 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 | 450721ad5436 |
children | d02b552e5304 |
comparison
equal
deleted
inserted
replaced
1335:c39265384763 | 1336:3692456e7b0f |
---|---|
47 #ifdef HAVE_MALLOC_H | 47 #ifdef HAVE_MALLOC_H |
48 #include <malloc.h> | 48 #include <malloc.h> |
49 #endif | 49 #endif |
50 | 50 |
51 #include "SDL_types.h" | 51 #include "SDL_types.h" |
52 #include "SDL_stdarg.h" | |
53 #include "SDL_getenv.h" | |
54 | |
55 | 52 |
56 #include "begin_code.h" | 53 #include "begin_code.h" |
57 /* Set up for C function definitions, even when using C++ */ | 54 /* Set up for C function definitions, even when using C++ */ |
58 #ifdef __cplusplus | 55 #ifdef __cplusplus |
59 extern "C" { | 56 extern "C" { |
60 #endif | 57 #endif |
61 | 58 |
62 #ifdef HAVE_MALLOC | 59 #ifdef HAVE_MALLOC |
63 #define SDL_malloc malloc | 60 #define SDL_malloc malloc |
64 #else | 61 #else |
65 #define malloc SDL_malloc | |
66 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); | 62 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); |
67 #endif | 63 #endif |
68 | 64 |
69 #ifdef HAVE_REALLOC | 65 #ifdef HAVE_REALLOC |
70 #define SDL_realloc realloc | 66 #define SDL_realloc realloc |
71 #else | 67 #else |
72 #define realloc SDL_realloc | |
73 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); | 68 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); |
74 #endif | 69 #endif |
75 | 70 |
76 #ifdef HAVE_FREE | 71 #ifdef HAVE_FREE |
77 #define SDL_free free | 72 #define SDL_free free |
78 #else | 73 #else |
79 #define free SDL_free | |
80 extern DECLSPEC void SDLCALL SDL_free(void *mem); | 74 extern DECLSPEC void SDLCALL SDL_free(void *mem); |
81 #endif | 75 #endif |
82 | 76 |
83 #ifdef HAVE_ALLOCA | 77 #ifdef HAVE_ALLOCA |
84 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) | 78 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) |
85 #define SDL_stack_free(data) | 79 #define SDL_stack_free(data) |
86 #else | 80 #else |
87 #define SDL_stack_alloc(type, count) SDL_malloc(sizeof(type)*count) | 81 #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count) |
88 #define SDL_stack_free(data) SDL_free(data) | 82 #define SDL_stack_free(data) SDL_free(data) |
83 #endif | |
84 | |
85 #ifdef HAVE_GETENV | |
86 #define SDL_getenv getenv | |
87 #else | |
88 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); | |
89 #endif | |
90 | |
91 #ifdef HAVE_PUTENV | |
92 #define SDL_putenv putenv | |
93 #else | |
94 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); | |
89 #endif | 95 #endif |
90 | 96 |
91 #ifdef HAVE_QSORT | 97 #ifdef HAVE_QSORT |
92 #define SDL_qsort qsort | 98 #define SDL_qsort qsort |
93 #else | 99 #else |
94 #define qsort SDL_qsort | |
95 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, | 100 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, |
96 int (*compare)(const void *, const void *)); | 101 int (*compare)(const void *, const void *)); |
97 #endif | 102 #endif |
98 | 103 |
99 /* Ends C function definitions when using C++ */ | 104 /* Ends C function definitions when using C++ */ |