fixed bugs in tzset and ttyslot, adapted malloc to allocate in bigger chunks

This commit is contained in:
ceriel 1987-08-19 14:44:54 +00:00
parent d747651237
commit cc524c3d9a
3 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,6 @@
/* $Header$ */
#define CLICK_SIZE 16
#define CLICK_SIZE 4096
#if EM_WSIZE == EM_PSIZE
typedef unsigned int vir_bytes;
#else
@ -13,7 +13,7 @@ extern bcopy();
#define NEXT(p) (* (char **) (p))
#ifdef pdp
#define BUGFIX 64
#define BUGFIX 64 /* cannot set break in top 64 bytes */
#else
#define BUGFIX 0
#endif
@ -25,11 +25,15 @@ static grow(len)
unsigned len;
{
register char *p;
register int click = CLICK_SIZE;
p = (char *) ALIGN((vir_bytes) top + sizeof(char *) + len, CLICK_SIZE)
while (click >= 4) {
p = (char *) ALIGN((vir_bytes) top + sizeof(char *) + len, click)
+ BUGFIX;
if (p < top || brk(p - BUGFIX) < 0)
return(0);
if (p > top && brk(p - BUGFIX) >= 0) break;
click >>= 1;
}
if (click < 4) return(0);
top = p - (BUGFIX + sizeof(char *));
for (p = bottom; NEXT(p) != 0; p = (char *) (* (vir_bytes *) p & ~BUSY))
;

View file

@ -60,13 +60,14 @@ ttyslot()
#else
for (;;) {
tp = buf;
for (;;) {
for (;;tp++) {
if (read(fd, tp, 1) != 1) {
close(fd);
return 0;
}
if (*tp == '\n' || tp >= &buf[31]) {
*tp = 0;
if (tp < buf+2) buf[2] = '\0';
tp = buf+2;
break;
}

View file

@ -57,7 +57,6 @@ tzset()
int sign = 1;
strncpy(__tzname[0], p, 3);
p += 3;
if (*(p += 3) == '-') {
sign = -1;
p++;