diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-02-04 23:04:07 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-02-04 23:04:07 -0500 |
| commit | e56f903522c07c959d22e81e7b4dedef9d0bd5cf (patch) | |
| tree | 45215f4c1a1e0b0c28528c447728a1a222b784b8 /std | |
| parent | 64a0510205b4d224413de52fd87632fbe6bfe083 (diff) | |
| download | zig-e56f903522c07c959d22e81e7b4dedef9d0bd5cf.tar.gz zig-e56f903522c07c959d22e81e7b4dedef9d0bd5cf.zip | |
memset and memcpy implementations need not return dest
Diffstat (limited to 'std')
| -rw-r--r-- | std/builtin.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/std/builtin.zig b/std/builtin.zig index 5371c2c99e..9d150f2224 100644 --- a/std/builtin.zig +++ b/std/builtin.zig @@ -1,31 +1,31 @@ // These functions are provided when not linking against libc because LLVM // sometimes generates code that calls them. -export fn memset(dest: ?&u8, c: u8, n: usize) -> ?&u8 { +// Note that these functions do not return `dest`, like the libc API. +// The semantics of these functions is dictated by the corresponding +// LLVM intrinsics, not by the libc API. + +export fn memset(dest: ?&u8, c: u8, n: usize) { @setDebugSafety(this, false); if (n == 0) - return dest; + return; const d = ??dest; var index: usize = 0; while (index != n; index += 1) d[index] = c; - - return dest; } -export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) -> ?&u8 { +export fn memcpy(noalias dest: ?&u8, noalias src: ?&const u8, n: usize) { @setDebugSafety(this, false); if (n == 0) - return dest; + return; const d = ??dest; const s = ??src; var index: usize = 0; while (index != n; index += 1) d[index] = s[index]; - - return dest; } |
