int main(void) { struct AATree aatree; struct CBTree *cbtree; struct md5_ctx md5; struct Heap *heap; char buf[128]; static_assert(sizeof(int) >= 4, "unsupported int size"); heap = heap_create(heap_is_better, NULL, NULL); heap_top(heap); aatree_init(&aatree, NULL, NULL); cbtree = cbtree_create(NULL, NULL, NULL, NULL); cbtree_destroy(cbtree); daemonize(NULL, false); hash_lookup3("foo", 3); if (!event_init()) log_debug("test"); if (!parse_ini_file("foo", NULL, NULL)) log_debug("test"); log_stats("1"); file_size("foo"); md5_reset(&md5); strlcpy(buf, "foo", sizeof(buf)); printf("xmalloc: %p\n", xmalloc(128)); if (0) die("0"); csrandom(); tls_init(); return 0; }
struct MDict *mdict_new(CxMem *cx) { struct MDict *dict; dict = cx_alloc(cx, sizeof(struct MDict)); if (!dict) return NULL; dict->cx = cx; dict->tree = cbtree_create(mdict_getkey, mdict_free_obj, dict, cx); if (!dict->tree) { cx_free(cx, dict); return NULL; } return dict; }
int main(void) { struct AATree aatree; struct CBTree *cbtree; struct md5_ctx md5; char buf[128]; aatree_init(&aatree, NULL, NULL); cbtree = cbtree_create(NULL, NULL, NULL, USUAL_ALLOC); daemonize(NULL, NULL); hash_lookup3("foo", 3); if (!event_init()) log_debug("test"); if (!parse_ini_file("foo", NULL, NULL)) log_debug("test"); log_stats("1"); file_size("foo"); md5_reset(&md5); strlcpy(buf, "foo", sizeof(buf)); printf("xmalloc: %p\n", xmalloc(128)); if (0) die("0"); return 0; }
/* create main structure */ struct StrPool *strpool_create(CxMem *ca) { struct StrPool *sp; int err = 0; sp = cx_alloc(ca, sizeof(*sp)); if (!sp) return NULL; sp->count = 0; sp->ca = ca; err = pthread_mutex_init(&sp->mutex, NULL); if (err < 0) { cx_free(ca, sp); return NULL; } sp->tree = cbtree_create(get_key, NULL, NULL, ca); if (!sp->tree) { cx_free(ca, sp); return NULL; } return sp; }