diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2024-04-17 16:55:28 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2024-04-18 10:31:54 -0400 |
commit | 523e454fab831e07c83a648c5d07370375a1c376 (patch) | |
tree | b8d5751d5d9215243ae787c6da707f246f0b65bb /gdbsupport/print-utils.h | |
parent | 31d5afc19d98869aa13c3197f55b8a208fd19da2 (diff) | |
download | binutils-523e454fab831e07c83a648c5d07370375a1c376.zip binutils-523e454fab831e07c83a648c5d07370375a1c376.tar.gz binutils-523e454fab831e07c83a648c5d07370375a1c376.tar.bz2 |
gdbsupport: constify some return values in print-utils.{h,cc}
There is no reason the callers of these functions need to change the
returned string, so change the `char *` return types to `const char *`.
Update a few callers to also use `const char *`.
Change-Id: I94adff574d5e1b326e8cc688cf1817a15b408b96
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdbsupport/print-utils.h')
-rw-r--r-- | gdbsupport/print-utils.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdbsupport/print-utils.h b/gdbsupport/print-utils.h index 510cc63..5c5869e 100644 --- a/gdbsupport/print-utils.h +++ b/gdbsupport/print-utils.h @@ -27,34 +27,34 @@ /* %u for ULONGEST. The result is stored in a circular static buffer, NUMCELLS deep. */ -extern char *pulongest (ULONGEST u); +extern const char *pulongest (ULONGEST u); /* %d for LONGEST. The result is stored in a circular static buffer, NUMCELLS deep. */ -extern char *plongest (LONGEST l); +extern const char *plongest (LONGEST l); /* Convert a ULONGEST into a HEX string, like %lx, with leading zeros. The result is stored in a circular static buffer, NUMCELLS deep. */ -extern char *phex (ULONGEST l, int sizeof_l); +extern const char *phex (ULONGEST l, int sizeof_l); /* Convert a ULONGEST into a HEX string, like %lx, without leading zeros. The result is stored in a circular static buffer, NUMCELLS deep. */ -extern char *phex_nz (ULONGEST l, int sizeof_l); +extern const char *phex_nz (ULONGEST l, int sizeof_l); /* Converts a LONGEST to a C-format hexadecimal literal and stores it in a static string. Returns a pointer to this string. */ -extern char *hex_string (LONGEST num); +extern const char *hex_string (LONGEST num); /* 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. */ -extern char *hex_string_custom (LONGEST num, int width); +extern const char *hex_string_custom (LONGEST num, int width); /* Convert VAL to a numeral in the given radix. For * radix 10, IS_SIGNED may be true, indicating a signed quantity; @@ -63,8 +63,8 @@ extern char *hex_string_custom (LONGEST num, int width); * to use C format in all cases. If it is false, then 'x' * and 'o' formats do not include a prefix (0x or leading 0). */ -extern char *int_string (LONGEST val, int radix, int is_signed, int width, - int use_c_format); +extern const char *int_string (LONGEST val, int radix, int is_signed, int width, + int use_c_format); /* Convert a CORE_ADDR into a string. */ |