smu

Simple markup processor
git clone https://git.sinitax.com/codemadness/smu
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 0c366f57600669cba8cff413d080f58304073a3f
parent 743f6ce00b472c6e7694b5d3c02eb73cbccaf223
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 11 May 2021 17:44:08 +0200

fix a regression in parsing when a link contains () + minor style fix

Diffstat:
Msmu.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/smu.c b/smu.c @@ -33,8 +33,8 @@ static int doshortlink(const char *begin, const char *end, int newblock); /* Par static int dosurround(const char *begin, const char *end, int newblock); /* Parser for surrounding tags */ static int dounderline(const char *begin, const char *end, int newblock); /* Parser for underline tags */ static void *ereallocz(void *p, size_t size); -static void hprint(const char *begin, const char *end); /* escapes HTML and prints it to output */ -static void hprintattr(const char *begin, const char *end); /* escapes HTML for attributes and prints it to output */ +static void hprint(const char *begin, const char *end); /* Escapes HTML and prints it to output */ +static void hprintattr(const char *begin, const char *end); /* Escapes HTML for attributes and prints it to output */ static void process(const char *begin, const char *end, int isblock); /* Processes range between begin and end. */ /* list of parsers */ @@ -298,15 +298,15 @@ dolink(const char *begin, const char *end, int newblock) linkend--; } else { /* trim leading spaces */ - for (p = link; p < end && isspace((unsigned char)*p); p++) + for (p = link; p < q && isspace((unsigned char)*p); p++) ; - for (link = p; p < end; p++) { + for (link = p; p < q; p++) { if (isspace((unsigned char)*p)) { linkend = p; break; } } - for (; p < end; p++) { + for (; p < q; p++) { if (isspace((unsigned char)*p)) continue; if (*p == '=') { @@ -320,8 +320,8 @@ dolink(const char *begin, const char *end, int newblock) sep = *p; title = ++p; if ((titleend = strchr(title, sep))) { - if (titleend >= end) - titleend = end; + if (titleend >= q) + titleend = q; else p = titleend; }