From a6ad607c1cdf19e3baba602060fe1a0f4b94f1a6 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Wed, 25 Sep 2019 13:53:10 +0900 Subject: [PATCH] add onig_regset_get_regex() --- src/oniguruma.h | 2 ++ src/regexec.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/src/oniguruma.h b/src/oniguruma.h index 5f219d3..fe5a9c3 100644 --- a/src/oniguruma.h +++ b/src/oniguruma.h @@ -812,6 +812,8 @@ int onig_regset_add P_((OnigRegSet* set, regex_t* reg)); ONIG_EXTERN void onig_regset_free P_((OnigRegSet* set)); ONIG_EXTERN +regex_t* onig_regset_get_regex P_((OnigRegSet* set, int at)); +ONIG_EXTERN OnigRegion* onig_regset_get_region P_((OnigRegSet* set, int at)); ONIG_EXTERN int onig_regset_search P_((OnigRegSet* set, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegSetLead lead, OnigOptionType option, int* rmatch_pos)); diff --git a/src/regexec.c b/src/regexec.c index e2d1125..4a58c7c 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -4746,6 +4746,15 @@ onig_regset_free(OnigRegSet* set) xfree(set); } +extern regex_t* +onig_regset_get_regex(OnigRegSet* set, int at) +{ + if (at < 0 || at >= set->n) + return (regex_t* )0; + + return set->rs[at].reg; +} + extern OnigRegion* onig_regset_get_region(OnigRegSet* set, int at) { -- 2.40.0