Beispiel #1
0
static bool file_map_has_kw_ptr( const file_map_type * file_map, const ecl_kw_type * ecl_kw) {
  int index;
  for (index = 0; index < vector_get_size( file_map->kw_list ); index++) {
    const ecl_file_kw_type * file_kw = vector_iget_const( file_map->kw_list , index );
    if (ecl_file_kw_ptr_eq( file_kw , ecl_kw ))
      return true;
  } 
  return false;
} 
Beispiel #2
0
static void file_map_replace_kw( file_map_type * file_map , ecl_kw_type * old_kw , ecl_kw_type * new_kw , bool insert_copy) {
  int index = 0;
  while (index < vector_get_size( file_map->kw_list )) {
    ecl_file_kw_type * ikw = vector_iget( file_map->kw_list , index );
    if (ecl_file_kw_ptr_eq( ikw , old_kw)) {
      /* 
         Found it; observe that the vector_iset() function will
         automatically invoke the destructor on the old_kw. 
      */
      ecl_kw_type * insert_kw = new_kw;
      
      if (insert_copy)
        insert_kw = ecl_kw_alloc_copy( new_kw );
      ecl_file_kw_replace_kw( ikw , file_map->fortio , insert_kw );
      
      file_map_make_index( file_map );
      return;
    }
    index++;
  }
  util_abort("%s: could not find ecl_kw ptr: %p \n",__func__ , old_kw);
}