Source-Changes-HG archive

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

[src/trunk]: src/libexec/ld.elf_so Minor cleanup.



details:   https://anonhg.NetBSD.org/src/rev/128dff69b3e6
branches:  trunk
changeset: 537737:128dff69b3e6
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sat Oct 05 11:59:03 2002 +0000

description:
Minor cleanup.

diffstat:

 libexec/ld.elf_so/arch/alpha/rtld_start.S   |   4 +-
 libexec/ld.elf_so/arch/mips/mips_reloc.c    |   4 +-
 libexec/ld.elf_so/arch/mips/rtld_start.S    |   4 +-
 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c  |   4 +-
 libexec/ld.elf_so/arch/powerpc/rtld_start.S |   4 +-
 libexec/ld.elf_so/arch/vax/rtld_start.S     |   4 +-
 libexec/ld.elf_so/headers.c                 |   3 +-
 libexec/ld.elf_so/load.c                    |   3 +-
 libexec/ld.elf_so/map_object.c              |   3 +-
 libexec/ld.elf_so/paths.c                   |  57 +++++++++++++++-------------
 libexec/ld.elf_so/rtld.c                    |   3 +-
 libexec/ld.elf_so/search.c                  |   6 +-
 libexec/ld.elf_so/symbol.c                  |   3 +-
 13 files changed, 56 insertions(+), 46 deletions(-)

diffs (truncated from 313 to 300 lines):

diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/alpha/rtld_start.S
--- a/libexec/ld.elf_so/arch/alpha/rtld_start.S Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/alpha/rtld_start.S Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: rtld_start.S,v 1.14 2002/09/12 17:18:37 mycroft Exp $  */
+/*     $NetBSD: rtld_start.S,v 1.15 2002/10/05 11:59:05 mycroft Exp $  */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/mips/mips_reloc.c
--- a/libexec/ld.elf_so/arch/mips/mips_reloc.c  Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/mips/mips_reloc.c  Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: mips_reloc.c,v 1.36 2002/09/26 20:41:34 mycroft Exp $  */
+/*     $NetBSD: mips_reloc.c,v 1.37 2002/10/05 11:59:05 mycroft Exp $  */
 
 /*
  * Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/mips/rtld_start.S
--- a/libexec/ld.elf_so/arch/mips/rtld_start.S  Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/mips/rtld_start.S  Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: rtld_start.S,v 1.8 2002/09/26 20:41:34 mycroft Exp $   */
+/*     $NetBSD: rtld_start.S,v 1.9 2002/10/05 11:59:05 mycroft Exp $   */
 
 /*
  * Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
--- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ppc_reloc.c,v 1.31 2002/09/26 20:42:11 mycroft Exp $   */
+/*     $NetBSD: ppc_reloc.c,v 1.32 2002/10/05 11:59:06 mycroft Exp $   */
 
 /*-
  * Copyright (C) 1998  Tsubai Masanari
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/powerpc/rtld_start.S
--- a/libexec/ld.elf_so/arch/powerpc/rtld_start.S       Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/rtld_start.S       Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: rtld_start.S,v 1.10 2002/09/25 07:27:53 mycroft Exp $  */
+/*     $NetBSD: rtld_start.S,v 1.11 2002/10/05 11:59:06 mycroft Exp $  */
 
 /*-
  * Copyright (C) 1998  Tsubai Masanari
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/arch/vax/rtld_start.S
--- a/libexec/ld.elf_so/arch/vax/rtld_start.S   Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/arch/vax/rtld_start.S   Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: rtld_start.S,v 1.14 2002/09/27 03:46:12 mycroft Exp $  */
+/*     $NetBSD: rtld_start.S,v 1.15 2002/10/05 11:59:06 mycroft Exp $  */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
- * Portions copyright 2002 Charles M. Hannum.
+ * Portions copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c       Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/headers.c       Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: headers.c,v 1.16 2002/10/04 18:50:43 mycroft Exp $      */
+/*     $NetBSD: headers.c,v 1.17 2002/10/05 11:59:03 mycroft Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
+ * Copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/load.c
--- a/libexec/ld.elf_so/load.c  Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/load.c  Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: load.c,v 1.23 2002/10/04 04:04:26 mycroft Exp $         */
+/*     $NetBSD: load.c,v 1.24 2002/10/05 11:59:04 mycroft Exp $         */
 
 /*
  * Copyright 1996 John D. Polstra.
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
+ * Copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/map_object.c
--- a/libexec/ld.elf_so/map_object.c    Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/map_object.c    Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: map_object.c,v 1.23 2002/10/05 00:13:27 mycroft Exp $   */
+/*     $NetBSD: map_object.c,v 1.24 2002/10/05 11:59:04 mycroft Exp $   */
 
 /*
  * Copyright 1996 John D. Polstra.
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
+ * Copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/paths.c
--- a/libexec/ld.elf_so/paths.c Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/paths.c Sat Oct 05 11:59:03 2002 +0000
@@ -1,7 +1,8 @@
-/*     $NetBSD: paths.c,v 1.18 2002/09/28 05:00:27 junyoung Exp $       */
+/*     $NetBSD: paths.c,v 1.19 2002/10/05 11:59:04 mycroft Exp $        */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
+ * Copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -53,8 +54,8 @@
 
 static Search_Path *_rtld_find_path __P((Search_Path *, const char *, size_t));
 static Search_Path **_rtld_append_path __P((Search_Path **, Search_Path **,
-    const char *, const char *));
-static void _rtld_process_mapping __P((Library_Xform **, char *, char *));
+    const char *, size_t));
+static void _rtld_process_mapping __P((Library_Xform **, char *, size_t));
 
 static Search_Path *
 _rtld_find_path(path, pathstr, pathlen)
@@ -71,25 +72,25 @@
 }
 
 static Search_Path **
-_rtld_append_path(head_p, path_p, bp, ep)
+_rtld_append_path(head_p, path_p, bp, len)
        Search_Path **head_p, **path_p;
        const char *bp;
-       const char *ep;
+       size_t len;
 {
        char *cp;
        Search_Path *path;
 
-       if (bp == NULL || bp == ep || *bp == '\0')
+       if (bp == NULL || len == 0 || *bp == '\0')
                return path_p;
 
-       if (_rtld_find_path(*head_p, bp, ep - bp) != NULL)
+       if (_rtld_find_path(*head_p, bp, len) != NULL)
                return path_p;
 
        path = NEW(Search_Path);
-       path->sp_pathlen = ep - bp;
-       cp = xmalloc(path->sp_pathlen + 1);
-       strncpy(cp, bp, path->sp_pathlen);
-       cp[path->sp_pathlen] = '\0';
+       path->sp_pathlen = len;
+       cp = xmalloc(len + 1);
+       memcpy(cp, bp, len);
+       cp[len] = '\0';
        path->sp_path = cp;
        path->sp_next = (*path_p);
        (*path_p) = path;
@@ -124,7 +125,7 @@
                if (ep == NULL)
                        ep = &pathstr[strlen(pathstr)];
 
-               path_p = _rtld_append_path(head_p, path_p, bp, ep);
+               path_p = _rtld_append_path(head_p, path_p, bp, ep - bp);
 
                if (ep[0] == '\0')
                        break;
@@ -186,16 +187,17 @@
  *     <library_name>  <machdep_variable> <value,...:library_name,...> ... 
  */
 static void
-_rtld_process_mapping(lib_p, bp, ep)
+_rtld_process_mapping(lib_p, bp, len)
        Library_Xform **lib_p;
-       char *bp, *ep;
+       char *bp;
+       size_t len;
 {
        static const char WS[] = " \t\n";
        Library_Xform *hwptr = NULL;
        char *ptr, *key, *lib, *l;
        int i, j, k;
        
-       if (bp == NULL || bp == ep || *bp == '\0')
+       if (bp == NULL || len == 0 || *bp == '\0')
                return;
 
        dbg((" processing mapping \"%s\"", bp));
@@ -372,12 +374,13 @@
                        break;
 
                case '\n':
-                       *p = '\0';
                        if (doing_path)
                                path_p = _rtld_append_path(head_p, path_p, b,
-                                   p);
-                       else
-                               _rtld_process_mapping(lib_p, b, p);
+                                   p - b);
+                       else {
+                               *p = '\0';
+                               _rtld_process_mapping(lib_p, b, p - b);
+                       }
                        b = NULL;
                        break;
 
@@ -387,13 +390,15 @@
                                for  (sp = p - 1; *sp == ' ' ||
                                    *sp == '\t'; --sp)
                                        continue;
-                               *++sp = '\0';
+                               ++sp;
                                if (doing_path)
                                        path_p = _rtld_append_path(head_p,
-                                           path_p, b, sp);
-                               else
-                                       _rtld_process_mapping(lib_p, b, sp);
-                               *sp = ' ';
+                                           path_p, b, sp - b);
+                               else {
+                                       *sp = '\0';
+                                       _rtld_process_mapping(lib_p, b, sp - b);
+                                       *sp = ' ';
+                               }
                        }
                        b = NULL;
                        break;
@@ -406,9 +411,9 @@
        }
 
        if (doing_path)
-               path_p = _rtld_append_path(head_p, path_p, b, ebuf);
+               path_p = _rtld_append_path(head_p, path_p, b, ebuf - b);
        else
-               _rtld_process_mapping(lib_p, b, ebuf);
+               _rtld_process_mapping(lib_p, b, ebuf - b);
 
        (void)munmap(buf, sz);
 }
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/rtld.c  Sat Oct 05 11:59:03 2002 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: rtld.c,v 1.86 2002/10/04 18:50:43 mycroft Exp $         */
+/*     $NetBSD: rtld.c,v 1.87 2002/10/05 11:59:04 mycroft Exp $         */
 
 /*
  * Copyright 1996 John D. Polstra.
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
+ * Copyright 2002 Charles M. Hannum <root%ihack.net@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/search.c
--- a/libexec/ld.elf_so/search.c        Sat Oct 05 11:43:23 2002 +0000
+++ b/libexec/ld.elf_so/search.c        Sat Oct 05 11:59:03 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: search.c,v 1.14 2002/10/01 14:16:53 junyoung Exp $      */
+/*     $NetBSD: search.c,v 1.15 2002/10/05 11:59:04 mycroft Exp $       */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -77,8 +77,8 @@
 
        for (sp = _rtld_invalid_paths; sp != NULL; sp = sp->sp_next) {
                if (sp->sp_pathlen == pathnamelen &&
-                   !strncmp(name, sp->sp_path + dirlen + 1, namelen) &&
-                   !strncmp(dir, sp->sp_path, dirlen)) {
+                   !memcmp(name, sp->sp_path + dirlen + 1, namelen) &&
+                   !memcmp(dir, sp->sp_path, dirlen)) {
                        return NULL;
                }
        }
diff -r 937307e08a5b -r 128dff69b3e6 libexec/ld.elf_so/symbol.c



Home | Main Index | Thread Index | Old Index