Made HEAP_strdup* functions inline (temporary).
This commit is contained in:
parent
89b18a7e1a
commit
8310aab3e5
|
@ -10,6 +10,8 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/windef16.h" /* for SEGPTR */
|
||||
|
||||
extern HANDLE SystemHeap;
|
||||
|
@ -17,10 +19,6 @@ extern HANDLE SegptrHeap;
|
|||
|
||||
extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
|
||||
extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
|
||||
extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
|
||||
extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
|
||||
extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
|
||||
extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
|
||||
extern BOOL HEAP_CreateSystemHeap(void);
|
||||
|
||||
/* SEGPTR helper macros */
|
||||
|
@ -41,6 +39,50 @@ static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
|
|||
#define SEGPTR_FREE(ptr) \
|
||||
(HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
|
||||
|
||||
|
||||
/* strdup macros */
|
||||
/* DO NOT USE THEM!! they will go away soon */
|
||||
|
||||
inline static LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
|
||||
{
|
||||
INT len = strlen(str) + 1;
|
||||
LPSTR p = HeapAlloc( heap, flags, len );
|
||||
if (p) memcpy( p, str, len );
|
||||
return p;
|
||||
}
|
||||
|
||||
inline static LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str )
|
||||
{
|
||||
INT len = strlenW(str) + 1;
|
||||
LPWSTR p = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
|
||||
if (p) memcpy( p, str, len * sizeof(WCHAR) );
|
||||
return p;
|
||||
}
|
||||
|
||||
inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
|
||||
{
|
||||
LPWSTR ret;
|
||||
INT len;
|
||||
|
||||
if (!str) return NULL;
|
||||
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||
ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
|
||||
if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
|
||||
{
|
||||
LPSTR ret;
|
||||
INT len;
|
||||
|
||||
if (!str) return NULL;
|
||||
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
ret = HeapAlloc( heap, flags, len );
|
||||
if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* system heap private data */
|
||||
/* you must lock the system heap before using this structure */
|
||||
typedef struct
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "wine/winbase16.h"
|
||||
#include "wine/winestring.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "selectors.h"
|
||||
#include "global.h"
|
||||
|
@ -1662,74 +1661,6 @@ DWORD WINAPI GetProcessHeaps( DWORD count, HANDLE *heaps )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HEAP_strdupA
|
||||
*/
|
||||
LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
|
||||
{
|
||||
LPSTR p = HeapAlloc( heap, flags, strlen(str) + 1 );
|
||||
if(p) {
|
||||
SET_EIP(p);
|
||||
strcpy( p, str );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HEAP_strdupW
|
||||
*/
|
||||
LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str )
|
||||
{
|
||||
INT len = strlenW(str) + 1;
|
||||
LPWSTR p = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
|
||||
if(p) {
|
||||
SET_EIP(p);
|
||||
strcpyW( p, str );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HEAP_strdupAtoW
|
||||
*/
|
||||
LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
|
||||
{
|
||||
LPWSTR ret;
|
||||
INT len;
|
||||
|
||||
if (!str) return NULL;
|
||||
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||
ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
|
||||
if (ret) {
|
||||
SET_EIP(ret);
|
||||
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HEAP_strdupWtoA
|
||||
*/
|
||||
LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
|
||||
{
|
||||
LPSTR ret;
|
||||
INT len;
|
||||
|
||||
if (!str) return NULL;
|
||||
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
||||
ret = HeapAlloc( heap, flags, len );
|
||||
if(ret) {
|
||||
SET_EIP(ret);
|
||||
WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 32-bit local heap functions (Win95; undocumented)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue