1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

[gemini] strncmp for readability

This commit is contained in:
Witold Filipczyk 2021-07-02 15:21:39 +02:00
parent 2f1e2fc58b
commit 623e0738df

@ -158,8 +158,8 @@ render_gemini_document(struct cache_entry *cached, struct document *document,
line.length = len; line.length = len;
struct string *repl; struct string *repl;
if (len >= 3 && (line.source[0] == '`' && line.source[1] == '`' && line.source[2] == '`') if (len >= 3 && (!strncmp(line.source, "```", 3)
|| (line.source[len-1] == '`' && line.source[len-2] == '`' && line.source[len-3])) { || !strncmp(line.source + len - 3, "```", 3))) {
preformat = !preformat; preformat = !preformat;
repl = preformat ? &pre_start : &pre_end; repl = preformat ? &pre_start : &pre_end;
string_replace(&html, &line, &gem_pre, repl); string_replace(&html, &line, &gem_pre, repl);