mirror of
https://github.com/ziglang/zig.git
synced 2026-01-19 05:45:12 +00:00
also start prefering NtDll API. so far: * NtQueryInformationFile * NtClose adds a performance workaround for windows unicode conversion. but that should probably be removed before merging
13 lines
197 B
C
13 lines
197 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
char *strndup(const char *s, size_t n)
|
|
{
|
|
size_t l = strnlen(s, n);
|
|
char *d = malloc(l+1);
|
|
if (!d) return NULL;
|
|
memcpy(d, s, l);
|
|
d[l] = 0;
|
|
return d;
|
|
}
|