1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

[gemini] strncmp for readability

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

View File

@ -144,7 +144,7 @@ render_gemini_document(struct cache_entry *cached, struct document *document,
add_to_string(&html, "\"/></head><body>");
mem_free_if(uristring);
while ( i < buffer->length) {
while (i < buffer->length) {
for (i = begin; i < buffer->length; ++i) {
if (buffer->source[i] == 13 || buffer->source[i] == 10) break;
@ -158,8 +158,8 @@ render_gemini_document(struct cache_entry *cached, struct document *document,
line.length = len;
struct string *repl;
if (len >= 3 && (line.source[0] == '`' && line.source[1] == '`' && line.source[2] == '`')
|| (line.source[len-1] == '`' && line.source[len-2] == '`' && line.source[len-3])) {
if (len >= 3 && (!strncmp(line.source, "```", 3)
|| !strncmp(line.source + len - 3, "```", 3))) {
preformat = !preformat;
repl = preformat ? &pre_start : &pre_end;
string_replace(&html, &line, &gem_pre, repl);