1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 13:39:09 +00:00

(svn r3748) Remove bubblesort(), it's unused

This commit is contained in:
tron
2006-03-03 20:43:54 +00:00
parent 40fd4377b0
commit 7579d1faa9
2 changed files with 0 additions and 30 deletions

29
misc.c
View File

@@ -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)
{