Introduction
Introduction Statistics Contact Development Disclaimer Help
sync C locale fixes from xmlparser repo - frontends - front-ends for some sites…
Log
Files
Refs
README
LICENSE
---
commit a38626bbb42f235b3d70635032f053db83322cfc
parent 607821dd376f5aaabac189e902e4d372af6b8863
Author: Hiltjo Posthuma <[email protected]>
Date: Tue, 29 Mar 2022 11:02:05 +0200
sync C locale fixes from xmlparser repo
Diffstat:
M xml.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/xml.c b/xml.c
@@ -9,6 +9,9 @@
#include "xml.h"
+#define ISALPHA(c) ((((unsigned)c) | 32) - 'a' < 26)
+#define ISSPACE(c) ((c) == ' ' || ((((unsigned)c) - '\t') < 5))
+
/* data buffers, size and offset used for parsing XML, see getnext() */
static const unsigned char *xml_data_buf;
static size_t xml_data_size;
@@ -37,7 +40,7 @@ xml_parseattrs(XMLParser *x)
int c, endsep, endname = 0, valuestart = 0;
while ((c = GETNEXT()) != EOF) {
- if (isspace(c)) {
+ if (ISSPACE(c)) {
if (namelen)
endname = 1;
continue;
@@ -47,7 +50,7 @@ xml_parseattrs(XMLParser *x)
x->name[namelen] = '\0';
valuestart = 1;
endname = 1;
- } else if (namelen && ((endname && !valuestart && isalpha(c)) …
+ } else if (namelen && ((endname && !valuestart && ISALPHA(c)) …
/* attribute without value */
x->name[namelen] = '\0';
if (x->xmlattrstart)
@@ -68,7 +71,7 @@ xml_parseattrs(XMLParser *x)
if (c == '\'' || c == '"') {
endsep = c;
} else {
- endsep = ' '; /* isspace() */
+ endsep = ' '; /* ISSPACE() */
goto startvalue;
}
@@ -82,7 +85,7 @@ startvalue:
x->data[0] = c;
valuelen = 1;
while ((c = GETNEXT()) != EOF) {
- if (c == endsep || (endsep == …
+ if (c == endsep || (endsep == …
break;
if (valuelen < sizeof(x->data)…
x->data[valuelen++] = …
@@ -103,7 +106,7 @@ startvalue:
break;
}
}
- } else if (c != endsep && !(endsep == ' ' && (…
+ } else if (c != endsep && !(endsep == ' ' && (…
if (valuelen < sizeof(x->data) - 1) {
x->data[valuelen++] = c;
} else {
@@ -114,7 +117,7 @@ startvalue:
valuelen = 1;
}
}
- if (c == endsep || (endsep == ' ' && (c == '>'…
+ if (c == endsep || (endsep == ' ' && (c == '>'…
x->data[valuelen] = '\0';
if (x->xmlattr)
x->xmlattr(x, x->tag, x->tagle…
@@ -392,7 +395,7 @@ xml_parse(XMLParser *x)
while ((c = GETNEXT()) != EOF) {
if (c == '/')
x->isshorttag = 1; /* short ta…
- else if (c == '>' || isspace(c)) {
+ else if (c == '>' || ISSPACE(c)) {
x->tag[x->taglen] = '\0';
if (isend) { /* end tag, start…
if (x->xmltagend)
@@ -403,7 +406,7 @@ xml_parse(XMLParser *x)
/* start tag */
if (x->xmltagstart)
x->xmltagstart…
- if (isspace(c))
+ if (ISSPACE(c))
xml_parseattrs…
if (x->xmltagstartpars…
x->xmltagstart…
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.