diff options
Diffstat (limited to 'src/lib/libc')
-rw-r--r-- | src/lib/libc/stdlib/getenv.c | 35 | ||||
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 6 | ||||
-rw-r--r-- | src/lib/libc/stdlib/qsort.c | 10 | ||||
-rw-r--r-- | src/lib/libc/stdlib/radixsort.c | 6 |
4 files changed, 29 insertions, 28 deletions
diff --git a/src/lib/libc/stdlib/getenv.c b/src/lib/libc/stdlib/getenv.c index 09d47f2149..d1487a7afc 100644 --- a/src/lib/libc/stdlib/getenv.c +++ b/src/lib/libc/stdlib/getenv.c | |||
@@ -33,27 +33,13 @@ | |||
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | /*static char *sccsid = "from: @(#)getenv.c 5.8 (Berkeley) 2/23/91";*/ | 35 | /*static char *sccsid = "from: @(#)getenv.c 5.8 (Berkeley) 2/23/91";*/ |
36 | static char *rcsid = "$Id: getenv.c,v 1.1.1.1 1995/10/18 08:42:17 deraadt Exp $"; | 36 | static char *rcsid = "$Id: getenv.c,v 1.2 1996/03/25 22:16:38 tholo Exp $"; |
37 | #endif /* LIBC_SCCS and not lint */ | 37 | #endif /* LIBC_SCCS and not lint */ |
38 | 38 | ||
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include <string.h> | 40 | #include <string.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * getenv -- | ||
44 | * Returns ptr to value associated with name, if any, else NULL. | ||
45 | */ | ||
46 | char * | ||
47 | getenv(name) | ||
48 | const char *name; | ||
49 | { | ||
50 | int offset; | ||
51 | char *__findenv(); | ||
52 | |||
53 | return(__findenv(name, &offset)); | ||
54 | } | ||
55 | |||
56 | /* | ||
57 | * __findenv -- | 43 | * __findenv -- |
58 | * Returns pointer to value associated with name, if any, else NULL. | 44 | * Returns pointer to value associated with name, if any, else NULL. |
59 | * Sets offset to be the offset of the name/value combination in the | 45 | * Sets offset to be the offset of the name/value combination in the |
@@ -64,14 +50,15 @@ getenv(name) | |||
64 | */ | 50 | */ |
65 | char * | 51 | char * |
66 | __findenv(name, offset) | 52 | __findenv(name, offset) |
67 | register char *name; | 53 | register const char *name; |
68 | int *offset; | 54 | int *offset; |
69 | { | 55 | { |
70 | extern char **environ; | 56 | extern char **environ; |
71 | register int len; | 57 | register int len; |
72 | register char **P, *C; | 58 | register char **P, *C; |
59 | register const char *cp; | ||
73 | 60 | ||
74 | for (C = name, len = 0; *C && *C != '='; ++C, ++len); | 61 | for (cp = name, len = 0; *cp != '\0' && *cp != '='; ++cp, ++len); |
75 | for (P = environ; *P; ++P) | 62 | for (P = environ; *P; ++P) |
76 | if (!strncmp(*P, name, len)) | 63 | if (!strncmp(*P, name, len)) |
77 | if (*(C = *P + len) == '=') { | 64 | if (*(C = *P + len) == '=') { |
@@ -80,3 +67,17 @@ __findenv(name, offset) | |||
80 | } | 67 | } |
81 | return(NULL); | 68 | return(NULL); |
82 | } | 69 | } |
70 | |||
71 | /* | ||
72 | * getenv -- | ||
73 | * Returns ptr to value associated with name, if any, else NULL. | ||
74 | */ | ||
75 | char * | ||
76 | getenv(name) | ||
77 | const char *name; | ||
78 | { | ||
79 | int offset; | ||
80 | char *__findenv(); | ||
81 | |||
82 | return(__findenv(name, &offset)); | ||
83 | } | ||
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 4498a9fb6c..612759d9b2 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -59,9 +59,6 @@ static char *rcsid = "$NetBSD: malloc.c,v 1.6 1996/01/17 02:45:25 jtc Exp $"; | |||
59 | 59 | ||
60 | #define NULL 0 | 60 | #define NULL 0 |
61 | 61 | ||
62 | static void morecore(); | ||
63 | static int findbucket(); | ||
64 | |||
65 | /* | 62 | /* |
66 | * The overhead on a block is at least 4 bytes. When free, this space | 63 | * The overhead on a block is at least 4 bytes. When free, this space |
67 | * contains a pointer to the next free block, and the bottom two bits must | 64 | * contains a pointer to the next free block, and the bottom two bits must |
@@ -88,6 +85,9 @@ union overhead { | |||
88 | #define ov_size ovu.ovu_size | 85 | #define ov_size ovu.ovu_size |
89 | }; | 86 | }; |
90 | 87 | ||
88 | static void morecore __P((int)); | ||
89 | static int findbucket __P((union overhead *, int)); | ||
90 | |||
91 | #define MAGIC 0xef /* magic # on accounting info */ | 91 | #define MAGIC 0xef /* magic # on accounting info */ |
92 | #define RMAGIC 0x5555 /* magic # on range info */ | 92 | #define RMAGIC 0x5555 /* magic # on range info */ |
93 | 93 | ||
diff --git a/src/lib/libc/stdlib/qsort.c b/src/lib/libc/stdlib/qsort.c index c06bd54054..fe757b9332 100644 --- a/src/lib/libc/stdlib/qsort.c +++ b/src/lib/libc/stdlib/qsort.c | |||
@@ -33,14 +33,14 @@ | |||
33 | 33 | ||
34 | #if defined(LIBC_SCCS) && !defined(lint) | 34 | #if defined(LIBC_SCCS) && !defined(lint) |
35 | /*static char sccsid[] = "from: @(#)qsort.c 8.1 (Berkeley) 6/4/93";*/ | 35 | /*static char sccsid[] = "from: @(#)qsort.c 8.1 (Berkeley) 6/4/93";*/ |
36 | static char *rcsid = "$Id: qsort.c,v 1.1.1.1 1995/10/18 08:42:18 deraadt Exp $"; | 36 | static char *rcsid = "$Id: qsort.c,v 1.2 1996/03/25 22:16:40 tholo Exp $"; |
37 | #endif /* LIBC_SCCS and not lint */ | 37 | #endif /* LIBC_SCCS and not lint */ |
38 | 38 | ||
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | 41 | ||
42 | static inline char *med3 __P((char *, char *, char *, int (*)())); | 42 | static __inline char *med3 __P((char *, char *, char *, int (*)())); |
43 | static inline void swapfunc __P((char *, char *, int, int)); | 43 | static __inline void swapfunc __P((char *, char *, int, int)); |
44 | 44 | ||
45 | #define min(a, b) (a) < (b) ? a : b | 45 | #define min(a, b) (a) < (b) ? a : b |
46 | 46 | ||
@@ -61,7 +61,7 @@ static inline void swapfunc __P((char *, char *, int, int)); | |||
61 | #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ | 61 | #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ |
62 | es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; | 62 | es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; |
63 | 63 | ||
64 | static inline void | 64 | static __inline void |
65 | swapfunc(a, b, n, swaptype) | 65 | swapfunc(a, b, n, swaptype) |
66 | char *a, *b; | 66 | char *a, *b; |
67 | int n, swaptype; | 67 | int n, swaptype; |
@@ -82,7 +82,7 @@ swapfunc(a, b, n, swaptype) | |||
82 | 82 | ||
83 | #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) | 83 | #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) |
84 | 84 | ||
85 | static inline char * | 85 | static __inline char * |
86 | med3(a, b, c, cmp) | 86 | med3(a, b, c, cmp) |
87 | char *a, *b, *c; | 87 | char *a, *b, *c; |
88 | int (*cmp)(); | 88 | int (*cmp)(); |
diff --git a/src/lib/libc/stdlib/radixsort.c b/src/lib/libc/stdlib/radixsort.c index dd51013c94..d571c8f3d2 100644 --- a/src/lib/libc/stdlib/radixsort.c +++ b/src/lib/libc/stdlib/radixsort.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #if defined(LIBC_SCCS) && !defined(lint) | 37 | #if defined(LIBC_SCCS) && !defined(lint) |
38 | /*static char sccsid[] = "from: @(#)radixsort.c 8.1 (Berkeley) 6/4/93";*/ | 38 | /*static char sccsid[] = "from: @(#)radixsort.c 8.1 (Berkeley) 6/4/93";*/ |
39 | static char *rcsid = "$Id: radixsort.c,v 1.1.1.1 1995/10/18 08:42:19 deraadt Exp $"; | 39 | static char *rcsid = "$Id: radixsort.c,v 1.2 1996/03/25 22:16:39 tholo Exp $"; |
40 | #endif /* LIBC_SCCS and not lint */ | 40 | #endif /* LIBC_SCCS and not lint */ |
41 | 41 | ||
42 | /* | 42 | /* |
@@ -61,7 +61,7 @@ typedef struct { | |||
61 | int sn, si; | 61 | int sn, si; |
62 | } stack; | 62 | } stack; |
63 | 63 | ||
64 | static inline void simplesort | 64 | static __inline void simplesort |
65 | __P((const u_char **, int, int, const u_char *, u_int)); | 65 | __P((const u_char **, int, int, const u_char *, u_int)); |
66 | static void r_sort_a __P((const u_char **, int, int, const u_char *, u_int)); | 66 | static void r_sort_a __P((const u_char **, int, int, const u_char *, u_int)); |
67 | static void r_sort_b __P((const u_char **, | 67 | static void r_sort_b __P((const u_char **, |
@@ -295,7 +295,7 @@ r_sort_b(a, ta, n, i, tr, endch) | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | static inline void | 298 | static __inline void |
299 | simplesort(a, n, b, tr, endch) /* insertion sort */ | 299 | simplesort(a, n, b, tr, endch) /* insertion sort */ |
300 | register const u_char **a; | 300 | register const u_char **a; |
301 | int n, b; | 301 | int n, b; |