about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-06 00:02:46 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-06 00:02:46 +0000
commit86187531d302de284b67ac162cf76c60c86bd7da (patch)
tree456f8b37f8e8fa67c16ee0cf6de7b591d9d3d913 /elf
parent1618c590382ef16b1942bf39a42aa683a050ff57 (diff)
downloadglibc-86187531d302de284b67ac162cf76c60c86bd7da.tar.gz
glibc-86187531d302de284b67ac162cf76c60c86bd7da.tar.xz
glibc-86187531d302de284b67ac162cf76c60c86bd7da.zip
1997-11-06 00:06  Ulrich Drepper  <drepper@cygnus.com>

	* argp/argp-help.c: Optimize a bit by using mempcpy.
	* elf/dl-load.c: Likewise.
	* elf/dl-lookup.c: Likewise.
	* inet/rcmd.c: Likewise.
	* io/ftw.c: Likewise.
	* libio/fileops.c: Likewise.
	* libio/genops.c: Likewise.
	* libio/obprintf.c: Likewise.
	* nss/nsswitch.c: Likewise.
	* posix/execvp.c: Likewise.
	* posix/getopt.c: Likewise.
	* posix/glob.c: Likewise.
	* posix/wordexp.c: Likewise.
	* stdio-common/vfprintf.c: Likewise.
	* stdlib/canonicalize.c: Likewise.
	* stdlib/msort.c: Likewise.
	* string/argz-replace.c: Likewise.
	* sysdeps/generic/putenv.c: Likewise.
	* sysdeps/generic/setenv.c: Likewise.
	* sysdeps/posix/getcwd.c: Likewise.
	* sysdeps/posix/ttyname.c: Likewise.
	* sysdeps/posix/writev.c: Likewise.
	* time/strftime.c: Likewise.
	* time/tzfile.c: Likewise.

	* login/utmp_daemon.c: Use memcpy instead of strcpy where possible.
	* sunrpc/svcauth_des.c: Likewise.
	* sysdeps/unix/sysv/linux/gethostname.c: Likewise.

	* misc/tsearch.c: Use memcpy return value if possible.
	* posix/regex.c: Likewise.
	* sysdeps/unix/readdir_r.c: Likewise.
	* wcsmbc/wcsdup.c: Likewise.

	* nss/digits_dots.c: Little optimization.

	* inet/ruserpass.c (ruserpass): Optimize by using stpcpy.
	(struct toktab): Make tokstr field a const char *.

	* elf/dl-profile.c: Fix typo.

	* inet/ether_ntoh.c: Don't use relative #include path.
	* inet/gethstbynm.c: Likewise.
	* resolv/inet_pton.c: Likewise.
	* shadow/sgetspent_r.c: Likewise.

	* libio/oldfileops.c (_IO_old_file_jumps): Use correct sync and write
	callbacks.  Patch by NIIBE Yutaka <gniibe@mri.co.jp>.

	* posix/confstr.c: Correct string for _CS_LFS_CFLAGS.
	Handle _CS_XBS5_* constants.
	* posix/unistd.h: Add comment describing _XBS5_* constants.
	* sysdeps/generic/bits/confname.h: Add _CS_XBS5_* constants.

	* posix/regex.c: Indent preprocessor code.

	* posix/wordexp.c: Using _itoa_word instead of sprintf.

	* stdlib/canonicalize.c: Avoid unnecessary copying.  Handle NULL
	and "" arguments correctly according to SUS.
	* stdlib/test-canon.c: Test "" and NULL argument handling.

	* sysdeps/posix/writev.c: Correct condition to leave the loop.

1997-11-05 18:13  Ulrich Drepper  <drepper@cygnus.com>

	* nss/getXXbyYY.c: Set buffer to NULL if realloc fails so that possible
	next call starts with malloc again.
	Proposed by Joe Keane <jgk@jgk.org>.

1997-11-04 23:57  Ulrich Drepper  <drepper@cygnus.com>

	* configure.in: Correct gcc -pipe test.
	Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.

	* posix/glob.c: Cleanups.  Patch by H.J. Lu <hjl@lucon.org>.

1997-11-04  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* manual/creature.texi (Feature Test Macros): Add _POSIX_C_SOURCE
	definition.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c39
-rw-r--r--elf/dl-lookup.c4
-rw-r--r--elf/dl-profile.c2
3 files changed, 22 insertions, 23 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 9a6aae6a93..0b752676b7 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -238,12 +238,12 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
 	      if (tmp == NULL)
 		_dl_signal_error (ENOMEM, NULL,
 				  "cannot create cache for search path");
-	      memcpy (tmp, cp, len);
-	      memcpy (tmp + len, _dl_platform, _dl_platformlen);
-	      tmp[len + _dl_platformlen] = '/';
-	      tmp[len + _dl_platformlen + 1] = '\0';
-
 	      dirp->dirname = tmp;
+	      tmp = __mempcpy (tmp, cp, len);
+	      tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+	      *tmp++ = '/';
+	      *tmp = '\0';
+
 	      dirp->machdirstatus = dirp->dirstatus;
 
 	      if (max_dirnamelen < dirp->machdirnamelen)
@@ -260,13 +260,11 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
 	      if (tmp == NULL)
 		_dl_signal_error (ENOMEM, NULL,
 				  "cannot create cache for search path");
-	      memcpy (tmp, cp, len);
-	      tmp[len] = '\0';
+	      dirp->dirname = tmp;
+	      *((char *) __mempcpy (tmp, cp, len)) = '\0';
 
 	      if (max_dirnamelen < dirp->dirnamelen)
 		max_dirnamelen = dirp->dirnamelen;
-
-	      dirp->dirname = tmp;
 	    }
 
 	  dirp->next = all_dirs;
@@ -430,12 +428,11 @@ _dl_init_paths (void)
 	    _dl_signal_error (ENOMEM, NULL,
 			      "cannot create cache for search path");
 
-	  memcpy (tmp, relem->dirname, relem->dirnamelen);
-	  memcpy (tmp + relem->dirnamelen, _dl_platform, _dl_platformlen);
-	  tmp[relem->dirnamelen + _dl_platformlen] = '/';
-	  tmp[relem->dirnamelen + _dl_platformlen + 1] = '\0';
-
 	  relem->dirname = tmp;
+	  tmp = __mempcpy (tmp, relem->dirname, relem->dirnamelen);
+	  tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);
+	  *tmp++ = '/';
+	  *tmp = '\0';
 
 	  relem->machdirstatus = unknown;
 
@@ -812,9 +809,10 @@ open_path (const char *name, size_t namelen,
       if (this_dir->machdirstatus != nonexisting)
 	{
 	  /* Construct the pathname to try.  */
-	  (void) memcpy (buf, this_dir->dirname, this_dir->machdirnamelen);
-	  (void) memcpy (buf + this_dir->machdirnamelen, name, namelen);
-	  buflen = this_dir->machdirnamelen + namelen;
+	  buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+						   this_dir->machdirnamelen),
+					name, namelen)
+		    - buf);
 
 	  fd = __open (buf, O_RDONLY);
 	  if (this_dir->machdirstatus == unknown)
@@ -839,9 +837,10 @@ open_path (const char *name, size_t namelen,
       if (fd == -1 && this_dir->dirstatus != nonexisting)
 	{
 	  /* Construct the pathname to try.  */
-	  (void) memcpy (buf, this_dir->dirname, this_dir->dirnamelen);
-	  (void) memcpy (buf + this_dir->dirnamelen, name, namelen);
-	  buflen = this_dir->dirnamelen + namelen;
+	  buflen = ((char *) __mempcpy (__mempcpy (buf, this_dir->dirname,
+						   this_dir->dirnamelen),
+					name, namelen)
+		    - buf);
 
 	  fd = __open (buf, O_RDONLY);
 	  if (this_dir->dirstatus == unknown)
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index ef344794c5..c51724026e 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -355,8 +355,8 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
       /* We could find no value for a strong reference.  */
       const size_t len = strlen (undef_name);
       char buf[sizeof undefined_msg + len];
-      memcpy (buf, undefined_msg, sizeof undefined_msg - 1);
-      memcpy (&buf[sizeof undefined_msg - 1], undef_name, len + 1);
+      __mempcpy (__mempcpy (buf, undefined_msg, sizeof undefined_msg - 1),
+		 undef_name, len + 1);
       _dl_signal_error (0, reference_name, buf);
     }
 
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index dcbbcd026e..1a4f6b3105 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -262,7 +262,7 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
   fd = __open (filename, O_RDWR | O_CREAT, 0666);
   if (fd == -1)
     {
-      /* We cannot write the profiling data so don't do anthing.  */
+      /* We cannot write the profiling data so don't do anything.  */
       char buf[400];
       _dl_sysdep_message (filename, ": cannot open file: ",
 			  _strerror_internal (errno, buf, sizeof buf),