Mercurial > sdl-ios-xcode
comparison src/loadso/macosx/SDL_loadso.c @ 1338:604d73db6802
Removed uses of stdlib.h and string.h
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 09:29:18 +0000 |
parents | 3692456e7b0f |
children | c71e05b4dc2e |
comparison
equal
deleted
inserted
replaced
1337:c687f06c7473 | 1338:604d73db6802 |
---|---|
60 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 60 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
61 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 61 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
62 */ | 62 */ |
63 | 63 |
64 #include <pthread.h> | 64 #include <pthread.h> |
65 #include <stdio.h> | |
66 #include <stdlib.h> | |
67 #include <string.h> | |
68 #include <sys/types.h> | 65 #include <sys/types.h> |
69 #include <sys/stat.h> | 66 #include <sys/stat.h> |
70 #include <stdarg.h> | 67 #include <stdarg.h> |
71 #include <limits.h> | 68 #include <limits.h> |
72 #include <mach-o/dyld.h> | 69 #include <mach-o/dyld.h> |
73 #include <mach-o/nlist.h> | 70 #include <mach-o/nlist.h> |
74 #include <mach-o/getsect.h> | 71 #include <mach-o/getsect.h> |
72 | |
73 #include "SDL_stdlib.h" | |
74 #include "SDL_string.h" | |
75 | 75 |
76 /* Just playing to see if it would compile with the freebsd headers, it does, | 76 /* Just playing to see if it would compile with the freebsd headers, it does, |
77 * but because of the different values for RTLD_LOCAL etc, it would break binary | 77 * but because of the different values for RTLD_LOCAL etc, it would break binary |
78 * compat... oh well | 78 * compat... oh well |
79 */ | 79 */ |
388 { | 388 { |
389 return (const char*)path; | 389 return (const char*)path; |
390 } | 390 } |
391 if (!path) | 391 if (!path) |
392 { | 392 { |
393 path = (char **)calloc(MAX_SEARCH_PATHS, sizeof(char **)); | 393 path = (char **)SDL_calloc(MAX_SEARCH_PATHS, sizeof(char **)); |
394 } | 394 } |
395 if (!list && !end) | 395 if (!list && !end) |
396 list = searchList(); | 396 list = searchList(); |
397 if (i >= (numsize)) | 397 if (i >= (numsize)) |
398 { | 398 { |
399 debug("Increasing size for long PATH"); | 399 debug("Increasing size for long PATH"); |
400 tmp = (char **)calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **)); | 400 tmp = (char **)SDL_calloc((MAX_SEARCH_PATHS + numsize), sizeof(char **)); |
401 if (tmp) | 401 if (tmp) |
402 { | 402 { |
403 SDL_memcpy(tmp, path, sizeof(char **) * numsize); | 403 SDL_memcpy(tmp, path, sizeof(char **) * numsize); |
404 SDL_free(path); | 404 SDL_free(path); |
405 path = tmp; | 405 path = tmp; |
513 dls = stqueue; | 513 dls = stqueue; |
514 while (dls && dls->module) | 514 while (dls && dls->module) |
515 dls = dls->next; | 515 dls = dls->next; |
516 if (!dls) | 516 if (!dls) |
517 #endif | 517 #endif |
518 dls = calloc(sizeof(*dls),1); | 518 dls = SDL_calloc(sizeof(*dls),1); |
519 return dls; | 519 return dls; |
520 } | 520 } |
521 | 521 |
522 static int promoteLocalToGlobal(struct dlstatus *dls) | 522 static int promoteLocalToGlobal(struct dlstatus *dls) |
523 { | 523 { |
1015 char *malloc_sym = NULL; | 1015 char *malloc_sym = NULL; |
1016 dolock(); | 1016 dolock(); |
1017 malloc_sym = SDL_malloc(sym_len + 2); | 1017 malloc_sym = SDL_malloc(sym_len + 2); |
1018 if (malloc_sym) | 1018 if (malloc_sym) |
1019 { | 1019 { |
1020 sprintf(malloc_sym, "_%s", symbol); | 1020 SDL_sprintf(malloc_sym, sym_len+2, "_%s", symbol); |
1021 value = dlsymIntern(handle, malloc_sym, 1); | 1021 value = dlsymIntern(handle, malloc_sym, 1); |
1022 SDL_free(malloc_sym); | 1022 SDL_free(malloc_sym); |
1023 } | 1023 } |
1024 else | 1024 else |
1025 { | 1025 { |
1060 void *value = NULL; | 1060 void *value = NULL; |
1061 char *malloc_sym = NULL; | 1061 char *malloc_sym = NULL; |
1062 malloc_sym = SDL_malloc(sym_len + 2); | 1062 malloc_sym = SDL_malloc(sym_len + 2); |
1063 if (malloc_sym) | 1063 if (malloc_sym) |
1064 { | 1064 { |
1065 sprintf(malloc_sym, "_%s", symbol); | 1065 SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol); |
1066 value = dlsymIntern(handle, malloc_sym, 1); | 1066 value = dlsymIntern(handle, malloc_sym, 1); |
1067 SDL_free(malloc_sym); | 1067 SDL_free(malloc_sym); |
1068 } | 1068 } |
1069 else | 1069 else |
1070 { | 1070 { |
1345 char *malloc_sym = NULL; | 1345 char *malloc_sym = NULL; |
1346 dolock(); | 1346 dolock(); |
1347 malloc_sym = SDL_malloc(sym_len + 2); | 1347 malloc_sym = SDL_malloc(sym_len + 2); |
1348 if (malloc_sym) | 1348 if (malloc_sym) |
1349 { | 1349 { |
1350 sprintf(malloc_sym, "_%s", symbol); | 1350 SDL_snprintf(malloc_sym, sym_len+2, "_%s", symbol); |
1351 rv.d = dlsymIntern(handle, malloc_sym, 1); | 1351 rv.d = dlsymIntern(handle, malloc_sym, 1); |
1352 SDL_free(malloc_sym); | 1352 SDL_free(malloc_sym); |
1353 } | 1353 } |
1354 else | 1354 else |
1355 { | 1355 { |