Commonize pattern matching functions

PUBLISHED_FROM=e69e298a51dbe0f9c47184169ecad06eef0676fc
This commit is contained in:
Sergey Lyubka authored and Cesanta Bot committed 2017-06-28 18:35:37 +00:00
1 parent ff078882d5
commit 244e5f67d3
5 files changed
+119 -150

No files matched your search

-2
View File
@@ -14,10 +14,8 @@ items:
- { name: mg_hexdump_connection.md }
- { name: mg_hexdumpf.md }
- { name: mg_is_big_endian.md }
- { name: mg_match_prefix.md }
- { name: mg_mbuf_append_base64.md }
- { name: mg_mbuf_append_base64_putc.md }
- { name: mg_next_comma_list_entry.md }
- { name: mg_open.md }
- { name: mg_skip.md }
- { name: mg_sock_addr_to_str.md }
-14
View File
@@ -1,14 +0,0 @@
---
title: "mg_match_prefix()"
decl_name: "mg_match_prefix"
symbol_kind: "func"
signature: |
int mg_match_prefix(const char *pattern, int pattern_len, const char *str);
---
Matches 0-terminated string (mg_match_prefix) or string with given length
mg_match_prefix_n against a glob pattern.
Match is case-insensitive. Returns number of bytes matched, or -1 if no
match.
@@ -1,21 +0,0 @@
---
title: "mg_next_comma_list_entry()"
decl_name: "mg_next_comma_list_entry"
symbol_kind: "func"
signature: |
const char *mg_next_comma_list_entry(const char *list, struct mg_str *val,
struct mg_str *eq_val);
---
A helper function for traversing a comma separated list of values.
It returns a list pointer shifted to the next value or NULL if the end
of the list found.
The value is stored in a val vector. If the value has a form "x=y", then
eq_val vector is initialised to point to the "y" part, and val vector length
is adjusted to point only to "x".
If the list is just a comma separated list of entries, like "aa,bb,cc" then
`eq_val` will contain zero-length string.
The purpose of this function is to parse comma separated string without
any copying/memory allocation.