contrib/gdb-7/gdb/utils.c
char *
hex_string_custom (LONGEST num, int width)
{
  char *result = get_cell ();
  char *result_end = result + CELLSIZE - 1;
  const char *hex = phex_nz (num, sizeof (num));
  int hex_len = strlen (hex);

  if (hex_len > width)
    width = hex_len;
  if (width + 2 >= CELLSIZE)
    internal_error (__FILE__, __LINE__, _("\
hex_string_custom: insufficient space to store result"));

  strcpy (result_end - width - 2, "0x");
  memset (result_end - width, '0', width);
  strcpy (result_end - hex_len, hex);
  return result_end - width - 2;
}
/* Converts a LONGEST number to a C-format hexadecimal literal and
   stores it in a static string.  Returns a pointer to this string
   that is valid until the next call.  The number is padded on the
   left with 0s to at least WIDTH characters.  */
Converts a LONGEST number to a C-format hexadecimal literal and
stores it in a static string.  Returns a pointer to this string
that is valid until the next call.  The number is padded on the
left with 0s to at least WIDTH characters.
Converts a LONGEST number to a C - format hexadecimal literal and stores it in a static string . Returns a pointer to this string that is valid until the next call . The number is padded on the left with 0s to at least WIDTH characters .
char *
hex_string_custom (LONGEST num, int width)
{
  char *result = get_cell ();
  char *result_end = result + CELLSIZE - 1;
  const char *hex = phex_nz (num, sizeof (num));
  int hex_len = strlen (hex);
  if (hex_len > width)
    width = hex_len;
  if (width + 2 >= CELLSIZE)
    internal_error (__FILE__, __LINE__, _("\
hex_string_custom: insufficient space to store result"));
  strcpy (result_end - width - 2, "0x");
  memset (result_end - width, '0', width);
  strcpy (result_end - hex_len, hex);
  return result_end - width - 2;
}
char * hex_string_custom ( LONGEST num , int width ) { char * result = get_cell ( ) ; char * result_end = result + CELLSIZE - 1 ; const char * hex = phex_nz ( num , sizeof ( num ) ) ; int hex_len = strlen ( hex ) ; if ( hex_len > width ) width = hex_len ; if ( width + 2 >= CELLSIZE ) internal_error ( __FILE__ , __LINE__ , _ ( " \
 " ) ) ; strcpy ( result_end - width - 2 , " " ) ; memset ( result_end - width , ' ' , width ) ; strcpy ( result_end - hex_len , hex ) ; return result_end - width - 2 ; }
Converts a LONGEST number to a C-format hexadecimal literal and
stores it in a static string.
Converts a LONGEST number to a C - format hexadecimal literal and stores it in a static string .