summaryrefslogtreecommitdiff
path: root/sfeed_xmlenc.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-03-29 11:03:54 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-03-29 11:03:54 +0200
commitd5ee385b4b5f19934a00408a2addc70f965ea4a9 (patch)
tree7f023c601b9b04dbd16273e47f3286f7ae61011e /sfeed_xmlenc.c
parent880256b8bfde746cd54993f3abcb4dc648895af7 (diff)
compatibility: reduce the assumption the builtin libc locale is ASCII-compatible
This is not clearly defined by the C99 standard. Define ctype-like macros to force it to be ASCII / UTF-8 (not extended ASCII or something like noticed on OpenBSD 3.8). (In practise modern libc libraries are all ASCII and UTF-8-compatible. Otherwise this would break many programs)
Diffstat (limited to 'sfeed_xmlenc.c')
-rw-r--r--sfeed_xmlenc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sfeed_xmlenc.c b/sfeed_xmlenc.c
index 67d7b0f..7fc93ae 100644
--- a/sfeed_xmlenc.c
+++ b/sfeed_xmlenc.c
@@ -1,4 +1,3 @@
-#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -26,10 +25,10 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
return;
for (; *v; v++) {
- if (isalpha((unsigned char)*v) ||
- isdigit((unsigned char)*v) ||
+ if (ISALPHA((unsigned char)*v) ||
+ ISDIGIT((unsigned char)*v) ||
*v == '.' || *v == ':' || *v == '-' || *v == '_')
- putchar(tolower((unsigned char)*v));
+ putchar(TOLOWER((unsigned char)*v));
}
}