diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-07-06 00:20:50 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-07-06 00:20:50 +0000 |
commit | a67c6273255c0357bf1e14ea35005b47c9a94e6c (patch) | |
tree | 34bce2531223bbc738b0c4e13fa25aeca2d1d79e /libc/stdlib | |
parent | 42ee079162ef0aacb93181dcc0df86c9d33f75c5 (diff) |
Lots and lots of cleanups.
-Erik
Diffstat (limited to 'libc/stdlib')
-rw-r--r-- | libc/stdlib/bsearch.c | 2 | ||||
-rw-r--r-- | libc/stdlib/mkstemp.c | 4 | ||||
-rw-r--r-- | libc/stdlib/mktemp.c | 4 | ||||
-rw-r--r-- | libc/stdlib/putenv.c | 2 | ||||
-rw-r--r-- | libc/stdlib/qsort.c | 11 | ||||
-rw-r--r-- | libc/stdlib/rand.c | 2 | ||||
-rw-r--r-- | libc/stdlib/setenv.c | 3 | ||||
-rw-r--r-- | libc/stdlib/system.c | 2 |
8 files changed, 16 insertions, 14 deletions
diff --git a/libc/stdlib/bsearch.c b/libc/stdlib/bsearch.c index 989866743..72ba2617a 100644 --- a/libc/stdlib/bsearch.c +++ b/libc/stdlib/bsearch.c @@ -28,7 +28,7 @@ register int (*cmp) (); /* comparison function */ while (a <= b) { c = (a + b) >> 1; /* == ((a + b) / 2) */ - if (dir = (*cmp) ((base + (c * size)), key)) + if ((dir = (*cmp) ((base + (c * size)), key))) { if (dir > 0) b = c - 1; diff --git a/libc/stdlib/mkstemp.c b/libc/stdlib/mkstemp.c index d65ada4f7..de3c682b2 100644 --- a/libc/stdlib/mkstemp.c +++ b/libc/stdlib/mkstemp.c @@ -1,4 +1,4 @@ - +#include <string.h> #include <features.h> #include <unistd.h> #include <fcntl.h> @@ -7,7 +7,7 @@ int mkstemp(template) char * template; { int i; - int num; /* UNINITIALIZED */ + int num __attribute__ ((unused)); /* UNINITIALIZED */ int n2; int l = strlen(template); diff --git a/libc/stdlib/mktemp.c b/libc/stdlib/mktemp.c index 08b356710..bbe589efc 100644 --- a/libc/stdlib/mktemp.c +++ b/libc/stdlib/mktemp.c @@ -1,4 +1,4 @@ - +#include <string.h> #include <features.h> #include <unistd.h> #include <fcntl.h> @@ -8,7 +8,7 @@ char * mktemp(template) char * template; { int i; - int num; /* UNINITIALIZED */ + int num __attribute__ ((unused)); /* UNINITIALIZED */ int n2; int l = strlen(template); struct stat stbuf; diff --git a/libc/stdlib/putenv.c b/libc/stdlib/putenv.c index a7a453d5f..692aefb5e 100644 --- a/libc/stdlib/putenv.c +++ b/libc/stdlib/putenv.c @@ -33,7 +33,7 @@ static int extras = 0; { if( memcmp(var, *p, len) == 0 && (*p)[len] == '=' ) { - while( p[0] = p[1] ) p++; + while( (p[0] = p[1]) ) p++; extras++; break; } diff --git a/libc/stdlib/qsort.c b/libc/stdlib/qsort.c index cee53c398..b45716c83 100644 --- a/libc/stdlib/qsort.c +++ b/libc/stdlib/qsort.c @@ -14,7 +14,7 @@ char *_qbuf = 0; /* pointer to storage for qsort() */ #define PIVOT ((i+j)>>1) #define moveitem(dst,src,size) if(dst != src) memcpy(dst, src, size) -static +static void _wqsort(base, lo, hi, cmp) register int *base; register int lo; @@ -56,7 +56,7 @@ register int (*cmp) (); } } -static +static void _lqsort(base, lo, hi, cmp) register long *base; register int lo; @@ -98,7 +98,7 @@ register int (*cmp) (); } } -static +static void _nqsort(base, lo, hi, size, cmp) register char *base; register int lo; @@ -141,7 +141,7 @@ register int (*cmp) (); } } -qsort(base, num, size, cmp) +extern int qsort(base, num, size, cmp) char *base; int num; int size; @@ -152,7 +152,7 @@ int (*cmp) (); if (_qbuf == 0) { if (size > sizeof(_qtemp))/* records too large! */ - return; + return 1; _qbuf = _qtemp; } if (size == 2) @@ -163,4 +163,5 @@ int (*cmp) (); _nqsort(base, 0, num - 1, size, cmp); if (_qbuf == _qtemp) _qbuf = 0; + return 0; } diff --git a/libc/stdlib/rand.c b/libc/stdlib/rand.c index 4eb07894b..4bf98d5bc 100644 --- a/libc/stdlib/rand.c +++ b/libc/stdlib/rand.c @@ -41,7 +41,7 @@ static int seed3 = 1; int rand() { - register int q, z; + register int q; CRANK(206, 157, 31, 32363, seed1); CRANK(217, 146, 45, 31727, seed2); CRANK(222, 142, 133, 31657, seed3); diff --git a/libc/stdlib/setenv.c b/libc/stdlib/setenv.c index 0990fdec2..afe5676d1 100644 --- a/libc/stdlib/setenv.c +++ b/libc/stdlib/setenv.c @@ -35,7 +35,8 @@ static int extras = 0; { if (!overwrite) return -1; - while( p[0] = p[1] ) p++; + /* Overwrite stuff */ + while( (p[0] = p[1]) ) p++; extras++; break; } diff --git a/libc/stdlib/system.c b/libc/stdlib/system.c index b764613be..74ac27b64 100644 --- a/libc/stdlib/system.c +++ b/libc/stdlib/system.c @@ -7,7 +7,7 @@ int system(command) char * command; { - int wait_val, wait_ret, pid; + int wait_val, pid; __sighandler_t save_quit, save_int, save_chld; if( command == 0 ) return 1; |