diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/std/strbasics.nim | 2 | ||||
-rw-r--r-- | lib/system.nim | 6 | ||||
-rw-r--r-- | lib/system/strs_v2.nim | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/strbasics.nim b/lib/std/strbasics.nim index 0ea5a2817..9232204ab 100644 --- a/lib/std/strbasics.nim +++ b/lib/std/strbasics.nim @@ -81,7 +81,7 @@ func setSlice*(s: var string, slice: Slice[int]) = impl() else: when defined(nimSeqsV2): - prepareStrMutation(s) + prepareMutation(s) moveMem(addr s[0], addr s[first], last - first + 1) s.setLen(last - first + 1) diff --git a/lib/system.nim b/lib/system.nim index 605670f44..559c71f01 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -3122,14 +3122,14 @@ when not defined(createNimHcr) and not defined(nimscript): include nimhcr when notJSnotNims and not defined(nimSeqsV2): - proc prepareStrMutation*(s: var string) {.inline.} = + proc prepareMutation*(s: var string) {.inline.} = ## String literals (e.g. "abc", etc) in the ARC/ORC mode are "copy on write", - ## therefore you should call `prepareStrMutation` before modifying the strings + ## therefore you should call `prepareMutation` before modifying the strings ## via `addr`. runnableExamples("--gc:arc"): var x = "abc" var y = "defgh" - prepareStrMutation(y) # without this, you may get a `SIGBUS` or `SIGSEGV` + prepareMutation(y) # without this, you may get a `SIGBUS` or `SIGSEGV` moveMem(addr y[0], addr x[0], x.len) assert y == "abcgh" discard diff --git a/lib/system/strs_v2.nim b/lib/system/strs_v2.nim index 2647f7dcc..6944cdc58 100644 --- a/lib/system/strs_v2.nim +++ b/lib/system/strs_v2.nim @@ -169,9 +169,9 @@ proc nimPrepareStrMutationV2(s: var NimStringV2) {.compilerRtl, inline.} = if s.p != nil and (s.p.cap and strlitFlag) == strlitFlag: nimPrepareStrMutationImpl(s) -proc prepareStrMutation*(s: var string) {.inline.} = +proc prepareMutation*(s: var string) {.inline.} = # string literals are "copy on write", so you need to call - # `prepareStrMutation` before modifying the strings via `addr`. + # `prepareMutation` before modifying the strings via `addr`. {.cast(noSideEffect).}: let s = unsafeAddr s nimPrepareStrMutationV2(cast[ptr NimStringV2](s)[]) |