svn commit: r349420 - head/contrib/elftoolchain/libelftc

Mark Johnston markj at FreeBSD.org
Wed Jun 26 16:30:16 UTC 2019


Author: markj
Date: Wed Jun 26 16:30:14 2019
New Revision: 349420
URL: https://svnweb.freebsd.org/changeset/base/349420

Log:
  libelftc: Micro-optimize string table insertion.
  
  The string's length is already known, so use memcpy() instead of
  strcpy() to add it to the string table image.
  
  Reviewed by:	emaste
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D20760

Modified:
  head/contrib/elftoolchain/libelftc/elftc_string_table.c

Modified: head/contrib/elftoolchain/libelftc/elftc_string_table.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_string_table.c	Wed Jun 26 16:28:42 2019	(r349419)
+++ head/contrib/elftoolchain/libelftc/elftc_string_table.c	Wed Jun 26 16:30:14 2019	(r349420)
@@ -119,7 +119,7 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
 		st->st_string_pool_size = newsize;
 	}
 
-	strcpy(st->st_string_pool + stlen, string);
+	memcpy(st->st_string_pool + stlen, string, len);
 	ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len);
 
 	return (stlen);


More information about the svn-src-head mailing list