mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: fix a warning for -d debug_realloc
This commit is contained in:
@ -198,10 +198,12 @@ pub fn v_realloc(b byteptr, n int) byteptr {
|
|||||||
// 4) free the old block
|
// 4) free the old block
|
||||||
// => if there is still a pointer to the old block somewhere
|
// => if there is still a pointer to the old block somewhere
|
||||||
// it will point to memory that is now filled with 0x57.
|
// it will point to memory that is now filled with 0x57.
|
||||||
new_ptr = malloc(n)
|
unsafe {
|
||||||
C.memcpy(new_ptr, b, n)
|
new_ptr = malloc(n)
|
||||||
C.memset(b, 0x57, n)
|
C.memcpy(new_ptr, b, n)
|
||||||
C.free(b)
|
C.memset(b, 0x57, n)
|
||||||
|
C.free(b)
|
||||||
|
}
|
||||||
} $else {
|
} $else {
|
||||||
new_ptr = unsafe { C.realloc(b, n) }
|
new_ptr = unsafe { C.realloc(b, n) }
|
||||||
if new_ptr == 0 {
|
if new_ptr == 0 {
|
||||||
|
Reference in New Issue
Block a user