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
4a558538
Commit
4a558538
authored
May 17, 2009
by
Francois Gouget
Committed by
Alexandre Julliard
May 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winetest: Replace malloc() & co with HeapAlloc().
parent
bf6b95e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
util.c
programs/winetest/util.c
+8
-6
No files found.
programs/winetest/util.c
View file @
4a558538
...
@@ -29,7 +29,7 @@ HANDLE logfile = 0;
...
@@ -29,7 +29,7 @@ HANDLE logfile = 0;
void
*
heap_alloc
(
size_t
len
)
void
*
heap_alloc
(
size_t
len
)
{
{
void
*
p
=
malloc
(
len
);
void
*
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
p
)
report
(
R_FATAL
,
"Out of memory."
);
if
(
!
p
)
report
(
R_FATAL
,
"Out of memory."
);
return
p
;
return
p
;
...
@@ -37,7 +37,7 @@ void *heap_alloc (size_t len)
...
@@ -37,7 +37,7 @@ void *heap_alloc (size_t len)
void
*
heap_realloc
(
void
*
op
,
size_t
len
)
void
*
heap_realloc
(
void
*
op
,
size_t
len
)
{
{
void
*
p
=
realloc
(
op
,
len
);
void
*
p
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
op
,
len
);
if
(
len
&&
!
p
)
report
(
R_FATAL
,
"Out of memory."
);
if
(
len
&&
!
p
)
report
(
R_FATAL
,
"Out of memory."
);
return
p
;
return
p
;
...
@@ -45,14 +45,16 @@ void *heap_realloc (void *op, size_t len)
...
@@ -45,14 +45,16 @@ void *heap_realloc (void *op, size_t len)
char
*
heap_strdup
(
const
char
*
str
)
char
*
heap_strdup
(
const
char
*
str
)
{
{
char
*
res
=
strdup
(
str
);
int
len
=
lstrlen
(
str
)
+
1
;
char
*
res
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
if
(
!
res
)
report
(
R_FATAL
,
"Out of memory."
);
if
(
!
res
)
report
(
R_FATAL
,
"Out of memory."
);
memcpy
(
res
,
str
,
len
);
return
res
;
return
res
;
}
}
void
heap_free
(
void
*
op
)
void
heap_free
(
void
*
op
)
{
{
free
(
op
);
HeapFree
(
GetProcessHeap
(),
0
,
op
);
}
}
static
char
*
vstrfmtmake
(
size_t
*
lenp
,
const
char
*
fmt
,
va_list
ap
)
static
char
*
vstrfmtmake
(
size_t
*
lenp
,
const
char
*
fmt
,
va_list
ap
)
...
@@ -61,14 +63,14 @@ static char *vstrfmtmake (size_t *lenp, const char *fmt, va_list ap)
...
@@ -61,14 +63,14 @@ static char *vstrfmtmake (size_t *lenp, const char *fmt, va_list ap)
char
*
p
,
*
q
;
char
*
p
,
*
q
;
int
n
;
int
n
;
p
=
malloc
(
size
);
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
p
)
return
NULL
;
if
(
!
p
)
return
NULL
;
while
(
1
)
{
while
(
1
)
{
n
=
vsnprintf
(
p
,
size
,
fmt
,
ap
);
n
=
vsnprintf
(
p
,
size
,
fmt
,
ap
);
if
(
n
<
0
)
size
*=
2
;
/* Windows */
if
(
n
<
0
)
size
*=
2
;
/* Windows */
else
if
((
unsigned
)
n
>=
size
)
size
=
n
+
1
;
/* glibc */
else
if
((
unsigned
)
n
>=
size
)
size
=
n
+
1
;
/* glibc */
else
break
;
else
break
;
q
=
realloc
(
p
,
size
);
q
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
p
,
size
);
if
(
!
q
)
{
if
(
!
q
)
{
heap_free
(
p
);
heap_free
(
p
);
return
NULL
;
return
NULL
;
...
...
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