add custom regex exec because regnexec doesnt exist in musl
This commit is contained in:
parent
ae9a0b231e
commit
b6747a40eb
2 changed files with 9 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 0e15f65dfbed81cbe3aa27437aa7ae27ae8f07f0
|
Subproject commit ce1c05c6e6fdc00ccc381ad3ba621edcaa80469e
|
10
src/regexp.c
10
src/regexp.c
|
@ -2,6 +2,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <regexp.h>
|
#include <regexp.h>
|
||||||
|
|
||||||
|
int regex_exec_char(const regex_t *preg, const char c, size_t nmatch, regmatch_t pmatch[], int eflags) {
|
||||||
|
char str[2] = {c, '\0'};
|
||||||
|
|
||||||
|
return regexec(preg, str, nmatch, pmatch, eflags);
|
||||||
|
}
|
||||||
|
|
||||||
void regex_step(char** input, char* c) {
|
void regex_step(char** input, char* c) {
|
||||||
(*input)++;
|
(*input)++;
|
||||||
*c = **input;
|
*c = **input;
|
||||||
|
@ -20,8 +26,8 @@ regex_t regex_create(const char* pattern, int flags) {
|
||||||
return regex;
|
return regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
int match_char(regex_t regex, char c) {
|
int match_char(regex_t regex, const char c) {
|
||||||
return regnexec(®ex, &c, 1, 0, NULL, 0) != REG_NOMATCH;
|
return regex_exec_char(®ex, c, 0, NULL, 0) != REG_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
sl_string collect_until(match_func matcher, regex_t regex, char** input) {
|
sl_string collect_until(match_func matcher, regex_t regex, char** input) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue