cleanups spotted by irix cc

This commit is contained in:
Russ Cox 2005-12-29 23:15:58 +00:00
parent 3c84c725ef
commit 21b830b1ac
8 changed files with 22 additions and 42 deletions

View File

@ -30,7 +30,6 @@ emallocz(ulong n)
return v;
}
ulong messagesize;
void
Xversion(Fsrpc *t)
@ -392,7 +391,7 @@ Xwstat(Fsrpc *t)
return;
}
strings = emallocz(t->work.nstat); /* ample */
if(convM2D(t->work.stat, t->work.nstat, &d, strings) < 0){
if(convM2D(t->work.stat, t->work.nstat, &d, strings) <= BIT16SZ){
rerrstr(err, sizeof err);
reply(&t->work, &rhdr, err);
t->busy = 0;

View File

@ -159,7 +159,6 @@ putXdata(Memimage *m, Rectangle r)
Xmem *xm;
XImage *xi;
GC g;
int offset;
Point xdelta, delta;
Point tp;
int x, y;
@ -175,10 +174,6 @@ putXdata(Memimage *m, Rectangle r)
xi = xm->xi;
g = (m->chan == GREY1) ? xgccopy0 : xgccopy;
if(m->depth == 24)
offset = r.min.x % 4;
else
offset = m->r.min.x & (31/m->depth);
delta = subpt(r.min, m->r.min);
tp = xm->r.min; /* avoid unaligned access on digital unix */

View File

@ -73,8 +73,6 @@ Atom targets;
Atom text;
Atom compoundtext;
static XModifierKeymap *modmap;
static int keypermod;
static Drawable xdrawable;
/* static Atom wm_take_focus; */
static void xexpose(XEvent*);
@ -288,7 +286,6 @@ xinitscreen(void)
XSetWindowAttributes attrs;
XPixmapFormatValues *pfmt;
int n;
Memdata *md;
xscreenid = 0;
xdrawable = 0;
@ -378,14 +375,11 @@ xinitscreen(void)
initmap(rootwin);
}
if((modmap = XGetModifierMapping(xdisplay)))
keypermod = modmap->max_keypermod;
r.min = ZP;
r.max.x = WidthOfScreen(screen);
r.max.y = HeightOfScreen(screen);
md = mallocz(sizeof(Memdata), 1);
xsize = Dx(r)*3/4;
ysize = Dy(r)*3/4;
@ -644,11 +638,7 @@ xmapping(XEvent *e)
if(e->type != MappingNotify)
return;
xe = (XMappingEvent*)e;
if(modmap)
XFreeModifiermap(modmap);
modmap = XGetModifierMapping(xe->display);
if(modmap)
keypermod = modmap->max_keypermod;
USED(xe);
}

View File

@ -72,7 +72,7 @@ so_connect(int fd, unsigned long raddr, unsigned short rport)
void
so_getsockname(int fd, unsigned long *laddr, unsigned short *lport)
{
uint len;
socklen_t len;
struct sockaddr_in sin;
len = sizeof(sin);
@ -97,7 +97,7 @@ int
so_accept(int fd, unsigned long *raddr, unsigned short *rport)
{
int nfd;
uint len;
socklen_t len;
struct sockaddr_in sin;
len = sizeof(sin);

View File

@ -126,6 +126,7 @@ tramp(void *vp)
/* BUG: leaks Proc */
pthread_setspecific(prdakey, 0);
pthread_exit(0);
return 0;
}
void
@ -161,20 +162,32 @@ int randfd;
void
randominit(void)
{
#ifdef USE_RANDOM
srandom(getpid()+fastticks(nil)+ticks());
#else
if((randfd = open("/dev/urandom", OREAD)) < 0)
if((randfd = open("/dev/random", OREAD)) < 0)
panic("open /dev/random: %r");
#endif
}
#undef read
ulong
randomread(void *v, ulong n)
{
#ifdef USE_RANDOM
int i;
for(i=0; i<n; i++)
((uchar*)v)[i] = random();
return n;
#else
int m;
if((m = read(randfd, v, n)) != n)
panic("short read from /dev/random: %d but %d", n, m);
return m;
#endif
}
#undef time

View File

@ -1159,7 +1159,6 @@ long
qbwrite(Queue *q, Block *b)
{
int n, dowakeup;
Proc *p;
n = BLEN(b);
@ -1222,10 +1221,11 @@ qbwrite(Queue *q, Block *b)
/* wakeup anyone consuming at the other end */
if(dowakeup){
p = wakeup(&q->rr);
wakeup(&q->rr);
/* if we just wokeup a higher priority process, let it run */
/*
p = wakeup(&q->rr);
if(p != nil && p->priority > up->priority)
sched();
*/

View File

@ -27,10 +27,9 @@ extern Memimage *gscreen;
static Rectangle flushr;
static Rectangle window;
static Point curpos;
static int h, w;
static int h;
static void termscreenputs(char*, int);
Point ZP;
static void
screenflush(void)
@ -51,7 +50,7 @@ addflush(Rectangle r)
static void
screenwin(void)
{
Point p, q;
Point p;
char *greet;
Memimage *grey;
@ -60,7 +59,6 @@ screenwin(void)
conscol = memblack;
memfillcolor(gscreen, 0x444488FF);
w = memdefont->info[' '].width;
h = memdefont->height;
window.min = addpt(gscreen->r.min, Pt(20,20));
@ -83,7 +81,6 @@ screenwin(void)
greet = " Plan 9 Console ";
p = addpt(window.min, Pt(10, 0));
q = memsubfontwidth(memdefont, greet);
memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
window.min.y += h+6;
curpos = window.min;

View File

@ -308,9 +308,6 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask,
* Conversion tables.
*/
static uchar replbit[1+8][256]; /* replbit[x][y] is the replication of the x-bit quantity y to 8-bit depth */
static uchar conv18[256][8]; /* conv18[x][y] is the yth pixel in the depth-1 pixel x */
static uchar conv28[256][4]; /* ... */
static uchar conv48[256][2];
/*
* bitmap of how to replicate n bits to fill 8, for 1 n 8.
@ -344,7 +341,7 @@ static int replmul[1+8] = {
static void
mktables(void)
{
int i, j, mask, sh, small;
int i, j, small;
if(tablesbuilt)
return;
@ -361,17 +358,6 @@ mktables(void)
}
}
/* bit unpacking up to 8 bits, only powers of 2 */
for(i=0; i<256; i++){
for(j=0, sh=7, mask=1; j<8; j++, sh--)
conv18[i][j] = replbit[1][(i>>sh)&mask];
for(j=0, sh=6, mask=3; j<4; j++, sh-=2)
conv28[i][j] = replbit[2][(i>>sh)&mask];
for(j=0, sh=4, mask=15; j<2; j++, sh-=4)
conv48[i][j] = replbit[4][(i>>sh)&mask];
}
}
static uchar ones = 0xff;