From e8fb7067ddf8d08a710ad0205e81c54bc533b2f8 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Fri, 6 Sep 2024 23:11:55 -0700 Subject: [PATCH] fix: fix build on Arm MacOS with no SIMD --- src/native/lib.d | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/native/lib.d b/src/native/lib.d index 906745a..f5f0d49 100644 --- a/src/native/lib.d +++ b/src/native/lib.d @@ -127,7 +127,7 @@ private bool notSlashAndNoSpaceOrBreak(const ref string str) @safe } /** Removes spaces from the original string */ -private string remove_spaces(string str) @trusted nothrow +private string remove_spaces(string str) @trusted { static if (supports_sse4_1()) { @@ -140,8 +140,11 @@ private string remove_spaces(string str) @trusted nothrow } else { + import std.regex : replaceAll; + const spaceOrBreakRegex = ctRegex!(`\s`); str.replaceAll(spaceOrBreakRegex, ""); + return str; } } @@ -157,6 +160,8 @@ private bool hasNoSpace(const ref string str) @trusted } else { + import std.regex : matchFirst; + const spaceOrBreakRegex = ctRegex!(`\s`); return str.matchFirst(spaceOrBreakRegex).empty(); } @@ -174,8 +179,8 @@ private bool hasNoSpace(const ref string str) @trusted */ string[] minifyStrings(in string[] jsonStrings, in bool hasComment = false) @trusted { - import std.algorithm: map; - import std.array: array; + import std.algorithm : map; + import std.array : array; return jsonStrings.map!(jsonString => minifyString(jsonString, hasComment)).array(); }