summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-13 01:38:29 +0430
committerGunnar Beutner <gunnar@beutner.name>2021-07-13 07:04:06 +0200
commitf9fed0b16712c05a13ad1a89a781e88609a53639 (patch)
tree39859ec21f9321cc728f7338d57137c975cf407d /Userland/Libraries/LibRegex
parent7e9845793714e77a6103b82462620dc8709926f0 (diff)
downloadserenity-f9fed0b16712c05a13ad1a89a781e88609a53639.zip
LibRegex+LibC: Make re_nsub available to the user
To comply with Dr.POSIX, this field has to be user-accessible.
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r--Userland/Libraries/LibRegex/C/Regex.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Userland/Libraries/LibRegex/C/Regex.cpp b/Userland/Libraries/LibRegex/C/Regex.cpp
index bb45131e04..35c40e9396 100644
--- a/Userland/Libraries/LibRegex/C/Regex.cpp
+++ b/Userland/Libraries/LibRegex/C/Regex.cpp
@@ -26,7 +26,6 @@ struct internal_regex_t {
size_t re_pat_errpos;
ReError re_pat_err;
String re_pat;
- size_t re_nsub;
};
static internal_regex_t* impl_from(regex_t* re)
@@ -51,7 +50,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags)
// Note that subsequent uses of regcomp() without regfree() _will_ leak memory
// This could've been prevented if libc provided a reginit() or similar, but it does not.
- reg->__data = new internal_regex_t { 0, 0, {}, 0, ReError::REG_NOERR, {}, 0 };
+ reg->__data = new internal_regex_t { 0, 0, {}, 0, ReError::REG_NOERR, {} };
auto preg = impl_from(reg);
bool is_extended = cflags & REG_EXTENDED;
@@ -76,7 +75,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags)
return (ReError)parser_result.error;
}
- preg->re_nsub = parser_result.capture_groups_count;
+ reg->re_nsub = parser_result.capture_groups_count;
return REG_NOERR;
}