vendor/libc: a bunch of additions

All these additions are to allow Dear ImGui to be compiled natively.
This commit is contained in:
Laytan Laats
2025-03-12 19:25:35 +01:00
parent d3b1aaad18
commit 140c902eff
15 changed files with 855 additions and 15 deletions
+10
View File
@@ -5,6 +5,7 @@ import "base:intrinsics"
import "core:c"
import "core:strings"
import "core:mem"
import "core:bytes"
// NOTE: already defined by Odin.
// void *memcpy(void *, const void *, size_t);
@@ -109,3 +110,12 @@ strstr :: proc "c" (str: cstring, substr: cstring) -> cstring {
return cstring(([^]byte)(str)[idx:])
}
@(require, linkage="strong", link_name="memchr")
memchr :: proc "c" (str: [^]byte, c: i32, n: uint) -> [^]byte {
idx := bytes.index_byte(str[:n], u8(c))
if idx < 0 {
return nil
}
return str[idx:]
}