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

Function mi_wdupenv_s

3rd/mimalloc-2.0.9/src/alloc-posix.c:157–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157int mi_wdupenv_s(unsigned short** buf, size_t* size, const unsigned short* name) mi_attr_noexcept {
158 if (buf==NULL || name==NULL) return EINVAL;
159 if (size != NULL) *size = 0;
160#if !defined(_WIN32) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP))
161 // not supported
162 *buf = NULL;
163 return EINVAL;
164#else
165 unsigned short* p = (unsigned short*)_wgetenv((const wchar_t*)name); // msvc warning 4996
166 if (p==NULL) {
167 *buf = NULL;
168 }
169 else {
170 *buf = mi_wcsdup(p);
171 if (*buf==NULL) return ENOMEM;
172 if (size != NULL) *size = wcslen((const wchar_t*)p);
173 }
174 return 0;
175#endif
176}
177
178mi_decl_nodiscard void* mi_aligned_offset_recalloc(void* p, size_t newcount, size_t size, size_t alignment, size_t offset) mi_attr_noexcept { // Microsoft
179 return mi_recalloc_aligned_at(p, newcount, size, alignment, offset);

Callers

nothing calls this directly

Calls 1

mi_wcsdupFunction · 0.85

Tested by

no test coverage detected