aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/terminal.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-08-04 14:49:21 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-08-06 17:47:14 +0200
commit13fac76a71f25631d7415ba457bdab267d0950d4 (patch)
tree76914bbdca93094302783c211f539ff5c6c1bdd0 /src/terminal.c
parentpubkey: isblank is a subset of isspace (diff)
downloadwireguard-tools-13fac76a71f25631d7415ba457bdab267d0950d4.tar.xz
wireguard-tools-13fac76a71f25631d7415ba457bdab267d0950d4.zip
ctype: use non-locale-specific ctype.h
We also make these constant time, even though we're never distinguishing between bits of a secret using them. From that perspective, though, this is markedly better than the locale-specific table lookups in glibc, even though base64 characters span two cache lines and valid private keys must hit both. Co-authored-by: Samuel Neves <sneves@dei.uc.pt> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
Diffstat (limited to '')
-rw-r--r--src/terminal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/terminal.c b/src/terminal.c
index bea27ba..7c293cd 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <ctype.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
@@ -11,6 +10,7 @@
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
+#include "ctype.h"
static bool color_mode(void)
{
@@ -46,7 +46,7 @@ static void filter_ansi(const char *fmt, va_list args)
if (str[i] == '\x1b' && str[i + 1] == '[') {
str[i] = str[i + 1] = '\0';
for (j = i + 2; j < len; ++j) {
- if (isalpha(str[j]))
+ if (char_is_alpha(str[j]))
break;
str[j] = '\0';
}