aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--text.c8
-rw-r--r--util.h7
2 files changed, 8 insertions, 7 deletions
diff --git a/text.c b/text.c
index 31db71f..67d873e 100644
--- a/text.c
+++ b/text.c
@@ -12,16 +12,10 @@
#include <sys/mman.h>
#include "text.h"
-
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-#define MIN(a, b) ((a) > (b) ? (b) : (a))
-#define LENGTH(x) ((int)(sizeof (x) / sizeof *(x)))
+#include "util.h"
#define BUFFER_SIZE (1 << 20)
-/* is c the start of a utf8 sequence? */
-#define isutf8(c) (((c)&0xC0)!=0x80)
-
struct Regex {
const char *string;
regex_t regex;
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..2992bea
--- /dev/null
+++ b/util.h
@@ -0,0 +1,7 @@
+#define LENGTH(x) ((int)(sizeof (x) / sizeof *(x)))
+#define MIN(a, b) ((a) > (b) ? (b) : (a))
+#define MAX(a, b) ((a) < (b) ? (b) : (a))
+
+/* is c the start of a utf8 sequence? */
+#define isutf8(c) (((c)&0xC0)!=0x80)
+#define ISASCII(ch) ((unsigned char)ch < 0x80)