ctype bug

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Jul 6 16:52:37 PDT 2005

On 07.07.2005, at 01:15, Matthew Dillon wrote:
    I am not going to cast the argument to an unsigned char, but I am 
    to change the macros to work the same way they work in FreeBSD, 
    is to say it will test whether the passed value is in the proper 
    rather then blindly indexing into an array.
I agree we should prevent missindexing. how about:

#ifdef __CTYPE_FAST
#define	VALID_BOUNDS(c)	/**/
#define	VALID_BOUNDS(c)	assert(c >= -1 && i < 256)
#define	VALID_BOUND(c)	if (c != -1) c &= 255;
static __inline int
isprint(int c)
	return ((int)((__libc_ctype_ + 1)[c] & _R));
oh well, doesn't look too good. maybe it's too late here.

Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00010.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/commits/attachments/20050706/50884405/attachment-0018.obj>

More information about the Commits mailing list