From 1d09cdaa6a79e0f0baa24d95c7fa992829cd455f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 25 Mar 2019 16:04:25 -0400 Subject: [PATCH] munmap allows address 0 fixes test suite regression on macOS from previous commit --- std/c.zig | 2 +- std/os/darwin.zig | 2 +- std/os/freebsd.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/std/c.zig b/std/c.zig index 41ec6a3569adad1e295082fc655158f5016d38bd..acff9229d1b31b9f076d5002e2c05cd4530860cc 100644 --- a/std/c.zig +++ b/std/c.zig @@ -27,7 +27,7 @@ pub extern "c" fn stat(noalias path: [*]const u8, noalias buf: *Stat) c_int; pub extern "c" fn write(fd: c_int, buf: *const c_void, nbyte: usize) isize; pub extern "c" fn pwrite(fd: c_int, buf: *const c_void, nbyte: usize, offset: u64) isize; pub extern "c" fn mmap(addr: ?*c_void, len: usize, prot: c_int, flags: c_int, fd: c_int, offset: isize) ?*c_void; -pub extern "c" fn munmap(addr: *c_void, len: usize) c_int; +pub extern "c" fn munmap(addr: ?*c_void, len: usize) c_int; pub extern "c" fn unlink(path: [*]const u8) c_int; pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8; pub extern "c" fn waitpid(pid: c_int, stat_loc: *c_int, options: c_int) c_int; diff --git a/std/os/darwin.zig b/std/os/darwin.zig index 4ce631c6ab8747202e69841f6786727b0f5ad302..9dc1ce117333acdff0a5f0f15e5a27dfd7332412 100644 --- a/std/os/darwin.zig +++ b/std/os/darwin.zig @@ -677,7 +677,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of } pub fn munmap(address: usize, length: usize) usize { - return errnoWrap(c.munmap(@intToPtr(*c_void, address), length)); + return errnoWrap(c.munmap(@intToPtr(?*c_void, address), length)); } pub fn unlink(path: [*]const u8) usize { diff --git a/std/os/freebsd.zig b/std/os/freebsd.zig index 90e8de1557cbf3988b7b69bef82ea634ff690466..c806067706bb6b730e761a7de8c3727c1fc5ef6f 100644 --- a/std/os/freebsd.zig +++ b/std/os/freebsd.zig @@ -628,7 +628,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of } pub fn munmap(address: usize, length: usize) usize { - return errnoWrap(c.munmap(@intToPtr(*c_void, address), length)); + return errnoWrap(c.munmap(@intToPtr(?*c_void, address), length)); } pub fn read(fd: i32, buf: [*]u8, nbyte: usize) usize { -- 2.54.0