cgen.c
char *replace_all_keys_with_values(const char *str, const struct key_value *key_values, size_t nkeys)
{
	if (nkeys == 0) return strdup(str);
	char *current_str = replace_key_with_value(str, key_values[0].key, key_values[0].value);
	for (size_t i = 1; i < nkeys; i++) {
		char *next_str = replace_key_with_value(current_str, key_values[i].key, key_values[i].value);
		free(current_str);
		current_str = next_str;
	}
	return current_str;
}
/* replace_keys_with_values returns an allocated string. The caller owns the return string. */
replace_keys_with_values returns an allocated string. The caller owns the return string.
replace_keys_with_values returns an allocated string . The caller owns the return string .
char *replace_all_keys_with_values(const char *str, const struct key_value *key_values, size_t nkeys)
{
	if (nkeys == 0) return strdup(str);
	char *current_str = replace_key_with_value(str, key_values[0].key, key_values[0].value);
	for (size_t i = 1; i < nkeys; i++) {
		char *next_str = replace_key_with_value(current_str, key_values[i].key, key_values[i].value);
		free(current_str);
		current_str = next_str;
	}
	return current_str;
}
char * replace_all_keys_with_values ( const char * str , const struct key_value * key_values , size_t nkeys ) { if ( nkeys == 0 ) return strdup ( str ) ; char * current_str = replace_key_with_value ( str , key_values [ 0 ] . key , key_values [ 0 ] . value ) ; for ( size_t i = 1 ; i < nkeys ; i ++ ) { char * next_str = replace_key_with_value ( current_str , key_values [ i ] . key , key_values [ i ] . value ) ; free ( current_str ) ; current_str = next_str ; } return current_str ; }
replace_keys_with_values returns an allocated string.
replace_keys_with_values returns an allocated string .