globus_result_t globus_xio_stack_destroy( globus_xio_stack_t stack) { globus_result_t res; GlobusXIOName(globus_xio_stack_destroy); GlobusXIODebugEnter(); if(stack == NULL) { res = GlobusXIOErrorParameter("stack"); goto err; } globus_list_free(stack->driver_stack); globus_free(stack); GlobusXIODebugExit(); return GLOBUS_SUCCESS; err: GlobusXIODebugExitWithError(); return res; }
void globus_fifo_destroy ( globus_fifo_t * fifo) { struct globus_fifo_s * s_fifo; if (fifo == GLOBUS_NULL) { return; } s_fifo = *fifo; globus_list_free (s_fifo->head); s_fifo->head = GLOBUS_NULL; s_fifo->tail = GLOBUS_NULL; s_fifo->size = 0; globus_free(s_fifo); }
int globus_gram_job_manager_validation_destroy( globus_list_t * validation_records) { globus_list_t * tmp; globus_rvf_record_t * record; tmp = validation_records; while (!globus_list_empty(tmp)) { record = globus_list_first(tmp); tmp = globus_list_rest(tmp); globus_l_gram_job_manager_validation_record_free(record); } globus_list_free(validation_records); return GLOBUS_SUCCESS; }
/** @brief Globus List Test Cases*/ int list_test(void) { globus_list_t *list = GLOBUS_NULL; int rc; void *ptr; int x1 = 1; int x2 = 2; int x3 = 3; int x4 = 4; int search_item; globus_list_t *sub_list; int size; printf("1..25\n"); globus_module_activate(GLOBUS_COMMON_MODULE); /** * @test * Call globus_list_size() with an empty list */ size = globus_list_size(list); ok(size == 0, "size_of_empty_list"); /** * @test * Insert a datum into a globus_list_t with globus_list_insert() */ rc = globus_list_insert(&list, &x1); ok(rc == 0, "insert_item_into_empty_list"); /** * @test * Add a datum to a globus_list_t with globus_list_cons() */ list = globus_list_cons(&x2, list); ok(list != NULL, "globus_list_cons"); /** * @test * Verify that globus_list_size() returns 2 after adding two data * items to a list. */ size = globus_list_size(list); ok(size == 2, "size_of_list_after_insert_and_cons"); /** * @test * Insert x3 into a list with globus_list_insert() */ ok(globus_list_insert(&list, &x3) == 0, "insert_x3"); /** * @test * Insert x4 into a list with globus_list_insert() */ ok(globus_list_insert(&list, &x4) == 0, "insert_x4"); /** * @test * Verify that the size of the list is now 4 with globus_list_size() */ ok(globus_list_size(list) == 4, "check_new_size"); /** * @test * Search for the first item in a list with globus_list_search() */ sub_list = globus_list_search(list, &x1); ok(sub_list != NULL, "search_first"); /** * @test * Use globus_list_first() to return the datum from the returned list node. * Verify that the search result matches the value searched for. */ ptr = globus_list_first(sub_list); ok(*((int *)ptr) == x1, "search_first_value"); /** * @test * Search for the third item in a list with globus_list_search() */ sub_list = globus_list_search(list, &x3); ok(sub_list != NULL, "search_third"); /** * @test * Use globus_list_first() to return the datum from the returned list node. * Verify that the search result matches the value searched for. */ ptr = globus_list_first(sub_list); ok(*((int *)ptr) == x3, "search_third_value"); /** * @test * Search for the fourth item in a list with globus_list_search() */ sub_list = globus_list_search(list, &x4); ok(sub_list != NULL, "search_last"); /** * @test * Use globus_list_first() to return the datum from the returned list node. * Verify that the search result matches the value searched for. */ ptr = globus_list_first(sub_list); ok(*((int *)ptr) == x4, "search_last_value"); /** * @test * Search for the second item in a list with globus_list_search() */ sub_list = globus_list_search(list, &x2); ok(sub_list != NULL, "search_second"); /** * @test * Use globus_list_first() to return the datum from the returned list node. * Verify that the search result matches the value searched for. */ ptr = globus_list_first(sub_list); ok(*((int *)ptr) == x2, "search_second_value"); /** * @test * Search for the fourth item in a list with globus_list_search_pred() */ search_item = 4; sub_list = globus_list_search_pred(list, matches, &search_item); ok(sub_list != NULL, "search_pred_4"); /** * @test * Search for the second item in a list with globus_list_search_pred() */ search_item = 2; sub_list = globus_list_search_pred(list, matches, &search_item); ok(sub_list != NULL, "search_pred_2"); /** * @test * Search for the third item in a list with globus_list_search_pred() */ search_item = 3; sub_list = globus_list_search_pred(list, matches, &search_item); ok(sub_list != NULL, "search_pred_3"); /** * @test * Search for the first item in a list with globus_list_search_pred() */ search_item = 1; sub_list = globus_list_search_pred(list, matches, &search_item); ok(sub_list != NULL, "search_pred_1"); /** * @test * Search for the second item in the list with globus_list_search() */ sub_list = globus_list_search(list, &x2); ok(sub_list != NULL, "search_2"); /** * @test * Remove the second item in the list with globus_list_remove() */ ok(globus_list_remove(&list, sub_list) == &x2, "remove_2"); /** * @test * Remove the first item in the list with globus_list_remove() */ ok(globus_list_remove(&list, list) == &x4, "remove_first"); /** * @test * Remove the first item in the list with globus_list_remove() */ ok(globus_list_remove(&list, list) == &x3, "remove_first_again"); /** * @test * Remove the first item in the list with globus_list_remove() */ ok(globus_list_remove(&list, list) == &x1, "remove_first_again"); /** * @test * Verify that the list is empty with globus_list_empty() */ ok(globus_list_empty(list), "empty_list"); globus_list_free(list); globus_module_deactivate(GLOBUS_COMMON_MODULE); return TEST_EXIT_CODE; }