Mercurial > sdl-ios-xcode
diff src/stdlib/SDL_qsort.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 | 1cbaeee565b1 |
children | c687f06c7473 |
line wrap: on
line diff
--- a/src/stdlib/SDL_qsort.c Mon Feb 06 17:28:04 2006 +0000 +++ b/src/stdlib/SDL_qsort.c Tue Feb 07 06:59:48 2006 +0000 @@ -233,9 +233,9 @@ /* Shift everything in [test,first) \ * up by one, and place |first| \ * where |test| is. */ \ - memcpy(pivot,first,size); \ - memmove(test+size,test,first-test); \ - memcpy(test,pivot,size); \ + SDL_memcpy(pivot,first,size); \ + SDL_memmove(test+size,test,first-test); \ + SDL_memcpy(test,pivot,size); \ } \ } @@ -298,7 +298,7 @@ stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; - char *pivot=malloc(size); + char *pivot=SDL_malloc(size); size_t trunc=TRUNC_nonaligned*size; assert(pivot!=0); @@ -310,7 +310,7 @@ /* Select pivot */ { char * mid=first+size*((last-first)/size >> 1); Pivot(SWAP_nonaligned,size); - memcpy(pivot,mid,size); + SDL_memcpy(pivot,mid,size); } /* Partition. */ Partition(SWAP_nonaligned,size); @@ -320,7 +320,7 @@ } PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size); Insertion(SWAP_nonaligned); - free(pivot); + SDL_free(pivot); } static void qsort_aligned(void *base, size_t nmemb, size_t size, @@ -329,7 +329,7 @@ stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; - char *pivot=malloc(size); + char *pivot=SDL_malloc(size); size_t trunc=TRUNC_aligned*size; assert(pivot!=0); @@ -341,7 +341,7 @@ /* Select pivot */ { char * mid=first+size*((last-first)/size >> 1); Pivot(SWAP_aligned,size); - memcpy(pivot,mid,size); + SDL_memcpy(pivot,mid,size); } /* Partition. */ Partition(SWAP_aligned,size); @@ -351,7 +351,7 @@ } PreInsertion(SWAP_aligned,TRUNC_aligned,size); Insertion(SWAP_aligned); - free(pivot); + SDL_free(pivot); } static void qsort_words(void *base, size_t nmemb, @@ -360,7 +360,7 @@ stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; - char *pivot=malloc(WORD_BYTES); + char *pivot=SDL_malloc(WORD_BYTES); assert(pivot!=0); first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; @@ -398,7 +398,7 @@ *pr=*pl; } if (pr!=(int*)first) *pr=*(int*)pivot; } - free(pivot); + SDL_free(pivot); } /* ---------------------------------------------------------------------- */