Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Don't use internal libc function __findenv().



details:   https://anonhg.NetBSD.org/src/rev/3034a007873e
branches:  trunk
changeset: 758751:3034a007873e
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Nov 14 22:25:23 2010 +0000

description:
Don't use internal libc function __findenv().

diffstat:

 lib/libpthread/pthread.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 02f756e4a322 -r 3034a007873e lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Sun Nov 14 22:09:16 2010 +0000
+++ b/lib/libpthread/pthread.c  Sun Nov 14 22:25:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.116 2010/07/08 15:13:35 rmind Exp $      */
+/*     $NetBSD: pthread.c,v 1.117 2010/11/14 22:25:23 tron Exp $       */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.116 2010/07/08 15:13:35 rmind Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.117 2010/11/14 22:25:23 tron Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -1287,10 +1287,18 @@
 char *
 pthread__getenv(const char *name)
 {
-       extern char *__findenv(const char *, int *);
-       int off;
+       extern char **environ;
+       size_t l_name, offset;
 
-       return __findenv(name, &off);
+       l_name = strlen(name);
+       for (offset = 0; environ[offset] != NULL; offset++) {
+               if (strncmp(name, environ[offset], l_name) == 0 &&
+                   environ[offset][l_name] == '=') {
+                       return environ[offset] + l_name + 1;
+               }
+       }
+
+       return NULL;
 }
 
 pthread_mutex_t *



Home | Main Index | Thread Index | Old Index