|  | @@ -726,7 +726,7 @@ int fetch_setting_len ( struct settings *settings, struct setting *setting ) {
 | 
		
	
		
			
			| 726 | 726 |  int fetch_setting_copy ( struct settings *settings, struct setting *setting,
 | 
		
	
		
			
			| 727 | 727 |  			 void **data ) {
 | 
		
	
		
			
			| 728 | 728 |  	int len;
 | 
		
	
		
			
			| 729 |  | -	int check_len = 0;
 | 
		
	
		
			
			|  | 729 | +	int check_len;
 | 
		
	
		
			
			| 730 | 730 |  
 | 
		
	
		
			
			| 731 | 731 |  	/* Avoid returning uninitialised data on error */
 | 
		
	
		
			
			| 732 | 732 |  	*data = NULL;
 | 
		
	
	
		
			
			|  | @@ -1028,7 +1028,7 @@ int setting_cmp ( struct setting *a, struct setting *b ) {
 | 
		
	
		
			
			| 1028 | 1028 |   */
 | 
		
	
		
			
			| 1029 | 1029 |  
 | 
		
	
		
			
			| 1030 | 1030 |  /**
 | 
		
	
		
			
			| 1031 |  | - * Fetch and format value of setting
 | 
		
	
		
			
			|  | 1031 | + * Fetch formatted value of setting
 | 
		
	
		
			
			| 1032 | 1032 |   *
 | 
		
	
		
			
			| 1033 | 1033 |   * @v settings		Settings block, or NULL to search all blocks
 | 
		
	
		
			
			| 1034 | 1034 |   * @v setting		Setting to fetch
 | 
		
	
	
		
			
			|  | @@ -1064,6 +1064,43 @@ int fetchf_setting ( struct settings *settings, struct setting *setting,
 | 
		
	
		
			
			| 1064 | 1064 |  	return ret;
 | 
		
	
		
			
			| 1065 | 1065 |  }
 | 
		
	
		
			
			| 1066 | 1066 |  
 | 
		
	
		
			
			|  | 1067 | +/**
 | 
		
	
		
			
			|  | 1068 | + * Fetch copy of formatted value of setting
 | 
		
	
		
			
			|  | 1069 | + *
 | 
		
	
		
			
			|  | 1070 | + * @v settings		Settings block, or NULL to search all blocks
 | 
		
	
		
			
			|  | 1071 | + * @v setting		Setting to fetch
 | 
		
	
		
			
			|  | 1072 | + * @v type		Settings type
 | 
		
	
		
			
			|  | 1073 | + * @v value		Buffer to allocate and fill with formatted value
 | 
		
	
		
			
			|  | 1074 | + * @ret len		Length of formatted value, or negative error
 | 
		
	
		
			
			|  | 1075 | + *
 | 
		
	
		
			
			|  | 1076 | + * The caller is responsible for eventually freeing the allocated
 | 
		
	
		
			
			|  | 1077 | + * buffer.
 | 
		
	
		
			
			|  | 1078 | + */
 | 
		
	
		
			
			|  | 1079 | +int fetchf_setting_copy ( struct settings *settings, struct setting *setting,
 | 
		
	
		
			
			|  | 1080 | +			  char **value ) {
 | 
		
	
		
			
			|  | 1081 | +	int len;
 | 
		
	
		
			
			|  | 1082 | +	int check_len;
 | 
		
	
		
			
			|  | 1083 | +
 | 
		
	
		
			
			|  | 1084 | +	/* Avoid returning uninitialised data on error */
 | 
		
	
		
			
			|  | 1085 | +	*value = NULL;
 | 
		
	
		
			
			|  | 1086 | +
 | 
		
	
		
			
			|  | 1087 | +	/* Check existence, and fetch formatted value length */
 | 
		
	
		
			
			|  | 1088 | +	len = fetchf_setting ( settings, setting, NULL, 0 );
 | 
		
	
		
			
			|  | 1089 | +	if ( len < 0 )
 | 
		
	
		
			
			|  | 1090 | +		return len;
 | 
		
	
		
			
			|  | 1091 | +
 | 
		
	
		
			
			|  | 1092 | +	/* Allocate buffer */
 | 
		
	
		
			
			|  | 1093 | +	*value = zalloc ( len + 1 /* NUL */ );
 | 
		
	
		
			
			|  | 1094 | +	if ( ! *value )
 | 
		
	
		
			
			|  | 1095 | +		return -ENOMEM;
 | 
		
	
		
			
			|  | 1096 | +
 | 
		
	
		
			
			|  | 1097 | +	/* Fetch formatted value */
 | 
		
	
		
			
			|  | 1098 | +	check_len = fetchf_setting ( settings, setting, *value,
 | 
		
	
		
			
			|  | 1099 | +				     ( len + 1 /* NUL */ ) );
 | 
		
	
		
			
			|  | 1100 | +	assert ( check_len == len );
 | 
		
	
		
			
			|  | 1101 | +	return len;
 | 
		
	
		
			
			|  | 1102 | +}
 | 
		
	
		
			
			|  | 1103 | +
 | 
		
	
		
			
			| 1067 | 1104 |  /**
 | 
		
	
		
			
			| 1068 | 1105 |   * Store formatted value of setting
 | 
		
	
		
			
			| 1069 | 1106 |   *
 |