ReviewOS

also looking at this

zig-utils/zig-regex

Port to latest zig-master

#2
Closed armagidon-exception wants to merge main into main
53 files +1149 -1017
tests/thread_safety.zigmodified+10-10
Changes to tests/thread_safety.zig
@@ -28,7 +28,7 @@ test "concurrent matching with same regex" {
2828 const allocator = testing.allocator;
2929
3030 // Compile a regex once
31 var regex = try Regex.compile(allocator, "\\d+");
31 var regex = try Regex.compile(allocator, std.testing.io, "\\d+");
3232 defer regex.deinit();
3333
3434 // Test inputs
@@ -73,7 +73,7 @@ test "concurrent matching with same regex" {
7373test "concurrent find operations" {
7474 const allocator = testing.allocator;
7575
76 var regex = try Regex.compile(allocator, "[0-9]+");
76 var regex = try Regex.compile(allocator, std.testing.io, "[0-9]+");
7777 defer regex.deinit();
7878
7979 const Worker = struct {
@@ -114,7 +114,7 @@ test "concurrent find operations" {
114114test "SharedRegex reference counting" {
115115 const allocator = testing.allocator;
116116
117 var shared = try SharedRegex.init(allocator, "test");
117 var shared = try SharedRegex.init(allocator, testing.io, "test");
118118 defer shared.deinit();
119119
120120 // Acquire multiple references
@@ -137,7 +137,7 @@ test "SharedRegex reference counting" {
137137test "SharedRegex concurrent access" {
138138 const allocator = testing.allocator;
139139
140 var shared = try SharedRegex.init(allocator, "\\d+");
140 var shared = try SharedRegex.init(allocator, testing.io, "\\d+");
141141 defer shared.deinit();
142142
143143 const Worker = struct {
@@ -172,7 +172,7 @@ test "SharedRegex concurrent access" {
172172test "RegexCache basic operations" {
173173 const allocator = testing.allocator;
174174
175 var cache = RegexCache.init(allocator);
175 var cache = RegexCache.init(allocator, testing.io);
176176 defer cache.deinit();
177177
178178 // Get and cache a pattern
@@ -195,7 +195,7 @@ test "thread-safe allocator with concurrent matching" {
195195 defer _ = gpa.deinit();
196196 const allocator = gpa.allocator();
197197
198 var regex = try Regex.compile(allocator, "test");
198 var regex = try Regex.compile(allocator, std.testing.io, "test");
199199 defer regex.deinit();
200200
201201 const Worker = struct {
@@ -227,13 +227,13 @@ test "concurrent matching different patterns" {
227227 const allocator = gpa.allocator();
228228
229229 // Compile multiple patterns
230 var regex1 = try Regex.compile(allocator, "\\d+");
230 var regex1 = try Regex.compile(allocator, std.testing.io, "\\d+");
231231 defer regex1.deinit();
232232
233 var regex2 = try Regex.compile(allocator, "[a-z]+");
233 var regex2 = try Regex.compile(allocator, std.testing.io, "[a-z]+");
234234 defer regex2.deinit();
235235
236 var regex3 = try Regex.compile(allocator, "test");
236 var regex3 = try Regex.compile(allocator, std.testing.io, "test");
237237 defer regex3.deinit();
238238
239239 const Worker = struct {
@@ -276,7 +276,7 @@ test "stress test: many threads many matches" {
276276 defer _ = gpa.deinit();
277277 const allocator = gpa.allocator();
278278
279 var regex = try Regex.compile(allocator, "test");
279 var regex = try Regex.compile(allocator, std.testing.io, "test");
280280 defer regex.deinit();
281281
282282 const Worker = struct {