cleanups spotted by irix cc
This commit is contained in:
parent
3c84c725ef
commit
21b830b1ac
@ -30,7 +30,6 @@ emallocz(ulong n)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong messagesize;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Xversion(Fsrpc *t)
|
Xversion(Fsrpc *t)
|
||||||
@ -392,7 +391,7 @@ Xwstat(Fsrpc *t)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strings = emallocz(t->work.nstat); /* ample */
|
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);
|
rerrstr(err, sizeof err);
|
||||||
reply(&t->work, &rhdr, err);
|
reply(&t->work, &rhdr, err);
|
||||||
t->busy = 0;
|
t->busy = 0;
|
||||||
|
@ -159,7 +159,6 @@ putXdata(Memimage *m, Rectangle r)
|
|||||||
Xmem *xm;
|
Xmem *xm;
|
||||||
XImage *xi;
|
XImage *xi;
|
||||||
GC g;
|
GC g;
|
||||||
int offset;
|
|
||||||
Point xdelta, delta;
|
Point xdelta, delta;
|
||||||
Point tp;
|
Point tp;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -175,10 +174,6 @@ putXdata(Memimage *m, Rectangle r)
|
|||||||
xi = xm->xi;
|
xi = xm->xi;
|
||||||
|
|
||||||
g = (m->chan == GREY1) ? xgccopy0 : xgccopy;
|
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);
|
delta = subpt(r.min, m->r.min);
|
||||||
tp = xm->r.min; /* avoid unaligned access on digital unix */
|
tp = xm->r.min; /* avoid unaligned access on digital unix */
|
||||||
|
@ -73,8 +73,6 @@ Atom targets;
|
|||||||
Atom text;
|
Atom text;
|
||||||
Atom compoundtext;
|
Atom compoundtext;
|
||||||
|
|
||||||
static XModifierKeymap *modmap;
|
|
||||||
static int keypermod;
|
|
||||||
static Drawable xdrawable;
|
static Drawable xdrawable;
|
||||||
/* static Atom wm_take_focus; */
|
/* static Atom wm_take_focus; */
|
||||||
static void xexpose(XEvent*);
|
static void xexpose(XEvent*);
|
||||||
@ -288,7 +286,6 @@ xinitscreen(void)
|
|||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
XPixmapFormatValues *pfmt;
|
XPixmapFormatValues *pfmt;
|
||||||
int n;
|
int n;
|
||||||
Memdata *md;
|
|
||||||
|
|
||||||
xscreenid = 0;
|
xscreenid = 0;
|
||||||
xdrawable = 0;
|
xdrawable = 0;
|
||||||
@ -378,14 +375,11 @@ xinitscreen(void)
|
|||||||
initmap(rootwin);
|
initmap(rootwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((modmap = XGetModifierMapping(xdisplay)))
|
|
||||||
keypermod = modmap->max_keypermod;
|
|
||||||
|
|
||||||
r.min = ZP;
|
r.min = ZP;
|
||||||
r.max.x = WidthOfScreen(screen);
|
r.max.x = WidthOfScreen(screen);
|
||||||
r.max.y = HeightOfScreen(screen);
|
r.max.y = HeightOfScreen(screen);
|
||||||
|
|
||||||
md = mallocz(sizeof(Memdata), 1);
|
|
||||||
|
|
||||||
xsize = Dx(r)*3/4;
|
xsize = Dx(r)*3/4;
|
||||||
ysize = Dy(r)*3/4;
|
ysize = Dy(r)*3/4;
|
||||||
@ -644,11 +638,7 @@ xmapping(XEvent *e)
|
|||||||
if(e->type != MappingNotify)
|
if(e->type != MappingNotify)
|
||||||
return;
|
return;
|
||||||
xe = (XMappingEvent*)e;
|
xe = (XMappingEvent*)e;
|
||||||
if(modmap)
|
USED(xe);
|
||||||
XFreeModifiermap(modmap);
|
|
||||||
modmap = XGetModifierMapping(xe->display);
|
|
||||||
if(modmap)
|
|
||||||
keypermod = modmap->max_keypermod;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ so_connect(int fd, unsigned long raddr, unsigned short rport)
|
|||||||
void
|
void
|
||||||
so_getsockname(int fd, unsigned long *laddr, unsigned short *lport)
|
so_getsockname(int fd, unsigned long *laddr, unsigned short *lport)
|
||||||
{
|
{
|
||||||
uint len;
|
socklen_t len;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
|
||||||
len = sizeof(sin);
|
len = sizeof(sin);
|
||||||
@ -97,7 +97,7 @@ int
|
|||||||
so_accept(int fd, unsigned long *raddr, unsigned short *rport)
|
so_accept(int fd, unsigned long *raddr, unsigned short *rport)
|
||||||
{
|
{
|
||||||
int nfd;
|
int nfd;
|
||||||
uint len;
|
socklen_t len;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
|
|
||||||
len = sizeof(sin);
|
len = sizeof(sin);
|
||||||
|
13
kern/posix.c
13
kern/posix.c
@ -126,6 +126,7 @@ tramp(void *vp)
|
|||||||
/* BUG: leaks Proc */
|
/* BUG: leaks Proc */
|
||||||
pthread_setspecific(prdakey, 0);
|
pthread_setspecific(prdakey, 0);
|
||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -161,20 +162,32 @@ int randfd;
|
|||||||
void
|
void
|
||||||
randominit(void)
|
randominit(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_RANDOM
|
||||||
|
srandom(getpid()+fastticks(nil)+ticks());
|
||||||
|
#else
|
||||||
if((randfd = open("/dev/urandom", OREAD)) < 0)
|
if((randfd = open("/dev/urandom", OREAD)) < 0)
|
||||||
if((randfd = open("/dev/random", OREAD)) < 0)
|
if((randfd = open("/dev/random", OREAD)) < 0)
|
||||||
panic("open /dev/random: %r");
|
panic("open /dev/random: %r");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef read
|
#undef read
|
||||||
ulong
|
ulong
|
||||||
randomread(void *v, ulong n)
|
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;
|
int m;
|
||||||
|
|
||||||
if((m = read(randfd, v, n)) != n)
|
if((m = read(randfd, v, n)) != n)
|
||||||
panic("short read from /dev/random: %d but %d", n, m);
|
panic("short read from /dev/random: %d but %d", n, m);
|
||||||
return m;
|
return m;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef time
|
#undef time
|
||||||
|
@ -1159,7 +1159,6 @@ long
|
|||||||
qbwrite(Queue *q, Block *b)
|
qbwrite(Queue *q, Block *b)
|
||||||
{
|
{
|
||||||
int n, dowakeup;
|
int n, dowakeup;
|
||||||
Proc *p;
|
|
||||||
|
|
||||||
n = BLEN(b);
|
n = BLEN(b);
|
||||||
|
|
||||||
@ -1222,10 +1221,11 @@ qbwrite(Queue *q, Block *b)
|
|||||||
|
|
||||||
/* wakeup anyone consuming at the other end */
|
/* wakeup anyone consuming at the other end */
|
||||||
if(dowakeup){
|
if(dowakeup){
|
||||||
p = wakeup(&q->rr);
|
wakeup(&q->rr);
|
||||||
|
|
||||||
/* if we just wokeup a higher priority process, let it run */
|
/* if we just wokeup a higher priority process, let it run */
|
||||||
/*
|
/*
|
||||||
|
p = wakeup(&q->rr);
|
||||||
if(p != nil && p->priority > up->priority)
|
if(p != nil && p->priority > up->priority)
|
||||||
sched();
|
sched();
|
||||||
*/
|
*/
|
||||||
|
@ -27,10 +27,9 @@ extern Memimage *gscreen;
|
|||||||
static Rectangle flushr;
|
static Rectangle flushr;
|
||||||
static Rectangle window;
|
static Rectangle window;
|
||||||
static Point curpos;
|
static Point curpos;
|
||||||
static int h, w;
|
static int h;
|
||||||
static void termscreenputs(char*, int);
|
static void termscreenputs(char*, int);
|
||||||
|
|
||||||
Point ZP;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
screenflush(void)
|
screenflush(void)
|
||||||
@ -51,7 +50,7 @@ addflush(Rectangle r)
|
|||||||
static void
|
static void
|
||||||
screenwin(void)
|
screenwin(void)
|
||||||
{
|
{
|
||||||
Point p, q;
|
Point p;
|
||||||
char *greet;
|
char *greet;
|
||||||
Memimage *grey;
|
Memimage *grey;
|
||||||
|
|
||||||
@ -60,7 +59,6 @@ screenwin(void)
|
|||||||
conscol = memblack;
|
conscol = memblack;
|
||||||
memfillcolor(gscreen, 0x444488FF);
|
memfillcolor(gscreen, 0x444488FF);
|
||||||
|
|
||||||
w = memdefont->info[' '].width;
|
|
||||||
h = memdefont->height;
|
h = memdefont->height;
|
||||||
|
|
||||||
window.min = addpt(gscreen->r.min, Pt(20,20));
|
window.min = addpt(gscreen->r.min, Pt(20,20));
|
||||||
@ -83,7 +81,6 @@ screenwin(void)
|
|||||||
|
|
||||||
greet = " Plan 9 Console ";
|
greet = " Plan 9 Console ";
|
||||||
p = addpt(window.min, Pt(10, 0));
|
p = addpt(window.min, Pt(10, 0));
|
||||||
q = memsubfontwidth(memdefont, greet);
|
|
||||||
memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
|
memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
|
||||||
window.min.y += h+6;
|
window.min.y += h+6;
|
||||||
curpos = window.min;
|
curpos = window.min;
|
||||||
|
@ -308,9 +308,6 @@ drawclip(Memimage *dst, Rectangle *r, Memimage *src, Point *p0, Memimage *mask,
|
|||||||
* Conversion tables.
|
* 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 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.
|
* 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
|
static void
|
||||||
mktables(void)
|
mktables(void)
|
||||||
{
|
{
|
||||||
int i, j, mask, sh, small;
|
int i, j, small;
|
||||||
|
|
||||||
if(tablesbuilt)
|
if(tablesbuilt)
|
||||||
return;
|
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;
|
static uchar ones = 0xff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user