* [binutils-gdb] Tidy string_ptr increment
@ 2023-03-24 10:35 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-24 10:35 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9c26a640c760f8b51a810f72e7dc58dd1d467cf4
commit 9c26a640c760f8b51a810f72e7dc58dd1d467cf4
Author: Alan Modra <amodra@gmail.com>
Date: Fri Mar 24 16:30:48 2023 +1030
Tidy string_ptr increment
* peicode.h (pe_ILF_make_a_symbol): Use sprintf output to
increment string_ptr to end of new string.
Diff:
---
bfd/peicode.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bfd/peicode.h b/bfd/peicode.h
index f1f3ce81533..f16aeca7a1b 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -576,7 +576,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
esym = vars->esym_ptr;
/* Copy the symbol's name into the string table. */
- sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
+ int len = sprintf (vars->string_ptr, "%s%s", prefix, symbol_name);
if (section == NULL)
section = bfd_und_section_ptr;
@@ -612,7 +612,7 @@ pe_ILF_make_a_symbol (pe_ILF_vars * vars,
vars->table_ptr ++;
vars->native_ptr ++;
vars->esym_ptr ++;
- vars->string_ptr += strlen (symbol_name) + strlen (prefix) + 1;
+ vars->string_ptr += len + 1;
BFD_ASSERT (vars->string_ptr < vars->end_string_ptr);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-24 10:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 10:35 [binutils-gdb] Tidy string_ptr increment Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).