Re: Avoid ctype(3) abuses

Leonardo Taccari <[email protected]> Thu, 15 Jan 2026 21:03:28 +0100
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <907.1768507408.1@boh>

Leonardo Taccari writes:
> [...]
> Good idea!
>
> I will then add possible missing d*() helper ctype(3) functions and
> adapt all direct ctype(3) users to switch to such d*() helper
> functions.
>
> I hope to be able to share possible patches for that in 48 hours or so!
> [...]

Updated patches modified as required attached in this email.

Now ctype(3) usage is only via d*() helper ctype(3) functions.


Thanks!

------- =_aaaaaaaaaa0
Content-Type: text/x-diff; charset="us-ascii";
	name="0001-Avoid-ctype-3-abuses.patch"
Content-Description: 0001-Avoid-ctype-3-abuses.patch
Content-Disposition: attachment; filename="0001-Avoid-ctype-3-abuses.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 26e0516b3456f71d0d27de1cfe575da6f09f9955 Mon Sep 17 00:00:00 2001
From: Leonardo Taccari <[email protected]>
Date: Tue, 6 Jan 2026 18:04:50 +0100
Subject: [PATCH] Avoid ctype(3) abuses

Valid argument of ctype(3) functions must be either EOF or non-negative
value within the range representable as unsigned char.  Invalid values
leads to undefined behavior.

Add all missing d*() ctype(3) helper functions and switch to use them.

Noticed by running dillo on NetBSD where dillo crashes due such
abuses.
---
 dlib/dlib.c                |  3 +-
 dlib/dlib.h                | 10 ++++++-
 dpi/bookmarks.c            | 27 +++++++++--------
 dpi/cookies.c              | 19 ++++++------
 dpi/datauri.c              |  3 +-
 dpi/downloads.cc           | 11 ++++---
 dpi/dpiutil.c              |  7 ++---
 dpi/file.c                 |  1 -
 dpi/ftp.c                  |  1 -
 dpid/dpidc.c               |  3 +-
 dpip/dpip.c                |  3 +-
 dw/findtext.hh             |  6 ++--
 dw/fltkui.cc               |  4 +--
 dw/style.cc                |  1 -
 dw/textblock.cc            |  8 +++---
 lout/misc.cc               |  1 -
 src/IO/dpi.c               |  3 +-
 src/IO/http.c              |  3 +-
 src/IO/tls_openssl.c       |  9 +++---
 src/auth.c                 |  3 +-
 src/colors.c               |  3 +-
 src/commit.h               |  1 +
 src/cookies.c              |  1 -
 src/cssparser.cc           | 21 +++++++-------
 src/dilloc.c               |  3 +-
 src/hsts.c                 |  3 +-
 src/html.cc                | 59 +++++++++++++++++++-------------------
 src/keys.cc                |  5 ++--
 src/misc.c                 |  5 ++--
 src/misc.h                 |  3 +-
 src/table.cc               |  2 +-
 src/url.c                  |  1 -
 src/xembed.cc              |  1 -
 test/dw/dw_anchors_test.cc |  1 -
 test/unit/cookies.c        |  3 +-
 35 files changed, 110 insertions(+), 128 deletions(-)
 create mode 100644 src/commit.h

diff --git a/dlib/dlib.c b/dlib/dlib.c
index ed967b3a..d8dd9d43 100644
--- a/dlib/dlib.c
+++ b/dlib/dlib.c
@@ -24,7 +24,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <ctype.h>
 #include <time.h>
 =

 #include "dlib.h"
@@ -525,7 +524,7 @@ const char *dStr_printable(Dstr *in, int maxlen)
       out =3D dStr_sized_new(in->len);
 =

    for (i =3D 0; (i < in->len) && (out->len < maxlen); ++i) {
-      if (isprint(in->str[i]) || (in->str[i] =3D=3D '\n')) {
+      if (dIsprint(in->str[i]) || (in->str[i] =3D=3D '\n')) {
          dStr_append_c(out, in->str[i]);
       } else {
          dStr_append_l(out, "\\x", 2);
diff --git a/dlib/dlib.h b/dlib/dlib.h
index 2e5164e9..d35d6f12 100644
--- a/dlib/dlib.h
+++ b/dlib/dlib.h
@@ -13,6 +13,7 @@
 #ifndef __DLIB_H__
 #define __DLIB_H__
 =

+#include <ctype.h>
 #include <stdio.h>     /* for FILE*  */
 #include <stddef.h>    /* for size_t */
 #include <stdarg.h>    /* for va_list */
@@ -42,8 +43,15 @@ extern "C" {
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
 =

 /* Handle signed char */
-#define dIsspace(c) isspace((uchar_t)(c))
 #define dIsalnum(c) isalnum((uchar_t)(c))
+#define dIsalpha(c) isalpha((uchar_t)(c))
+#define dIscntrl(c) iscntrl((uchar_t)(c))
+#define dIsdigit(c) isdigit((uchar_t)(c))
+#define dIsprint(c) isprint((uchar_t)(c))
+#define dIspunct(c) ispunct((uchar_t)(c))
+#define dIsspace(c) isspace((uchar_t)(c))
+#define dIsxdigit(c) isxdigit((uchar_t)(c))
+#define dTolower(c) tolower((uchar_t)(c))
 =

 #define D_ASCII_TOUPPER(c) (((c) >=3D 'a' && (c) <=3D 'z') ? (c) - 0x20 :=
 (c))
 #define D_ASCII_TOLOWER(c) (((c) >=3D 'A' && (c) <=3D 'Z') ? (c) + 0x20 :=
 (c))
diff --git a/dpi/bookmarks.c b/dpi/bookmarks.c
index 68b5edfb..ae1c1b9e 100644
--- a/dpi/bookmarks.c
+++ b/dpi/bookmarks.c
@@ -26,7 +26,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
-#include <ctype.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -338,8 +337,8 @@ static void Unencode_str(char *e_str)
             *p =3D '\n';
             e +=3D 5;
          } else {
-            *p =3D (isdigit(e[1]) ? (e[1] - '0') : (e[1] - 'A' + 10)) * 1=
6 +
-                 (isdigit(e[2]) ? (e[2] - '0') : (e[2] - 'A' + 10));
+            *p =3D (dIsdigit(e[1]) ? (e[1] - '0') : (e[1] - 'A' + 10)) * =
16 +
+                 (dIsdigit(e[2]) ? (e[2] - '0') : (e[2] - 'A' + 10));
             e +=3D 2;
          }
       } else {
@@ -807,11 +806,11 @@ static void Bmsrv_count_urls_and_sections(char *url,=
 int *n_sec, int *n_url)
    *n_sec =3D *n_url =3D 0;
    if ((p =3D strchr(url, '?'))) {
       for (q =3D p; (q =3D strstr(q, "&url")); ++q) {
-         for (i =3D 0; isdigit(q[4+i]); ++i);
+         for (i =3D 0; dIsdigit(q[4+i]); ++i);
          *n_url +=3D (q[4+i] =3D=3D '=3D') ? 1 : 0;
       }
       for (q =3D p; (q =3D strstr(q, "&s")); ++q) {
-         for (i =3D 0; isdigit(q[2+i]); ++i);
+         for (i =3D 0; dIsdigit(q[2+i]); ++i);
          *n_sec +=3D (q[2+i] =3D=3D '=3D') ? 1 : 0;
       }
    }
@@ -972,7 +971,7 @@ static int Bmsrv_send_modify_update(Dsh *sh, char *url=
)
       /* send items here */
       p =3D strchr(url1, '?');
       for (q =3D p; (q =3D strstr(q, "&s")); ++q) {
-         for (i =3D 0; isdigit(q[2+i]); ++i);
+         for (i =3D 0; dIsdigit(q[2+i]); ++i);
          if (q[2+i] =3D=3D '=3D') {
             key =3D strtol(q + 2, NULL, 10);
             if ((sec_node =3D Bms_get_sec(key))) {
@@ -992,7 +991,7 @@ static int Bmsrv_send_modify_update(Dsh *sh, char *url=
)
       /* send items here */
       p =3D strchr(url1, '?');
       for (q =3D p; (q =3D strstr(q, "&url")); ++q) {
-         for (i =3D 0; isdigit(q[4+i]); ++i);
+         for (i =3D 0; dIsdigit(q[4+i]); ++i);
          if (q[4+i] =3D=3D '=3D') {
             key =3D strtol(q + 4, NULL, 10);
             bm_node =3D Bms_get(key);
@@ -1060,7 +1059,7 @@ static int Bmsrv_modify_delete(char *url)
    /* Remove marked sections */
    p =3D strchr(url, '?');
    for (ns =3D 0; (p =3D strstr(p, "&s")); ++p) {
-      if (isdigit(p[2])) {
+      if (dIsdigit(p[2])) {
          key =3D strtol(p + 2, NULL, 10);
          Bms_sec_del(key);
          ++ns;
@@ -1070,7 +1069,7 @@ static int Bmsrv_modify_delete(char *url)
    /* Remove marked urls */
    p =3D strchr(url, '?');
    for (nb =3D 0; (p =3D strstr(p, "&url")); ++p) {
-      if (isdigit(p[4])) {
+      if (dIsdigit(p[4])) {
          key =3D strtol(p + 4, NULL, 10);
          Bms_del(key);
          ++nb;
@@ -1105,7 +1104,7 @@ static int Bmsrv_modify_move(char *url)
 =

    /* get target section */
    for (p =3D url; (p =3D strstr(p, "&s")); ++p) {
-      if (isdigit(p[2])) {
+      if (dIsdigit(p[2])) {
          section =3D strtol(p + 2, NULL, 10);
          break;
       }
@@ -1116,7 +1115,7 @@ static int Bmsrv_modify_move(char *url)
    /* move marked urls */
    p =3D strchr(url, '?');
    for (n =3D 0; (p =3D strstr(p, "&url")); ++p) {
-      if (isdigit(p[4])) {
+      if (dIsdigit(p[4])) {
          key =3D strtol(p + 4, NULL, 10);
          Bms_move(key, section);
          ++n;
@@ -1145,7 +1144,7 @@ static int Bmsrv_modify_update(char *url)
    p =3D strchr(url, '?');
    for (  ; (p =3D strstr(p, "s")); ++p) {
       if (p[-1] =3D=3D '&' || p[-1] =3D=3D '?' ) {
-         for (i =3D 0; isdigit(p[1 + i]); ++i);
+         for (i =3D 0; dIsdigit(p[1 + i]); ++i);
          if (i && p[1 + i] =3D=3D '=3D') {
             /* we have a title/key to change */
             key =3D strtol(p + 1, NULL, 10);
@@ -1164,7 +1163,7 @@ static int Bmsrv_modify_update(char *url)
    p =3D strchr(url, '?');
    for (  ; (p =3D strstr(p, "title")); ++p) {
       if (p[-1] =3D=3D '&' || p[-1] =3D=3D '?' ) {
-         for (i =3D 0; isdigit(p[5 + i]); ++i);
+         for (i =3D 0; dIsdigit(p[5 + i]); ++i);
          if (i && p[5 + i] =3D=3D '=3D') {
             /* we have a title/key to change */
             key =3D strtol(p + 5, NULL, 10);
@@ -1229,7 +1228,7 @@ static int Bmsrv_modify_add_url(Dsh *sh, char *s_url=
)
    if (sh =3D=3D NULL) {
       /* look for section */
       for (q =3D s_url; (q =3D strstr(q, "&s")); ++q) {
-         for (i =3D 0; isdigit(q[2+i]); ++i);
+         for (i =3D 0; dIsdigit(q[2+i]); ++i);
          if (q[2+i] =3D=3D '=3D')
             section =3D strtol(q + 2, NULL, 10);
       }
diff --git a/dpi/cookies.c b/dpi/cookies.c
index f629768e..82065162 100644
--- a/dpi/cookies.c
+++ b/dpi/cookies.c
@@ -44,7 +44,6 @@ int main(void)
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>       /* for time() and time_t */
-#include <ctype.h>
 #include <limits.h>
 #include <netdb.h>
 #include <signal.h>
@@ -487,14 +486,14 @@ static int Cookies_get_timefield(const char **str)
    int n;
    const char *s =3D *str;
 =

-   if (!isdigit(*s))
+   if (!dIsdigit(*s))
       return -1;
 =

    n =3D *(s++) - '0';
-   if (isdigit(*s)) {
+   if (dIsdigit(*s)) {
       n *=3D 10;
       n +=3D *(s++) - '0';
-      if (isdigit(*s))
+      if (dIsdigit(*s))
          return -1;
    }
    *str =3D s;
@@ -550,24 +549,24 @@ static bool_t Cookies_get_year(struct tm *tm, const =
char **str)
    int n;
    const char *s =3D *str;
 =

-   if (isdigit(*s))
+   if (dIsdigit(*s))
       n =3D *(s++) - '0';
    else
       return FALSE;
-   if (isdigit(*s)) {
+   if (dIsdigit(*s)) {
       n *=3D 10;
       n +=3D *(s++) - '0';
    } else
       return FALSE;
-   if (isdigit(*s)) {
+   if (dIsdigit(*s)) {
       n *=3D 10;
       n +=3D *(s++) - '0';
    }
-   if (isdigit(*s)) {
+   if (dIsdigit(*s)) {
       n *=3D 10;
       n +=3D *(s++) - '0';
    }
-   if (isdigit(*s)) {
+   if (dIsdigit(*s)) {
       /* Sorry, users of prehistoric software in the year 10000! */
       return FALSE;
    }
@@ -936,7 +935,7 @@ static CookieData_t *Cookies_parse(char *cookie_str, c=
onst char *server_date)
          cookie->domain =3D value;
       } else if (dStrAsciiCasecmp(attr, "Max-Age") =3D=3D 0) {
          value =3D Cookies_parse_value(&str);
-         if (isdigit(*value) || *value =3D=3D '-') {
+         if (dIsdigit(*value) || *value =3D=3D '-') {
             long age;
             time_t now =3D time(NULL);
             struct tm *tm =3D gmtime(&now);
diff --git a/dpi/datauri.c b/dpi/datauri.c
index f968baa2..6cd1ba3b 100644
--- a/dpi/datauri.c
+++ b/dpi/datauri.c
@@ -15,7 +15,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <errno.h>
 =

 #include "../dpip/dpip.h"
@@ -45,7 +44,7 @@ static void b64strip_illegal_chars(unsigned char* str)
    MSG("len=3D%d{%s}\n", strlen((char*)str), str);
 =

    for (p =3D s; (*p =3D *s); ++s) {
-      if (d_isascii(*p) && (isalnum(*p) || strchr("+/=3D", *p)))
+      if (d_isascii(*p) && (dIsalnum(*p) || strchr("+/=3D", *p)))
          ++p;
    }
 =

diff --git a/dpi/downloads.cc b/dpi/downloads.cc
index 69e04f8f..40a9a5ee 100644
--- a/dpi/downloads.cc
+++ b/dpi/downloads.cc
@@ -20,7 +20,6 @@
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <ctype.h>
 #include <math.h>
 #include <time.h>
 #include <signal.h>
@@ -513,7 +512,7 @@ void DLItem::log_text_add(const char *buf, ssize_t st)
       case ST_newline:
          if (*p =3D=3D ' ') {
             log_state =3D ST_discard;
-         } else if (isdigit(*p)) {
+         } else if (dIsdigit(*p)) {
             *q++ =3D *p; log_state =3D ST_number;
          } else if (*p =3D=3D '\n') {
             *q++ =3D *p;
@@ -522,10 +521,10 @@ void DLItem::log_text_add(const char *buf, ssize_t s=
t)
          }
          break;
       case ST_number:
-         if (isdigit(*q++ =3D *p)) {
+         if (dIsdigit((*q++ =3D *p))) {
             // keep here
          } else if (*p =3D=3D 'K') {
-            for (--q; isdigit(q[-1]); --q) ; =

+            for (--q; dIsdigit(q[-1]); --q) ;
             log_state =3D ST_discard;
          } else {
             log_state =3D ST_copy;
@@ -549,9 +548,9 @@ void DLItem::log_text_add(const char *buf, ssize_t st)
    // Now scan for the length of the file
    if (total_bytesize =3D=3D -1) {
       p =3D strstr(log_text, "\nLength: ");
-      if (p && isdigit(p[9]) && strchr(p + 9, ' ')) {
+      if (p && dIsdigit(p[9]) && strchr(p + 9, ' ')) {
          for (p +=3D 9, d =3D &num[0]; *p !=3D ' '; ++p)
-            if (isdigit(*p))
+            if (dIsdigit(*p))
                *d++ =3D *p;
          *d =3D 0;
          total_bytesize =3D strtol (num, NULL, 10);
diff --git a/dpi/dpiutil.c b/dpi/dpiutil.c
index 45100be2..75debf34 100644
--- a/dpi/dpiutil.c
+++ b/dpi/dpiutil.c
@@ -14,7 +14,6 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-#include <ctype.h>
 #include <errno.h>
 #include <sys/socket.h>
 =

@@ -67,10 +66,10 @@ char *Unescape_uri_str(const char *s)
 =

    if (strchr(s, '%')) {
       for (p =3D buf; (*p =3D *s); ++s, ++p) {
-         if (*p =3D=3D '%' && isxdigit(s[1]) && isxdigit(s[2])) {
-            *p =3D (isdigit(s[1]) ? (s[1] - '0')
+         if (*p =3D=3D '%' && dIsxdigit(s[1]) && dIsxdigit(s[2])) {
+            *p =3D (dIsdigit(s[1]) ? (s[1] - '0')
                                 : D_ASCII_TOUPPER(s[1]) - 'A' + 10) * 16;
-            *p +=3D isdigit(s[2]) ? (s[2] - '0')
+            *p +=3D dIsdigit(s[2]) ? (s[2] - '0')
                                 : D_ASCII_TOUPPER(s[2]) - 'A' + 10;
             s +=3D 2;
          }
diff --git a/dpi/file.c b/dpi/file.c
index ecee90ea..5d39f1c8 100644
--- a/dpi/file.c
+++ b/dpi/file.c
@@ -16,7 +16,6 @@
  * With new HTML layout.
  */
 =

-#include <ctype.h>           /* for isspace */
 #include <errno.h>           /* for errno */
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/dpi/ftp.c b/dpi/ftp.c
index 3b1c72a1..02d3fd0f 100644
--- a/dpi/ftp.c
+++ b/dpi/ftp.c
@@ -39,7 +39,6 @@
 #include <sys/wait.h>
 #include <errno.h>
 #include <sys/time.h>
-#include <ctype.h>
 =

 #include "../dpip/dpip.h"
 #include "dpiutil.h"
diff --git a/dpid/dpidc.c b/dpid/dpidc.c
index f9e579b2..365eb260 100644
--- a/dpid/dpidc.c
+++ b/dpid/dpidc.c
@@ -12,7 +12,6 @@
 #include <stdlib.h>  /* for exit */
 #include <string.h>  /* for memset */
 #include <unistd.h>  /* for read and write */
-#include <ctype.h>   /* for isxdigit */
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -59,7 +58,7 @@ static int Dpi_read_comm_keys(int *port)
       MSG_ERR("[Dpi_read_comm_keys] empty file: %s\n", fname);
    } else {
       *port =3D strtol(rcline, &tail, 10);
-      for (i =3D 0; *tail && isxdigit(tail[i+1]); ++i)
+      for (i =3D 0; *tail && dIsxdigit(tail[i+1]); ++i)
          SharedKey[i] =3D tail[i+1];
       SharedKey[i] =3D 0;
       ret =3D 1;
diff --git a/dpip/dpip.c b/dpip/dpip.c
index 066d82e9..2d04e01f 100644
--- a/dpip/dpip.c
+++ b/dpip/dpip.c
@@ -15,7 +15,6 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include <ctype.h>
 #include <unistd.h>   /* for close */
 #include <fcntl.h>    /* for fcntl */
 =

@@ -220,7 +219,7 @@ int a_Dpip_check_auth(const char *auth_tag)
    } else {
       port =3D strtol(rcline, &tail, 10);
       if (tail && port !=3D 0) {
-         for (i =3D 0; *tail && isxdigit(tail[i+1]); ++i)
+         for (i =3D 0; *tail && dIsxdigit(tail[i+1]); ++i)
             SharedSecret[i] =3D tail[i+1];
          SharedSecret[i] =3D 0;
          if (strcmp(msg, SharedSecret) =3D=3D 0)
diff --git a/dw/findtext.hh b/dw/findtext.hh
index 1923acce..2ca52106 100644
--- a/dw/findtext.hh
+++ b/dw/findtext.hh
@@ -5,7 +5,7 @@
 #   error Do not include this file directly, use "core.hh" instead.
 #endif
 =

-#include <ctype.h>
+#include "dlib/dlib.h"
 =

 namespace dw {
 namespace core {
@@ -66,8 +66,8 @@ private:
    bool search0 (bool backwards, bool firstTrial);
 =

    inline static bool charsEqual (char c1, char c2, bool caseSens)
-   { return caseSens ? c1 =3D=3D c2 : tolower (c1) =3D=3D tolower (c2) ||
-      (isspace (c1) && isspace (c2)); }
+   { return caseSens ? c1 =3D=3D c2 : dTolower (c1) =3D=3D dTolower (c2) =
||
+      (dIsspace (c1) && dIsspace (c2)); }
 =

 public:
    FindtextState ();
diff --git a/dw/fltkui.cc b/dw/fltkui.cc
index 11fbb883..f6eeaf33 100644
--- a/dw/fltkui.cc
+++ b/dw/fltkui.cc
@@ -366,14 +366,14 @@ int CustChoice::handle(int e)
       if (k =3D=3D FL_Enter || k =3D=3D FL_Down) {
          return Fl_Choice::handle(FL_PUSH); // activate menu
 =

-      } else if (isalnum(k)) { // try key as shortcut to menuitem
+      } else if (dIsalnum(k)) { // try key as shortcut to menuitem
          int t =3D value()+1 >=3D size() ? 0 : value()+1;
          while (t !=3D value()) {
              const Fl_Menu_Item *mi =3D &(menu()[t]);
              if (mi->submenu()) // submenu?
                 ;
              else if (mi->label() && mi->active()) { // menu item?
-                if (k =3D=3D tolower(mi->label()[0])) {
+                if (k =3D=3D dTolower(mi->label()[0])) {
                    value(mi);
                    return 1; // Let FLTK know we used this key
                 }
diff --git a/dw/style.cc b/dw/style.cc
index dfb36a8d..06768e42 100644
--- a/dw/style.cc
+++ b/dw/style.cc
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <ctype.h>
 #include <math.h>
 =

 #include "dlib/dlib.h"
diff --git a/dw/textblock.cc b/dw/textblock.cc
index a1cbf2a3..067a245c 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -1238,14 +1238,14 @@ void Textblock::drawText(core::View *view, core::s=
tyle::Style *style,
                bool initial_seen =3D false;
 =

                for (int i =3D 0; i < start; i++)
-                  if (!ispunct(text[i]))
+                  if (!dIspunct(text[i]))
                      initial_seen =3D true;
                if (initial_seen)
                   break;
 =

                int after =3D 0;
                text +=3D start;
-               while (ispunct(text[after]))
+               while (dIspunct(text[after]))
                   after++;
                if (text[after])
                   after =3D layout->nextGlyph(text, after);
@@ -1931,7 +1931,7 @@ int Textblock::textWidth(const char *text, int start=
, int len,
                bool initial_seen =3D false;
 =

                for (int i =3D 0; i < start; i++)
-                  if (!ispunct(text[i]))
+                  if (!dIspunct(text[i]))
                      initial_seen =3D true;
                if (initial_seen) {
                   ret =3D layout->textWidth(style->font, text+start, len)=
;
@@ -1939,7 +1939,7 @@ int Textblock::textWidth(const char *text, int start=
, int len,
                   int after =3D 0;
 =

                   text +=3D start;
-                  while (ispunct(text[after]))
+                  while (dIspunct(text[after]))
                      after++;
                   if (text[after])
                      after =3D layout->nextGlyph(text, after);
diff --git a/lout/misc.cc b/lout/misc.cc
index 6bd5992d..0b757189 100644
--- a/lout/misc.cc
+++ b/lout/misc.cc
@@ -22,7 +22,6 @@
 =

 #include "misc.hh"
 =

-#include <ctype.h>
 #include <config.h>
 =

 #define PRGNAME PACKAGE "/" VERSION
diff --git a/src/IO/dpi.c b/src/IO/dpi.c
index 6729b011..b098f29d 100644
--- a/src/IO/dpi.c
+++ b/src/IO/dpi.c
@@ -26,7 +26,6 @@
 #include <stdio.h>
 #include <errno.h>           /* for errno */
 #include <fcntl.h>
-#include <ctype.h>           /* isxdigit */
 #include <stdint.h>
 =

 #include <sys/socket.h>
@@ -405,7 +404,7 @@ static int Dpi_read_comm_keys(int *port)
       MSG_ERR("[Dpi_read_comm_keys] empty file: %s\n", fname);
    } else {
       *port =3D strtol(rcline, &tail, 10);
-      for (i =3D 0; *tail && isxdigit(tail[i+1]); ++i)
+      for (i =3D 0; *tail && dIsxdigit(tail[i+1]); ++i)
          SharedKey[i] =3D tail[i+1];
       SharedKey[i] =3D 0;
       ret =3D 1;
diff --git a/src/IO/http.c b/src/IO/http.c
index f5d98df8..8fcc007c 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -17,7 +17,6 @@
 =

 #include "config.h"
 =

-#include <ctype.h>              /* isdigit */
 #include <unistd.h>
 #include <errno.h>              /* for errno */
 #include <stdlib.h>
@@ -709,7 +708,7 @@ static char *Http_get_connect_str(const DilloUrl *url)
    dstr =3D dStr_new("");
    auth1 =3D URL_AUTHORITY(url);
    auth_len =3D strlen(auth1);
-   if (auth_len > 0 && !isdigit(auth1[auth_len - 1]))
+   if (auth_len > 0 && !dIsdigit(auth1[auth_len - 1]))
       /* if no port number, add HTTPS port */
       auth2 =3D dStrconcat(auth1, ":443", NULL);
    else
diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c
index 3345a0dc..1b991e7d 100644
--- a/src/IO/tls_openssl.c
+++ b/src/IO/tls_openssl.c
@@ -39,7 +39,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 =

-#include <ctype.h>            /* tolower for wget stuff */
 #include <stdio.h>
 #include <errno.h>
 #include "../../dlib/dlib.h"
@@ -577,13 +576,13 @@ static bool_t pattern_match (const char *pattern, co=
nst char *string)
 =

   const char *p =3D pattern, *n =3D string;
   char c;
-  for (; (c =3D tolower (*p++)) !=3D '\0'; n++)
+  for (; (c =3D dTolower (*p++)) !=3D '\0'; n++)
     if (c =3D=3D '*')
       {
-        for (c =3D tolower (*p); c =3D=3D '*'; c =3D tolower (*++p))
+        for (c =3D dTolower (*p); c =3D=3D '*'; c =3D dTolower (*++p))
           ;
         for (; *n !=3D '\0'; n++)
-          if (tolower (*n) =3D=3D c && pattern_match (p, n))
+          if (dTolower (*n) =3D=3D c && pattern_match (p, n))
             return TRUE;
 #ifdef ASTERISK_EXCLUDES_DOT
           else if (*n =3D=3D '.')
@@ -593,7 +592,7 @@ static bool_t pattern_match (const char *pattern, cons=
t char *string)
       }
     else
       {
-        if (c !=3D tolower (*n))
+        if (c !=3D dTolower (*n))
           return FALSE;
       }
   return *n =3D=3D '\0';
diff --git a/src/auth.c b/src/auth.c
index cb00f475..770aa432 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -17,7 +17,6 @@
  */
 =

 =

-#include <ctype.h> /* iscntrl, isascii */
 #include "auth.h"
 #include "msg.h"
 #include "misc.h"
@@ -105,7 +104,7 @@ static int Auth_path_is_inside(const char *path1, cons=
t char *path2, int len)
 static int Auth_is_token_char(char c)
 {
    const char *invalid =3D "\"()<>@,;:\\[]?=3D/{} \t";
-   return (!d_isascii(c) || strchr(invalid, c) || iscntrl((uchar_t)c)) ? =
0 : 1;
+   return (!d_isascii(c) || strchr(invalid, c) || dIscntrl(c)) ? 0 : 1;
 }
 =

 /**
diff --git a/src/colors.c b/src/colors.c
index 767d5f84..2d00327c 100644
--- a/src/colors.c
+++ b/src/colors.c
@@ -11,11 +11,12 @@
 =

 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 #include "colors.h"
 =

 #include "msg.h"
 =

+#include "../dlib/dlib.h"
+
 /*
  * If EXTENDED_COLOR is defined, the extended set of named colors is supp=
orted.
  * These colors're not standard but they're supported in most browsers.
diff --git a/src/commit.h b/src/commit.h
new file mode 100644
index 00000000..7c4f940d
--- /dev/null
+++ b/src/commit.h
@@ -0,0 +1 @@
+#define GIT_COMMIT "v3.2.0-143-gabad1053-dirty"
diff --git a/src/cookies.c b/src/cookies.c
index 39373d7e..e2fc34f4 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -37,7 +37,6 @@ void a_Cookies_init(void)
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include <ctype.h>
 #include <errno.h>
 =

 #include "IO/Url.h"
diff --git a/src/cssparser.cc b/src/cssparser.cc
index 065eb624..38e509ee 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -16,7 +16,6 @@
  * a dillo1 based CSS prototype written by Sebastian Geerken.
  */
 =

-#include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
 =

@@ -530,7 +529,7 @@ void CssParser::nextToken()
 =

    while (true) {
       c =3D getChar();
-      if (isspace(c)) {                    // ignore whitespace
+      if (dIsspace(c)) {                    // ignore whitespace
          spaceSeparated =3D true;
       } else if (skipString(c, "/*")) {    // ignore comments
          do {
@@ -550,7 +549,7 @@ void CssParser::nextToken()
       c =3D getChar();
    }
 =

-   if (isdigit(c)) {
+   if (dIsdigit(c)) {
       ttype =3D CSS_TK_DECINT;
       do {
          if (i < maxStrLen - 1) {
@@ -558,7 +557,7 @@ void CssParser::nextToken()
          }
          /* else silently truncated */
          c =3D getChar();
-      } while (isdigit(c));
+      } while (dIsdigit(c));
       if (c !=3D '.')
          ungetChar();
 =

@@ -567,7 +566,7 @@ void CssParser::nextToken()
 =

    if (c =3D=3D '.') {
       c =3D getChar();
-      if (isdigit(c)) {
+      if (dIsdigit(c)) {
          ttype =3D CSS_TK_FLOAT;
          if (i < maxStrLen - 1)
             tval[i++] =3D '.';
@@ -576,7 +575,7 @@ void CssParser::nextToken()
                tval[i++] =3D c;
             /* else silently truncated */
             c =3D getChar();
-         } while (isdigit(c));
+         } while (dIsdigit(c));
 =

          ungetChar();
          tval[i] =3D 0;
@@ -604,13 +603,13 @@ void CssParser::nextToken()
       c =3D getChar();
    }
 =

-   if (isalpha(c) || c =3D=3D '_' || c =3D=3D '-') {
+   if (dIsalpha(c) || c =3D=3D '_' || c =3D=3D '-') {
       ttype =3D CSS_TK_SYMBOL;
 =

       tval[0] =3D c;
       i =3D 1;
       c =3D getChar();
-      while (isalnum(c) || c =3D=3D '_' || c =3D=3D '-') {
+      while (dIsalnum(c) || c =3D=3D '_' || c =3D=3D '-') {
          if (i < maxStrLen - 1) {
             tval[i] =3D c;
             i++;
@@ -633,13 +632,13 @@ void CssParser::nextToken()
       while (c !=3D EOF && c !=3D c1) {
          if (c =3D=3D '\\') {
             d =3D getChar();
-            if (isxdigit(d)) {
+            if (dIsxdigit(d)) {
                /* Read hex Unicode char. (Actually, strings are yet only =
8
                 * bit.) */
                hexbuf[0] =3D d;
                j =3D 1;
                d =3D getChar();
-               while (j < 4 && isxdigit(d)) {
+               while (j < 4 && dIsxdigit(d)) {
                   hexbuf[j] =3D d;
                   j++;
                   d =3D getChar();
@@ -674,7 +673,7 @@ void CssParser::nextToken()
       tval[0] =3D c;
       i =3D 1;
       c =3D getChar();
-      while (isxdigit(c)) {
+      while (dIsxdigit(c)) {
          if (i < maxStrLen - 1) {
             tval[i] =3D c;
             i++;
diff --git a/src/dilloc.c b/src/dilloc.c
index cdcdb5a8..49f9efa9 100644
--- a/src/dilloc.c
+++ b/src/dilloc.c
@@ -13,7 +13,6 @@
 =

 #include "dlib/dlib.h"
 =

-#include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
 #include <limits.h>
@@ -31,7 +30,7 @@ static int
 is_number(const char *str)
 {
    for (const char *p =3D str; *p; p++) {
-      if (!isdigit(*p))
+      if (!dIsdigit(*p))
          return 0;
    }
 =

diff --git a/src/hsts.c b/src/hsts.c
index f1349c43..6c06ad7c 100644
--- a/src/hsts.c
+++ b/src/hsts.c
@@ -26,7 +26,6 @@
 #include <time.h>
 #include <errno.h>
 #include <limits.h> /* for INT_MAX */
-#include <ctype.h> /* for isspace */
 #include <stdlib.h> /* for strtol */
 =

 #include "hsts.h"
@@ -223,7 +222,7 @@ void a_Hsts_set(const char *header, const DilloUrl *ur=
l)
       /* Get the value for the attribute and store it */
       if (dStrAsciiCasecmp(attr, "max-age") =3D=3D 0) {
          value =3D Hsts_parse_value(&header);
-         if (isdigit(*value)) {
+         if (dIsdigit(*value)) {
             errno =3D 0;
             max_age =3D strtol(value, NULL, 10);
             if (errno =3D=3D ERANGE)
diff --git a/src/html.cc b/src/html.cc
index 1a44202d..f2d2ca15 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -17,7 +17,6 @@
 /*-----------------------------------------------------------------------=
------
  * Includes
  *-----------------------------------------------------------------------=
----*/
-#include <ctype.h>      /* for isspace */
 #include <string.h>     /* for memcpy and memmove */
 #include <stdlib.h>
 #include <stdio.h>      /* for sprintf */
@@ -893,7 +892,7 @@ static const char *Html_parse_numeric_charref(DilloHtm=
l *html, char *tok,
    errno =3D 0;
 =

    if (*s =3D=3D 'x' || *s =3D=3D 'X') {
-      if (isxdigit(*++s)) {
+      if (dIsxdigit(*++s)) {
          /* strtol with base 16 accepts leading "0x" - we don't */
          if (*s =3D=3D '0' && s[1] =3D=3D 'x') {
             s++;
@@ -902,7 +901,7 @@ static const char *Html_parse_numeric_charref(DilloHtm=
l *html, char *tok,
             codepoint =3D strtol(s, &s, 16);
          }
       }
-   } else if (isdigit(*s)) {
+   } else if (dIsdigit(*s)) {
       codepoint =3D strtol(s, &s, 10);
    }
    if (errno)
@@ -994,7 +993,7 @@ static const char *Html_parse_named_charref(DilloHtml =
*html, char *tok,
    char *s =3D tok;
    const char *ret =3D NULL;
 =

-   while (*++s && (isalnum(*s) || strchr(":_.-", *s))) ;
+   while (*++s && (dIsalnum(*s) || strchr(":_.-", *s))) ;
    c =3D *s;
    *s =3D '\0';
    if (c !=3D ';') {
@@ -1061,7 +1060,7 @@ static const char *Html_parse_entity(DilloHtml *html=
, const char *token,
 =

    if (*tok =3D=3D '#') {
       ret =3D Html_parse_numeric_charref(html, tok+1, is_attr, entsize);
-   } else if (isalpha(*tok)) {
+   } else if (dIsalpha(*tok)) {
       ret =3D Html_parse_named_charref(html, tok, is_attr, entsize);
    } else if (prefs.show_extra_warnings &&
        (!(html->DocType =3D=3D DT_HTML && html->DocTypeVersion >=3D 5.0f)=
)) {
@@ -1259,11 +1258,11 @@ static void Html_process_word(DilloHtml *html, con=
st char *word, int size)
       /* all this overhead is to catch white-space entities */
       Pword =3D a_Html_parse_entities(html, word, size);
       for (start =3D i =3D 0; Pword[i]; start =3D i)
-         if (isspace(Pword[i])) {
-            while (Pword[++i] && isspace(Pword[i])) ;
+         if (dIsspace(Pword[i])) {
+            while (Pword[++i] && dIsspace(Pword[i])) ;
             Html_process_space(html, Pword + start, i - start);
          } else {
-            while (Pword[++i] && !isspace(Pword[i])) ;
+            while (Pword[++i] && !dIsspace(Pword[i])) ;
             HT2TB(html)->addText(Pword + start, i - start, html->wordStyl=
e ());
             html->pre_column +=3D i - start;
             html->PreFirstChar =3D false;
@@ -1297,8 +1296,8 @@ static void Html_process_word(DilloHtml *html, const=
 char *word, int size)
       for (start =3D i =3D 0; word2[i]; start =3D i) {
          int len;
 =

-         if (isspace(word2[i])) {
-            while (word2[++i] && isspace(word2[i])) ;
+         if (dIsspace(word2[i])) {
+            while (word2[++i] && dIsspace(word2[i])) ;
             Html_process_space(html, word2 + start, i - start);
          } else if (!strncmp(word2+i, utf8_zero_width_space, 3)) {
             i +=3D 3;
@@ -1310,7 +1309,7 @@ static void Html_process_word(DilloHtml *html, const=
 char *word, int size)
          } else {
             do {
                i +=3D len;
-            } while (word2[i] && !isspace(word2[i]) &&
+            } while (word2[i] && !dIsspace(word2[i]) &&
                      strncmp(word2+i, utf8_zero_width_space, 3) &&
                      (!a_Utf8_ideographic(word2+i, beyond_word2, &len)));
             HT2TB(html)->addText(word2 + start, i - start, html->wordStyl=
e ());
@@ -1334,7 +1333,7 @@ static bool Html_match_tag(const char *tagstr, char =
*tag, int tagsize)
          return false;
    }
    /* The test for '/' is for xml compatibility: "empty/>" will be matche=
d. */
-   if (i < tagsize && (isspace(tag[i]) || tag[i] =3D=3D '>' || tag[i] =3D=
=3D '/'))
+   if (i < tagsize && (dIsspace(tag[i]) || tag[i] =3D=3D '>' || tag[i] =3D=
=3D '/'))
       return true;
    return false;
 }
@@ -1451,7 +1450,7 @@ CssLength a_Html_parse_length (DilloHtml *html, cons=
t char *attr)
       l =3D CSS_CREATE_LENGTH(0.0, CSS_LENGTH_TYPE_AUTO);
    else {
       /* allow only whitespaces */
-      if (*end && !isspace (*end)) {
+      if (*end && !dIsspace (*end)) {
          BUG_MSG("Garbage after length: '%s'.", attr);
          l =3D CSS_CREATE_LENGTH(0.0, CSS_LENGTH_TYPE_AUTO);
       }
@@ -1497,10 +1496,10 @@ static int
       int i;
 =

       for (i =3D 0; val[i]; ++i)
-         if (!d_isascii(val[i]) || !(isalnum(val[i]) || strchr(":_.-", va=
l[i])))
+         if (!d_isascii(val[i]) || !(dIsalnum(val[i]) || strchr(":_.-", v=
al[i])))
             break;
 =

-      if (val[i] || !(d_isascii(val[0]) && isalpha(val[0])))
+      if (val[i] || !(d_isascii(val[0]) && dIsalpha(val[0])))
          BUG_MSG("%s attribute value \"%s\" is not of the form "
                  "'[A-Za-z][A-Za-z0-9:_.-]*'.", attrname, val);
 =

@@ -1547,8 +1546,8 @@ static void Html_parse_doctype(DilloHtml *html, cons=
t char *tag, int tagsize)
    /* Tag sanitization: Collapse whitespace between tokens
     * and replace '\n' and '\r' with ' ' inside quoted strings. */
    for (i =3D 0, p =3D ntag; *p; ++p) {
-      if (isspace(*p)) {
-         for (ntag[i++] =3D ' '; isspace(p[1]); ++p) ;
+      if (dIsspace(*p)) {
+         for (ntag[i++] =3D ' '; dIsspace(p[1]); ++p) ;
       } else if ((quote =3D *p) =3D=3D '"' || *p =3D=3D '\'') {
          for (ntag[i++] =3D *p++; (ntag[i] =3D *p) && ntag[i++] !=3D quot=
e; ++p) {
             if (*p =3D=3D '\n' || *p =3D=3D '\r')
@@ -2390,7 +2389,7 @@ misc::SimpleVector<int> *Html_read_coords(DilloHtml =
*html, const char *str)
          break;
       coords->increase();
       coords->set(coords->size() - 1, coord);
-      while (isspace(*newtail))
+      while (dIsspace(*newtail))
          newtail++;
       if (!*newtail)
          break;
@@ -4203,7 +4202,7 @@ static const char *Html_get_attr2(DilloHtml *html,
    for (i =3D 1; i < tagsize; ++i) {
       switch (state) {
       case SEEK_ATTR_START:
-         if (isspace(tag[i]))
+         if (dIsspace(tag[i]))
             state =3D SEEK_TOKEN_START;
          else if (tag[i] =3D=3D '=3D')
             state =3D SEEK_VALUE_START;
@@ -4211,7 +4210,7 @@ static const char *Html_get_attr2(DilloHtml *html,
 =

       case MATCH_ATTR_NAME:
          if (!attrname[attr_pos] &&
-             (tag[i] =3D=3D '=3D' || isspace(tag[i]) || tag[i] =3D=3D '>'=
)) {
+             (tag[i] =3D=3D '=3D' || dIsspace(tag[i]) || tag[i] =3D=3D '>=
')) {
             Found =3D 1;
             state =3D SEEK_TOKEN_START;
             --i;
@@ -4227,14 +4226,14 @@ static const char *Html_get_attr2(DilloHtml *html,
       case SEEK_TOKEN_START:
          if (tag[i] =3D=3D '=3D') {
             state =3D SEEK_VALUE_START;
-         } else if (!isspace(tag[i])) {
+         } else if (!dIsspace(tag[i])) {
             attr_pos =3D 0;
             state =3D (Found) ? FINISHED : MATCH_ATTR_NAME;
             --i;
          }
          break;
       case SEEK_VALUE_START:
-         if (!isspace(tag[i])) {
+         if (!dIsspace(tag[i])) {
             delimiter =3D (tag[i] =3D=3D '"' || tag[i] =3D=3D '\'') ? tag=
[i] : ' ';
             i -=3D (delimiter =3D=3D ' ');
             state =3D (Found) ? GET_VALUE : SKIP_VALUE;
@@ -4242,11 +4241,11 @@ static const char *Html_get_attr2(DilloHtml *html,
          break;
 =

       case SKIP_VALUE:
-         if ((delimiter =3D=3D ' ' && isspace(tag[i])) || tag[i] =3D=3D d=
elimiter)
+         if ((delimiter =3D=3D ' ' && dIsspace(tag[i])) || tag[i] =3D=3D =
delimiter)
             state =3D SEEK_TOKEN_START;
          break;
       case GET_VALUE:
-         if ((delimiter =3D=3D ' ' && (isspace(tag[i]) || tag[i] =3D=3D '=
>')) ||
+         if ((delimiter =3D=3D ' ' && (dIsspace(tag[i]) || tag[i] =3D=3D =
'>')) ||
              tag[i] =3D=3D delimiter) {
             state =3D FINISHED;
          } else if (tag[i] =3D=3D '&' &&
@@ -4277,10 +4276,10 @@ static const char *Html_get_attr2(DilloHtml *html,
    }
 =

    if (tag_parsing_flags & HTML_LeftTrim)
-      while (isspace(Buf->str[0]))
+      while (dIsspace(Buf->str[0]))
          dStr_erase(Buf, 0, 1);
    if (tag_parsing_flags & HTML_RightTrim)
-      while (Buf->len && isspace(Buf->str[Buf->len - 1]))
+      while (Buf->len && dIsspace(Buf->str[Buf->len - 1]))
          dStr_truncate(Buf, Buf->len - 1);
 =

    return (Found) ? Buf->str : NULL;
@@ -4374,14 +4373,14 @@ static int Html_write_raw(DilloHtml *html, char *b=
uf, int bufsize, int Eof)
             break;
       }
 =

-      if (isspace(buf[buf_index])) {
+      if (dIsspace(buf[buf_index])) {
          /* whitespace: group all available whitespace */
-         while (++buf_index < bufsize && isspace(buf[buf_index])) ;
+         while (++buf_index < bufsize && dIsspace(buf[buf_index])) ;
          Html_process_space(html, buf + token_start, buf_index - token_st=
art);
          token_start =3D buf_index;
 =

       } else if (buf[buf_index] =3D=3D '<' && (ch =3D buf[buf_index + 1])=
 &&
-                 (isalpha(ch) || strchr("/!?", ch)) ) {
+                 (dIsalpha(ch) || strchr("/!?", ch)) ) {
          /* Tag */
          if (buf_index + 3 < bufsize && !strncmp(buf + buf_index, "<!--",=
 4)) {
             /* Comment: search for close of comment, skipping over
@@ -4447,7 +4446,7 @@ static int Html_write_raw(DilloHtml *html, char *buf=
, int bufsize, int Eof)
          while (++buf_index < bufsize) {
             buf_index +=3D strcspn(buf + buf_index, " <\n\r\t\f\v");
             if (buf[buf_index] =3D=3D '<' && (ch =3D buf[buf_index + 1]) =
&&
-                !isalpha(ch) && !strchr("/!?", ch))
+                !dIsalpha(ch) && !strchr("/!?", ch))
                continue;
             break;
          }
diff --git a/src/keys.cc b/src/keys.cc
index 69256d6d..dd541a75 100644
--- a/src/keys.cc
+++ b/src/keys.cc
@@ -14,7 +14,6 @@
 #include <stdio.h>
 #include <stdlib.h>        /* strtol */
 #include <string.h>
-#include <ctype.h>
 =

 #include "dlib/dlib.h"
 #include "keys.hh"
@@ -216,7 +215,7 @@ KeysCommand_t Keys::getKeyCmd()
    KeyBinding_t keyNode;
 =

    keyNode.modifier =3D Fl::event_state() & (FL_SHIFT | FL_CTRL |FL_ALT|F=
L_META);
-   if (iscntrl(Fl::event_text()[0])) {
+   if (dIscntrl(Fl::event_text()[0])) {
       keyNode.key =3D Fl::event_key();
    } else {
       const char *beyond =3D Fl::event_text() + Fl::event_length();
@@ -359,7 +358,7 @@ void Keys::parseKey(char *key, char *commandName)
    }
 =

    // Skip space
-   for (  ; isspace(*key); ++key) ;
+   for (  ; dIsspace(*key); ++key) ;
    // Get modifiers
    while(*key =3D=3D '<' && (p =3D strchr(key, '>'))) {
       ++key;
diff --git a/src/misc.c b/src/misc.c
index 9129f819..4821a6ac 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -12,7 +12,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <assert.h>
 =

 #include "utf8.hh"
@@ -222,13 +221,13 @@ void a_Misc_parse_content_type(const char *type, cha=
r **major, char **minor,
    if (!(str =3D type))
       return;
 =

-   for (s =3D str; *s && d_isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) =
&&
+   for (s =3D str; *s && d_isascii((uchar_t)*s) && !dIscntrl(*s) &&
         !strchr(tspecials_space, *s); s++) ;
    if (major)
       *major =3D dStrndup(str, s - str);
 =

    if (*s =3D=3D '/') {
-      for (str =3D ++s; *s && d_isascii((uchar_t)*s) && !iscntrl((uchar_t=
)*s) &&
+      for (str =3D ++s; *s && d_isascii((uchar_t)*s) && !dIscntrl(*s) &&
            !strchr(tspecials_space, *s); s++) ;
       if (minor)
          *minor =3D dStrndup(str, s - str);
diff --git a/src/misc.h b/src/misc.h
index 81c109c2..d6a558f4 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -2,7 +2,6 @@
 #define __DILLO_MISC_H__
 =

 #include <stddef.h>     /* for size_t */
-#include <ctype.h>      /* iscntrl, isascii */
 =

 =

 #ifdef __cplusplus
@@ -42,7 +41,7 @@ static inline void a_Misc_parse_content_disposition(cons=
t char *disposition, cha
    str =3D disposition;
 =

    /* Parse the type (attachment, inline, ...) by reading alpha character=
s. */
-   for (s =3D str; *s && d_isascii((uchar_t)*s) && !iscntrl((uchar_t)*s) =
&&
+   for (s =3D str; *s && d_isascii((uchar_t)*s) && !dIscntrl(*s) &&
       !strchr(tspecials_space, *s); s++) ;
 =

    if (s !=3D str) {
diff --git a/src/table.cc b/src/table.cc
index 6d144380..3b6c9f80 100644
--- a/src/table.cc
+++ b/src/table.cc
@@ -51,7 +51,7 @@ void Html_tag_open_table(DilloHtml *html, const char *ta=
g, int tagsize)
    CssLength cssLength;
 =

    if ((attrbuf =3D a_Html_get_attr(html, tag, tagsize, "border")))
-      border =3D isdigit(attrbuf[0]) ? strtol (attrbuf, NULL, 10) : 1;
+      border =3D dIsdigit(attrbuf[0]) ? strtol (attrbuf, NULL, 10) : 1;
    if ((attrbuf =3D a_Html_get_attr(html, tag, tagsize, "cellspacing"))) =
{
       cellspacing =3D strtol (attrbuf, NULL, 10);
       if (html->DocType =3D=3D DT_HTML && html->DocTypeVersion >=3D 5.0f)
diff --git a/src/url.c b/src/url.c
index b50e6a72..9d465c1c 100644
--- a/src/url.c
+++ b/src/url.c
@@ -44,7 +44,6 @@
 =

 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 =

 #include "url.h"
 #include "hsts.h"
diff --git a/src/xembed.cc b/src/xembed.cc
index fb623f1d..d50b93fc 100644
--- a/src/xembed.cc
+++ b/src/xembed.cc
@@ -10,7 +10,6 @@
  */
 =

 #include <string.h>
-#include <ctype.h>
 =

 #define FL_INTERNALS
 #include <FL/Fl_Window.H>
diff --git a/test/dw/dw_anchors_test.cc b/test/dw/dw_anchors_test.cc
index 258acc0e..1a362419 100644
--- a/test/dw/dw_anchors_test.cc
+++ b/test/dw/dw_anchors_test.cc
@@ -20,7 +20,6 @@
 =

 =

 =

-#include <ctype.h>
 #include <FL/Fl_Window.H>
 #include <FL/Fl.H>
 =

diff --git a/test/unit/cookies.c b/test/unit/cookies.c
index 40a19418..2d0bf868 100644
--- a/test/unit/cookies.c
+++ b/test/unit/cookies.c
@@ -26,7 +26,6 @@
 #include <stdarg.h>  /* va_list */
 #include <string.h> /* strchr */
 #include <errno.h>
-#include <ctype.h>
 #include <time.h>
 /* net */
 #include <sys/types.h>
@@ -126,7 +125,7 @@ static int Dpi_read_comm_keys(int *port)
       MSG_ERR("[Dpi_read_comm_keys] empty file: %s\n", fname);
    } else {
       *port =3D strtol(rcline, &tail, 10);
-      for (i =3D 0; *tail && isxdigit(tail[i+1]); ++i)
+      for (i =3D 0; *tail && dIsxdigit(tail[i+1]); ++i)
          SharedKey[i] =3D tail[i+1];
       SharedKey[i] =3D 0;
       ret =3D 1;
-- =

2.52.0


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Dillo-dev mailing list -- dillo-dev-lx9mn2B4QYRWk0Htik3J/[email protected]
To unsubscribe send an email to dillo-dev-leave-lx9mn2B4QYRWk0Htik3J/[email protected]

------- =_aaaaaaaaaa0--