void state_destory(void *st) { state_t *s = (state_t*)st; if (s) { darray_destory(s->in); darray_destory(s->out); } free(s); }
int main(int argc, char** argv) { CU_pSuite pSuite; CU_initialize_registry(); pSuite = CU_add_suite("TestHello", TestInit, TestClean); CU_add_test(pSuite, "testAssertTrue", testAssertTrue); CU_console_run_tests(); CU_cleanup_registry(); DArray* darray = (DArray*) malloc( sizeof( DArray )); memset( darray, 0x00 ,sizeof(DArray)); char* name = (char*) malloc( sizeof(char)*100); sprintf( name, "kakasi"); darray_append( darray, sizeof(char)*strlen(name), name); darray_for_each( darray, print_content_char, NULL ); darray_destory( darray ); return 0; }