Move alloc procs to godotinternal module

This commit is contained in:
Ruslan Mustakov 2017-07-29 22:00:21 +07:00
commit 25a21072be
2 changed files with 17 additions and 17 deletions

View file

@ -83,20 +83,3 @@ proc stepify*(value, step: float32): float32 =
floor(value / step + 0.5'f32) * step
else:
value
# System Functions
proc godotAlloc*(bytes: cint): pointer {.
importc: "godot_alloc".}
## Allocates the specified number of bytes.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.
proc godotRealloc*(p: pointer; bytes: cint): pointer {.
importc: "godot_realloc".}
## Reallocates the pointer for the specified number of bytes.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.
proc godotFree*(p: pointer) {.importc: "godot_free".}
## Frees the memory pointed to by the pointer.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.

View file

@ -269,3 +269,20 @@ proc getClassName*(o: ptr GodotObject): string =
if result.len > 2 and result[^2] == 'S' and result[^1] == 'W':
# There are physics type not known by ClassDB
result = result[0..result.len-3]
# System Functions
proc godotAlloc*(bytes: cint): pointer {.
importc: "godot_alloc".}
## Allocates the specified number of bytes.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.
proc godotRealloc*(p: pointer; bytes: cint): pointer {.
importc: "godot_realloc".}
## Reallocates the pointer for the specified number of bytes.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.
proc godotFree*(p: pointer) {.importc: "godot_free".}
## Frees the memory pointed to by the pointer.
## Using this instead of stdlib proc will help Godot track how much memory
## is in use in debug mode.