mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-09 06:46:55 +00:00
MINOR: ist: add an iststop() function
Add a function that finds a character in an ist and returns an updated ist with the length of the portion of the original string that doesn't contain the char. Might be backported to 2.1
This commit is contained in:
parent
6e59cb5db1
commit
9dde0b2d31
@ -708,4 +708,16 @@ static inline struct ist istist(const struct ist ist, const struct ist pat)
|
||||
return ist2(NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* looks for the first occurence of <chr> in string <ist> and returns a shorter
|
||||
* ist if char is found.
|
||||
*/
|
||||
static inline struct ist iststop(const struct ist ist, char chr)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
while (len++ < ist.len && ist.ptr[len - 1] != chr)
|
||||
;
|
||||
return ist2(ist.ptr, len - 1);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user