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
f339506f
Commit
f339506f
authored
Aug 17, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Aug 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find: Use CRT allocation functions.
parent
dcc049ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
find.c
programs/find/find.c
+10
-11
No files found.
programs/find/find.c
View file @
f339506f
...
...
@@ -20,7 +20,6 @@
#include <stdlib.h>
#include <shlwapi.h>
#include "wine/heap.h"
#include "wine/debug.h"
#include "resources.h"
...
...
@@ -53,7 +52,7 @@ static WCHAR* read_line_from_handle(HANDLE handle)
WCHAR
*
line_converted
;
int
line_converted_length
;
BOOL
success
;
char
*
line
=
heap_
alloc
(
line_max
);
char
*
line
=
m
alloc
(
line_max
);
for
(;;)
{
...
...
@@ -76,7 +75,7 @@ static WCHAR* read_line_from_handle(HANDLE handle)
if
(
length
+
1
>=
line_max
)
{
line_max
*=
2
;
line
=
heap_
realloc
(
line
,
line_max
);
line
=
realloc
(
line
,
line_max
);
}
line
[
length
++
]
=
c
;
...
...
@@ -87,10 +86,10 @@ static WCHAR* read_line_from_handle(HANDLE handle)
line
[
length
-
1
]
=
0
;
line_converted_length
=
MultiByteToWideChar
(
CP_ACP
,
0
,
line
,
-
1
,
0
,
0
);
line_converted
=
heap_
alloc
(
line_converted_length
*
sizeof
(
WCHAR
));
line_converted
=
m
alloc
(
line_converted_length
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
line
,
-
1
,
line_converted
,
line_converted_length
);
heap_
free
(
line
);
free
(
line
);
return
line_converted
;
}
...
...
@@ -104,14 +103,14 @@ static void write_to_stdout(const WCHAR *str)
int
codepage
=
CP_ACP
;
str_converted_length
=
WideCharToMultiByte
(
codepage
,
0
,
str
,
str_length
,
NULL
,
0
,
NULL
,
NULL
);
str_converted
=
heap_
alloc
(
str_converted_length
);
str_converted
=
m
alloc
(
str_converted_length
);
WideCharToMultiByte
(
codepage
,
0
,
str
,
str_length
,
str_converted
,
str_converted_length
,
NULL
,
NULL
);
WriteFile
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
str_converted
,
str_converted_length
,
&
bytes_written
,
NULL
);
if
(
bytes_written
<
str_converted_length
)
ERR
(
"Failed to write output
\n
"
);
heap_
free
(
str_converted
);
free
(
str_converted
);
}
static
BOOL
run_find_for_line
(
const
WCHAR
*
line
,
const
WCHAR
*
tofind
)
...
...
@@ -173,7 +172,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
if
(
file_paths_len
>=
file_paths_max
)
{
file_paths_max
=
file_paths_max
?
file_paths_max
*
2
:
2
;
file_paths
=
heap_
realloc
(
file_paths
,
sizeof
(
WCHAR
*
)
*
file_paths_max
);
file_paths
=
realloc
(
file_paths
,
sizeof
(
WCHAR
*
)
*
file_paths_max
);
}
file_paths
[
file_paths_len
++
]
=
argv
[
i
];
}
...
...
@@ -219,7 +218,7 @@ int __cdecl wmain(int argc, WCHAR *argv[])
if
(
run_find_for_line
(
line
,
tofind
))
exitcode
=
0
;
heap_
free
(
line
);
free
(
line
);
}
CloseHandle
(
input
);
}
...
...
@@ -232,10 +231,10 @@ int __cdecl wmain(int argc, WCHAR *argv[])
if
(
run_find_for_line
(
line
,
tofind
))
exitcode
=
0
;
heap_
free
(
line
);
free
(
line
);
}
}
heap_
free
(
file_paths
);
free
(
file_paths
);
return
exitcode
;
}
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