From 1fdbf850eeef751bbde914f177bf659e402344d6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 29 Nov 2020 21:21:49 +0100 Subject: [PATCH] libport: Move the non-inline version of the string functions to libwine. Signed-off-by: Alexandre Julliard --- include/wine/unicode.h | 29 +++++++++++++++++++++++------ libs/port/Makefile.in | 1 - libs/wine/Makefile.in | 1 + libs/wine/port.c | 12 ++---------- libs/{port => wine}/string.c | 6 ++++++ 5 files changed, 32 insertions(+), 17 deletions(-) rename libs/{port => wine}/string.c (99%) diff --git a/include/wine/unicode.h b/include/wine/unicode.h index f42a94c7e0d..069b5ce2624 100644 --- a/include/wine/unicode.h +++ b/include/wine/unicode.h @@ -40,7 +40,7 @@ extern "C" { #endif #ifndef WINE_UNICODE_INLINE -#define WINE_UNICODE_INLINE static inline +#define WINE_UNICODE_INLINE static FORCEINLINE #endif /* code page info common to SBCS and DBCS */ @@ -79,11 +79,6 @@ union cptable struct dbcs_table dbcs; }; -extern int sprintfW( WCHAR *str, const WCHAR *format, ... ); -extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... ); -extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist ); -extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist ); - WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch ) { extern const WCHAR wine_casemap_lower[]; @@ -401,6 +396,28 @@ WINE_UNICODE_INLINE int atoiW( const WCHAR *str ) return (int)atolW( str ); } +NTSYSAPI int __cdecl _vsnwprintf(WCHAR*,size_t,const WCHAR*,__ms_va_list); + +static inline int WINAPIV snprintfW( WCHAR *str, size_t len, const WCHAR *format, ...) +{ + int retval; + __ms_va_list valist; + __ms_va_start(valist, format); + retval = _vsnwprintf(str, len, format, valist); + __ms_va_end(valist); + return retval; +} + +static inline int WINAPIV sprintfW( WCHAR *str, const WCHAR *format, ...) +{ + int retval; + __ms_va_list valist; + __ms_va_start(valist, format); + retval = _vsnwprintf(str, MAXLONG, format, valist); + __ms_va_end(valist); + return retval; +} + #undef WINE_UNICODE_INLINE #ifdef __cplusplus diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in index 7bc67fa3fee..aabcc833ec6 100644 --- a/libs/port/Makefile.in +++ b/libs/port/Makefile.in @@ -17,7 +17,6 @@ C_SRCS = \ rint.c \ spawn.c \ statvfs.c \ - string.c \ strnlen.c \ symlink.c \ usleep.c \ diff --git a/libs/wine/Makefile.in b/libs/wine/Makefile.in index 65a07895027..74ffc0d5f83 100644 --- a/libs/wine/Makefile.in +++ b/libs/wine/Makefile.in @@ -81,6 +81,7 @@ C_SRCS = \ mmap.c \ port.c \ sortkey.c \ + string.c \ utf8.c \ wctomb.c diff --git a/libs/wine/port.c b/libs/wine/port.c index 62d5c2abcdb..8e56ada52aa 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -27,16 +27,8 @@ #include #include #include - -#include "wine/unicode.h" - -/* functions from libwine_port that are also exported from libwine for backwards compatibility, - * on platforms that require it */ -const void *libwine_port_functions[] = -{ - strtolW, - vsnprintfW, -}; +#include +#include /* no longer used, for backwards compatibility only */ struct wine_pthread_functions; diff --git a/libs/port/string.c b/libs/wine/string.c similarity index 99% rename from libs/port/string.c rename to libs/wine/string.c index 62b972399bf..d6fb88f8eca 100644 --- a/libs/port/string.c +++ b/libs/wine/string.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wine/asm.h" + +#ifdef __ASM_OBSOLETE + #include #include #include @@ -711,3 +715,5 @@ int sprintfW( WCHAR *str, const WCHAR *format, ...) va_end(valist); return retval; } + +#endif /* __ASM_OBSOLETE */