summaryrefslogtreecommitdiffstats
path: root/lib/libedit/tokenizer.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2016-04-11 19:54:53 +0000
committerschwarze <schwarze@openbsd.org>2016-04-11 19:54:53 +0000
commit5c93237dc61741a77e4aedea71fcbacffe8f97ad (patch)
treebc0e95ee0e85ecbc603cd014b3d6702559a8323f /lib/libedit/tokenizer.c
parent- In isin(), quote $_b to ensure it's treated as string not as pattern. (diff)
downloadwireguard-openbsd-5c93237dc61741a77e4aedea71fcbacffe8f97ad.tar.xz
wireguard-openbsd-5c93237dc61741a77e4aedea71fcbacffe8f97ad.zip
Move wrapper macros to the two files actually needing them:
FUNW, Strlen, Strdup, Strcmp, Strncmp, Strncpy, Strncat -> history.c Strchr, tok_strdup -> tokenizer.c FUN, TYPE, STR -> both of these files OK martijn@ Also proofread by Christian Heckendorf <mbie at ulmus dot me> who reported some whitespace issues in parse.c.
Diffstat (limited to 'lib/libedit/tokenizer.c')
-rw-r--r--lib/libedit/tokenizer.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index 6a026654eaf..1cdb9019d22 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tokenizer.c,v 1.17 2016/03/20 23:48:27 schwarze Exp $ */
+/* $OpenBSD: tokenizer.c,v 1.18 2016/04/11 19:54:54 schwarze Exp $ */
/* $NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $ */
/*-
@@ -57,8 +57,19 @@ typedef enum {
#define IFS STR("\t \n")
-#define tok_strdup(a) Strdup(a)
-
+#ifdef NARROWCHAR
+#define FUN(prefix, rest) prefix ## _ ## rest
+#define TYPE(type) type
+#define STR(x) x
+#define Strchr(s, c) strchr(s, c)
+#define tok_strdup(s) strdup(s)
+#else
+#define FUN(prefix, rest) prefix ## _w ## rest
+#define TYPE(type) type ## W
+#define STR(x) L ## x
+#define Strchr(s, c) wcschr(s, c)
+#define tok_strdup(s) wcsdup(s)
+#endif
struct TYPE(tokenizer) {
Char *ifs; /* In field separator */