silence all gcc warnings

This commit is contained in:
Russ Cox
2005-11-07 17:13:41 +00:00
parent 7732ac0a9b
commit 1c8b499228
47 changed files with 192 additions and 128 deletions

View File

@ -167,7 +167,6 @@ kstrdup(char **p, char *s)
{
int n;
char *t, *prev;
static Lock l;
n = strlen(s)+1;
/* if it's a user, we can wait for memory; if not, something's very wrong */
@ -1422,8 +1421,7 @@ char isfrog[256]={
void
validname(char *aname, int slashok)
{
char *p, *ename, *name;
uint t;
char *ename, *name;
int c;
Rune r;

View File

@ -136,7 +136,7 @@ enum
COPEN = 0x0001, /* for i/o */
CMSG = 0x0002, /* the message channel for a mount */
/*rsc CCREATE = 0x0004, /* permits creation if c->mnt */
/* CCREATE = 0x0004, permits creation if c->mnt */
CCEXEC = 0x0008, /* close on exec */
CFREE = 0x0010, /* not in use */
CRCLOSE = 0x0020, /* remove on close */

View File

@ -128,9 +128,6 @@ prflush(void)
static void
putstrn0(char *str, int n, int usewrite)
{
int m;
char *t;
/*
* if someone is reading /dev/kprint,
* put the message there.
@ -294,8 +291,7 @@ echoserialoq(char *buf, int n)
static void
echo(char *buf, int n)
{
static int ctrlt, pid;
extern ulong etext;
static int ctrlt;
int x;
char *e, *p;
@ -655,11 +651,10 @@ consclose(Chan *c)
static long
consread(Chan *c, void *buf, long n, vlong off)
{
ulong l;
char *b, *bp;
char *b;
char tmp[128]; /* must be >= 6*NUMSIZE */
char *cbuf = buf;
int ch, i, k, id, eol;
int ch, i, eol;
vlong offset = off;
if(n <= 0)
@ -819,7 +814,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
char buf[256];
long l, bp;
char *a = va;
int id, fd;
int fd;
Chan *swc;
ulong offset = off;
Cmdbuf *cb;
@ -866,7 +861,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
} else if(strncmp(a, "ctlpoff", 7) == 0){
kbd.ctlpoff = 1;
}
if(a = strchr(a, ' '))
if((a = strchr(a, ' ')))
a++;
}
break;
@ -999,19 +994,19 @@ seedrand(void)
randomread((void*)&randn, sizeof(randn));
}
// int
// nrand(int n)
// {
// if(randn == 0)
// seedrand();
// randn = randn*1103515245 + 12345 + fastticks(0);
// return (randn>>16) % n;
// }
int
xnrand(int n)
{
if(randn == 0)
seedrand();
randn = randn*1103515245 + 12345 + fastticks(0);
return (randn>>16) % n;
}
int
rand(void)
{
nrand(1);
xnrand(1);
return randn;
}
@ -1058,6 +1053,7 @@ le2long(long *to, uchar *f)
return f+sizeof(long);
}
/*
static uchar*
long2le(uchar *t, long from)
{
@ -1070,6 +1066,7 @@ long2le(uchar *t, long from)
t[i] = f[o[i]];
return t+sizeof(long);
}
*/
char *Ebadtimectl = "bad time control";

View File

@ -176,7 +176,7 @@ static char Ewriteoutside[] = "writeimage outside image";
static char Enotfont[] = "image not a font";
static char Eindex[] = "character index out of range";
static char Enoclient[] = "no such draw client";
static char Edepth[] = "image has bad depth";
/* static char Edepth[] = "image has bad depth"; */
static char Enameused[] = "image name in use";
static char Enoname[] = "no image with that name";
static char Eoldname[] = "named image no longer valid";
@ -627,7 +627,7 @@ drawfreedscreen(DScreen *this)
dscreen = this->next;
goto Found;
}
while(next = ds->next){ /* assign = */
while((next = ds->next)){ /* assign = */
if(next == this){
ds->next = this->next;
goto Found;
@ -702,7 +702,7 @@ drawuninstallscreen(Client *client, CScreen *this)
free(this);
return;
}
while(next = cs->next){ /* assign = */
while((next = cs->next)){ /* assign = */
if(next == this){
cs->next = this->next;
drawfreedscreen(this->dscreen);
@ -726,7 +726,7 @@ drawuninstall(Client *client, int id)
drawfreedimage(d);
return;
}
while(next = d->next){ /* assign = */
while((next = d->next)){ /* assign = */
if(next->id == id){
d->next = next->next;
drawfreedimage(next);
@ -1024,7 +1024,7 @@ drawclose(Chan *c)
if(QID(c->qid) == Qctl)
cl->busy = 0;
if((c->flag&COPEN) && (decref(&cl->r)==0)){
while(r = cl->refresh){ /* assign = */
while((r = cl->refresh)){ /* assign = */
cl->refresh = r->next;
free(r);
}

View File

@ -413,7 +413,7 @@ fswstat(Chan *c, uchar *buf, int n)
{
Dir d;
struct stat stbuf;
char old[MAXPATH], new[MAXPATH], dir[MAXPATH];
char old[MAXPATH], new[MAXPATH];
char strs[MAXPATH*3], *p;
Ufsinfo *uif;
@ -491,9 +491,6 @@ fsqid(char *p, struct stat *st)
static void
fspath(Chan *c, char *ext, char *path)
{
int i, n;
char *comp[MAXCOMP];
strcpy(path, base);
strcat(path, "/");
strcat(path, uc2name(c));

View File

@ -199,7 +199,7 @@ so_getservbyname(char *service, char *net, char *port)
int
so_send(int fd, void *d, int n, int f)
{
send(fd, d, n, f);
return send(fd, d, n, f);
}
int

View File

@ -621,9 +621,6 @@ eipfmt(Fmt *f)
static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux";
static char *ifmt = "%d.%d.%d.%d";
uchar *p, ip[16];
ulong *lp;
ushort s;
int i, j, n, eln, eli;
ulong ul;
switch(f->r) {

View File

@ -9,6 +9,8 @@ void so_connect(int, unsigned long, unsigned short);
void so_getsockname(int, unsigned long*, unsigned short*);
void so_bind(int, int, unsigned short);
void so_listen(int);
int so_send(int, void*, int, int);
int so_recv(int, void*, int, int);
int so_accept(int, unsigned long*, unsigned short*);
int so_getservbyname(char*, char*, char*);
int so_gethostbyname(char*, char**, int);

View File

@ -151,7 +151,7 @@ void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int);
void kstrdup(char**, char*);
long latin1(Rune*, int);
int lock(Lock*);
void lock(Lock*);
void lockinit(void);
void logopen(Log*);
void logclose(Log*);
@ -197,6 +197,7 @@ int nrand(int);
int okaddr(ulong, ulong, int);
int openmode(ulong);
void oserrstr(void);
void oserror(void);
Block* packblock(Block*);
Block* padblock(Block*, int);
void pagechainhead(Page*);
@ -379,3 +380,12 @@ void hnputs(void*, ushort);
vlong nhgetv(void*);
ulong nhgetl(void*);
ushort nhgets(void*);
ulong ticks(void);
void osproc(Proc*);
void osnewproc(Proc*);
void procsleep(void);
void procwakeup(Proc*);
void osinit(void);
void screeninit(void);
extern void terminit(void);

View File

@ -189,7 +189,7 @@ dupfgrp(Fgrp *f)
new->maxfd = f->maxfd;
for(i = 0; i <= f->maxfd; i++) {
if(c = f->fd[i]){
if((c = f->fd[i])){
incref(&c->ref);
new->fd[i] = c;
}
@ -212,7 +212,7 @@ closefgrp(Fgrp *f)
return;
for(i = 0; i <= f->maxfd; i++)
if(c = f->fd[i])
if((c = f->fd[i]))
cclose(c);
free(f->fd);

View File

@ -86,7 +86,6 @@ void
oserrstr(void)
{
char *p;
char buf[ERRMAX];
if((p = strerror(errno)) != nil)
strecpy(up->errstr, up->errstr+ERRMAX, p);
@ -132,7 +131,6 @@ tramp(void *vp)
void
procsleep(void)
{
int c;
Proc *p;
Oproc *op;

View File

@ -213,7 +213,7 @@ pullupblock(Block *bp, int n)
* copy bytes from the trailing blocks into the first
*/
n -= BLEN(bp);
while(nbp = bp->next){
while((nbp = bp->next)){
i = BLEN(nbp);
if(i > n) {
memmove(bp->wp, nbp->rp, n);

View File

@ -152,6 +152,7 @@ postnote(Proc *p, int x, char *msg, int flag)
USED(x);
USED(msg);
USED(flag);
return 0;
}
void