cl_endpoint_list_elem_t* cl_endpoint_list_get_elem_endpoint(cl_raw_list_t* list_p, cl_com_endpoint_t *endpoint) { cl_endpoint_list_elem_t *elem = NULL; if (endpoint != NULL && list_p != NULL) { cl_endpoint_list_data_t* ldata = NULL; ldata = list_p->list_data; if (ldata->ht != NULL) { if (sge_htable_lookup(ldata->ht, endpoint->hash_id, (const void**)&elem) == True) { return elem; } } else { /* Search without having hash table */ CL_LOG(CL_LOG_INFO,"no hash table available, searching sequential"); elem = cl_endpoint_list_get_first_elem(list_p); while ( elem != NULL) { if (cl_com_compare_endpoints(elem->endpoint, endpoint) == 1) { /* found matching element */ return elem; } elem = cl_endpoint_list_get_next_elem(elem); } } } return NULL; }
cl_host_list_elem_t* cl_host_list_get_elem_host(cl_raw_list_t* list_p, const char *unresolved_hostname) { cl_host_list_elem_t *elem = NULL; if (list_p != NULL && unresolved_hostname != NULL) { cl_host_list_data_t* ldata = list_p->list_data; if (ldata->ht != NULL) { if (sge_htable_lookup(ldata->ht, unresolved_hostname, (const void **)&elem) == True) { return elem; } } else { /* Search without having hash table */ CL_LOG(CL_LOG_INFO,"no hash table available, searching sequential"); elem = cl_host_list_get_first_elem(list_p); while ( elem != NULL) { if (elem->host_spec != NULL && elem->host_spec->unresolved_name != NULL ) { if (strcmp(elem->host_spec->unresolved_name,unresolved_hostname) == 0) { /* found matching element */ return elem; } } elem = cl_host_list_get_next_elem(elem); } } } return NULL; }