Restrict usernames to the same character set as tags
[blerg.git] / database / database.h
index 4c5853e..2f71bee 100644 (file)
@@ -7,6 +7,9 @@
 #include <stdint.h>
 #include <time.h>
 
+#define VALID_CHAR(c) ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '_')
+#define WHITESPACE(c) (c == ' ' || c == '\t' || c == '\n' || c == '\r')
+
 struct record {
        uint32_t offset;
        uint16_t length;