Commit fed0531f9dd2f04fa36feca8766d43d3a8534e14

Thomas de Grivel 2024-07-17T21:21:04

ekc3: html_escape

diff --git a/ekc3/html.c b/ekc3/html.c
index 87a486c..88eefd7 100644
--- a/ekc3/html.c
+++ b/ekc3/html.c
@@ -10,6 +10,7 @@
  * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
  * THIS SOFTWARE.
  */
+#include <libkc3/kc3.h>
 #include "html.h"
 
 s_str * html_escape (const s_str *str, s_str *dest)
@@ -38,7 +39,7 @@ s_str * html_escape (const s_str *str, s_str *dest)
              " List"));
     return NULL;
   }
-  escape = escape_tag->data.list;
+  escape = escape_tag.data.list;
   if (! buf_init_alloc(&buf, str->size * 8))
     return NULL;
   tag_c.type = TAG_CHARACTER;
@@ -71,14 +72,14 @@ s_str * html_escape (const s_str *str, s_str *dest)
     if (replace) {
       if (buf_write_str(&buf, &replace->data.str) <= 0) {
         err_puts("html_escape: buf_write_str");
-        assert(!("html_escape: buf_write_str");
+        assert(! "html_escape: buf_write_str");
         goto ko;
       }
     }
     else {
-      if (buf_write_character_utf8(&buf, &tag_c.data.character) <= 0) {
+      if (buf_write_character_utf8(&buf, tag_c.data.character) <= 0) {
         err_puts("html_escape: buf_write_character_utf8");
-        assert(!("html_escape: buf_write_character_utf8");
+        assert(! "html_escape: buf_write_character_utf8");
         goto ko;
       }
     }
diff --git a/ekc3/html.h b/ekc3/html.h
new file mode 100644
index 0000000..2da7d90
--- /dev/null
+++ b/ekc3/html.h
@@ -0,0 +1,20 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef EKC3_HTML_H
+#define EKC3_HTML_H
+
+#include "types.h"
+
+s_str * html_escape (const s_str *str, s_str *dest);
+
+#endif /* EKC3_HTML_H */
diff --git a/ekc3/sources.mk b/ekc3/sources.mk
index ab1436b..3d70e30 100644
--- a/ekc3/sources.mk
+++ b/ekc3/sources.mk
@@ -1,6 +1,7 @@
 # sources.mk generated by update_sources
 HEADERS = \
 	"ekc3.h" \
+	"html.h" \
 	"types.h" \
 
 SOURCES = \
diff --git a/ekc3/sources.sh b/ekc3/sources.sh
index 906f7d9..514daad 100644
--- a/ekc3/sources.sh
+++ b/ekc3/sources.sh
@@ -1,3 +1,3 @@
 # sources.sh generated by update_sources
-HEADERS='ekc3.h types.h '
+HEADERS='ekc3.h html.h types.h '
 SOURCES='ekc3.c html.c '