(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

View File

@ -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 */

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