Make lstr* functions inline inside Wine.

This commit is contained in:
Mike McCormack 2005-02-22 15:50:13 +00:00 committed by Alexandre Julliard
parent 0d735ac9be
commit 3b2019badb
3 changed files with 84 additions and 5 deletions

View File

@ -27,6 +27,7 @@
#include <stdarg.h>
#include <string.h>
#define WINE_NO_INLINE_STRING
#include "windef.h"
#include "winbase.h"
#include "excpt.h"

View File

@ -252,13 +252,13 @@
306 stdcall StrCmpNIA(str str long) shlwapi.StrCmpNIA
307 stdcall StrCmpNIW(wstr wstr long) shlwapi.StrCmpNIW
308 stdcall StrCmpNW(wstr wstr long) shlwapi.StrCmpNW
309 stdcall StrCpyNA (ptr str long) lstrcpynA
309 stdcall StrCpyNA (ptr str long) kernel32.lstrcpynA
310 stdcall StrCpyNW(wstr wstr long) shlwapi.StrCpyNW
311 stdcall StrNCmpA(str str long) shlwapi.StrCmpNA
312 stdcall StrNCmpIA(str str long) shlwapi.StrCmpNIA
313 stdcall StrNCmpIW(wstr wstr long) shlwapi.StrCmpNIW
314 stdcall StrNCmpW(wstr wstr long) shlwapi.StrCmpNW
315 stdcall StrNCpyA (ptr str long) lstrcpynA
315 stdcall StrNCpyA (ptr str long) kernel32.lstrcpynA
316 stdcall StrNCpyW(wstr wstr long) shlwapi.StrCpyNW
317 stdcall StrRChrA(str str long) shlwapi.StrRChrA
318 stdcall StrRChrIA(str str long) shlwapi.StrRChrIA

View File

@ -1966,18 +1966,96 @@ BOOL WINAPI WriteProfileStringA(LPCSTR,LPCSTR,LPCSTR);
BOOL WINAPI WriteProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR);
#define WriteProfileString WINELIB_NAME_AW(WriteProfileString)
#define Yield()
#if defined(WINE_NO_INLINE_STRING) || !defined(__WINESRC__)
LPSTR WINAPI lstrcatA(LPSTR,LPCSTR);
LPWSTR WINAPI lstrcatW(LPWSTR,LPCWSTR);
#define lstrcat WINELIB_NAME_AW(lstrcat)
LPSTR WINAPI lstrcpyA(LPSTR,LPCSTR);
LPWSTR WINAPI lstrcpyW(LPWSTR,LPCWSTR);
#define lstrcpy WINELIB_NAME_AW(lstrcpy)
LPSTR WINAPI lstrcpynA(LPSTR,LPCSTR,INT);
LPWSTR WINAPI lstrcpynW(LPWSTR,LPCWSTR,INT);
#define lstrcpyn WINELIB_NAME_AW(lstrcpyn)
INT WINAPI lstrlenA(LPCSTR);
INT WINAPI lstrlenW(LPCWSTR);
#else /* !defined(WINE_NO_INLINE_STRING) && defined(__WINESRC__) */
/* string functions without the exception handler */
extern inline LPWSTR lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
{
LPWSTR d = dst;
LPCWSTR s = src;
UINT count = n;
while ((count > 1) && *s)
{
count--;
*d++ = *s++;
}
if (count) *d = 0;
return dst;
}
extern inline LPSTR lstrcpynA( LPSTR dst, LPCSTR src, INT n )
{
LPSTR d = dst;
LPCSTR s = src;
UINT count = n;
while ((count > 1) && *s)
{
count--;
*d++ = *s++;
}
if (count) *d = 0;
return dst;
}
extern inline INT lstrlenW( LPCWSTR str )
{
const WCHAR *s = str;
while (*s) s++;
return s - str;
}
extern inline INT lstrlenA( LPCSTR str )
{
return strlen( str );
}
extern inline LPWSTR lstrcpyW( LPWSTR dst, LPCWSTR src )
{
WCHAR *p = dst;
while ((*p++ = *src++));
return dst;
}
extern inline LPSTR lstrcpyA( LPSTR dst, LPCSTR src )
{
return strcpy( dst, src );
}
extern inline LPWSTR lstrcatW( LPWSTR dst, LPCWSTR src )
{
WCHAR *p = dst;
while (*p) p++;
while ((*p++ = *src++));
return dst;
}
extern inline LPSTR lstrcatA( LPSTR dst, LPCSTR src )
{
return strcat( dst, src );
}
#endif /* !defined(WINE_NO_INLINE_STRING) && defined(__WINESRC__) */
#define lstrcat WINELIB_NAME_AW(lstrcat)
#define lstrcpy WINELIB_NAME_AW(lstrcpy)
#define lstrcpyn WINELIB_NAME_AW(lstrcpyn)
#define lstrlen WINELIB_NAME_AW(lstrlen)
LONG WINAPI _hread(HFILE,LPVOID,LONG);
LONG WINAPI _hwrite(HFILE,LPCSTR,LONG);
HFILE WINAPI _lcreat(LPCSTR,INT);