diff options
author | Nicholas Johnson <nick@nicksphere.ch> | 2022-01-18 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicksphere.ch> | 2022-01-18 00:00:00 +0000 |
commit | 5061c75c11817a44f53084785da02a7ba5afa6bab35c45d7a3fc380510570883 (patch) | |
tree | 45f71b78b7869317c1e2e601a746a97300075a86505299cc4369fd7c597c133c | |
parent | 7daf122276e205e381deba6123877485531e23f420b0f680567da89522ee8009 (diff) |
Make escape_text length parameter more descriptive
-rw-r--r-- | src/gemini2html.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gemini2html.c b/src/gemini2html.c index 2d90636..bbc5788 100644 --- a/src/gemini2html.c +++ b/src/gemini2html.c @@ -31,7 +31,7 @@ * "i'm so high" => "I'm so high" * ""hello world" => ""hello world"" */ -char* escape_text(const char* unescaped, const size_t size) { +char* escape_text(const char* unescaped, const size_t unescaped_len) { /* In the worst case, every unescaped character corresponds to 6 escape characters. * Examples: * "'" => "'" @@ -39,10 +39,10 @@ char* escape_text(const char* unescaped, const size_t size) { * * +1 for the NULL byte at the end of the string */ - char* escaped = malloc(6 * size + 1); + char* escaped = malloc(6 * unescaped_len + 1); size_t escaped_pos = 0; - for (size_t unescaped_pos = 0; unescaped_pos < size; unescaped_pos++) { + for (size_t unescaped_pos = 0; unescaped_pos < unescaped_len; unescaped_pos++) { switch (unescaped[unescaped_pos]) { case '<': strncpy(escaped + escaped_pos, "<", 4); |