aboutsummaryrefslogtreecommitdiff
path: root/libtxt
diff options
context:
space:
mode:
authorMarvin Borner2020-12-05 18:23:51 +0100
committerMarvin Borner2020-12-05 18:23:51 +0100
commita5e01116f8b28f7ff2e0b33e0ed837be448a43d9 (patch)
tree2e2362aa408f2d015c10720242abca3ac141169d /libtxt
parentcd2dbb2e146562c9e37c614bb09a24f7fbf135e0 (diff)
Some casual network fixes
Diffstat (limited to 'libtxt')
-rw-r--r--libtxt/html.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libtxt/html.c b/libtxt/html.c
index 4fa9789..e1c1246 100644
--- a/libtxt/html.c
+++ b/libtxt/html.c
@@ -62,8 +62,9 @@ static struct dom *generate_dom(char *data, u32 length)
enum xml_error err = xml_parse(&parser, buffer, length, tokens, 128);
if (err != XML_SUCCESS && err != XML_ERROR_BUFFERDRY) {
- printf("\nXML parse error: %d\n", err);
- /* return NULL; */
+ printf("XML parse error: %d\n", err);
+ printf("DATA: '%s'\n", data);
+ return NULL;
}
struct dom *root = new_object("root", NULL);
@@ -113,9 +114,8 @@ static struct dom *generate_dom(char *data, u32 length)
token->end_pos - token->start_pos);
name[token->end_pos - token->start_pos] = '\0';
char *clean_name = name;
- for (u32 j = 0; j < strlen(name); j++) {
- if (name[j] == ' ' || name[j] == '\n' || name[j] == '\r' ||
- name[j] == '\t') {
+ for (char *p = name; *p; p++) {
+ if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') {
clean_name++;
} else {
break;