diff options
author | tron <tron@openttd.org> | 2006-03-03 20:43:54 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-03 20:43:54 +0000 |
commit | 9261a179c9e24f4f81addf1bc20774cd17c1e9cb (patch) | |
tree | a3cbed4089976b97f4ba0cc588f977e9ef247ebc | |
parent | d85178166324d5d5183ee0f3c1d295a85534d708 (diff) | |
download | openttd-9261a179c9e24f4f81addf1bc20774cd17c1e9cb.tar.xz |
(svn r3748) Remove bubblesort(), it's unused
-rw-r--r-- | functions.h | 1 | ||||
-rw-r--r-- | misc.c | 29 |
2 files changed, 0 insertions, 30 deletions
diff --git a/functions.h b/functions.h index a1895cd6e..58304bf6b 100644 --- a/functions.h +++ b/functions.h @@ -263,6 +263,5 @@ int ttd_main(int argc, char* argv[]); 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 */ @@ -609,35 +609,6 @@ int FindFirstBit(uint32 value) 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) { |