From 9da74023eb9378315d6b7e1bae02f52cfecc8bd1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 13 Apr 2022 06:32:28 -0600 Subject: Remove the byte order parameter to target_read_string target_read_string takes a byte order parameter, but only uses this to check whether a given character is zero. This is readily done without requiring the parameter, so remove it. --- gdb/valprint.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index a4c0f7b..8f99547 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -2052,7 +2052,6 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int target_read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, - enum bfd_endian byte_order, gdb::unique_xmalloc_ptr *buffer, int *bytes_read) { @@ -2122,12 +2121,15 @@ target_read_string (CORE_ADDR addr, int len, int width, limit = bufptr + nfetch * width; while (bufptr < limit) { - unsigned long c; + bool found_nonzero = false; + + for (int i = 0; !found_nonzero && i < width; ++i) + if (bufptr[i] != 0) + found_nonzero = true; - c = extract_unsigned_integer (bufptr, width, byte_order); addr += width; bufptr += width; - if (c == 0) + if (!found_nonzero) { /* We don't care about any error which happened after the NUL terminator. */ @@ -2733,7 +2735,7 @@ val_print_string (struct type *elttype, const char *encoding, fetchlimit = (len == -1 ? options->print_max : std::min ((unsigned) len, options->print_max)); - err = target_read_string (addr, len, width, fetchlimit, byte_order, + err = target_read_string (addr, len, width, fetchlimit, &buffer, &bytes_read); addr += bytes_read; -- cgit v1.1