/* Returns: Whether a transformation rule was found and could be applied. Upon failing transformations, @dest_value is left untouched.  */
gboolean g_value_transform(const GValue *src_value, GValue *dest_value)
/* Returns: Whether a transformation rule was found and could be applied. Upon failing transformations, @dest_value is left untouched.  */
gboolean g_value_transform(const GValue *src_value, GValue *dest_value)
{
  GType dest_type;
  g_return_val_if_fail (G_IS_VALUE (src_value), FALSE);
  g_return_val_if_fail (G_IS_VALUE (dest_value), FALSE);
  dest_type = G_VALUE_TYPE (dest_value);
  if (g_value_type_compatible (G_VALUE_TYPE (src_value), dest_type))
    {
      g_value_copy (src_value, dest_value);
      return TRUE;
    }
  else
    {
      GValueTransform transform = transform_func_lookup (G_VALUE_TYPE (src_value), dest_type);
      if (transform)
	{
	  g_value_unset (dest_value);
	  value_meminit (dest_value, dest_type);
	  transform (src_value, dest_value);
	  return TRUE;
	}
    }
  return FALSE;
}