winedos: Replace malloc/calloc with HeapAlloc().

This commit is contained in:
Andrew Talbot 2009-02-11 20:35:04 +00:00 committed by Alexandre Julliard
parent b5d1bfe5ba
commit 044e76df92
5 changed files with 13 additions and 13 deletions

View File

@ -134,7 +134,7 @@ static void do_strategy(CONTEXT86*ctx, int id, int extra)
void **hdr_ptr = strategy_data[id]; void **hdr_ptr = strategy_data[id];
if (!hdr_ptr) { if (!hdr_ptr) {
hdr_ptr = calloc(1,sizeof(void *)+extra); hdr_ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(void *)+extra);
strategy_data[id] = hdr_ptr; strategy_data[id] = hdr_ptr;
} }
*hdr_ptr = hdr; *hdr_ptr = hdr;

View File

@ -264,7 +264,7 @@ static int DOSCONF_Country(char **confline)
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
TRACE( "Country '%s'\n", *confline ); TRACE( "Country '%s'\n", *confline );
if (DOSCONF_config.country == NULL) if (DOSCONF_config.country == NULL)
DOSCONF_config.country = malloc(strlen(*confline) + 1); DOSCONF_config.country = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_config.country, *confline); strcpy(DOSCONF_config.country, *confline);
return 1; return 1;
} }
@ -304,7 +304,7 @@ static int DOSCONF_Shell(char **confline)
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
TRACE( "Shell '%s'\n", *confline ); TRACE( "Shell '%s'\n", *confline );
if (DOSCONF_config.shell == NULL) if (DOSCONF_config.shell == NULL)
DOSCONF_config.shell = malloc(strlen(*confline) + 1); DOSCONF_config.shell = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_config.shell, *confline); strcpy(DOSCONF_config.shell, *confline);
return 1; return 1;
} }
@ -354,7 +354,7 @@ static int DOSCONF_Menu(char **confline)
&& (!(strncasecmp(*confline, DOSCONF_menu_default, && (!(strncasecmp(*confline, DOSCONF_menu_default,
strlen(DOSCONF_menu_default))))) strlen(DOSCONF_menu_default)))))
{ {
free(DOSCONF_menu_default); HeapFree(GetProcessHeap(), 0, DOSCONF_menu_default);
DOSCONF_menu_default = NULL; DOSCONF_menu_default = NULL;
DOSCONF_menu_skip = 0; DOSCONF_menu_skip = 0;
} }
@ -367,7 +367,7 @@ static int DOSCONF_Menu(char **confline)
{ {
if (!(DOSCONF_JumpToEntry(confline, '='))) return 0; if (!(DOSCONF_JumpToEntry(confline, '='))) return 0;
*confline = strtok(*confline, ","); *confline = strtok(*confline, ",");
DOSCONF_menu_default = malloc(strlen(*confline) + 1); DOSCONF_menu_default = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(DOSCONF_menu_default, *confline); strcpy(DOSCONF_menu_default, *confline);
} }
@ -384,10 +384,10 @@ static int DOSCONF_Include(char **confline)
fgetpos(DOSCONF_fd, &oldpos); fgetpos(DOSCONF_fd, &oldpos);
fseek(DOSCONF_fd, 0, SEEK_SET); fseek(DOSCONF_fd, 0, SEEK_SET);
TRACE( "Including menu '%s'\n", *confline ); TRACE( "Including menu '%s'\n", *confline );
temp = malloc(strlen(*confline) + 1); temp = HeapAlloc(GetProcessHeap(), 0, strlen(*confline) + 1);
strcpy(temp, *confline); strcpy(temp, *confline);
DOSCONF_Parse(temp); DOSCONF_Parse(temp);
free(temp); HeapFree(GetProcessHeap(), 0, temp);
fsetpos(DOSCONF_fd, &oldpos); fsetpos(DOSCONF_fd, &oldpos);
return 1; return 1;
} }

View File

@ -182,7 +182,7 @@ static void DOSVM_SendOneEvent( CONTEXT86 *context )
DOSVM_BuildCallFrame( context, event->relay, event->data ); DOSVM_BuildCallFrame( context, event->relay, event->data );
} }
free(event); HeapFree(GetProcessHeap(), 0, event);
} }
} }
@ -257,7 +257,7 @@ void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data
BOOL old_pending; BOOL old_pending;
if (MZ_Current()) { if (MZ_Current()) {
event = malloc(sizeof(DOSEVENT)); event = HeapAlloc(GetProcessHeap(), 0, sizeof(DOSEVENT));
if (!event) { if (!event) {
ERR("out of memory allocating event entry\n"); ERR("out of memory allocating event entry\n");
return; return;
@ -622,7 +622,7 @@ void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val)
current_event = event->next; current_event = event->next;
if (event->relay) if (event->relay)
(*event->relay)(NULL,event->data); (*event->relay)(NULL,event->data);
free(event); HeapFree(GetProcessHeap(), 0, event);
if (DOSVM_HasPendingEvents()) if (DOSVM_HasPendingEvents())
{ {

View File

@ -218,7 +218,7 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
ctx.Edi = data->my; ctx.Edi = data->my;
ctx.SegCs = SELECTOROF(data->proc); ctx.SegCs = SELECTOROF(data->proc);
ctx.Eip = OFFSETOF(data->proc); ctx.Eip = OFFSETOF(data->proc);
free(data); HeapFree(GetProcessHeap(), 0, data);
DPMI_CallRMProc(&ctx, NULL, 0, 0); DPMI_CallRMProc(&ctx, NULL, 0, 0);
} }
@ -264,7 +264,7 @@ static void QueueMouseRelay(DWORD mx, DWORD my, WORD mask)
} }
if ((mask & mouse_info.callmask) && mouse_info.callback) { if ((mask & mouse_info.callmask) && mouse_info.callback) {
MCALLDATA *data = calloc(1,sizeof(MCALLDATA)); MCALLDATA *data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MCALLDATA));
data->proc = mouse_info.callback; data->proc = mouse_info.callback;
data->mask = mask & mouse_info.callmask; data->mask = mask & mouse_info.callmask;
data->but = mouse_info.but; data->but = mouse_info.but;

View File

@ -181,7 +181,7 @@ char IO_pp_init(void)
ERR("Perhaps the device is already in use or nonexistent\n"); ERR("Perhaps the device is already in use or nonexistent\n");
continue; continue;
} }
PPDeviceList[nports].devicename = malloc(sizeof(buffer)+1); PPDeviceList[nports].devicename = HeapAlloc(GetProcessHeap(), 0, sizeof(buffer)+1);
if (!PPDeviceList[nports].devicename) if (!PPDeviceList[nports].devicename)
{ {
ERR("No (more) space for devicename\n"); ERR("No (more) space for devicename\n");