MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_heap_realpath

Function mi_heap_realpath

3rd/mimalloc-2.0.9/src/alloc.c:804–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802#endif
803#include <windows.h>
804mi_decl_nodiscard mi_decl_restrict char* mi_heap_realpath(mi_heap_t* heap, const char* fname, char* resolved_name) mi_attr_noexcept {
805 // todo: use GetFullPathNameW to allow longer file names
806 char buf[PATH_MAX];
807 DWORD res = GetFullPathNameA(fname, PATH_MAX, (resolved_name == NULL ? buf : resolved_name), NULL);
808 if (res == 0) {
809 errno = GetLastError(); return NULL;
810 }
811 else if (res > PATH_MAX) {
812 errno = EINVAL; return NULL;
813 }
814 else if (resolved_name != NULL) {
815 return resolved_name;
816 }
817 else {
818 return mi_heap_strndup(heap, buf, PATH_MAX);
819 }
820}
821#else
822/*
823#include <unistd.h> // pathconf

Callers 1

mi_realpathFunction · 0.85

Calls 2

mi_heap_strndupFunction · 0.85
mi_heap_strdupFunction · 0.85

Tested by

no test coverage detected