Replaced xmalloc calls with malloc/HeapAlloc calls.

This commit is contained in:
Dimitrie O. Paun 2000-04-09 18:41:15 +00:00 committed by Alexandre Julliard
parent d57f7d14f1
commit a20b7921ad
3 changed files with 23 additions and 7 deletions

View File

@ -4,11 +4,12 @@
* Copyright 1999 Patrik Stridvall
*/
#include <stdlib.h>
#include "color.h"
#include "debugtools.h"
#include "palette.h"
#include "ttydrv.h"
#include "xmalloc.h"
DEFAULT_DEBUG_CHANNEL(ttydrv)
@ -35,7 +36,11 @@ BOOL TTYDRV_PALETTE_Initialize(void)
TTYDRV_DC_DevCaps.sizePalette = 256;
COLOR_sysPal = (PALETTEENTRY *) xmalloc(sizeof(PALETTEENTRY) * TTYDRV_DC_DevCaps.sizePalette);
COLOR_sysPal = (PALETTEENTRY *) HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * TTYDRV_DC_DevCaps.sizePalette);
if(COLOR_sysPal == NULL) {
WARN("No memory to create system palette!");
return FALSE;
}
for(i=0; i < TTYDRV_DC_DevCaps.sizePalette; i++ ) {
const PALETTEENTRY *src;

View File

@ -357,7 +357,13 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
EnterCriticalSection( &X11DRV_CritSection );
image = XCreateImage( display, X11DRV_GetVisual(), bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL,
bmp->bitmap.bmWidth, height, 32, 0 );
image->data = (LPBYTE)xmalloc(image->bytes_per_line * height);
if (!(image->data = (LPBYTE)malloc(image->bytes_per_line * height)))
{
WARN("No memory to create image data.\n");
XDestroyImage( image );
LeaveCriticalSection( &X11DRV_CritSection );
return 0;
}
/* copy 16 bit padded image buffer with real bitsperpixel to XImage */

View File

@ -20,7 +20,6 @@
#include "options.h"
#include "palette.h"
#include "windef.h"
#include "xmalloc.h"
#include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(palette);
@ -253,7 +252,10 @@ static BOOL X11DRV_PALETTE_BuildPrivateMap(void)
XColor color;
int i;
COLOR_sysPal = (PALETTEENTRY*)xmalloc(sizeof(PALETTEENTRY)*X11DRV_DevCaps.sizePalette);
if((COLOR_sysPal = (PALETTEENTRY*)HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY)*X11DRV_DevCaps.sizePalette)) == NULL) {
WARN("Can not allocate system palette\n");
return FALSE;
}
TRACE("Building private map - %i palette entries\n", X11DRV_DevCaps.sizePalette);
@ -402,7 +404,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
* X guidelines and does binary search...
*/
pixDynMapping = (unsigned long*)xmalloc(sizeof(long)*X11DRV_DevCaps.sizePalette);
if((pixDynMapping = (unsigned long*)HeapAlloc(GetProcessHeap(), 0, sizeof(long)*X11DRV_DevCaps.sizePalette)) == NULL) {
WARN("Out of memory while building system palette.\n");
return FALSE;
}
while( c_max - c_min > 0 )
{
c_val = (c_max + c_min)/2 + (c_max + c_min)%2;
@ -519,7 +524,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
X11DRV_PALETTE_XPixelToPalette[X11DRV_PALETTE_PaletteToXPixel[i]] = i;
}
if( pixDynMapping ) free(pixDynMapping);
if( pixDynMapping ) HeapFree(GetProcessHeap(), 0, pixDynMapping);
return TRUE;
}