void stringlist_apply_subst(stringlist_type * stringlist , const subst_list_type * subst_list) { int i; for (i=0; i < stringlist_get_size( stringlist ); i++) { const char * old_string = stringlist_iget( stringlist , i ); char * new_string = subst_list_alloc_filtered_string( subst_list , old_string ); stringlist_iset_owned_ref( stringlist , i , new_string ); } }
const char * member_config_update_jobname(member_config_type * member_config , const char * jobname_fmt , const subst_list_type * subst_list) { if (jobname_fmt != NULL) { util_safe_free( member_config->jobname ); { char * tmp = util_alloc_sprintf( jobname_fmt , member_config->iens); member_config->jobname = subst_list_alloc_filtered_string( subst_list , tmp ); free( tmp ); } } return member_config->jobname; }
char * ert_run_context_alloc_runpath( int iens , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter) { char * runpath; { char * first_pass = path_fmt_alloc_path(runpath_fmt , false , iens, iter); /* 1: Replace first %d with iens, if a second %d replace with iter */ if (subst_list) runpath = subst_list_alloc_filtered_string( subst_list , first_pass ); /* 2: Filter out various magic strings like <CASE> and <CWD>. */ else runpath = util_alloc_string_copy( first_pass ); free( first_pass ); } return runpath; }
const char * member_config_update_eclbase(member_config_type * member_config , const ecl_config_type * ecl_config , const subst_list_type * subst_list) { util_safe_free( member_config->eclbase ); { const path_fmt_type * eclbase_fmt = ecl_config_get_eclbase_fmt(ecl_config); if (eclbase_fmt != NULL) { { char * tmp = path_fmt_alloc_path(eclbase_fmt , false , member_config->iens); member_config->eclbase = subst_list_alloc_filtered_string( subst_list , tmp ); free( tmp ); } if (!ecl_util_valid_basename( member_config->eclbase )) util_exit("Sorry - the basename:%s is invalid. ECLIPSE does not handle mIxeD cAsE :-( \n" , member_config->eclbase); } } return member_config->eclbase; }
static stringlist_type * ert_run_context_alloc_runpath_list(const bool_vector_type * iactive , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter) { stringlist_type * runpath_list = stringlist_alloc_new(); for (int iens = 0; iens < bool_vector_size( iactive ); iens++) { if (bool_vector_iget( iactive , iens )) { char * tmp1 = path_fmt_alloc_path(runpath_fmt , false , iens, iter); /* 1: Replace first %d with iens, if a second %d replace with iter */ char * tmp2 = tmp1; if (subst_list) tmp2 = subst_list_alloc_filtered_string( subst_list , tmp1 ); /* 2: Filter out various magic strings like <CASE> and <CWD>. */ stringlist_append_copy( runpath_list , tmp2 ); if (subst_list) free( tmp2 ); free( tmp1 ); } else stringlist_append_ref( runpath_list , NULL ); } return runpath_list; }