Browse Source

use some #defines internal to the ctype functions to eliminate them
calling other tiny ctype functions. Now all ctype funcs will end up
with no extern references, which ends up shrinking both the uClibc
shared lib and shrinking client code.
-Erik

Eric Andersen 24 years ago
parent
commit
91b3a453de
2 changed files with 33 additions and 7 deletions
  1. 1 7
      include/ctype.h
  2. 32 0
      libc/misc/ctype/ctype.c

+ 1 - 7
include/ctype.h

@@ -8,15 +8,9 @@
 
 
 __BEGIN_DECLS
 __BEGIN_DECLS
 
 
-/* For now, just always use the functions instead of the macros...*/
-#define __USE_CTYPE_C_FUNCTIONS
-
 /* Locale-compatible macros/inlines have yet to be implemented. */
 /* Locale-compatible macros/inlines have yet to be implemented. */
-#if defined(__UCLIBC_HAS_LOCALE__) && !defined(__USE_CTYPE_C_FUNCTIONS)
-#define __USE_CTYPE_C_FUNCTIONS
-#endif
+#if defined(__UCLIBC_HAS_LOCALE__) && !defined(__USE_CTYPE_C_MACROS)
 
 
-#ifdef __USE_CTYPE_C_FUNCTIONS
 /* function prototpes */ 
 /* function prototpes */ 
 extern int isalnum(int c);
 extern int isalnum(int c);
 extern int isalpha(int c);
 extern int isalpha(int c);

+ 32 - 0
libc/misc/ctype/ctype.c

@@ -11,9 +11,11 @@
  * used ideas is part of the GNU C Library.
  * used ideas is part of the GNU C Library.
  */
  */
 
 
+#define __USE_CTYPE_C_MACROS
 #include <ctype.h>
 #include <ctype.h>
 
 
 #ifdef L_isascii
 #ifdef L_isascii
+#undef isascii
 int
 int
 isascii( int c )
 isascii( int c )
 {
 {
@@ -22,6 +24,7 @@ isascii( int c )
 #endif
 #endif
 
 
 #ifdef L_isdigit
 #ifdef L_isdigit
+#undef isdigit
 int
 int
 isdigit( int c )
 isdigit( int c )
 {
 {
@@ -30,6 +33,7 @@ isdigit( int c )
 #endif
 #endif
 
 
 #ifdef L_toascii
 #ifdef L_toascii
+#undef toascii
 int
 int
 toascii( int c )
 toascii( int c )
 {
 {
@@ -42,6 +46,7 @@ toascii( int c )
 #ifndef __UCLIBC_HAS_LOCALE__
 #ifndef __UCLIBC_HAS_LOCALE__
 
 
 #ifdef L_isalpha
 #ifdef L_isalpha
+#undef isalpha
 int
 int
 isalpha( int c )
 isalpha( int c )
 {
 {
@@ -50,6 +55,7 @@ isalpha( int c )
 #endif
 #endif
 
 
 #ifdef L_isalnum
 #ifdef L_isalnum
+#undef isalnum
 int
 int
 isalnum( int c )
 isalnum( int c )
 {
 {
@@ -58,6 +64,7 @@ isalnum( int c )
 #endif
 #endif
 
 
 #ifdef L_iscntrl
 #ifdef L_iscntrl
+#undef iscntrl
 int
 int
 iscntrl( int c )
 iscntrl( int c )
 {
 {
@@ -66,6 +73,7 @@ iscntrl( int c )
 #endif
 #endif
 
 
 #ifdef L_isgraph
 #ifdef L_isgraph
+#undef isgraph
 int
 int
 isgraph( int c )
 isgraph( int c )
 {
 {
@@ -74,6 +82,7 @@ isgraph( int c )
 #endif
 #endif
 
 
 #ifdef L_islower
 #ifdef L_islower
+#undef islower
 int
 int
 islower( int c )
 islower( int c )
 {
 {
@@ -82,6 +91,7 @@ islower( int c )
 #endif
 #endif
 
 
 #ifdef L_isprint
 #ifdef L_isprint
+#undef isprint
 int
 int
 isprint( int c )
 isprint( int c )
 {
 {
@@ -90,6 +100,7 @@ isprint( int c )
 #endif
 #endif
 
 
 #ifdef L_ispunct
 #ifdef L_ispunct
+#undef ispunct
 int
 int
 ispunct( int c )
 ispunct( int c )
 {
 {
@@ -98,6 +109,7 @@ ispunct( int c )
 #endif
 #endif
 
 
 #ifdef L_isspace
 #ifdef L_isspace
+#undef isspace
 int
 int
 isspace( int c )
 isspace( int c )
 {
 {
@@ -107,6 +119,7 @@ isspace( int c )
 #endif
 #endif
 
 
 #ifdef L_isupper
 #ifdef L_isupper
+#undef isupper
 int
 int
 isupper( int c )
 isupper( int c )
 {
 {
@@ -115,6 +128,7 @@ isupper( int c )
 #endif
 #endif
 
 
 #ifdef L_isxdigit
 #ifdef L_isxdigit
+#undef isxdigit
 int
 int
 isxdigit( int c )
 isxdigit( int c )
 {
 {
@@ -123,6 +137,7 @@ isxdigit( int c )
 #endif
 #endif
 
 
 #ifdef L_isxlower
 #ifdef L_isxlower
+#undef isxlower
 int
 int
 isxlower( int c )
 isxlower( int c )
 {
 {
@@ -131,6 +146,7 @@ isxlower( int c )
 #endif
 #endif
 
 
 #ifdef L_isxupper
 #ifdef L_isxupper
+#undef isxupper
 int
 int
 isxupper( int c )
 isxupper( int c )
 {
 {
@@ -139,6 +155,7 @@ isxupper( int c )
 #endif
 #endif
 
 
 #ifdef L_tolower
 #ifdef L_tolower
+#undef tolower
 int
 int
 tolower( int c )
 tolower( int c )
 {
 {
@@ -147,6 +164,7 @@ tolower( int c )
 #endif
 #endif
 
 
 #ifdef L_toupper
 #ifdef L_toupper
+#undef toupper
 int
 int
 toupper( int c )
 toupper( int c )
 {
 {
@@ -177,6 +195,7 @@ const unsigned char *_uc_ctype_trans = _uc_ctype_b_C+LOCALE_BUF_SIZE/2;
 #endif  /* L_ctype_C */
 #endif  /* L_ctype_C */
 
 
 #ifdef L_isalpha
 #ifdef L_isalpha
+#undef isalpha
 int
 int
 isalpha( int c )
 isalpha( int c )
 {
 {
@@ -185,6 +204,7 @@ isalpha( int c )
 #endif
 #endif
 
 
 #ifdef L_isalnum
 #ifdef L_isalnum
+#undef isalnum
 int
 int
 isalnum( int c )
 isalnum( int c )
 {
 {
@@ -193,6 +213,7 @@ isalnum( int c )
 #endif
 #endif
 
 
 #ifdef L_iscntrl
 #ifdef L_iscntrl
+#undef iscntrl
 int
 int
 iscntrl( int c )
 iscntrl( int c )
 {
 {
@@ -201,6 +222,7 @@ iscntrl( int c )
 #endif
 #endif
 
 
 #ifdef L_isgraph
 #ifdef L_isgraph
+#undef isgraph
 int
 int
 isgraph( int c )
 isgraph( int c )
 {
 {
@@ -209,6 +231,7 @@ isgraph( int c )
 #endif
 #endif
 
 
 #ifdef L_islower
 #ifdef L_islower
+#undef islower
 int
 int
 islower( int c )
 islower( int c )
 {
 {
@@ -217,6 +240,7 @@ islower( int c )
 #endif
 #endif
 
 
 #ifdef L_isprint
 #ifdef L_isprint
+#undef isprint
 int
 int
 isprint( int c )
 isprint( int c )
 {
 {
@@ -225,6 +249,7 @@ isprint( int c )
 #endif
 #endif
 
 
 #ifdef L_ispunct
 #ifdef L_ispunct
+#undef ispunct
 int
 int
 ispunct( int c )
 ispunct( int c )
 {
 {
@@ -233,6 +258,7 @@ ispunct( int c )
 #endif
 #endif
 
 
 #ifdef L_isspace
 #ifdef L_isspace
+#undef isspace
 int
 int
 isspace( int c )
 isspace( int c )
 {
 {
@@ -241,6 +267,7 @@ isspace( int c )
 #endif
 #endif
 
 
 #ifdef L_isupper
 #ifdef L_isupper
+#undef isupper
 int
 int
 isupper( int c )
 isupper( int c )
 {
 {
@@ -249,6 +276,7 @@ isupper( int c )
 #endif
 #endif
 
 
 #ifdef L_isxdigit
 #ifdef L_isxdigit
+#undef isxdigit
 int
 int
 isxdigit( int c )
 isxdigit( int c )
 {
 {
@@ -257,6 +285,7 @@ isxdigit( int c )
 #endif
 #endif
 
 
 #ifdef L_isxlower
 #ifdef L_isxlower
+#undef isxlower
 int
 int
 isxlower( int c )
 isxlower( int c )
 {
 {
@@ -265,6 +294,7 @@ isxlower( int c )
 #endif
 #endif
 
 
 #ifdef L_isxupper
 #ifdef L_isxupper
+#undef isxupper
 int
 int
 isxupper( int c )
 isxupper( int c )
 {
 {
@@ -273,6 +303,7 @@ isxupper( int c )
 #endif
 #endif
 
 
 #ifdef L_tolower
 #ifdef L_tolower
+#undef tolower
 int
 int
 tolower( int c )
 tolower( int c )
 {
 {
@@ -286,6 +317,7 @@ tolower( int c )
 #endif
 #endif
 
 
 #ifdef L_toupper
 #ifdef L_toupper
+#undef toupper
 int
 int
 toupper( int c )
 toupper( int c )
 {
 {