]> jfr.im git - solanum.git/blobdiff - include/match.h
ircd: rewrite SOCKET_ERROR as I_SOCKET_ERROR
[solanum.git] / include / match.h
index 7fe1e5fb2487269fb45f9431f4da8bb84fd7e76b..c49e12e9fc55460206843e7e231a2400dc110bab 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  ircd-ratbox: A slightly useful ircd.
- *  irc_string.h: A header for the ircd string functions.
+ *  match.h: A header for the ircd string functions.
  *
  *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
  *  Copyright (C) 1996-2002 Hybrid Development Team
@@ -81,11 +81,11 @@ extern char *canonize(char *);
 /*
  * character macros
  */
-extern const unsigned char ToLowerTab[];
-#define ToLower(c) (ToLowerTab[(unsigned char)(c)])
+extern const unsigned char irctolower_tab[];
+#define irctolower(c) (irctolower_tab[(unsigned char)(c)])
 
-extern const unsigned char ToUpperTab[];
-#define ToUpper(c) (ToUpperTab[(unsigned char)(c)])
+extern const unsigned char irctoupper_tab[];
+#define irctoupper(c) (irctoupper_tab[(unsigned char)(c)])
 
 extern const unsigned int CharAttrs[];
 
@@ -137,4 +137,26 @@ extern const unsigned int CharAttrs[];
 #define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
 #define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)
 
+
+/* Below are used for radix trees and the like */
+static inline void irccasecanon(char *str)
+{
+        while (*str)
+        {
+                *str = irctoupper(*str);
+                str++;
+        }
+        return;
+}
+
+static inline void strcasecanon(char *str)
+{
+        while (*str)
+        {
+                *str = toupper((unsigned char)*str);
+                str++;
+        }
+        return;
+}
+
 #endif /* INCLUDED_match_h */