Re: [Mingw-w64-public] [PATCH 1/6] string_s.h/wchar_s.h: Added wcsnlen_s implementation.
Date: Tue, 19 Aug 2014 15:53:11 +0200 From: ja...@codeweavers.com To: mingw-w64-public@lists.sourceforge.net Subject: Re: [Mingw-w64-public] [PATCH 1/6] string_s.h/wchar_s.h: Added wcsnlen_s implementation. OK, I pushed it with extern inline declaration. If my memory is correct, when -std=gnu99/-std=c99 is specified, extern inline doesn't get rid of function definition. (e.g. Building GCC will probably be failed.) Therefore, we should use static with attribute unused. Yuta Thanks for reviews, Jacek On 08/19/14 15:38, Kai Tietz wrote: Hmm, this patch looks to me not 100% ok. Making functions static inline seems to be not the proper thing to do here AFAICS. This will lead to warning for cases those functions aren't used. So I would think that attribute unused is missing here. Additionally the 'inline' looks to me bogus. Either it should be extern inline, or static with attribute unused. Kai 2014-08-19 14:02 GMT+02:00 Jacek Caban ja...@codeweavers.com: --- mingw-w64-headers/crt/sec_api/string_s.h | 3 +++ mingw-w64-headers/crt/sec_api/wchar_s.h | 3 +++ 2 files changed, 6 insertions(+) -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH 1/6] string_s.h/wchar_s.h: Added wcsnlen_s implementation.
--- mingw-w64-headers/crt/sec_api/string_s.h | 3 +++ mingw-w64-headers/crt/sec_api/wchar_s.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mingw-w64-headers/crt/sec_api/string_s.h b/mingw-w64-headers/crt/sec_api/string_s.h index 34d1c99..4b10820 100644 --- a/mingw-w64-headers/crt/sec_api/string_s.h +++ b/mingw-w64-headers/crt/sec_api/string_s.h @@ -60,6 +60,9 @@ extern C { _CRTIMP errno_t __cdecl _wcsset_s_l(wchar_t *_Str,size_t _SizeInChars,unsigned int _Val,_locale_t _Locale); _CRTIMP errno_t __cdecl _wcsnset_s_l(wchar_t *_Str,size_t _SizeInChars,unsigned int _Val, size_t _Count,_locale_t _Locale); + static inline size_t __cdecl wcsnlen_s(const wchar_t * _src, size_t _count) { +return _src ? wcsnlen(_src, _count) : 0; + } #endif #ifndef _MEMORY_S_DEFINED diff --git a/mingw-w64-headers/crt/sec_api/wchar_s.h b/mingw-w64-headers/crt/sec_api/wchar_s.h index fc8fc4d..f9fc6ad 100644 --- a/mingw-w64-headers/crt/sec_api/wchar_s.h +++ b/mingw-w64-headers/crt/sec_api/wchar_s.h @@ -130,6 +130,9 @@ extern C { _CRTIMP errno_t __cdecl _wcsset_s_l(wchar_t *_Str,size_t _SizeInChars,unsigned int _Val,_locale_t _Locale); _CRTIMP errno_t __cdecl _wcsnset_s_l(wchar_t *_Str,size_t _SizeInChars,unsigned int _Val, size_t _Count,_locale_t _Locale); + static inline size_t __cdecl wcsnlen_s(const wchar_t * _src, size_t _count) { +return _src ? wcsnlen(_src, _count) : 0; + } #endif #ifndef _WTIME_S_DEFINED -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH 1/6] string_s.h/wchar_s.h: Added wcsnlen_s implementation.
Hmm, this patch looks to me not 100% ok. Making functions static inline seems to be not the proper thing to do here AFAICS. This will lead to warning for cases those functions aren't used. So I would think that attribute unused is missing here. Additionally the 'inline' looks to me bogus. Either it should be extern inline, or static with attribute unused. Kai 2014-08-19 14:02 GMT+02:00 Jacek Caban ja...@codeweavers.com: --- mingw-w64-headers/crt/sec_api/string_s.h | 3 +++ mingw-w64-headers/crt/sec_api/wchar_s.h | 3 +++ 2 files changed, 6 insertions(+) -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH 1/6] string_s.h/wchar_s.h: Added wcsnlen_s implementation.
OK, I pushed it with extern inline declaration. Thanks for reviews, Jacek On 08/19/14 15:38, Kai Tietz wrote: Hmm, this patch looks to me not 100% ok. Making functions static inline seems to be not the proper thing to do here AFAICS. This will lead to warning for cases those functions aren't used. So I would think that attribute unused is missing here. Additionally the 'inline' looks to me bogus. Either it should be extern inline, or static with attribute unused. Kai 2014-08-19 14:02 GMT+02:00 Jacek Caban ja...@codeweavers.com: --- mingw-w64-headers/crt/sec_api/string_s.h | 3 +++ mingw-w64-headers/crt/sec_api/wchar_s.h | 3 +++ 2 files changed, 6 insertions(+) -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public