Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8310aab3
Commit
8310aab3
authored
Nov 28, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made HEAP_strdup* functions inline (temporary).
parent
89b18a7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
73 deletions
+46
-73
heap.h
include/heap.h
+46
-4
heap.c
memory/heap.c
+0
-69
No files found.
include/heap.h
View file @
8310aab3
...
...
@@ -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
...
...
memory/heap.c
View file @
8310aab3
...
...
@@ -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"
...
...
@@ -1663,74 +1662,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)
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment