summaryrefslogtreecommitdiff
path: root/src/houdini_html_e.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-27 21:35:54 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-27 21:35:54 -0700
commit62cb38bf8a826125fba0034221343aa70dd3d415 (patch)
tree67348fa88068e1fdb2fca04d74c0ce60072bd280 /src/houdini_html_e.c
parentaca7161e53ec40f6979d024d84afeb36fa911292 (diff)
Use clang-format, llvm style, for formatting.
* Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig.
Diffstat (limited to 'src/houdini_html_e.c')
-rw-r--r--src/houdini_html_e.c87
1 files changed, 36 insertions, 51 deletions
diff --git a/src/houdini_html_e.c b/src/houdini_html_e.c
index 7f4b91f..0e539f0 100644
--- a/src/houdini_html_e.c
+++ b/src/houdini_html_e.c
@@ -16,66 +16,51 @@
*
*/
static const char HTML_ESCAPE_TABLE[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 4,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-static const char *HTML_ESCAPES[] = {
- "",
- "&quot;",
- "&amp;",
- "&#39;",
- "&#47;",
- "&lt;",
- "&gt;"
-};
+static const char *HTML_ESCAPES[] = {"", "&quot;", "&amp;", "&#39;",
+ "&#47;", "&lt;", "&gt;"};
-int
-houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, bufsize_t size, int secure)
-{
- bufsize_t i = 0, org, esc = 0;
+int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, bufsize_t size,
+ int secure) {
+ bufsize_t i = 0, org, esc = 0;
- while (i < size) {
- org = i;
- while (i < size && (esc = HTML_ESCAPE_TABLE[src[i]]) == 0)
- i++;
+ while (i < size) {
+ org = i;
+ while (i < size && (esc = HTML_ESCAPE_TABLE[src[i]]) == 0)
+ i++;
- if (i > org)
- cmark_strbuf_put(ob, src + org, i - org);
+ if (i > org)
+ cmark_strbuf_put(ob, src + org, i - org);
- /* escaping */
- if (unlikely(i >= size))
- break;
+ /* escaping */
+ if (unlikely(i >= size))
+ break;
- /* The forward slash is only escaped in secure mode */
- if ((src[i] == '/' || src[i] == '\'') && !secure) {
- cmark_strbuf_putc(ob, src[i]);
- } else {
- cmark_strbuf_puts(ob, HTML_ESCAPES[esc]);
- }
+ /* The forward slash is only escaped in secure mode */
+ if ((src[i] == '/' || src[i] == '\'') && !secure) {
+ cmark_strbuf_putc(ob, src[i]);
+ } else {
+ cmark_strbuf_puts(ob, HTML_ESCAPES[esc]);
+ }
- i++;
- }
+ i++;
+ }
- return 1;
+ return 1;
}
-int
-houdini_escape_html(cmark_strbuf *ob, const uint8_t *src, bufsize_t size)
-{
- return houdini_escape_html0(ob, src, size, 1);
+int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src, bufsize_t size) {
+ return houdini_escape_html0(ob, src, size, 1);
}