src/stdlib/SDL_qsort.c
changeset 1336 3692456e7b0f
parent 1331 1cbaeee565b1
child 1337 c687f06c7473
     1.1 --- a/src/stdlib/SDL_qsort.c	Mon Feb 06 17:28:04 2006 +0000
     1.2 +++ b/src/stdlib/SDL_qsort.c	Tue Feb 07 06:59:48 2006 +0000
     1.3 @@ -233,9 +233,9 @@
     1.4        /* Shift everything in [test,first)	\
     1.5         * up by one, and place |first|		\
     1.6         * where |test| is. */			\
     1.7 -      memcpy(pivot,first,size);			\
     1.8 -      memmove(test+size,test,first-test);	\
     1.9 -      memcpy(test,pivot,size);			\
    1.10 +      SDL_memcpy(pivot,first,size);			\
    1.11 +      SDL_memmove(test+size,test,first-test);	\
    1.12 +      SDL_memcpy(test,pivot,size);			\
    1.13      }						\
    1.14    }
    1.15  
    1.16 @@ -298,7 +298,7 @@
    1.17    stack_entry stack[STACK_SIZE];
    1.18    int stacktop=0;
    1.19    char *first,*last;
    1.20 -  char *pivot=malloc(size);
    1.21 +  char *pivot=SDL_malloc(size);
    1.22    size_t trunc=TRUNC_nonaligned*size;
    1.23    assert(pivot!=0);
    1.24  
    1.25 @@ -310,7 +310,7 @@
    1.26        /* Select pivot */
    1.27        { char * mid=first+size*((last-first)/size >> 1);
    1.28          Pivot(SWAP_nonaligned,size);
    1.29 -        memcpy(pivot,mid,size);
    1.30 +        SDL_memcpy(pivot,mid,size);
    1.31        }
    1.32        /* Partition. */
    1.33        Partition(SWAP_nonaligned,size);
    1.34 @@ -320,7 +320,7 @@
    1.35    }
    1.36    PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size);
    1.37    Insertion(SWAP_nonaligned);
    1.38 -  free(pivot);
    1.39 +  SDL_free(pivot);
    1.40  }
    1.41  
    1.42  static void qsort_aligned(void *base, size_t nmemb, size_t size,
    1.43 @@ -329,7 +329,7 @@
    1.44    stack_entry stack[STACK_SIZE];
    1.45    int stacktop=0;
    1.46    char *first,*last;
    1.47 -  char *pivot=malloc(size);
    1.48 +  char *pivot=SDL_malloc(size);
    1.49    size_t trunc=TRUNC_aligned*size;
    1.50    assert(pivot!=0);
    1.51  
    1.52 @@ -341,7 +341,7 @@
    1.53        /* Select pivot */
    1.54        { char * mid=first+size*((last-first)/size >> 1);
    1.55          Pivot(SWAP_aligned,size);
    1.56 -        memcpy(pivot,mid,size);
    1.57 +        SDL_memcpy(pivot,mid,size);
    1.58        }
    1.59        /* Partition. */
    1.60        Partition(SWAP_aligned,size);
    1.61 @@ -351,7 +351,7 @@
    1.62    }
    1.63    PreInsertion(SWAP_aligned,TRUNC_aligned,size);
    1.64    Insertion(SWAP_aligned);
    1.65 -  free(pivot);
    1.66 +  SDL_free(pivot);
    1.67  }
    1.68  
    1.69  static void qsort_words(void *base, size_t nmemb,
    1.70 @@ -360,7 +360,7 @@
    1.71    stack_entry stack[STACK_SIZE];
    1.72    int stacktop=0;
    1.73    char *first,*last;
    1.74 -  char *pivot=malloc(WORD_BYTES);
    1.75 +  char *pivot=SDL_malloc(WORD_BYTES);
    1.76    assert(pivot!=0);
    1.77  
    1.78    first=(char*)base; last=first+(nmemb-1)*WORD_BYTES;
    1.79 @@ -398,7 +398,7 @@
    1.80        *pr=*pl; }
    1.81      if (pr!=(int*)first) *pr=*(int*)pivot;
    1.82    }
    1.83 -  free(pivot);
    1.84 +  SDL_free(pivot);
    1.85  }
    1.86  
    1.87  /* ---------------------------------------------------------------------- */