commit 043ba68601ec7884f745b72b052ab0a1d0030e3d
parent 85f25df58716735cd9da678128e310a33c6a010f
Author: Eyal Sawady <ecs@d2evs.net>
Date: Mon, 25 Apr 2022 22:42:36 +0000
regex: replace alloc([]) with []
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/regex/regex.ha b/regex/regex.ha
@@ -141,7 +141,7 @@ fn handle_bracket(
};
if (*bracket_idx == -1) {
- append(charsets, alloc([]));
+ append(charsets, []);
};
*bracket_idx += 1;
@@ -217,8 +217,8 @@ fn handle_bracket(
// Compiles a string containing a regular expression into a regex struct.
export fn compile(expr: str) (regex | error) = {
- let insts: []inst = alloc([]);
- let charsets: []charset = alloc([]);
+ let insts: []inst = [];
+ let charsets: []charset = [];
let iter = strings::iter(expr);
let r_idx = 0z;
let anchored = false;
@@ -649,7 +649,7 @@ fn search(
str_idx: *int
) (void | []matchgroup | error) = {
let threads: []thread = alloc([
- thread { groups = alloc([]), ... }
+ thread { groups = [], ... }
]);
if (re.n_reps > 0) {
threads[0].rep_counters = alloc([0...], re.n_reps);
@@ -775,7 +775,7 @@ export fn find(re: regex, string: str) (void | []matchgroup | error) = {
// Attempts to match a regular expression against a string and returns all
// non-overlapping matches.
export fn findall(re: regex, string: str) (void | [][]matchgroup | error) = {
- let res: [][]matchgroup = alloc([]);
+ let res: [][]matchgroup = [];
let str_idx = -1;
let str_iter = strings::iter(string);
for (true) {