Module: wine Branch: master Commit: f339506f4f7852436fe13ecba78b416c412918f7 URL: https://gitlab.winehq.org/wine/wine/-/commit/f339506f4f7852436fe13ecba78b416...
Author: Alex Henrie alexhenrie24@gmail.com Date: Thu Aug 17 21:56:54 2023 -0600
find: Use CRT allocation functions.
---
programs/find/find.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/programs/find/find.c b/programs/find/find.c index 5b86325d1c2..b4eb4d1949b 100644 --- a/programs/find/find.c +++ b/programs/find/find.c @@ -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 = malloc(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 = malloc(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 = malloc(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; }