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 | 7daf122276e205e381deba6123877485531e23f420b0f680567da89522ee8009 (patch) | |
tree | a52aa4f47efcead8572fd08ac60ab03d657466f5e972303f18e97209ea44b093 | |
parent | 5179da0b877893ff81da5a63191061b63a710727d7518093eba92d88ee2e2784 (diff) |
Document prefix() and skip_*()
-rw-r--r-- | src/gemini2html.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gemini2html.c b/src/gemini2html.c index 48c5128..2d90636 100644 --- a/src/gemini2html.c +++ b/src/gemini2html.c @@ -75,15 +75,18 @@ char* escape_text(const char* unescaped, const size_t size) { return escaped; } +/* Returns true if str has the prefix pre, otherwise false. */ bool prefix(const char* pre, const char* str) { return strncmp(pre, str, strlen(pre)) == 0; } -int skip_whitespace(const char* str, size_t* pos) { +/* Moves pos index to next non-whitespace or NULL character in str. */ +void skip_whitespace(const char* str, size_t* pos) { while (str[*pos] != '\0' && (str[*pos] == ' ' || str[*pos] == '\t')) (*pos)++; } -int skip_non_whitespace(const char* str, size_t* pos) { +/* Moves pos index to next whitespace or NULL character in str. */ +void skip_non_whitespace(const char* str, size_t* pos) { while (str[*pos] != '\0' && !(str[*pos] == ' ' || str[*pos] == '\t')) (*pos)++; } |