This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: reduce strlen() calls
- From: Andreas Schwab <schwab at suse dot de>
- To: Devang Patel <dpatel at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Jul 2002 22:14:14 +0200
- Subject: Re: PATCH: reduce strlen() calls
- References: <83D7AE26-A0CF-11D6-8224-00039310EDEA@apple.com>
Devang Patel <dpatel@apple.com> writes:
|> This simple patch reduces strlen() calls by using write_chars (str, len)
|> instead of write_string (str).
|> Index: cp/mangle.c
|> ===================================================================
|> RCS file: /cvsroot/gcc/gcc/gcc/cp/mangle.c,v
|> retrieving revision 1.56
|> diff -c -3 -p -r1.56 mangle.c
|> *** cp/mangle.c 2 Jul 2002 03:19:22 -0000 1.56
|> --- cp/mangle.c 26 Jul 2002 19:21:23 -0000
|> *************** find_substitution (node)
|> *** 501,507 ****
|> && is_std_substitution (decl, SUBID_ALLOCATOR)
|> && !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl)))
|> {
|> ! write_string ("Sa");
|> return 1;
|> }
|>
|> --- 501,507 ----
|> && is_std_substitution (decl, SUBID_ALLOCATOR)
|> && !CLASSTYPE_USE_TEMPLATE (TREE_TYPE (decl)))
|> {
|> ! write_chars ("Sa", 2);
|> return 1;
|> }
|>
IMHO it would be more robust to use a macro that expands to `write_chars
(str, strlen (str))' instead of using plain numbers.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."