diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-07-13 23:20:38 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-07-13 23:20:38 +0200 |
commit | 3e01d0dc158358d091bdee0ddf90b0f0562e1c89 (patch) | |
tree | b30ee3a5d9ab6ff3bd4dcce4cb25e50dc10c171f | |
parent | f317303d77b519bb5d7e13db6247c1cf3ae0a5ae (diff) |
Fix warning
m--------- | depends/html-parser | 0 | ||||
-rw-r--r-- | src/HtmlSearch.c | 13 |
2 files changed, 13 insertions, 0 deletions
diff --git a/depends/html-parser b/depends/html-parser -Subproject 66ec83b862ea2a8dbda1c1f3663af88a8d12d9b +Subproject 5ea469de363ab319f1cf0707c56bf3165287795 diff --git a/src/HtmlSearch.c b/src/HtmlSearch.c index f1631a7..8449ac9 100644 --- a/src/HtmlSearch.c +++ b/src/HtmlSearch.c @@ -349,19 +349,32 @@ static int is_newline(int c) { } static void lstrip(const char *str, size_t size, const char **output_str, size_t *output_size, int(*strip_filter_func)(int)) { + if(size == 0) { + *output_str = str; + *output_size = size; + return; + } + size_t i = 0; while(i < size && strip_filter_func(str[i])) { ++i; } + *output_str = str + i; *output_size = size - i; } static void rstrip(const char *str, size_t size, size_t *output_size, int(*strip_filter_func)(int)) { + if(size == 0) { + *output_size = size; + return; + } + ssize_t i = size - 1; while(i >= 0 && strip_filter_func(str[i])) { --i; } + *output_size = i + 1; } |