int cl_endpoint_list_undefine_endpoint(cl_raw_list_t* list_p, cl_com_endpoint_t* endpoint) { int back = CL_RETVAL_UNKNOWN_ENDPOINT; int ret_val = CL_RETVAL_OK; cl_endpoint_list_elem_t* elem = NULL; if (list_p == NULL || endpoint == NULL) { return CL_RETVAL_PARAMS; } /* lock list */ if ( (ret_val = cl_raw_list_lock(list_p)) != CL_RETVAL_OK) { return ret_val; } elem = cl_endpoint_list_get_elem_endpoint(list_p, endpoint); if (elem && elem->is_static == false) { cl_endpoint_list_data_t* ldata = NULL; cl_raw_list_remove_elem(list_p, elem->raw_elem); cl_com_free_endpoint(&(elem->endpoint)); sge_free(&elem); ldata = list_p->list_data; if (ldata->ht != NULL) { sge_htable_delete(ldata->ht, endpoint->hash_id); } back = CL_RETVAL_OK; } /* unlock list */ if ( (ret_val = cl_raw_list_unlock(list_p)) != CL_RETVAL_OK) { return ret_val; } return back; }
int cl_host_list_remove_host(cl_raw_list_t* list_p, cl_com_host_spec_t* host, int lock_list) { int ret_val = CL_RETVAL_OK; int function_return = CL_RETVAL_UNKOWN_HOST_ERROR; cl_host_list_elem_t* elem = NULL; if (list_p == NULL || host == NULL) { return CL_RETVAL_PARAMS; } if (lock_list != 0) { /* lock list */ if ( (ret_val = cl_raw_list_lock(list_p)) != CL_RETVAL_OK) { return ret_val; } } elem = cl_host_list_get_elem_host(list_p, host->unresolved_name); if (elem != NULL) { /* remove element from hash table */ if (host->unresolved_name != NULL) { cl_host_list_data_t* ldata = list_p->list_data; if (ldata->ht != NULL) { sge_htable_delete(ldata->ht, host->unresolved_name); } } cl_raw_list_remove_elem(list_p, elem->raw_elem); function_return = CL_RETVAL_OK; cl_com_free_hostspec(&(elem->host_spec)); free(elem); } if (lock_list != 0) { /* unlock list */ if ((ret_val = cl_raw_list_unlock(list_p)) != CL_RETVAL_OK) { return ret_val; } } return function_return; }