aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicksphere.ch>2022-01-25 00:00:00 +0000
committerNicholas Johnson <nick@nicksphere.ch>2022-01-25 00:00:00 +0000
commit568624bc668045822726981a0d4518ce131eab8ff9abfb79cc257235f254d31b (patch)
tree7c21de0c938dc83e68427748fb5f65ceb06ec35018e47d8bf302dfbc0b4c5722
parent6d7e18b35643c318c67d3042e9fe43b041d1e26e660013129ca1c41f387b021e (diff)
Replace size arg with len for clarity
-rw-r--r--src/gemini2html.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gemini2html.c b/src/gemini2html.c
index c4617d7..0fd5da6 100644
--- a/src/gemini2html.c
+++ b/src/gemini2html.c
@@ -162,17 +162,17 @@ enum linetype getlinetype(const char* line, const bool pre_is_toggled) {
* If the text line is empty except for a newline, "<br/>\n" is returned.
* Otherwise the escaped text line is returned.
*/
-char* convert_text_line(const char* line, const size_t size) {
+char* convert_text_line(const char* line, const size_t len) {
if (line[0] == '\n') return escape_text_add_tags("", "", "<br/>", 0);
- else return escape_text_add_tags("<p>", line, "</p>", size);
+ else return escape_text_add_tags("<p>", line, "</p>", len);
}
/* Converts the preformatted text line to HTML.
*
* Returns the escaped preformatted text line.
*/
-char* convert_pre_line(const char* line, const size_t size) {
- return escape_text_add_tags("", line, "", size);
+char* convert_pre_line(const char* line, const size_t len) {
+ return escape_text_add_tags("", line, "", len);
}
/* Converts the preformatting toggle line to HTML.
@@ -180,7 +180,7 @@ char* convert_pre_line(const char* line, const size_t size) {
* Returns the empty string. Preformatting toggle lines aren't meant to be displayed.
* convert_pre_toggle_line() doesn't know if the starting or ending toggle line, so gmi_to_html() handles the pre tags.
*/
-char* convert_pre_toggle_line(const char* line, const size_t size) {
+char* convert_pre_toggle_line(const char* line, const size_t len) {
return strdup("");
}
@@ -194,7 +194,7 @@ char* convert_pre_toggle_line(const char* line, const size_t size) {
* convert_link_line("=> https://google.com Goolag ") => "<a rel=\"noreferrer noopener\" href=\"https://google.com\"">Goolag </a>\n"
* convert_link_line("=> https://google.com") => "<a rel=\"noreferrer noopener\" href=\"https://google.com\"">https://google.com</a>\n"
*/
-char* convert_link_line(const char* line, const size_t size) {
+char* convert_link_line(const char* line, const size_t len) {
/* skip whitespace before href */
size_t before_href = 2;
skip_whitespace(line, &before_href);
@@ -219,7 +219,7 @@ char* convert_link_line(const char* line, const size_t size) {
escaped_with_tags = escape_text_add_tags(escaped_href, line + before_href, "</a>", after_href - before_href);
/* otherwise use the link text */
} else {
- escaped_with_tags = escape_text_add_tags(escaped_href, line + before_link_text, "</a>", size - before_link_text);
+ escaped_with_tags = escape_text_add_tags(escaped_href, line + before_link_text, "</a>", len - before_link_text);
}
/* escaped_href is no longer needed */
@@ -237,10 +237,10 @@ char* convert_link_line(const char* line, const size_t size) {
* Example:
* convert_h1_line("# i'm an h1 heading! ") => "<h1>i&apos;m an h1 heading! </h1>\n"
*/
-char* convert_h1_line(const char* line, const size_t size) {
+char* convert_h1_line(const char* line, const size_t len) {
size_t pos = 1;
skip_whitespace(line, &pos);
- return escape_text_add_tags("<h1>", line + pos, "</h1>", size - pos);
+ return escape_text_add_tags("<h1>", line + pos, "</h1>", len - pos);
}
/* Converts the heading text line to HTML.
@@ -251,10 +251,10 @@ char* convert_h1_line(const char* line, const size_t size) {
* Example:
* convert_h2_line("## i'm an h2 heading! ") => "<h2>i&apos;m an h2 heading! </h2>\n"
*/
-char* convert_h2_line(const char* line, const size_t size) {
+char* convert_h2_line(const char* line, const size_t len) {
size_t pos = 2;
skip_whitespace(line, &pos);
- return escape_text_add_tags("<h2>", line + pos, "</h2>", size - pos);
+ return escape_text_add_tags("<h2>", line + pos, "</h2>", len - pos);
}
/* Converts the heading text line to HTML.
@@ -265,10 +265,10 @@ char* convert_h2_line(const char* line, const size_t size) {
* Example:
* convert_h3_line("### i'm an h3 heading! ") => "<h3>i&apos;m an h3 heading! </h3>\n"
*/
-char* convert_h3_line(const char* line, const size_t size) {
+char* convert_h3_line(const char* line, const size_t len) {
size_t pos = 3;
skip_whitespace(line, &pos);
- return escape_text_add_tags("<h3>", line + pos, "</h3>", size - pos);
+ return escape_text_add_tags("<h3>", line + pos, "</h3>", len - pos);
}
/* Converts the unordered list line to HTML.
@@ -281,10 +281,10 @@ char* convert_h3_line(const char* line, const size_t size) {
*
* convert_ul_line() doesn't know when it's at the first or last list item, so gmi_to_html() handles the surrounding ul tags.
*/
-char* convert_ul_line(const char* line, const size_t size) {
+char* convert_ul_line(const char* line, const size_t len) {
size_t pos = 1;
skip_whitespace(line, &pos);
- escape_text_add_tags("<li>", line + pos, "</li>", size - pos);
+ escape_text_add_tags("<li>", line + pos, "</li>", len - pos);
}
/* Converts the quote line to HTML.
@@ -297,10 +297,10 @@ char* convert_ul_line(const char* line, const size_t size) {
*
* convert_quote_line() doesn't know when it's at the first or last quote line, so gmi_to_html() handles the surrounding blockquote tags.
*/
-char* convert_quote_line(const char* line, const size_t size) {
+char* convert_quote_line(const char* line, const size_t len) {
size_t pos = 1;
skip_whitespace(line, &pos);
- return escape_text_add_tags("", line + pos, "", size - pos);
+ return escape_text_add_tags("", line + pos, "", len - pos);
}
/* Generic function for other convert_line functions. */