aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-11 08:57:41 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-11 08:57:41 +0000
commit67c94753e3f2ec372483cd41fbcc1bcdc04053fb (patch)
tree253f8967708078bd2fc0f24dcdae28d14f47e668 /sysdeps/generic
parent6ae9b99ef23691204c5e1e8128425f1a78465a4f (diff)
downloadglibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar
glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar.gz
glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.tar.bz2
glibc-67c94753e3f2ec372483cd41fbcc1bcdc04053fb.zip
Update.
2001-08-11 Ulrich Drepper <drepper@redhat.com> * malloc/malloc.c (ptmalloc_init): Don't call getenv five times. Instead use new function next_env_entry which iterates over the environment once. * sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Only set _dl_profile_map for the right object. * elf/dl-reloc.c (_dl_relocate_object): Allocate l_reloc_result only if consider_profiling is != 0, not if _dl_profile != NULL. * sysdeps/generic/dl-environ.c (_dl_next_ld_env_entry): Optimize a bit. Now returns pointer to first character set "LD_". * elf/rtld.c (process_envvars): Adjust for change above. * sysdeps/unix/sysv/linux/dl-librecon.h (EXTRA_LD_ENVVARS): Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h (EXTRA_LD_ENVVARS): Likewise. 2001-08-10 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c (grow_heap): Use mmap() rather than mprotect() to allocate new memory, for better performance with Linux-2.4.x.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/dl-environ.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sysdeps/generic/dl-environ.c b/sysdeps/generic/dl-environ.c
index 26ddf922f3..9b317548ec 100644
--- a/sysdeps/generic/dl-environ.c
+++ b/sysdeps/generic/dl-environ.c
@@ -1,5 +1,5 @@
/* Environment handling for dynamic loader.
- Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,21 +32,22 @@ _dl_next_ld_env_entry (char ***position)
char **current = *position;
char *result = NULL;
- if (current == NULL)
- /* We start over. */
- current = _environ;
-
- while (result == NULL && *current != NULL)
+ while (*current != NULL)
{
- if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
- result = *current;
+ if (__builtin_expect ((*current)[0] == 'L', 0)
+ && (*current)[1] == 'D' && (*current)[2] == '_')
+ {
+ result = &(*current)[3];
+
+ /* Save current position for next visit. */
+ *position = ++current;
+
+ break;
+ }
++current;
}
- /* Save current position for next visit. */
- *position = current;
-
return result;
}