[klibc] [PATCH] fix off-by-one correction in ctypes
Martin Hicks
mort at wildopensource.com
Mon Nov 24 15:39:36 PST 2003
Me again,
Here's a patch to fix ctypes. There was an off-by-one correction that
looks like it isn't needed. Boundary conditions and single-entry items,
like isspace(), now work for me.
mh
--
Martin Hicks Wild Open Source Inc.
mort at wildopensource.com 613-266-2296
# This is a BitKeeper generated patch for the following project:
# Project Name: The kernel C library
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.248 -> 1.249
# klibc/include/ctype.h 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/11/24 mort at green.i.bork.org 1.249
# Fix ctypes. There was an off-by-one correction that wasn't necessary.
# --------------------------------------------
#
diff -Nru a/klibc/include/ctype.h b/klibc/include/ctype.h
--- a/klibc/include/ctype.h Mon Nov 24 15:37:03 2003
+++ b/klibc/include/ctype.h Mon Nov 24 15:37:03 2003
@@ -35,13 +35,13 @@
__ctype_inline int isalnum(int __c)
{
- return __ctypes[__c+1] &
+ return __ctypes[__c] &
(__ctype_upper|__ctype_lower|__ctype_digit);
}
__ctype_inline int isalpha(int __c)
{
- return __ctypes[__c+1] &
+ return __ctypes[__c] &
(__ctype_upper|__ctype_lower);
}
@@ -57,48 +57,48 @@
__ctype_inline int iscntrl(int __c)
{
- return (__c >= 0) && !(__ctypes[__c+1] & __ctype_print);
+ return (__c >= 0) && !(__ctypes[__c] & __ctype_print);
}
__ctype_inline int isdigit(int __c)
{
- return __ctypes[__c+1] & __ctype_digit;
+ return __ctypes[__c] & __ctype_digit;
}
__ctype_inline int isgraph(int __c)
{
- return __ctypes[__c+1] &
+ return __ctypes[__c] &
(__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct);
}
__ctype_inline int islower(int __c)
{
- return __ctypes[__c+1] & __ctype_lower;
+ return __ctypes[__c] & __ctype_lower;
}
__ctype_inline int isprint(int __c)
{
- return __ctypes[__c+1] & __ctype_print;
+ return __ctypes[__c] & __ctype_print;
}
__ctype_inline int ispunct(int __c)
{
- return __ctypes[__c+1] & __ctype_punct;
+ return __ctypes[__c] & __ctype_punct;
}
__ctype_inline int isspace(int __c)
{
- return __ctypes[__c+1] & __ctype_space;
+ return __ctypes[__c] & __ctype_space;
}
__ctype_inline int isupper(int __c)
{
- return __ctypes[__c+1] & __ctype_upper;
+ return __ctypes[__c] & __ctype_upper;
}
__ctype_inline int isxdigit(int __c)
{
- return __ctypes[__c+1] & __ctype_xdigit;
+ return __ctypes[__c] & __ctype_xdigit;
}
#define _toupper(__c) ((__c) & ~0x20)
More information about the klibc
mailing list