diff --git a/dub.sdl b/dub.sdl index d228f09..93d0513 100644 --- a/dub.sdl +++ b/dub.sdl @@ -12,6 +12,7 @@ importPaths "./src/native" dependency "automem" version="~>0.6.6" preGenerateCommands "git submodule update --init" # despacer download dependency "despacer" path="./src/native/despacer/bindings/d" +dependency "bc-string" version="1.2.2" configuration "executable" { targetType "executable" diff --git a/dub.selections.json b/dub.selections.json index 8ac5703..914f13b 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -2,6 +2,7 @@ "fileVersion": 1, "versions": { "automem": "0.6.7", + "bc-string": "1.2.2", "despacer": {"path":"src/native/despacer/bindings/d"}, "test_allocator": "0.3.3", "unit-threaded": "2.0.3" diff --git a/src/native/lib.d b/src/native/lib.d index 17ba70f..6900e2d 100644 --- a/src/native/lib.d +++ b/src/native/lib.d @@ -1,6 +1,7 @@ module minijson.lib; import std : ctRegex, matchAll, matchFirst; +import bc.string: String; import despacer.simd_check : supports_sse4_1, supports_avx2; @@ -22,7 +23,7 @@ string minifyString(in string jsonString, in bool hasComment = false) @trusted auto in_string = false; auto in_multiline_comment = false; auto in_singleline_comment = false; - string result; + String result; size_t from = 0; auto rightContext = ""; @@ -99,7 +100,7 @@ string minifyString(in string jsonString, in bool hasComment = false) @trusted match.popFront(); } result ~= rightContext; - return result; + return cast (string) result; } private bool hasNoSlashOrEvenNumberOfSlashes(in string leftContextSubstr) @safe @nogc