Definition in file sort.c.
#include "../include/beeos.h"
#include "../include/bmalloc.h"
#include "../include/bstring.h"
Include dependency graph for sort.c:

Go to the source code of this file.
Functions | |
| void | bubblesort (char *base, ushort num, ushort size, sshort(*cmp_func)(const void *, const void *)) |
|
||||||||||||||||||||
|
Definition at line 36 of file sort.c. References bfree(), bmalloc(), bmemcpy(), NULL, and ushort.
00038 {
00056 char *ptr;
00057 char *temp = bmalloc(size, NULL);
00058 ushort i, j;
00059
00060 for (i = 0; i < num - 1; i++) {
00061 for (j = 0, ptr = base; j < num - 1 - i; j++, ptr += size) {
00062 if (0 > cmp_func(ptr, ptr + size)) {
00063 bmemcpy(temp, ptr + size, size);
00064 bmemcpy(ptr + size, ptr, size);
00065 bmemcpy(ptr, temp, size);
00066 }
00067 }
00068 }
00069 bfree(temp);
00070
00071 return;
00072 }
|
Here is the call graph for this function:

1.3.6-20040222