#include "gwlib/gwlib.h"Include dependency graph for test_list.c:

Go to the source code of this file.
Defines | |
| #define | HUGE_SIZE 20 |
Functions | |
| int | my_sort_cmp (const void *a, const void *b) |
| int | main (void) |
|
|
Definition at line 66 of file test_list.c. |
|
|
Definition at line 78 of file test_list.c. References debug(), gwlib_init(), gwlib_shutdown(), gwlist_append(), gwlist_create, gwlist_destroy(), gwlist_get(), gwlist_len(), gwlist_sort(), HUGE_SIZE, my_sort_cmp(), octstr_create, octstr_destroy_item(), octstr_get_cstr, uuid_clear(), uuid_generate(), UUID_STR_LEN, uuid_t, and uuid_unparse(). 00079 {
00080 List *list;
00081 char id[UUID_STR_LEN + 1];
00082 int i;
00083
00084 gwlib_init();
00085
00086 debug("",0,"List performance test.");
00087 list = gwlist_create();
00088
00089 /* generate UUIDs and populate the list */
00090 debug("", 0, "Creating %d UUIDs for the list.", HUGE_SIZE);
00091 for (i = 0; i < HUGE_SIZE; i++) {
00092 Octstr *os;
00093 uuid_t uid;
00094 uuid_generate(uid);
00095 uuid_unparse(uid, id);
00096 os = octstr_create(id);
00097 gwlist_append(list, os);
00098 uuid_clear(uid);
00099 }
00100 debug("",0,"Objects in the list: %ld", gwlist_len(list));
00101
00102 /* try to sort */
00103 debug("",0,"Sorting.");
00104 gwlist_sort(list, my_sort_cmp);
00105 debug("",0,"Sorting done.");
00106 for (i = 0; i < HUGE_SIZE; i++) {
00107 Octstr *os = gwlist_get(list, i);
00108 debug("",0,"After sort: %s %d", octstr_get_cstr(os), i);
00109 }
00110
00111 gwlist_destroy(list, octstr_destroy_item);
00112
00113 gwlib_shutdown();
00114 return 0;
00115 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 69 of file test_list.c. References octstr_compare(). Referenced by main(). 00070 {
00071 Octstr *fa = *((Octstr**) a);
00072 Octstr *fb = *((Octstr**) b);
00073
00074 return octstr_compare(fa, fb);
00075 }
|
Here is the call graph for this function:
