Date: Wed, 17 Sep 2008 20:14:58 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 149955 for review Message-ID: <200809172014.m8HKEwjR062892@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149955 Change 149955 by ed@ed_dull on 2008/09/17 20:14:44 See what happens if we remove quote bits from clists. These bits were only used back in the days when our TTY's used clists. Affected files ... .. //depot/projects/mpsafetty/sys/kern/subr_clist.c#3 edit .. //depot/projects/mpsafetty/sys/sys/clist.h#2 edit .. //depot/projects/mpsafetty/sys/sys/param.h#11 edit Differences ... ==== //depot/projects/mpsafetty/sys/kern/subr_clist.c#3 (text+ko) ==== @@ -52,8 +52,6 @@ #define INITIAL_CBLOCKS 50 #endif -#define QUOTEMASK 0x100 - static struct cblock *cblock_alloc(void); static void cblock_alloc_cblocks(int number); static void cblock_free(struct cblock *cblockp); @@ -118,8 +116,6 @@ cblock_free(cblockp) struct cblock *cblockp; { - if (isset(cblockp->c_quote, CBQSIZE * NBBY - 1)) - bzero(cblockp->c_quote, sizeof cblockp->c_quote); cblockp->c_next = cfreelist; cfreelist = cblockp; cfreecount += CBSIZE; @@ -146,7 +142,6 @@ * Freed cblocks have zero quotes and garbage elsewhere. * Set the may-have-quote bit to force zeroing the quotes. */ - setbit(cbp->c_quote, CBQSIZE * NBBY - 1); cblock_free(cbp); } ctotcount += number; @@ -233,12 +228,6 @@ chr = (u_char)*clistp->c_cf; /* - * If this char is quoted, set the flag. - */ - if (isset(cblockp->c_quote, clistp->c_cf - (char *)cblockp->c_info)) - chr |= QUOTEMASK; - - /* * Advance to next character. */ clistp->c_cf++; @@ -405,19 +394,6 @@ } } - /* - * If this character is quoted, set the quote bit, if not, clear it. - */ - if (chr & QUOTEMASK) { - setbit(cblockp->c_quote, clistp->c_cl - (char *)cblockp->c_info); - /* - * Use one of the spare quote bits to record that something - * may be quoted. - */ - setbit(cblockp->c_quote, CBQSIZE * NBBY - 1); - } else - clrbit(cblockp->c_quote, clistp->c_cl - (char *)cblockp->c_info); - *clistp->c_cl++ = chr; clistp->c_cc++; @@ -497,39 +473,6 @@ bcopy(src, clistp->c_cl, numc); /* - * Clear quote bits if they aren't known to be clear. - * The following could probably be made into a separate - * "bitzero()" routine, but why bother? - */ - if (isset(cblockp->c_quote, CBQSIZE * NBBY - 1)) { - startbit = clistp->c_cl - (char *)cblockp->c_info; - endbit = startbit + numc - 1; - - firstbyte = (u_char *)cblockp->c_quote + (startbit / NBBY); - lastbyte = (u_char *)cblockp->c_quote + (endbit / NBBY); - - /* - * Calculate mask of bits to preserve in first and - * last bytes. - */ - startmask = NBBY - (startbit % NBBY); - startmask = 0xff >> startmask; - endmask = (endbit % NBBY); - endmask = 0xff << (endmask + 1); - - if (firstbyte != lastbyte) { - *firstbyte &= startmask; - *lastbyte &= endmask; - - num_between = lastbyte - firstbyte - 1; - if (num_between) - bzero(firstbyte + 1, num_between); - } else { - *firstbyte &= (startmask | endmask); - } - } - - /* * ...and update pointer for the next chunk. */ src += numc; @@ -582,7 +525,7 @@ * Get the character. Set the quote flag if this character * is quoted. */ - *dst = (u_char)*cp | (isset(cblockp->c_quote, cp - (char *)cblockp->c_info) ? QUOTEMASK : 0); + *dst = (u_char)*cp; return (cp); } @@ -613,12 +556,6 @@ cblockp = (struct cblock *)((intptr_t)clistp->c_cl & ~CROUND); /* - * Set quote flag if this character was quoted. - */ - if (isset(cblockp->c_quote, (u_char *)clistp->c_cl - cblockp->c_info)) - chr |= QUOTEMASK; - - /* * If all of the characters have been unput in this * cblock, then find the previous one and free this * one. ==== //depot/projects/mpsafetty/sys/sys/clist.h#2 (text+ko) ==== @@ -50,7 +50,6 @@ struct cblock { struct cblock *c_next; /* next cblock in queue */ - unsigned char c_quote[CBQSIZE]; /* quoted characters */ unsigned char c_info[CBSIZE]; /* characters */ }; ==== //depot/projects/mpsafetty/sys/sys/param.h#11 (text+ko) ==== @@ -193,9 +193,8 @@ #define NODEV (dev_t)(-1) /* non-existent device */ #define CBLOCK 128 /* Clist block size, must be a power of 2. */ -#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ /* Data chars/clist. */ -#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) +#define CBSIZE (CBLOCK - sizeof(struct cblock *)) #define CROUND (CBLOCK - 1) /* Clist rounding. */ /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809172014.m8HKEwjR062892>