diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-11-12 15:05:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-12 15:05:36 +0100 |
commit | dfb020b174b6f3489294d9ec096de3cf9d6b5944 (patch) | |
tree | 30a5ef1faaa611c5de2d092d03c5cb12df0741b5 /lib/core | |
parent | 7e689873e203620c3a14f1697129cd0e3fd548e4 (diff) | |
download | Nim-dfb020b174b6f3489294d9ec096de3cf9d6b5944.tar.gz |
.cursor implementation (#12637)
* cursors: first implementation * added currently failing test * .cursor works for doubly linked lists * make -d:useMalloc work again * added code to nil out refs in a destructor * it's now called --gc:arc * renderer.nim: render nkBreakState properly * make simple closure iterators work without leaking
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/allocators.nim | 4 | ||||
-rw-r--r-- | lib/core/runtime_v2.nim | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/core/allocators.nim b/lib/core/allocators.nim index 25df59b63..43aae0111 100644 --- a/lib/core/allocators.nim +++ b/lib/core/allocators.nim @@ -43,7 +43,7 @@ proc getLocalAllocator*(): Allocator = result = addr allocatorStorage result.alloc = proc (a: Allocator; size: int; alignment: int = 8): pointer {.nimcall, raises: [].} = when defined(useMalloc) and not defined(nimscript): - result = c_malloc(size) + result = c_malloc(cuint size) # XXX do we need this? nimZeroMem(result, size) else: @@ -57,7 +57,7 @@ proc getLocalAllocator*(): Allocator = inc a.deallocCount result.realloc = proc (a: Allocator; p: pointer; oldSize, newSize: int): pointer {.nimcall, raises: [].} = when defined(useMalloc) and not defined(nimscript): - result = c_realloc(p, newSize) + result = c_realloc(p, cuint newSize) else: result = system.realloc(p, newSize) nimZeroMem(result +! oldSize, newSize - oldSize) diff --git a/lib/core/runtime_v2.nim b/lib/core/runtime_v2.nim index aa2511ce4..d18f91f6f 100644 --- a/lib/core/runtime_v2.nim +++ b/lib/core/runtime_v2.nim @@ -47,7 +47,7 @@ proc nimNewObj(size: int): pointer {.compilerRtl.} = when defined(nimscript): discard elif defined(useMalloc): - var orig = c_malloc(s) + var orig = c_malloc(cuint s) nimZeroMem(orig, s) result = orig +! sizeof(RefHeader) else: |