void BTU_ShutDown(void) { #if BTU_DYNAMIC_MEMORY FREE_AND_RESET(btu_cb_ptr); #endif btu_task_shut_down(); hash_map_free(btu_general_alarm_hash_map); osi_mutex_free(&btu_general_alarm_lock); hash_map_free(btu_oneshot_alarm_hash_map); osi_mutex_free(&btu_oneshot_alarm_lock); hash_map_free(btu_l2cap_alarm_hash_map); osi_mutex_free(&btu_l2cap_alarm_lock); vTaskDelete(xBtuTaskHandle); vQueueDelete(xBtuQueue); btu_general_alarm_hash_map = NULL; btu_oneshot_alarm_hash_map = NULL; btu_l2cap_alarm_hash_map = NULL; xBtuTaskHandle = NULL; xBtuQueue = 0; }
void module_management_stop(void) { if (!metadata) return; hash_map_free(metadata); metadata = NULL; pthread_mutex_destroy(&metadata_lock); }
static future_t *clean_up(void) { initialized = false; hash_map_free(peers_by_address); peers_by_address = NULL; pthread_mutex_destroy(&bag_of_peers_lock); return NULL; }
void data_dispatcher_free(data_dispatcher_t *dispatcher) { if (!dispatcher) return; hash_map_free(dispatcher->dispatch_table); if (dispatcher->name) osi_free(dispatcher->name); osi_free(dispatcher); }
char *test_create_hash() { spec_describe("Create"); HashMap *hash_map = HashMap_create(100); assert_ints_equal(hash_map_capacity(hash_map), 100, "capacity"); assert_ints_equal(hash_map_length(hash_map), 0, "length"); assert_ints_equal(array_capacity(hash_map_values(hash_map)), 100, "values capacity"); assert_ints_equal(array_length(hash_map_values(hash_map)), 0, "values length"); hash_map_free(hash_map); return NULL; }
char *test_get_value_from_empty() { spec_describe("Getting values from empty hash_map"); HashMap *hash_map = HashMap_create(10); String *key = String_create("key"); assert_equal(hash_map_get(hash_map, key), NULL, "return NULL"); string_free(key); hash_map_free(hash_map); return NULL; }
void BTU_ShutDown(void) { btu_task_shut_down(); fixed_queue_free(btu_bta_msg_queue, NULL); hash_map_free(btu_general_alarm_hash_map); pthread_mutex_destroy(&btu_general_alarm_lock); fixed_queue_free(btu_general_alarm_queue, NULL); hash_map_free(btu_oneshot_alarm_hash_map); pthread_mutex_destroy(&btu_oneshot_alarm_lock); fixed_queue_free(btu_oneshot_alarm_queue, NULL); hash_map_free(btu_l2cap_alarm_hash_map); pthread_mutex_destroy(&btu_l2cap_alarm_lock); fixed_queue_free(btu_l2cap_alarm_queue, NULL); //thread_free(bt_workqueue_thread); vTaskDelete(xBtuTaskHandle); vQueueDelete(xBtuQueue); btu_bta_msg_queue = NULL; btu_general_alarm_hash_map = NULL; btu_general_alarm_queue = NULL; btu_oneshot_alarm_hash_map = NULL; btu_oneshot_alarm_queue = NULL; btu_l2cap_alarm_hash_map = NULL; btu_l2cap_alarm_queue = NULL; // bt_workqueue_thread = NULL; xBtuTaskHandle = NULL; xBtuQueue = 0; }
char *test_set_value() { spec_describe("Setting and getting value"); HashMap *hash_map = HashMap_create(10); String *key = String_create("key"); String *value = String_create("value"); hash_map_set(hash_map, key, value); assert_equal(hash_map_get(hash_map, key), value, "value same"); string_free(key); string_free(value); hash_map_free(hash_map); return NULL; }
char *test_reset_value() { spec_describe("Setting and getting value"); HashMap *hash_map = HashMap_create(10); String *key = String_create("key"); String *value_1 = String_create("value"); String *value_2 = String_create("another value"); hash_map_set(hash_map, key, value_1); hash_map_set(hash_map, key, value_2); assert_equal(hash_map_get(hash_map, key), value_2, "value same"); int index = hash_map_index_for_key(hash_map, key); assert_ints_equal(list_length((List *)hash_map_list_at_index(hash_map, index)), 1, "no duplicates for key in list"); string_free(key); string_free(value_1); string_free(value_2); hash_map_free(hash_map); return NULL; }
void dict_free(dict* d) { if (d) { if (d->dict) { #ifdef TSTC tstc_call(d->dict, 0, dict_entry_free, 0); tstc_free(d->dict); #elif defined (HASHMAP) extern void pdf_obj_delete(void *); hash_map_entry *e; hash_map_iterator *i = hash_map_front(d->dict); while (!hash_map_iterator_at_end(i)) { e = hash_map_iterator_get(i); pdf_obj_delete(e->v); pdf_free(e->v); hash_map_iterator_next(i); } hash_map_iterator_free(i); hash_map_free(d->dict); #else tst_print_reset(1); tst_traverse(d->dict, dict_free_val, NULL); tst_cleanup(d->dict); tst_print_reset(-1); #endif } if (d->stream) { pdf_free(d->stream); } pdf_free(d); } return; }
static void cleanup() { if (partial_packets) { hash_map_free(partial_packets); } }
void tearDown() { hash_map_free(map); TEST_ASSERT_EQUAL_INT(__malloc_counter, 0); }