decimal_from_floating (struct value *from, gdb_byte *to, int len)
{
char *buffer;
- int ret;
- ret = asprintf (&buffer, "%.30" DOUBLEST_PRINT_FORMAT,
- value_as_double (from));
- if (ret < 0)
- error (_("Error in memory allocation for conversion to decimal float."));
+ buffer = xstrprintf ("%.30" DOUBLEST_PRINT_FORMAT, value_as_double (from));
decimal_from_string (to, len, buffer);
- free (buffer);
+ xfree (buffer);
}
/* Converts a decimal float of LEN bytes to a double value. */