summaryrefslogtreecommitdiff
path: root/src/creole.c
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-02-17 16:04:09 +0100
committerLinnnus <[email protected]>2024-02-17 16:04:09 +0100
commit0418c832533f8670211d5f44cb7eed5e70581c74 (patch)
tree35d1bc980b043859ffc310e78b7173484a1bbfcb /src/creole.c
parent7b5ed48d52ed7a24108c4411a01555f13d08d787 (diff)
refactor(creole): Use starts_with everywhere
Diffstat (limited to 'src/creole.c')
-rw-r--r--src/creole.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/creole.c b/src/creole.c
index 3beec9e..56edbd8 100644
--- a/src/creole.c
+++ b/src/creole.c
@@ -170,7 +170,7 @@ long do_replacements(const char *begin, const char *end, bool new_block, FILE *o
long do_link(const char *begin, const char *end, bool new_block, FILE *out)
{
// Links start with "[[".
- if (begin + 2 >= end || begin[0] != '[' || begin[1] != '[') {
+ if (!starts_with(begin, end, "[[")) {
return 0;
}
const char *start = begin + 2;
@@ -289,7 +289,7 @@ end_url:
}
long do_emphasis(const char *begin, const char *end, bool new_block, FILE *out) {
- if (begin + 2 >= end || begin[0] != '/' || begin[1] != '/') {
+ if (!starts_with(begin, end, "//")) {
return 0;
}
const char *start = begin + 2; /* // */
@@ -312,7 +312,7 @@ long do_emphasis(const char *begin, const char *end, bool new_block, FILE *out)
// FIXME: This is //almost// just a copy/paste of do_emphasis. Not very DRY...
// The one difficult part is that : should only be treated as an escape character for //.
long do_bold(const char *begin, const char *end, bool new_block, FILE *out) {
- if (begin + 2 >= end || begin[0] != '*' || begin[1] != '*') {
+ if (!starts_with(begin, end, "**")) {
return 0;
}
const char *start = begin + 2; /* // */