Mercurial > hg > openttd
changeset 3133:914e441eecb9 draft
(svn r3748) Remove bubblesort(), it's unused
author | tron <tron@openttd.org> |
---|---|
date | Fri, 03 Mar 2006 20:43:54 +0000 |
parents | 0eefe2c282dc |
children | da171a5e370b |
files | functions.h misc.c |
diffstat | 2 files changed, 0 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/functions.h +++ b/functions.h @@ -263,6 +263,5 @@ void DeterminePaths(void); -void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); void CSleep(int milliseconds); #endif /* FUNCTIONS_H */
--- a/misc.c +++ b/misc.c @@ -609,35 +609,6 @@ return i; } -//!We're writing an own sort algorithm here, as -//!qsort isn't stable -//!Since the number of elements will be low, a -//!simple bubble sort will have to do :) - -void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) -{ - uint i,k; - void *buffer = malloc(size); - char *start = base; - - nmemb--; - - for (i = 0; i < nmemb; i++) { - for (k = 0; k < nmemb; k++) { - void *a, *b; - a = start + size * k; - b = start + size * (k + 1); - if (compar(a, b) > 0) { - memcpy(buffer, a, size); - memcpy(a, b, size); - memcpy(b, buffer, size); - } - } - } - - free(buffer); - buffer = NULL; -} static void Save_NAME(void) {