Move tolower() etc to ctype.h as per ISO C
authorMichael Brown <mcb30@etherboot.org>
Fri, 26 Jan 2007 03:25:19 +0000 (03:25 +0000)
committerMichael Brown <mcb30@etherboot.org>
Fri, 26 Jan 2007 03:25:19 +0000 (03:25 +0000)
src/core/string.c
src/include/ctype.h [new file with mode: 0644]
src/include/string.h

index da35e20..353abd6 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 /* *** FROM string.c *** */
 
 
 /* *** FROM string.c *** */
 
diff --git a/src/include/ctype.h b/src/include/ctype.h
new file mode 100644 (file)
index 0000000..a79395d
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+/** @file
+ *
+ * Character types
+ */
+
+#define isdigit(c)     ((c & 0x04) != 0)
+#define islower(c)     ((c & 0x02) != 0)
+//#define isspace(c)   ((c & 0x20) != 0)
+#define isupper(c)     ((c & 0x01) != 0)
+
+static inline unsigned char tolower(unsigned char c)
+{
+       if (isupper(c))
+               c -= 'A'-'a';
+       return c;
+}
+
+static inline unsigned char toupper(unsigned char c)
+{
+       if (islower(c))
+               c -= 'a'-'A';
+       return c;
+}
+
+#endif /* _CTYPE_H */
index 123e70c..e02b5ed 100644 (file)
 #ifndef ETHERBOOT_STRING_H
 #define ETHERBOOT_STRING_H
 
 #ifndef ETHERBOOT_STRING_H
 #define ETHERBOOT_STRING_H
 
-#include "stddef.h"
-#include "bits/string.h"
-
-
-/* *** FROM ctype.h *** */
-
-#define isdigit(c)     ((c & 0x04) != 0)
-#define islower(c)     ((c & 0x02) != 0)
-//#define isspace(c)   ((c & 0x20) != 0)
-#define isupper(c)     ((c & 0x01) != 0)
-
-static inline unsigned char tolower(unsigned char c)
-{
-       if (isupper(c))
-               c -= 'A'-'a';
-       return c;
-}
-
-static inline unsigned char toupper(unsigned char c)
-{
-       if (islower(c))
-               c -= 'a'-'A';
-       return c;
-}
-
-
-/* *** FROM string.h *** */
+#include <stddef.h>
+#include <bits/string.h>
 
 int strnicmp(const char *s1, const char *s2, size_t len);
 char * strcpy(char * dest,const char *src);
 
 int strnicmp(const char *s1, const char *s2, size_t len);
 char * strcpy(char * dest,const char *src);