Module: wine Branch: master Commit: 8fb70648d13875eefb07ae26c53bdb7bd2db8141 URL: https://gitlab.winehq.org/wine/wine/-/commit/8fb70648d13875eefb07ae26c53bdb7...
Author: Daniel Lehman dlehman25@gmail.com Date: Mon Aug 21 22:32:06 2023 -0700
include: Add [_w]getenv_s.
---
include/msvcrt/corecrt_wstdlib.h | 11 +++++++++++ include/msvcrt/stdlib.h | 11 +++++++++++ 2 files changed, 22 insertions(+)
diff --git a/include/msvcrt/corecrt_wstdlib.h b/include/msvcrt/corecrt_wstdlib.h index eef1fa26e0b..e37da1848ac 100644 --- a/include/msvcrt/corecrt_wstdlib.h +++ b/include/msvcrt/corecrt_wstdlib.h @@ -24,6 +24,7 @@ _ACRTIMP wchar_t* __cdecl _ultow(__msvcrt_ulong,wchar_t*,int); _ACRTIMP errno_t __cdecl _ultow_s(__msvcrt_ulong, wchar_t*, size_t, int); _ACRTIMP wchar_t* __cdecl _wfullpath(wchar_t*,const wchar_t*,size_t); _ACRTIMP wchar_t* __cdecl _wgetenv(const wchar_t*); +_ACRTIMP errno_t __cdecl _wgetenv_s(size_t *,wchar_t *,size_t,const wchar_t *); _ACRTIMP void __cdecl _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); _ACRTIMP int __cdecl _wmakepath_s(wchar_t*,size_t,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); _ACRTIMP void __cdecl _wperror(const wchar_t*); @@ -63,6 +64,16 @@ _ACRTIMP unsigned __int64 __cdecl wcstoull(const wchar_t*,wchar_t**,int); _ACRTIMP unsigned __int64 __cdecl _wcstoull_l(const wchar_t*,wchar_t**,int,_locale_t);
#ifdef __cplusplus +extern "C++" { + +template <size_t size> +inline errno_t _wgetenv_s(size_t *ret, wchar_t (&buf)[size], const wchar_t *var) +{ + return _wgetenv_s(ret, buf, size, var); +} + +} /* extern "C++" */ + } #endif
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index e7dd2caefc4..b7ced413440 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -216,6 +216,7 @@ _ACRTIMP ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); _ACRTIMP lldiv_t __cdecl lldiv(__int64,__int64); _ACRTIMP DECLSPEC_NORETURN void __cdecl exit(int); _ACRTIMP char* __cdecl getenv(const char*); +_ACRTIMP errno_t __cdecl getenv_s(size_t*,char*,size_t,const char*); _ACRTIMP __msvcrt_long __cdecl labs(__msvcrt_long); _ACRTIMP __int64 __cdecl llabs(__int64); _ACRTIMP int __cdecl mblen(const char*,size_t); @@ -255,6 +256,16 @@ static inline long double strtold(const char *string, char **endptr) { return _s #endif /* _UCRT */
#ifdef __cplusplus +extern "C++" { + +template <size_t size> +inline errno_t getenv_s(size_t *ret, char (&buf)[size], const char *var) +{ + return getenv_s(ret, buf, size, var); +} + +} /* extern "C++" */ + } #endif