deps/kb_meme/meme-5.0.1/src/object-list.c
/*************************************************************************
 * Retrieve an object from a list.
 *************************************************************************/
Retrieve an object from a list.
Retrieve an object from a list .
void* retrieve_object
 (void*          key,
  OBJECT_LIST_T* an_object_list)
{
  int i_object;
  if (key == NULL) {
    die("Tried to retrieve by NULL key.");
  }
  for (i_object = 0; i_object < an_object_list->num_objects; i_object++) {
    void* this_key = an_object_list->objects[i_object].key;
    if (this_key == NULL) {
      die("Tried to retrieve by key from a list containing a NULL key.");
    }
    if ((an_object_list->compare_keys)(key, this_key)) {
      return(an_object_list->objects[i_object].value);
    }
  }
  return(NULL);
}
void * retrieve_object ( void * key , OBJECT_LIST_T * an_object_list ) { int i_object ; if ( key == NULL ) { die ( " " ) ; } for ( i_object = 0 ; i_object < an_object_list -> num_objects ; i_object ++ ) { void * this_key = an_object_list -> objects [ i_object ] . key ; if ( this_key == NULL ) { die ( " " ) ; } if ( ( an_object_list -> compare_keys ) ( key , this_key ) ) { return ( an_object_list -> objects [ i_object ] . value ) ; } } return ( NULL ) ; }
Retrieve an object from a list.
Retrieve an object from a list .
// If we didn't find it, return null pointer.