Commit ef8e4b7e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11: Use libc for driver memory allocation.

parent 306ad478
...@@ -926,7 +926,7 @@ BOOL CDECL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -926,7 +926,7 @@ BOOL CDECL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
static void CDECL free_heap_bits( struct gdi_image_bits *bits ) static void CDECL free_heap_bits( struct gdi_image_bits *bits )
{ {
HeapFree( GetProcessHeap(), 0, bits->ptr ); free( bits->ptr );
} }
static void CDECL free_ximage_bits( struct gdi_image_bits *bits ) static void CDECL free_ximage_bits( struct gdi_image_bits *bits )
...@@ -1188,7 +1188,7 @@ DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, ...@@ -1188,7 +1188,7 @@ DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image,
{ {
width_bytes = (width_bytes + 3) & ~3; width_bytes = (width_bytes + 3) & ~3;
info->bmiHeader.biSizeImage = height * width_bytes; info->bmiHeader.biSizeImage = height * width_bytes;
if (!(dst_bits->ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) if (!(dst_bits->ptr = malloc( info->bmiHeader.biSizeImage )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
dst_bits->is_copy = TRUE; dst_bits->is_copy = TRUE;
dst_bits->free = free_heap_bits; dst_bits->free = free_heap_bits;
...@@ -1748,7 +1748,7 @@ static void update_surface_region( struct x11drv_window_surface *surface ) ...@@ -1748,7 +1748,7 @@ static void update_surface_region( struct x11drv_window_surface *surface )
{ {
XShapeCombineRectangles( gdi_display, surface->window, ShapeBounding, 0, 0, XShapeCombineRectangles( gdi_display, surface->window, ShapeBounding, 0, 0,
(XRectangle *)data->Buffer, data->rdh.nCount, ShapeSet, YXBanded ); (XRectangle *)data->Buffer, data->rdh.nCount, ShapeSet, YXBanded );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
NtGdiDeleteObjectApp( rgn ); NtGdiDeleteObjectApp( rgn );
...@@ -1890,7 +1890,7 @@ static void x11drv_surface_set_region( struct window_surface *window_surface, HR ...@@ -1890,7 +1890,7 @@ static void x11drv_surface_set_region( struct window_surface *window_surface, HR
{ {
XSetClipRectangles( gdi_display, surface->gc, 0, 0, XSetClipRectangles( gdi_display, surface->gc, 0, 0,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
} }
window_surface->funcs->unlock( window_surface ); window_surface->funcs->unlock( window_surface );
...@@ -1974,7 +1974,7 @@ static void x11drv_surface_destroy( struct window_surface *window_surface ) ...@@ -1974,7 +1974,7 @@ static void x11drv_surface_destroy( struct window_surface *window_surface )
if (surface->gc) XFreeGC( gdi_display, surface->gc ); if (surface->gc) XFreeGC( gdi_display, surface->gc );
if (surface->image) if (surface->image)
{ {
if (surface->image->data != surface->bits) HeapFree( GetProcessHeap(), 0, surface->bits ); if (surface->image->data != surface->bits) free( surface->bits );
#ifdef HAVE_LIBXXSHM #ifdef HAVE_LIBXXSHM
if (surface->shminfo.shmid != -1) if (surface->shminfo.shmid != -1)
{ {
...@@ -1983,12 +1983,12 @@ static void x11drv_surface_destroy( struct window_surface *window_surface ) ...@@ -1983,12 +1983,12 @@ static void x11drv_surface_destroy( struct window_surface *window_surface )
} }
else else
#endif #endif
HeapFree( GetProcessHeap(), 0, surface->image->data ); free( surface->image->data );
surface->image->data = NULL; surface->image->data = NULL;
XDestroyImage( surface->image ); XDestroyImage( surface->image );
} }
if (surface->region) NtGdiDeleteObjectApp( surface->region ); if (surface->region) NtGdiDeleteObjectApp( surface->region );
HeapFree( GetProcessHeap(), 0, surface ); free( surface );
} }
static const struct window_surface_funcs x11drv_surface_funcs = static const struct window_surface_funcs x11drv_surface_funcs =
...@@ -2013,8 +2013,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co ...@@ -2013,8 +2013,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co
int width = rect->right - rect->left, height = rect->bottom - rect->top; int width = rect->right - rect->left, height = rect->bottom - rect->top;
int colors = format->bits_per_pixel <= 8 ? 1 << format->bits_per_pixel : 3; int colors = format->bits_per_pixel <= 8 ? 1 << format->bits_per_pixel : 3;
surface = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, surface = calloc( 1, FIELD_OFFSET( struct x11drv_window_surface, info.bmiColors[colors] ));
FIELD_OFFSET( struct x11drv_window_surface, info.bmiColors[colors] ));
if (!surface) return NULL; if (!surface) return NULL;
surface->info.bmiHeader.biSize = sizeof(surface->info.bmiHeader); surface->info.bmiHeader.biSize = sizeof(surface->info.bmiHeader);
surface->info.bmiHeader.biWidth = width; surface->info.bmiHeader.biWidth = width;
...@@ -2042,7 +2041,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co ...@@ -2042,7 +2041,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co
surface->image = XCreateImage( gdi_display, vis->visual, vis->depth, ZPixmap, 0, NULL, surface->image = XCreateImage( gdi_display, vis->visual, vis->depth, ZPixmap, 0, NULL,
width, height, 32, 0 ); width, height, 32, 0 );
if (!surface->image) goto failed; if (!surface->image) goto failed;
surface->image->data = HeapAlloc( GetProcessHeap(), 0, surface->info.bmiHeader.biSizeImage ); surface->image->data = malloc( surface->info.bmiHeader.biSizeImage );
if (!surface->image->data) goto failed; if (!surface->image->data) goto failed;
} }
...@@ -2056,8 +2055,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co ...@@ -2056,8 +2055,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co
if (surface->byteswap || format->bits_per_pixel == 4 || format->bits_per_pixel == 8) if (surface->byteswap || format->bits_per_pixel == 4 || format->bits_per_pixel == 8)
{ {
/* allocate separate surface bits if byte swapping or palette mapping is required */ /* allocate separate surface bits if byte swapping or palette mapping is required */
if (!(surface->bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, if (!(surface->bits = calloc( 1, surface->info.bmiHeader.biSizeImage )))
surface->info.bmiHeader.biSizeImage )))
goto failed; goto failed;
} }
else surface->bits = surface->image->data; else surface->bits = surface->image->data;
......
...@@ -122,8 +122,7 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth) ...@@ -122,8 +122,7 @@ static Pixmap BRUSH_DitherColor( COLORREF color, int depth)
XUnlockDisplay( gdi_display ); XUnlockDisplay( gdi_display );
return 0; return 0;
} }
ditherImage->data = HeapAlloc( GetProcessHeap(), 0, ditherImage->data = malloc( ditherImage->height * ditherImage->bytes_per_line );
ditherImage->height * ditherImage->bytes_per_line );
} }
if (color != prevColor) if (color != prevColor)
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
/* avoid conflict with field names in included win32 headers */ /* avoid conflict with field names in included win32 headers */
#undef Status #undef Status
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
...@@ -123,7 +122,7 @@ static BOOL X11DRV_desktop_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_ ...@@ -123,7 +122,7 @@ static BOOL X11DRV_desktop_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_
screen_height = primary_rect.bottom - primary_rect.top; screen_height = primary_rect.bottom - primary_rect.top;
/* Allocate memory for modes in different color depths */ /* Allocate memory for modes in different color depths */
if (!(modes = heap_calloc( (ARRAY_SIZE(screen_sizes) + 2) * DEPTH_COUNT, sizeof(*modes))) ) if (!(modes = calloc( (ARRAY_SIZE(screen_sizes) + 2) * DEPTH_COUNT, sizeof(*modes))) )
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return FALSE; return FALSE;
...@@ -161,7 +160,7 @@ static BOOL X11DRV_desktop_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_ ...@@ -161,7 +160,7 @@ static BOOL X11DRV_desktop_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_
static void X11DRV_desktop_free_modes( DEVMODEW *modes ) static void X11DRV_desktop_free_modes( DEVMODEW *modes )
{ {
heap_free( modes ); free( modes );
} }
static BOOL X11DRV_desktop_get_current_mode( ULONG_PTR id, DEVMODEW *mode ) static BOOL X11DRV_desktop_get_current_mode( ULONG_PTR id, DEVMODEW *mode )
...@@ -209,7 +208,7 @@ static BOOL X11DRV_desktop_get_gpus( struct gdi_gpu **new_gpus, int *count ) ...@@ -209,7 +208,7 @@ static BOOL X11DRV_desktop_get_gpus( struct gdi_gpu **new_gpus, int *count )
static const WCHAR wine_adapterW[] = {'W','i','n','e',' ','A','d','a','p','t','e','r',0}; static const WCHAR wine_adapterW[] = {'W','i','n','e',' ','A','d','a','p','t','e','r',0};
struct gdi_gpu *gpu; struct gdi_gpu *gpu;
gpu = heap_calloc( 1, sizeof(*gpu) ); gpu = calloc( 1, sizeof(*gpu) );
if (!gpu) return FALSE; if (!gpu) return FALSE;
if (!get_host_primary_gpu( gpu )) if (!get_host_primary_gpu( gpu ))
...@@ -225,7 +224,7 @@ static BOOL X11DRV_desktop_get_gpus( struct gdi_gpu **new_gpus, int *count ) ...@@ -225,7 +224,7 @@ static BOOL X11DRV_desktop_get_gpus( struct gdi_gpu **new_gpus, int *count )
static void X11DRV_desktop_free_gpus( struct gdi_gpu *gpus ) static void X11DRV_desktop_free_gpus( struct gdi_gpu *gpus )
{ {
heap_free( gpus ); free( gpus );
} }
/* TODO: Support multi-head virtual desktop */ /* TODO: Support multi-head virtual desktop */
...@@ -233,7 +232,7 @@ static BOOL X11DRV_desktop_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter ** ...@@ -233,7 +232,7 @@ static BOOL X11DRV_desktop_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **
{ {
struct gdi_adapter *adapter; struct gdi_adapter *adapter;
adapter = heap_calloc( 1, sizeof(*adapter) ); adapter = calloc( 1, sizeof(*adapter) );
if (!adapter) return FALSE; if (!adapter) return FALSE;
adapter->state_flags = DISPLAY_DEVICE_PRIMARY_DEVICE; adapter->state_flags = DISPLAY_DEVICE_PRIMARY_DEVICE;
...@@ -247,7 +246,7 @@ static BOOL X11DRV_desktop_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter ** ...@@ -247,7 +246,7 @@ static BOOL X11DRV_desktop_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **
static void X11DRV_desktop_free_adapters( struct gdi_adapter *adapters ) static void X11DRV_desktop_free_adapters( struct gdi_adapter *adapters )
{ {
heap_free( adapters ); free( adapters );
} }
static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count ) static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count )
...@@ -257,7 +256,7 @@ static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monito ...@@ -257,7 +256,7 @@ static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monito
'N','o','n','-','P','n','P',' ','M','o','n','i','t','o','r',0}; 'N','o','n','-','P','n','P',' ','M','o','n','i','t','o','r',0};
struct gdi_monitor *monitor; struct gdi_monitor *monitor;
monitor = heap_calloc( 1, sizeof(*monitor) ); monitor = calloc( 1, sizeof(*monitor) );
if (!monitor) return FALSE; if (!monitor) return FALSE;
lstrcpyW( monitor->name, generic_nonpnp_monitorW ); lstrcpyW( monitor->name, generic_nonpnp_monitorW );
...@@ -277,7 +276,7 @@ static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monito ...@@ -277,7 +276,7 @@ static BOOL X11DRV_desktop_get_monitors( ULONG_PTR adapter_id, struct gdi_monito
static void X11DRV_desktop_free_monitors( struct gdi_monitor *monitors, int count ) static void X11DRV_desktop_free_monitors( struct gdi_monitor *monitors, int count )
{ {
heap_free( monitors ); free( monitors );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -148,8 +148,7 @@ static void add_pen_device_bounds( X11DRV_PDEVICE *dev, const POINT *points, int ...@@ -148,8 +148,7 @@ static void add_pen_device_bounds( X11DRV_PDEVICE *dev, const POINT *points, int
* X11DRV_GetRegionData * X11DRV_GetRegionData
* *
* Calls GetRegionData on the given region and converts the rectangle * Calls GetRegionData on the given region and converts the rectangle
* array to XRectangle format. The returned buffer must be freed by * array to XRectangle format. The returned buffer must be freed by caller.
* caller using HeapFree(GetProcessHeap(),...).
* If hdc_lptodp is not 0, the rectangles are converted through LPtoDP. * If hdc_lptodp is not 0, the rectangles are converted through LPtoDP.
*/ */
RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
...@@ -167,10 +166,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) ...@@ -167,10 +166,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp )
int count = (size - sizeof(RGNDATAHEADER)) / sizeof(RECT); int count = (size - sizeof(RGNDATAHEADER)) / sizeof(RECT);
size += count * (sizeof(XRectangle) - sizeof(RECT)); size += count * (sizeof(XRectangle) - sizeof(RECT));
} }
if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL; if (!(data = malloc( size ))) return NULL;
if (!NtGdiGetRegionData( hrgn, size, data )) if (!NtGdiGetRegionData( hrgn, size, data ))
{ {
HeapFree( GetProcessHeap(), 0, data ); free( data );
return NULL; return NULL;
} }
...@@ -256,7 +255,7 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn ) ...@@ -256,7 +255,7 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn )
{ {
XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top, XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
} }
...@@ -1079,7 +1078,7 @@ BOOL CDECL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) ...@@ -1079,7 +1078,7 @@ BOOL CDECL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
} }
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
if (NtGdiGetRgnBox( hrgn, &rc )) if (NtGdiGetRgnBox( hrgn, &rc ))
{ {
...@@ -1099,15 +1098,15 @@ static BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) ...@@ -1099,15 +1098,15 @@ static BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
POINT *points; POINT *points;
XPoint *xpoints; XPoint *xpoints;
points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pt) ); points = malloc( count * sizeof(*pt) );
if (!points) return FALSE; if (!points) return FALSE;
memcpy( points, pt, count * sizeof(*pt) ); memcpy( points, pt, count * sizeof(*pt) );
lp_to_dp( dev->hdc, points, count ); lp_to_dp( dev->hdc, points, count );
add_pen_device_bounds( physDev, points, count ); add_pen_device_bounds( physDev, points, count );
if (!(xpoints = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (count+1) ))) if (!(xpoints = malloc( sizeof(XPoint) * (count+1) )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
return FALSE; return FALSE;
} }
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
...@@ -1125,8 +1124,8 @@ static BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) ...@@ -1125,8 +1124,8 @@ static BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
XDrawLines( gdi_display, physDev->drawable, physDev->gc, XDrawLines( gdi_display, physDev->drawable, physDev->gc,
xpoints, count+1, CoordModeOrigin ); xpoints, count+1, CoordModeOrigin );
HeapFree( GetProcessHeap(), 0, xpoints ); free( xpoints );
HeapFree( GetProcessHeap(), 0, points ); free( points );
return TRUE; return TRUE;
} }
...@@ -1150,7 +1149,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, ...@@ -1150,7 +1149,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
total += counts[i]; total += counts[i];
} }
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) ); points = malloc( total * sizeof(*pt) );
if (!points) return FALSE; if (!points) return FALSE;
memcpy( points, pt, total * sizeof(*pt) ); memcpy( points, pt, total * sizeof(*pt) );
lp_to_dp( dev->hdc, points, total ); lp_to_dp( dev->hdc, points, total );
...@@ -1178,7 +1177,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, ...@@ -1178,7 +1177,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
} }
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
if (X11DRV_SetupGCForPen ( physDev )) if (X11DRV_SetupGCForPen ( physDev ))
...@@ -1186,7 +1185,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, ...@@ -1186,7 +1185,7 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
XPoint *xpoints; XPoint *xpoints;
int j; int j;
if (!(xpoints = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (max + 1) ))) goto done; if (!(xpoints = malloc( sizeof(XPoint) * (max + 1) ))) goto done;
for (i = pos = 0; i < polygons; pos += counts[i++]) for (i = pos = 0; i < polygons; pos += counts[i++])
{ {
for (j = 0; j < counts[i]; j++) for (j = 0; j < counts[i]; j++)
...@@ -1197,12 +1196,12 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, ...@@ -1197,12 +1196,12 @@ BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
xpoints[j] = xpoints[0]; xpoints[j] = xpoints[0];
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j + 1, CoordModeOrigin ); XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j + 1, CoordModeOrigin );
} }
HeapFree( GetProcessHeap(), 0, xpoints ); free( xpoints );
} }
ret = TRUE; ret = TRUE;
done: done:
HeapFree( GetProcessHeap(), 0, points ); free( points );
return ret; return ret;
} }
...@@ -1223,7 +1222,7 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count ...@@ -1223,7 +1222,7 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
total += counts[i]; total += counts[i];
} }
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) ); points = malloc( total * sizeof(*pt) );
if (!points) return FALSE; if (!points) return FALSE;
memcpy( points, pt, total * sizeof(*pt) ); memcpy( points, pt, total * sizeof(*pt) );
lp_to_dp( dev->hdc, points, total ); lp_to_dp( dev->hdc, points, total );
...@@ -1233,9 +1232,9 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count ...@@ -1233,9 +1232,9 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
{ {
XPoint *xpoints; XPoint *xpoints;
if (!(xpoints = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * max ))) if (!(xpoints = malloc( sizeof(XPoint) * max )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
return FALSE; return FALSE;
} }
for (i = pos = 0; i < polylines; pos += counts[i++]) for (i = pos = 0; i < polylines; pos += counts[i++])
...@@ -1247,9 +1246,9 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count ...@@ -1247,9 +1246,9 @@ BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
} }
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j, CoordModeOrigin ); XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j, CoordModeOrigin );
} }
HeapFree( GetProcessHeap(), 0, xpoints ); free( xpoints );
} }
HeapFree( GetProcessHeap(), 0, points ); free( points );
return TRUE; return TRUE;
} }
...@@ -1270,9 +1269,9 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill ) ...@@ -1270,9 +1269,9 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill )
NtGdiAbortPath( dev->hdc ); NtGdiAbortPath( dev->hdc );
return TRUE; return TRUE;
} }
xpoints = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(*xpoints) ); xpoints = malloc( (size + 1) * sizeof(*xpoints) );
points = HeapAlloc( GetProcessHeap(), 0, size * sizeof(*points) ); points = malloc( size * sizeof(*points) );
flags = HeapAlloc( GetProcessHeap(), 0, size * sizeof(*flags) ); flags = malloc( size * sizeof(*flags) );
if (!points || !flags || !xpoints) goto done; if (!points || !flags || !xpoints) goto done;
if (NtGdiGetPath( dev->hdc, points, flags, size ) == -1) goto done; if (NtGdiGetPath( dev->hdc, points, flags, size ) == -1) goto done;
lp_to_dp( dev->hdc, points, size ); lp_to_dp( dev->hdc, points, size );
...@@ -1293,7 +1292,7 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill ) ...@@ -1293,7 +1292,7 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill )
} }
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
if (stroke && X11DRV_SetupGCForPen ( physDev )) if (stroke && X11DRV_SetupGCForPen ( physDev ))
...@@ -1324,9 +1323,9 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill ) ...@@ -1324,9 +1323,9 @@ static BOOL x11drv_stroke_and_fill_path( PHYSDEV dev, BOOL stroke, BOOL fill )
ret = TRUE; ret = TRUE;
done: done:
HeapFree( GetProcessHeap(), 0, xpoints ); free( xpoints );
HeapFree( GetProcessHeap(), 0, points ); free( points );
HeapFree( GetProcessHeap(), 0, flags ); free( flags );
return ret; return ret;
} }
...@@ -1635,7 +1634,7 @@ static char *get_icm_profile( unsigned long *size ) ...@@ -1635,7 +1634,7 @@ static char *get_icm_profile( unsigned long *size )
*size = get_property_size( format, count ); *size = get_property_size( format, count );
if (format && count) if (format && count)
{ {
if ((ret = HeapAlloc( GetProcessHeap(), 0, *size ))) memcpy( ret, profile, *size ); if ((ret = malloc( *size ))) memcpy( ret, profile, *size );
XFree( profile ); XFree( profile );
} }
return ret; return ret;
...@@ -1724,7 +1723,7 @@ BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, ...@@ -1724,7 +1723,7 @@ BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size,
if (status) ERR( "Unable to write color profile: %x\n", status ); if (status) ERR( "Unable to write color profile: %x\n", status );
NtClose( file ); NtClose( file );
} }
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
else if (!allow_default) return FALSE; else if (!allow_default) return FALSE;
else lstrcpyW( p, srgb ); else lstrcpyW( p, srgb );
......
...@@ -79,7 +79,7 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable ) ...@@ -79,7 +79,7 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
pthread_once( &init_once, device_init ); pthread_once( &init_once, device_init );
if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL; if (!(physDev = calloc( 1, sizeof(*physDev) ))) return NULL;
physDev->drawable = drawable; physDev->drawable = drawable;
physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL ); physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
...@@ -135,7 +135,7 @@ static BOOL CDECL X11DRV_DeleteDC( PHYSDEV dev ) ...@@ -135,7 +135,7 @@ static BOOL CDECL X11DRV_DeleteDC( PHYSDEV dev )
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev ); X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
XFreeGC( gdi_display, physDev->gc ); XFreeGC( gdi_display, physDev->gc );
HeapFree( GetProcessHeap(), 0, physDev ); free( physDev );
return TRUE; return TRUE;
} }
......
...@@ -1338,7 +1338,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) ...@@ -1338,7 +1338,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
TRACE_(key)("XmbLookupString needs %i byte(s)\n", ascii_chars); TRACE_(key)("XmbLookupString needs %i byte(s)\n", ascii_chars);
if (status == XBufferOverflow) if (status == XBufferOverflow)
{ {
Str = HeapAlloc(GetProcessHeap(), 0, ascii_chars); Str = malloc( ascii_chars );
if (Str == NULL) if (Str == NULL)
{ {
ERR_(key)("Failed to allocate memory!\n"); ERR_(key)("Failed to allocate memory!\n");
...@@ -1356,7 +1356,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) ...@@ -1356,7 +1356,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
{ {
X11DRV_XIMLookupChars( Str, ascii_chars ); X11DRV_XIMLookupChars( Str, ascii_chars );
if (buf != Str) if (buf != Str)
HeapFree(GetProcessHeap(), 0, Str); free( Str );
return TRUE; return TRUE;
} }
...@@ -1385,7 +1385,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) ...@@ -1385,7 +1385,7 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
keysym, ksname, ascii_chars, debugstr_an(Str, ascii_chars)); keysym, ksname, ascii_chars, debugstr_an(Str, ascii_chars));
} }
if (buf != Str) if (buf != Str)
HeapFree(GetProcessHeap(), 0, Str); free( Str );
vkey = EVENT_event_to_vkey(xic,event); vkey = EVENT_event_to_vkey(xic,event);
/* X returns keycode 0 for composed characters */ /* X returns keycode 0 for composed characters */
...@@ -2463,7 +2463,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState, ...@@ -2463,7 +2463,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
TRACE_(key)("XmbLookupString needs %d byte(s)\n", ret); TRACE_(key)("XmbLookupString needs %d byte(s)\n", ret);
if (status == XBufferOverflow) if (status == XBufferOverflow)
{ {
lpChar = HeapAlloc(GetProcessHeap(), 0, ret); lpChar = malloc( ret );
if (lpChar == NULL) if (lpChar == NULL)
{ {
ERR_(key)("Failed to allocate memory!\n"); ERR_(key)("Failed to allocate memory!\n");
...@@ -2617,7 +2617,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState, ...@@ -2617,7 +2617,7 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
found: found:
if (buf != lpChar) if (buf != lpChar)
HeapFree(GetProcessHeap(), 0, lpChar); free( lpChar );
pthread_mutex_unlock( &kbd_mutex ); pthread_mutex_unlock( &kbd_mutex );
......
...@@ -791,10 +791,10 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i ...@@ -791,10 +791,10 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
/* Retrieve the number of frames to render */ /* Retrieve the number of frames to render */
if (!NtUserGetCursorFrameInfo(icon, 0, &delay_jiffies, &nFrames)) return 0; if (!NtUserGetCursorFrameInfo(icon, 0, &delay_jiffies, &nFrames)) return 0;
if (!(imgs = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(XcursorImage*)*nFrames ))) return 0; if (!(imgs = calloc( 1, sizeof(XcursorImage*) * nFrames ))) return 0;
/* Allocate all of the resources necessary to obtain a cursor frame */ /* Allocate all of the resources necessary to obtain a cursor frame */
if (!(info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto cleanup; if (!(info = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto cleanup;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info->bmiHeader.biWidth = width; info->bmiHeader.biWidth = width;
info->bmiHeader.biHeight = -height; info->bmiHeader.biHeight = -height;
...@@ -848,7 +848,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i ...@@ -848,7 +848,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
images->images[images->nimage] = imgs[images->nimage]; images->images[images->nimage] = imgs[images->nimage];
cursor = pXcursorImagesLoadCursor( gdi_display, images ); cursor = pXcursorImagesLoadCursor( gdi_display, images );
pXcursorImagesDestroy( images ); /* Note: this frees each individual frame (calls XcursorImageDestroy) */ pXcursorImagesDestroy( images ); /* Note: this frees each individual frame (calls XcursorImageDestroy) */
HeapFree( GetProcessHeap(), 0, imgs ); free( imgs );
imgs = NULL; imgs = NULL;
cleanup: cleanup:
...@@ -857,12 +857,12 @@ cleanup: ...@@ -857,12 +857,12 @@ cleanup:
/* Failed to produce a cursor, free previously allocated frames */ /* Failed to produce a cursor, free previously allocated frames */
for (i=0; i<nFrames && imgs[i]; i++) for (i=0; i<nFrames && imgs[i]; i++)
pXcursorImageDestroy( imgs[i] ); pXcursorImageDestroy( imgs[i] );
HeapFree( GetProcessHeap(), 0, imgs ); free( imgs );
} }
/* Cleanup all of the resources used to obtain the frame data */ /* Cleanup all of the resources used to obtain the frame data */
if (hbmColor) NtGdiDeleteObjectApp( hbmColor ); if (hbmColor) NtGdiDeleteObjectApp( hbmColor );
if (hbmMask) NtGdiDeleteObjectApp( hbmMask ); if (hbmMask) NtGdiDeleteObjectApp( hbmMask );
HeapFree( GetProcessHeap(), 0, info ); free( info );
return cursor; return cursor;
} }
...@@ -1163,7 +1163,7 @@ static Cursor create_xlib_monochrome_cursor( HDC hdc, const ICONINFOEXW *icon, i ...@@ -1163,7 +1163,7 @@ static Cursor create_xlib_monochrome_cursor( HDC hdc, const ICONINFOEXW *icon, i
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done; if (!(mask_bits = malloc( info->bmiHeader.biSizeImage ))) goto done;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height * 2, mask_bits, info, if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height * 2, mask_bits, info,
DIB_RGB_COLORS, 0, 0 )) goto done; DIB_RGB_COLORS, 0, 0 )) goto done;
...@@ -1220,7 +1220,7 @@ static Cursor create_xlib_monochrome_cursor( HDC hdc, const ICONINFOEXW *icon, i ...@@ -1220,7 +1220,7 @@ static Cursor create_xlib_monochrome_cursor( HDC hdc, const ICONINFOEXW *icon, i
XFreePixmap( gdi_display, mask_pixmap ); XFreePixmap( gdi_display, mask_pixmap );
done: done:
HeapFree( GetProcessHeap(), 0, mask_bits ); free( mask_bits );
return cursor; return cursor;
} }
...@@ -1294,14 +1294,14 @@ static Cursor create_xlib_color_cursor( HDC hdc, const ICONINFOEXW *icon, int wi ...@@ -1294,14 +1294,14 @@ static Cursor create_xlib_color_cursor( HDC hdc, const ICONINFOEXW *icon, int wi
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done; if (!(mask_bits = malloc( info->bmiHeader.biSizeImage ))) goto done;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height, mask_bits, info, if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, height, mask_bits, info,
DIB_RGB_COLORS, 0, 0 )) goto done; DIB_RGB_COLORS, 0, 0 )) goto done;
info->bmiHeader.biBitCount = 32; info->bmiHeader.biBitCount = 32;
info->bmiHeader.biSizeImage = width * height * 4; info->bmiHeader.biSizeImage = width * height * 4;
if (!(color_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done; if (!(color_bits = malloc( info->bmiHeader.biSizeImage ))) goto done;
if (!(xor_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, width_bytes * height ))) goto done; if (!(xor_bits = calloc( 1, width_bytes * height ))) goto done;
NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, height, color_bits, info, DIB_RGB_COLORS, 0, 0 ); NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, height, color_bits, info, DIB_RGB_COLORS, 0, 0 );
/* compute fg/bg color and xor bitmap based on average of the color values */ /* compute fg/bg color and xor bitmap based on average of the color values */
...@@ -1389,9 +1389,9 @@ static Cursor create_xlib_color_cursor( HDC hdc, const ICONINFOEXW *icon, int wi ...@@ -1389,9 +1389,9 @@ static Cursor create_xlib_color_cursor( HDC hdc, const ICONINFOEXW *icon, int wi
XFreePixmap( gdi_display, xor_pixmap ); XFreePixmap( gdi_display, xor_pixmap );
done: done:
HeapFree( GetProcessHeap(), 0, color_bits ); free( color_bits );
HeapFree( GetProcessHeap(), 0, xor_bits ); free( xor_bits );
HeapFree( GetProcessHeap(), 0, mask_bits ); free( mask_bits );
return cursor; return cursor;
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "x11drv.h" #include "x11drv.h"
#include "xcomposite.h" #include "xcomposite.h"
#include "winternl.h" #include "winternl.h"
#include "wine/heap.h"
#include "wine/debug.h" #include "wine/debug.h"
#ifdef SONAME_LIBGL #ifdef SONAME_LIBGL
...@@ -467,7 +466,7 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void) ...@@ -467,7 +466,7 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void)
gl_renderer = (const char *)opengl_funcs.gl.p_glGetString(GL_RENDERER); gl_renderer = (const char *)opengl_funcs.gl.p_glGetString(GL_RENDERER);
gl_version = (const char *)opengl_funcs.gl.p_glGetString(GL_VERSION); gl_version = (const char *)opengl_funcs.gl.p_glGetString(GL_VERSION);
str = (const char *) opengl_funcs.gl.p_glGetString(GL_EXTENSIONS); str = (const char *) opengl_funcs.gl.p_glGetString(GL_EXTENSIONS);
glExtensions = HeapAlloc(GetProcessHeap(), 0, strlen(str)+sizeof(legacy_extensions)); glExtensions = malloc( strlen(str) + sizeof(legacy_extensions) );
strcpy(glExtensions, str); strcpy(glExtensions, str);
strcat(glExtensions, legacy_extensions); strcat(glExtensions, legacy_extensions);
...@@ -1023,7 +1022,7 @@ static void init_pixel_formats( Display *display ) ...@@ -1023,7 +1022,7 @@ static void init_pixel_formats( Display *display )
} }
TRACE("Found %d bitmap capable fbconfigs\n", bmp_formats); TRACE("Found %d bitmap capable fbconfigs\n", bmp_formats);
list = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nCfgs + bmp_formats) * sizeof(*list)); list = calloc( 1, (nCfgs + bmp_formats) * sizeof(*list) );
/* Fill the pixel format list. Put onscreen formats at the top and offscreen ones at the bottom. /* Fill the pixel format list. Put onscreen formats at the top and offscreen ones at the bottom.
* Do this as GLX doesn't guarantee that the list is sorted */ * Do this as GLX doesn't guarantee that the list is sorted */
...@@ -1165,7 +1164,7 @@ static void release_gl_drawable( struct gl_drawable *gl ) ...@@ -1165,7 +1164,7 @@ static void release_gl_drawable( struct gl_drawable *gl )
default: default:
break; break;
} }
HeapFree( GetProcessHeap(), 0, gl ); free( gl );
} }
/* Mark any allocated context using the glx drawable 'old' to use 'new' */ /* Mark any allocated context using the glx drawable 'old' to use 'new' */
...@@ -1308,7 +1307,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel ...@@ -1308,7 +1307,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
width = min( max( 1, rect.right ), 65535 ); width = min( max( 1, rect.right ), 65535 );
height = min( max( 1, rect.bottom ), 65535 ); height = min( max( 1, rect.bottom ), 65535 );
if (!(gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ))) return NULL; if (!(gl = calloc( 1, sizeof(*gl) ))) return NULL;
/* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI /* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI
* there is no way to query it, so we have to store it here. * there is no way to query it, so we have to store it here.
...@@ -1358,7 +1357,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel ...@@ -1358,7 +1357,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
if (!gl->drawable) if (!gl->drawable)
{ {
HeapFree( GetProcessHeap(), 0, gl ); free( gl );
return NULL; return NULL;
} }
...@@ -1724,7 +1723,7 @@ static struct wgl_context * WINAPI glxdrv_wglCreateContext( HDC hdc ) ...@@ -1724,7 +1723,7 @@ static struct wgl_context * WINAPI glxdrv_wglCreateContext( HDC hdc )
return NULL; return NULL;
} }
if ((ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) if ((ret = calloc( 1, sizeof(*ret) )))
{ {
ret->hdc = hdc; ret->hdc = hdc;
ret->fmt = gl->format; ret->fmt = gl->format;
...@@ -1763,7 +1762,8 @@ static BOOL WINAPI glxdrv_wglDeleteContext(struct wgl_context *ctx) ...@@ -1763,7 +1762,8 @@ static BOOL WINAPI glxdrv_wglDeleteContext(struct wgl_context *ctx)
release_gl_drawable( ctx->drawables[1] ); release_gl_drawable( ctx->drawables[1] );
release_gl_drawable( ctx->new_drawables[0] ); release_gl_drawable( ctx->new_drawables[0] );
release_gl_drawable( ctx->new_drawables[1] ); release_gl_drawable( ctx->new_drawables[1] );
return HeapFree( GetProcessHeap(), 0, ctx ); free( ctx );
return TRUE;
} }
/*********************************************************************** /***********************************************************************
...@@ -2011,7 +2011,7 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg ...@@ -2011,7 +2011,7 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg
return NULL; return NULL;
} }
if ((ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)))) if ((ret = calloc( 1, sizeof(*ret) )))
{ {
ret->hdc = hdc; ret->hdc = hdc;
ret->fmt = gl->format; ret->fmt = gl->format;
...@@ -2077,7 +2077,7 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg ...@@ -2077,7 +2077,7 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg
{ {
/* In the future we should convert the GLX error to a win32 one here if needed */ /* In the future we should convert the GLX error to a win32 one here if needed */
WARN("Context creation failed (error %#x).\n", err); WARN("Context creation failed (error %#x).\n", err);
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
ret = NULL; ret = NULL;
} }
else else
...@@ -2127,7 +2127,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat ...@@ -2127,7 +2127,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat
return NULL; return NULL;
} }
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc( 1, sizeof(*object) );
if (NULL == object) { if (NULL == object) {
SetLastError(ERROR_NO_SYSTEM_RESOURCES); SetLastError(ERROR_NO_SYSTEM_RESOURCES);
return NULL; return NULL;
...@@ -2285,7 +2285,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat ...@@ -2285,7 +2285,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat
return object; return object;
create_failed: create_failed:
HeapFree(GetProcessHeap(), 0, object); free( object );
TRACE("->(FAILED)\n"); TRACE("->(FAILED)\n");
return NULL; return NULL;
} }
...@@ -2305,7 +2305,7 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object ) ...@@ -2305,7 +2305,7 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object )
pglXDestroyPbuffer(gdi_display, object->drawable); pglXDestroyPbuffer(gdi_display, object->drawable);
if (object->tmp_context) if (object->tmp_context)
pglXDestroyContext(gdi_display, object->tmp_context); pglXDestroyContext(gdi_display, object->tmp_context);
HeapFree(GetProcessHeap(), 0, object); free( object );
return GL_TRUE; return GL_TRUE;
} }
...@@ -2323,7 +2323,7 @@ static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object ) ...@@ -2323,7 +2323,7 @@ static HDC X11DRV_wglGetPbufferDCARB( struct wgl_pbuffer *object )
hdc = NtGdiOpenDCW( NULL, NULL, NULL, 0, TRUE, NULL, NULL, NULL ); hdc = NtGdiOpenDCW( NULL, NULL, NULL, 0, TRUE, NULL, NULL, NULL );
if (!hdc) return 0; if (!hdc) return 0;
if (!(gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ))) if (!(gl = calloc( 1, sizeof(*gl) )))
{ {
NtGdiDeleteObjectApp( hdc ); NtGdiDeleteObjectApp( hdc );
return 0; return 0;
...@@ -2589,7 +2589,7 @@ static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, c ...@@ -2589,7 +2589,7 @@ static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, c
return GL_FALSE; return GL_FALSE;
} }
if (!(formats = heap_alloc(nCfgs * sizeof(*formats)))) if (!(formats = malloc( nCfgs * sizeof(*formats) )))
{ {
ERR("No memory.\n"); ERR("No memory.\n");
XFree(cfgs); XFree(cfgs);
...@@ -2639,7 +2639,7 @@ static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, c ...@@ -2639,7 +2639,7 @@ static BOOL X11DRV_wglChoosePixelFormatARB( HDC hdc, const int *piAttribIList, c
for (i = 0; i < *nNumFormats; ++i) for (i = 0; i < *nNumFormats; ++i)
piFormats[i] = formats[i].format; piFormats[i] = formats[i].format;
heap_free(formats); free( formats );
XFree(cfgs); XFree(cfgs);
return GL_TRUE; return GL_TRUE;
} }
...@@ -2923,7 +2923,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribfvARB( HDC hdc, int iPixelFormat, int ...@@ -2923,7 +2923,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribfvARB( HDC hdc, int iPixelFormat, int
TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues); TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues);
/* Allocate a temporary array to store integer values */ /* Allocate a temporary array to store integer values */
attr = HeapAlloc(GetProcessHeap(), 0, nAttributes * sizeof(int)); attr = malloc( nAttributes * sizeof(int) );
if (!attr) { if (!attr) {
ERR("couldn't allocate %d array\n", nAttributes); ERR("couldn't allocate %d array\n", nAttributes);
return GL_FALSE; return GL_FALSE;
...@@ -2939,7 +2939,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribfvARB( HDC hdc, int iPixelFormat, int ...@@ -2939,7 +2939,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribfvARB( HDC hdc, int iPixelFormat, int
} }
} }
HeapFree(GetProcessHeap(), 0, attr); free( attr );
return ret; return ret;
} }
......
...@@ -332,7 +332,7 @@ int X11DRV_PALETTE_Init(void) ...@@ -332,7 +332,7 @@ int X11DRV_PALETTE_Init(void)
{ {
get_palette_entries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, sys_pal_template ); get_palette_entries( GetStockObject(DEFAULT_PALETTE), 0, NB_RESERVED_COLORS, sys_pal_template );
if ((mapping = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(int) * NB_RESERVED_COLORS ))) if ((mapping = calloc( 1, sizeof(int) * NB_RESERVED_COLORS )))
palette_set_mapping( GetStockObject(DEFAULT_PALETTE), mapping ); palette_set_mapping( GetStockObject(DEFAULT_PALETTE), mapping );
if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE) if (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_PRIVATE)
...@@ -364,7 +364,8 @@ static BOOL X11DRV_PALETTE_BuildPrivateMap( const PALETTEENTRY *sys_pal_template ...@@ -364,7 +364,8 @@ static BOOL X11DRV_PALETTE_BuildPrivateMap( const PALETTEENTRY *sys_pal_template
XColor color; XColor color;
int i; int i;
if((COLOR_sysPal = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY)*palette_size)) == NULL) { if((COLOR_sysPal = malloc( sizeof(PALETTEENTRY) * palette_size )) == NULL)
{
WARN("Unable to allocate the system palette\n"); WARN("Unable to allocate the system palette\n");
return FALSE; return FALSE;
} }
...@@ -526,7 +527,8 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ...@@ -526,7 +527,8 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
* X guidelines and does binary search... * X guidelines and does binary search...
*/ */
if((pixDynMapping = HeapAlloc(GetProcessHeap(), 0, sizeof(long)*palette_size)) == NULL) { if (!(pixDynMapping = malloc( sizeof(*pixDynMapping) * palette_size )))
{
WARN("Out of memory while building system palette.\n"); WARN("Out of memory while building system palette.\n");
return FALSE; return FALSE;
} }
...@@ -594,10 +596,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ...@@ -594,10 +596,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL || !(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED)) ) (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL || !(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED)) )
? NB_RESERVED_COLORS/2 : -1; ? NB_RESERVED_COLORS/2 : -1;
COLOR_sysPal = HeapAlloc(GetProcessHeap(),0,sizeof(PALETTEENTRY)*256); COLOR_sysPal = malloc( sizeof(PALETTEENTRY) * 256 );
if(COLOR_sysPal == NULL) { if(COLOR_sysPal == NULL) {
ERR("Unable to allocate the system palette!\n"); ERR("Unable to allocate the system palette!\n");
HeapFree(GetProcessHeap(), 0, pixDynMapping); free( pixDynMapping );
return FALSE; return FALSE;
} }
...@@ -605,10 +607,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ...@@ -605,10 +607,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
if (default_visual.depth <= 8) if (default_visual.depth <= 8)
{ {
X11DRV_PALETTE_XPixelToPalette = HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(int) ); X11DRV_PALETTE_XPixelToPalette = malloc( 256 * sizeof(int) );
if(X11DRV_PALETTE_XPixelToPalette == NULL) { if(X11DRV_PALETTE_XPixelToPalette == NULL) {
ERR("Out of memory: XPixelToPalette!\n"); ERR("Out of memory: XPixelToPalette!\n");
HeapFree(GetProcessHeap(), 0, pixDynMapping); free( pixDynMapping );
return FALSE; return FALSE;
} }
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
...@@ -619,10 +621,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ...@@ -619,10 +621,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
* RGB->pixel calculation in X11DRV_PALETTE_ToPhysical(). * RGB->pixel calculation in X11DRV_PALETTE_ToPhysical().
*/ */
X11DRV_PALETTE_PaletteToXPixel = HeapAlloc(GetProcessHeap(),0,sizeof(int)*256); X11DRV_PALETTE_PaletteToXPixel = malloc( sizeof(int) * 256 );
if(X11DRV_PALETTE_PaletteToXPixel == NULL) { if(X11DRV_PALETTE_PaletteToXPixel == NULL) {
ERR("Out of memory: PaletteToXPixel!\n"); ERR("Out of memory: PaletteToXPixel!\n");
HeapFree(GetProcessHeap(), 0, pixDynMapping); free( pixDynMapping );
return FALSE; return FALSE;
} }
...@@ -658,7 +660,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template ...@@ -658,7 +660,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
X11DRV_PALETTE_XPixelToPalette[X11DRV_PALETTE_PaletteToXPixel[i]] = i; X11DRV_PALETTE_XPixelToPalette[X11DRV_PALETTE_PaletteToXPixel[i]] = i;
} }
HeapFree(GetProcessHeap(), 0, pixDynMapping); free( pixDynMapping );
return TRUE; return TRUE;
} }
...@@ -1194,10 +1196,7 @@ UINT CDECL X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) ...@@ -1194,10 +1196,7 @@ UINT CDECL X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary )
/* initialize palette mapping table */ /* initialize palette mapping table */
prev_mapping = palette_get_mapping( hpal ); prev_mapping = palette_get_mapping( hpal );
if (prev_mapping) mapping = realloc( prev_mapping, sizeof(int) * num_entries );
mapping = HeapReAlloc( GetProcessHeap(), 0, prev_mapping, sizeof(int)*num_entries);
else
mapping = HeapAlloc( GetProcessHeap(), 0, sizeof(int)*num_entries);
if(mapping == NULL) { if(mapping == NULL) {
ERR("Unable to allocate new mapping -- memory exhausted!\n"); ERR("Unable to allocate new mapping -- memory exhausted!\n");
...@@ -1302,7 +1301,7 @@ BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) ...@@ -1302,7 +1301,7 @@ BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal )
if (mapping) if (mapping)
{ {
XDeleteContext( gdi_display, (XID)hpal, palette_context ); XDeleteContext( gdi_display, (XID)hpal, palette_context );
HeapFree( GetProcessHeap(), 0, mapping ); free( mapping );
} }
return TRUE; return TRUE;
} }
......
...@@ -78,7 +78,7 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern ...@@ -78,7 +78,7 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
if (!size) return 0; if (!size) return 0;
physDev->pen.ext = 1; physDev->pen.ext = 1;
elp = HeapAlloc( GetProcessHeap(), 0, size ); elp = malloc( size );
NtGdiExtGetObjectW( hpen, size, elp ); NtGdiExtGetObjectW( hpen, size, elp );
logpen.lopnStyle = elp->elpPenStyle; logpen.lopnStyle = elp->elpPenStyle;
...@@ -145,7 +145,7 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern ...@@ -145,7 +145,7 @@ HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
for(i = 0; i < physDev->pen.dash_len; i++) for(i = 0; i < physDev->pen.dash_len; i++)
physDev->pen.dashes[i] = min( physDev->pen.dashes[i] * physDev->pen.width, 255 ); physDev->pen.dashes[i] = min( physDev->pen.dashes[i] * physDev->pen.width, 255 );
HeapFree( GetProcessHeap(), 0, elp ); free( elp );
return hpen; return hpen;
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "winreg.h" #include "winreg.h"
#include "wingdi.h" #include "wingdi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11settings); WINE_DEFAULT_DEBUG_CHANNEL(x11settings);
...@@ -101,7 +100,7 @@ static BOOL nores_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UIN ...@@ -101,7 +100,7 @@ static BOOL nores_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UIN
RECT primary = get_host_primary_monitor_rect(); RECT primary = get_host_primary_monitor_rect();
DEVMODEW *modes; DEVMODEW *modes;
modes = heap_calloc(1, sizeof(*modes)); modes = calloc(1, sizeof(*modes));
if (!modes) if (!modes)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
...@@ -126,7 +125,7 @@ static BOOL nores_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UIN ...@@ -126,7 +125,7 @@ static BOOL nores_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UIN
static void nores_free_modes(DEVMODEW *modes) static void nores_free_modes(DEVMODEW *modes)
{ {
heap_free(modes); free(modes);
} }
static BOOL nores_get_current_mode(ULONG_PTR id, DEVMODEW *mode) static BOOL nores_get_current_mode(ULONG_PTR id, DEVMODEW *mode)
...@@ -431,7 +430,7 @@ static void set_display_depth(ULONG_PTR display_id, DWORD depth) ...@@ -431,7 +430,7 @@ static void set_display_depth(ULONG_PTR display_id, DWORD depth)
} }
} }
display_depth = heap_alloc(sizeof(*display_depth)); display_depth = malloc(sizeof(*display_depth));
if (!display_depth) if (!display_depth)
{ {
ERR("Failed to allocate memory.\n"); ERR("Failed to allocate memory.\n");
...@@ -595,7 +594,7 @@ static DEVMODEW *get_full_mode(ULONG_PTR id, DEVMODEW *dev_mode) ...@@ -595,7 +594,7 @@ static DEVMODEW *get_full_mode(ULONG_PTR id, DEVMODEW *dev_mode)
return NULL; return NULL;
} }
if (!(full_mode = heap_alloc(sizeof(*found_mode) + found_mode->dmDriverExtra))) if (!(full_mode = malloc(sizeof(*found_mode) + found_mode->dmDriverExtra)))
{ {
handler.free_modes(modes); handler.free_modes(modes);
return NULL; return NULL;
...@@ -612,7 +611,7 @@ static DEVMODEW *get_full_mode(ULONG_PTR id, DEVMODEW *dev_mode) ...@@ -612,7 +611,7 @@ static DEVMODEW *get_full_mode(ULONG_PTR id, DEVMODEW *dev_mode)
static void free_full_mode(DEVMODEW *mode) static void free_full_mode(DEVMODEW *mode)
{ {
if (!is_detached_mode(mode)) if (!is_detached_mode(mode))
heap_free(mode); free(mode);
} }
static LONG get_display_settings(struct x11drv_display_setting **new_displays, static LONG get_display_settings(struct x11drv_display_setting **new_displays,
...@@ -629,7 +628,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays, ...@@ -629,7 +628,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays,
for (display_idx = 0; !NtUserEnumDisplayDevices( NULL, display_idx, &display_device, 0 ); ++display_idx) for (display_idx = 0; !NtUserEnumDisplayDevices( NULL, display_idx, &display_device, 0 ); ++display_idx)
++display_count; ++display_count;
displays = heap_calloc(display_count, sizeof(*displays)); displays = calloc(display_count, sizeof(*displays));
if (!displays) if (!displays)
goto done; goto done;
...@@ -692,7 +691,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays, ...@@ -692,7 +691,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays,
return DISP_CHANGE_SUCCESSFUL; return DISP_CHANGE_SUCCESSFUL;
done: done:
heap_free(displays); free(displays);
return ret; return ret;
} }
...@@ -956,7 +955,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, ...@@ -956,7 +955,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
full_mode = get_full_mode(displays[display_idx].id, &displays[display_idx].desired_mode); full_mode = get_full_mode(displays[display_idx].id, &displays[display_idx].desired_mode);
if (!full_mode) if (!full_mode)
{ {
heap_free(displays); free(displays);
return DISP_CHANGE_BADMODE; return DISP_CHANGE_BADMODE;
} }
...@@ -964,7 +963,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, ...@@ -964,7 +963,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
{ {
ERR("Failed to write %s display settings to registry.\n", wine_dbgstr_w(devname)); ERR("Failed to write %s display settings to registry.\n", wine_dbgstr_w(devname));
free_full_mode(full_mode); free_full_mode(full_mode);
heap_free(displays); free(displays);
return DISP_CHANGE_NOTUPDATED; return DISP_CHANGE_NOTUPDATED;
} }
...@@ -976,14 +975,14 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, ...@@ -976,14 +975,14 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
if (flags & (CDS_TEST | CDS_NORESET)) if (flags & (CDS_TEST | CDS_NORESET))
{ {
heap_free(displays); free(displays);
return DISP_CHANGE_SUCCESSFUL; return DISP_CHANGE_SUCCESSFUL;
} }
if (all_detached_settings(displays, display_count)) if (all_detached_settings(displays, display_count))
{ {
WARN("Detaching all displays is not permitted.\n"); WARN("Detaching all displays is not permitted.\n");
heap_free(displays); free(displays);
return DISP_CHANGE_SUCCESSFUL; return DISP_CHANGE_SUCCESSFUL;
} }
...@@ -995,6 +994,6 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, ...@@ -995,6 +994,6 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
ret = apply_display_settings(displays, display_count, TRUE); ret = apply_display_settings(displays, display_count, TRUE);
if (ret == DISP_CHANGE_SUCCESSFUL) if (ret == DISP_CHANGE_SUCCESSFUL)
X11DRV_DisplayDevices_Update(TRUE); X11DRV_DisplayDevices_Update(TRUE);
heap_free(displays); free(displays);
return ret; return ret;
} }
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "winbase.h" #include "winbase.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "x11drv.h" #include "x11drv.h"
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
...@@ -165,7 +164,7 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo ...@@ -165,7 +164,7 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo
if (src->enabledExtensionCount > 0) if (src->enabledExtensionCount > 0)
{ {
enabled_extensions = heap_calloc(src->enabledExtensionCount, sizeof(*src->ppEnabledExtensionNames)); enabled_extensions = calloc(src->enabledExtensionCount, sizeof(*src->ppEnabledExtensionNames));
if (!enabled_extensions) if (!enabled_extensions)
{ {
ERR("Failed to allocate memory for enabled extensions\n"); ERR("Failed to allocate memory for enabled extensions\n");
...@@ -214,7 +213,7 @@ static void wine_vk_surface_release(struct wine_vk_surface *surface) ...@@ -214,7 +213,7 @@ static void wine_vk_surface_release(struct wine_vk_surface *surface)
if (surface->window) if (surface->window)
XDestroyWindow(gdi_display, surface->window); XDestroyWindow(gdi_display, surface->window);
heap_free(surface); free(surface);
} }
void wine_vk_surface_destroy(HWND hwnd) void wine_vk_surface_destroy(HWND hwnd)
...@@ -273,7 +272,7 @@ static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info, ...@@ -273,7 +272,7 @@ static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info,
res = pvkCreateInstance(&create_info_host, NULL /* allocator */, instance); res = pvkCreateInstance(&create_info_host, NULL /* allocator */, instance);
heap_free((void *)create_info_host.ppEnabledExtensionNames); free((void *)create_info_host.ppEnabledExtensionNames);
return res; return res;
} }
...@@ -317,7 +316,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, ...@@ -317,7 +316,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
return VK_ERROR_INCOMPATIBLE_DRIVER; return VK_ERROR_INCOMPATIBLE_DRIVER;
} }
x11_surface = heap_alloc_zero(sizeof(*x11_surface)); x11_surface = calloc(1, sizeof(*x11_surface));
if (!x11_surface) if (!x11_surface)
return VK_ERROR_OUT_OF_HOST_MEMORY; return VK_ERROR_OUT_OF_HOST_MEMORY;
...@@ -578,7 +577,7 @@ static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice ph ...@@ -578,7 +577,7 @@ static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice ph
if (!formats) if (!formats)
return pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, NULL); return pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, NULL);
formats_host = heap_calloc(*count, sizeof(*formats_host)); formats_host = calloc(*count, sizeof(*formats_host));
if (!formats_host) return VK_ERROR_OUT_OF_HOST_MEMORY; if (!formats_host) return VK_ERROR_OUT_OF_HOST_MEMORY;
result = pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, formats_host); result = pvkGetPhysicalDeviceSurfaceFormatsKHR(phys_dev, surface_info_host.surface, count, formats_host);
if (result == VK_SUCCESS || result == VK_INCOMPLETE) if (result == VK_SUCCESS || result == VK_INCOMPLETE)
...@@ -587,7 +586,7 @@ static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice ph ...@@ -587,7 +586,7 @@ static VkResult X11DRV_vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice ph
formats[i].surfaceFormat = formats_host[i]; formats[i].surfaceFormat = formats_host[i];
} }
heap_free(formats_host); free(formats_host);
return result; return result;
} }
......
...@@ -213,7 +213,7 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd ) ...@@ -213,7 +213,7 @@ static struct x11drv_win_data *alloc_win_data( Display *display, HWND hwnd )
{ {
struct x11drv_win_data *data; struct x11drv_win_data *data;
if ((data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)))) if ((data = calloc( 1, sizeof(*data) )))
{ {
data->display = display; data->display = display;
data->vis = default_visual; data->vis = default_visual;
...@@ -405,7 +405,7 @@ static void sync_window_region( struct x11drv_win_data *data, HRGN win_region ) ...@@ -405,7 +405,7 @@ static void sync_window_region( struct x11drv_win_data *data, HRGN win_region )
data->window_rect.top - data->whole_rect.top, data->window_rect.top - data->whole_rect.top,
(XRectangle *)pRegionData->Buffer, (XRectangle *)pRegionData->Buffer,
pRegionData->rdh.nCount, ShapeSet, YXBanded ); pRegionData->rdh.nCount, ShapeSet, YXBanded );
HeapFree(GetProcessHeap(), 0, pRegionData); free( pRegionData );
data->shaped = TRUE; data->shaped = TRUE;
} }
} }
...@@ -443,13 +443,13 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text ) ...@@ -443,13 +443,13 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text )
/* allocate new buffer for window text */ /* allocate new buffer for window text */
count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL); count = WideCharToMultiByte(CP_UNIXCP, 0, text, -1, NULL, 0, NULL, NULL);
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, count ))) return; if (!(buffer = malloc( count ))) return;
WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL); WideCharToMultiByte(CP_UNIXCP, 0, text, -1, buffer, count, NULL, NULL);
count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL); count = WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), NULL, 0, NULL, NULL);
if (!(utf8_buffer = HeapAlloc( GetProcessHeap(), 0, count ))) if (!(utf8_buffer = malloc( count )))
{ {
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
return; return;
} }
WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, text, strlenW(text), utf8_buffer, count, NULL, NULL);
...@@ -468,8 +468,8 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text ) ...@@ -468,8 +468,8 @@ static void sync_window_text( Display *display, Window win, const WCHAR *text )
XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING), XChangeProperty( display, win, x11drv_atom(_NET_WM_NAME), x11drv_atom(UTF8_STRING),
8, PropModeReplace, (unsigned char *) utf8_buffer, count); 8, PropModeReplace, (unsigned char *) utf8_buffer, count);
HeapFree( GetProcessHeap(), 0, utf8_buffer ); free( utf8_buffer );
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
...@@ -501,7 +501,7 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns ...@@ -501,7 +501,7 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
*size = bm.bmWidth * bm.bmHeight + 2; *size = bm.bmWidth * bm.bmHeight + 2;
if (!(bits = HeapAlloc( GetProcessHeap(), 0, *size * sizeof(long) ))) goto failed; if (!(bits = malloc( *size * sizeof(long) ))) goto failed;
if (!NtGdiGetDIBitsInternal( hdc, color, 0, bm.bmHeight, bits + 2, info, DIB_RGB_COLORS, 0, 0 )) if (!NtGdiGetDIBitsInternal( hdc, color, 0, bm.bmHeight, bits + 2, info, DIB_RGB_COLORS, 0, 0 ))
goto failed; goto failed;
...@@ -517,14 +517,14 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns ...@@ -517,14 +517,14 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns
/* generate alpha channel from the mask */ /* generate alpha channel from the mask */
info->bmiHeader.biBitCount = 1; info->bmiHeader.biBitCount = 1;
info->bmiHeader.biSizeImage = width_bytes * bm.bmHeight; info->bmiHeader.biSizeImage = width_bytes * bm.bmHeight;
if (!(mask_bits = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto failed; if (!(mask_bits = malloc( info->bmiHeader.biSizeImage ))) goto failed;
if (!NtGdiGetDIBitsInternal( hdc, mask, 0, bm.bmHeight, mask_bits, info, DIB_RGB_COLORS, 0, 0 )) if (!NtGdiGetDIBitsInternal( hdc, mask, 0, bm.bmHeight, mask_bits, info, DIB_RGB_COLORS, 0, 0 ))
goto failed; goto failed;
ptr = bits + 2; ptr = bits + 2;
for (i = 0; i < bm.bmHeight; i++) for (i = 0; i < bm.bmHeight; i++)
for (j = 0; j < bm.bmWidth; j++, ptr++) for (j = 0; j < bm.bmWidth; j++, ptr++)
if (!((mask_bits[i * width_bytes + j / 8] << (j % 8)) & 0x80)) *ptr |= 0xff000000; if (!((mask_bits[i * width_bytes + j / 8] << (j % 8)) & 0x80)) *ptr |= 0xff000000;
HeapFree( GetProcessHeap(), 0, mask_bits ); free( mask_bits );
} }
/* convert to array of longs */ /* convert to array of longs */
...@@ -534,8 +534,8 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns ...@@ -534,8 +534,8 @@ static unsigned long *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, uns
return (unsigned long *)bits; return (unsigned long *)bits;
failed: failed:
HeapFree( GetProcessHeap(), 0, bits ); free( bits );
HeapFree( GetProcessHeap(), 0, mask_bits ); free( mask_bits );
return NULL; return NULL;
} }
...@@ -561,12 +561,12 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret ...@@ -561,12 +561,12 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret
info->bmiHeader.biBitCount = 0; info->bmiHeader.biBitCount = 0;
if (!(lines = NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, 0, NULL, info, DIB_RGB_COLORS, 0, 0 ))) if (!(lines = NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, 0, NULL, info, DIB_RGB_COLORS, 0, 0 )))
goto failed; goto failed;
if (!(bits.ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto failed; if (!(bits.ptr = malloc( info->bmiHeader.biSizeImage ))) goto failed;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, lines, bits.ptr, info, DIB_RGB_COLORS, 0, 0 )) if (!NtGdiGetDIBitsInternal( hdc, icon->hbmColor, 0, lines, bits.ptr, info, DIB_RGB_COLORS, 0, 0 ))
goto failed; goto failed;
color_pixmap = create_pixmap_from_image( hdc, &vis, info, &bits, DIB_RGB_COLORS ); color_pixmap = create_pixmap_from_image( hdc, &vis, info, &bits, DIB_RGB_COLORS );
HeapFree( GetProcessHeap(), 0, bits.ptr ); free( bits.ptr );
bits.ptr = NULL; bits.ptr = NULL;
if (!color_pixmap) goto failed; if (!color_pixmap) goto failed;
...@@ -574,7 +574,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret ...@@ -574,7 +574,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret
info->bmiHeader.biBitCount = 0; info->bmiHeader.biBitCount = 0;
if (!(lines = NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, 0, NULL, info, DIB_RGB_COLORS, 0, 0 ))) if (!(lines = NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, 0, NULL, info, DIB_RGB_COLORS, 0, 0 )))
goto failed; goto failed;
if (!(bits.ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto failed; if (!(bits.ptr = malloc( info->bmiHeader.biSizeImage ))) goto failed;
if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, lines, bits.ptr, info, DIB_RGB_COLORS, 0, 0 )) if (!NtGdiGetDIBitsInternal( hdc, icon->hbmMask, 0, lines, bits.ptr, info, DIB_RGB_COLORS, 0, 0 ))
goto failed; goto failed;
...@@ -583,7 +583,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret ...@@ -583,7 +583,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret
vis.depth = 1; vis.depth = 1;
mask_pixmap = create_pixmap_from_image( hdc, &vis, info, &bits, DIB_RGB_COLORS ); mask_pixmap = create_pixmap_from_image( hdc, &vis, info, &bits, DIB_RGB_COLORS );
HeapFree( GetProcessHeap(), 0, bits.ptr ); free( bits.ptr );
bits.ptr = NULL; bits.ptr = NULL;
if (!mask_pixmap) goto failed; if (!mask_pixmap) goto failed;
...@@ -593,7 +593,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret ...@@ -593,7 +593,7 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, Pixmap *icon_ret
failed: failed:
if (color_pixmap) XFreePixmap( gdi_display, color_pixmap ); if (color_pixmap) XFreePixmap( gdi_display, color_pixmap );
HeapFree( GetProcessHeap(), 0, bits.ptr ); free( bits.ptr );
return FALSE; return FALSE;
} }
...@@ -642,15 +642,14 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small ) ...@@ -642,15 +642,14 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small )
if ((bits_small = get_bitmap_argb( hDC, ii_small.hbmColor, ii_small.hbmMask, &size_small )) && if ((bits_small = get_bitmap_argb( hDC, ii_small.hbmColor, ii_small.hbmMask, &size_small )) &&
(bits_small[0] != bits[0] || bits_small[1] != bits[1])) /* size must be different */ (bits_small[0] != bits[0] || bits_small[1] != bits[1])) /* size must be different */
{ {
if ((new = HeapReAlloc( GetProcessHeap(), 0, bits, if ((new = realloc( bits, (size + size_small) * sizeof(unsigned long) )))
(size + size_small) * sizeof(unsigned long) )))
{ {
bits = new; bits = new;
memcpy( bits + size, bits_small, size_small * sizeof(unsigned long) ); memcpy( bits + size, bits_small, size_small * sizeof(unsigned long) );
size += size_small; size += size_small;
} }
} }
HeapFree( GetProcessHeap(), 0, bits_small ); free( bits_small );
NtGdiDeleteObjectApp( ii_small.hbmColor ); NtGdiDeleteObjectApp( ii_small.hbmColor );
NtGdiDeleteObjectApp( ii_small.hbmMask ); NtGdiDeleteObjectApp( ii_small.hbmMask );
} }
...@@ -665,7 +664,7 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small ) ...@@ -665,7 +664,7 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small )
{ {
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
HeapFree( GetProcessHeap(), 0, data->icon_bits ); free( data->icon_bits );
data->icon_pixmap = icon_pixmap; data->icon_pixmap = icon_pixmap;
data->icon_mask = mask_pixmap; data->icon_mask = mask_pixmap;
data->icon_bits = bits; data->icon_bits = bits;
...@@ -676,7 +675,7 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small ) ...@@ -676,7 +675,7 @@ static void fetch_icon_data( HWND hwnd, HICON icon_big, HICON icon_small )
{ {
if (icon_pixmap) XFreePixmap( gdi_display, icon_pixmap ); if (icon_pixmap) XFreePixmap( gdi_display, icon_pixmap );
if (mask_pixmap) XFreePixmap( gdi_display, mask_pixmap ); if (mask_pixmap) XFreePixmap( gdi_display, mask_pixmap );
HeapFree( GetProcessHeap(), 0, bits ); free( bits );
} }
} }
...@@ -1759,10 +1758,10 @@ void X11DRV_DestroyWindow( HWND hwnd ) ...@@ -1759,10 +1758,10 @@ void X11DRV_DestroyWindow( HWND hwnd )
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
if (data->client_colormap) XFreeColormap( data->display, data->client_colormap ); if (data->client_colormap) XFreeColormap( data->display, data->client_colormap );
HeapFree( GetProcessHeap(), 0, data->icon_bits ); free( data->icon_bits );
XDeleteContext( gdi_display, (XID)hwnd, win_data_context ); XDeleteContext( gdi_display, (XID)hwnd, win_data_context );
release_win_data( data ); release_win_data( data );
HeapFree( GetProcessHeap(), 0, data ); free( data );
destroy_gl_drawable( hwnd ); destroy_gl_drawable( hwnd );
wine_vk_surface_destroy( hwnd ); wine_vk_surface_destroy( hwnd );
} }
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
WINE_DECLARE_DEBUG_CHANNEL(synchronous); WINE_DECLARE_DEBUG_CHANNEL(synchronous);
...@@ -315,7 +314,7 @@ static void init_pixmap_formats( Display *display ) ...@@ -315,7 +314,7 @@ static void init_pixmap_formats( Display *display )
formats[i].depth, formats[i].bits_per_pixel, formats[i].scanline_pad ); formats[i].depth, formats[i].bits_per_pixel, formats[i].scanline_pad );
if (formats[i].depth > max) max = formats[i].depth; if (formats[i].depth > max) max = formats[i].depth;
} }
pixmap_formats = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pixmap_formats) * (max + 1) ); pixmap_formats = calloc( 1, sizeof(*pixmap_formats) * (max + 1) );
for (i = 0; i < count; i++) pixmap_formats[formats[i].depth] = &formats[i]; for (i = 0; i < count; i++) pixmap_formats[formats[i].depth] = &formats[i];
} }
...@@ -442,7 +441,7 @@ static void setup_options(void) ...@@ -442,7 +441,7 @@ static void setup_options(void)
if ((p = strrchrW( appname, '\\' ))) appname = p + 1; if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
CharLowerW(appname); CharLowerW(appname);
len = WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, NULL, 0, NULL, NULL );
if ((process_name = HeapAlloc( GetProcessHeap(), 0, len ))) if ((process_name = malloc( len )))
WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, process_name, len, NULL, NULL ); WideCharToMultiByte( CP_UNIXCP, 0, appname, -1, process_name, len, NULL, NULL );
strcatW( appname, x11driverW ); strcatW( appname, x11driverW );
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */ /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */
...@@ -707,7 +706,7 @@ void X11DRV_ThreadDetach(void) ...@@ -707,7 +706,7 @@ void X11DRV_ThreadDetach(void)
if (data->xim) XCloseIM( data->xim ); if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set ); if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display ); XCloseDisplay( data->display );
HeapFree( GetProcessHeap(), 0, data ); free( data );
/* clear data in case we get re-entered from user32 before the thread is truly dead */ /* clear data in case we get re-entered from user32 before the thread is truly dead */
NtUserGetThreadInfo()->driver_data = NULL; NtUserGetThreadInfo()->driver_data = NULL;
} }
...@@ -749,7 +748,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) ...@@ -749,7 +748,7 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (data) return data; if (data) return data;
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) if (!(data = calloc( 1, sizeof(*data) )))
{ {
ERR( "could not create data\n" ); ERR( "could not create data\n" );
ExitProcess(1); ExitProcess(1);
...@@ -906,7 +905,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE ...@@ -906,7 +905,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE
if (source->device == desc->hDevice) if (source->device == desc->hDevice)
{ {
list_remove( &source->entry ); list_remove( &source->entry );
heap_free( source ); free( source );
} }
} }
goto done; goto done;
...@@ -929,7 +928,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE ...@@ -929,7 +928,7 @@ NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNE
source->type = desc->pType[i]; source->type = desc->pType[i];
else else
{ {
source = heap_alloc( sizeof( *source ) ); source = malloc( sizeof( *source ) );
if (!source) if (!source)
{ {
status = STATUS_NO_MEMORY; status = STATUS_NO_MEMORY;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "x11drv.h" #include "x11drv.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
...@@ -87,8 +86,8 @@ static int query_screens(void) ...@@ -87,8 +86,8 @@ static int query_screens(void)
!pXineramaQueryExtension( gdi_display, &event_base, &error_base ) || !pXineramaQueryExtension( gdi_display, &event_base, &error_base ) ||
!(screens = pXineramaQueryScreens( gdi_display, &count ))) return 0; !(screens = pXineramaQueryScreens( gdi_display, &count ))) return 0;
if (monitors != &default_monitor) HeapFree( GetProcessHeap(), 0, monitors ); if (monitors != &default_monitor) free( monitors );
if ((monitors = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*monitors) ))) if ((monitors = malloc( count * sizeof(*monitors) )))
{ {
nb_monitors = count; nb_monitors = count;
for (i = 0; i < nb_monitors; i++) for (i = 0; i < nb_monitors; i++)
...@@ -125,7 +124,7 @@ static BOOL xinerama_get_gpus( struct gdi_gpu **new_gpus, int *count ) ...@@ -125,7 +124,7 @@ static BOOL xinerama_get_gpus( struct gdi_gpu **new_gpus, int *count )
struct gdi_gpu *gpus; struct gdi_gpu *gpus;
/* Xinerama has no support for GPU, faking one */ /* Xinerama has no support for GPU, faking one */
gpus = heap_calloc( 1, sizeof(*gpus) ); gpus = calloc( 1, sizeof(*gpus) );
if (!gpus) if (!gpus)
return FALSE; return FALSE;
...@@ -139,7 +138,7 @@ static BOOL xinerama_get_gpus( struct gdi_gpu **new_gpus, int *count ) ...@@ -139,7 +138,7 @@ static BOOL xinerama_get_gpus( struct gdi_gpu **new_gpus, int *count )
static void xinerama_free_gpus( struct gdi_gpu *gpus ) static void xinerama_free_gpus( struct gdi_gpu *gpus )
{ {
heap_free( gpus ); free( gpus );
} }
static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_adapters, int *count ) static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_adapters, int *count )
...@@ -154,7 +153,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad ...@@ -154,7 +153,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
return FALSE; return FALSE;
/* Being lazy, actual adapter count may be less */ /* Being lazy, actual adapter count may be less */
adapters = heap_calloc( nb_monitors, sizeof(*adapters) ); adapters = calloc( nb_monitors, sizeof(*adapters) );
if (!adapters) if (!adapters)
return FALSE; return FALSE;
...@@ -206,7 +205,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad ...@@ -206,7 +205,7 @@ static BOOL xinerama_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
static void xinerama_free_adapters( struct gdi_adapter *adapters ) static void xinerama_free_adapters( struct gdi_adapter *adapters )
{ {
heap_free( adapters ); free( adapters );
} }
static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count ) static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count )
...@@ -228,7 +227,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne ...@@ -228,7 +227,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
monitor_count++; monitor_count++;
} }
monitor = heap_calloc( monitor_count, sizeof(*monitor) ); monitor = calloc( monitor_count, sizeof(*monitor) );
if (!monitor) if (!monitor)
return FALSE; return FALSE;
...@@ -259,7 +258,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne ...@@ -259,7 +258,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
static void xinerama_free_monitors( struct gdi_monitor *monitors, int count ) static void xinerama_free_monitors( struct gdi_monitor *monitors, int count )
{ {
heap_free( monitors ); free( monitors );
} }
void xinerama_init( unsigned int width, unsigned int height ) void xinerama_init( unsigned int width, unsigned int height )
......
...@@ -43,7 +43,6 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); ...@@ -43,7 +43,6 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
#define WINE_VK_HOST #define WINE_VK_HOST
#include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/vulkan.h" #include "wine/vulkan.h"
#include "wine/vulkan_driver.h" #include "wine/vulkan_driver.h"
...@@ -199,7 +198,7 @@ static BOOL xrandr10_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, ...@@ -199,7 +198,7 @@ static BOOL xrandr10_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes,
/* Allocate space for reported modes in three depths, and put an SizeID at the end of DEVMODEW as /* Allocate space for reported modes in three depths, and put an SizeID at the end of DEVMODEW as
* driver private data */ * driver private data */
modes = heap_calloc( mode_count * DEPTH_COUNT, sizeof(*modes) + sizeof(SizeID) ); modes = calloc( mode_count * DEPTH_COUNT, sizeof(*modes) + sizeof(SizeID) );
if (!modes) if (!modes)
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
...@@ -235,7 +234,7 @@ static BOOL xrandr10_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, ...@@ -235,7 +234,7 @@ static BOOL xrandr10_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes,
static void xrandr10_free_modes( DEVMODEW *modes ) static void xrandr10_free_modes( DEVMODEW *modes )
{ {
heap_free( modes ); free( modes );
} }
static BOOL xrandr10_get_current_mode( ULONG_PTR id, DEVMODEW *mode ) static BOOL xrandr10_get_current_mode( ULONG_PTR id, DEVMODEW *mode )
...@@ -339,7 +338,7 @@ static pthread_mutex_t xrandr_mutex = PTHREAD_MUTEX_INITIALIZER; ...@@ -339,7 +338,7 @@ static pthread_mutex_t xrandr_mutex = PTHREAD_MUTEX_INITIALIZER;
static void xrandr14_invalidate_current_mode_cache(void) static void xrandr14_invalidate_current_mode_cache(void)
{ {
pthread_mutex_lock( &xrandr_mutex ); pthread_mutex_lock( &xrandr_mutex );
heap_free( current_modes); free( current_modes);
current_modes = NULL; current_modes = NULL;
current_mode_count = 0; current_mode_count = 0;
pthread_mutex_unlock( &xrandr_mutex ); pthread_mutex_unlock( &xrandr_mutex );
...@@ -690,7 +689,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid ...@@ -690,7 +689,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
goto done; goto done;
} }
if (!(vk_physical_devices = heap_calloc( device_count, sizeof(*vk_physical_devices) ))) if (!(vk_physical_devices = calloc( device_count, sizeof(*vk_physical_devices) )))
goto done; goto done;
vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, vk_physical_devices ); vr = pvkEnumeratePhysicalDevices( vk_instance, &device_count, vk_physical_devices );
...@@ -731,7 +730,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid ...@@ -731,7 +730,7 @@ static BOOL get_gpu_properties_from_vulkan( struct gdi_gpu *gpu, const XRRProvid
} }
done: done:
heap_free( vk_physical_devices ); free( vk_physical_devices );
if (vk_instance) if (vk_instance)
vulkan_funcs->p_vkDestroyInstance( vk_instance, NULL ); vulkan_funcs->p_vkDestroyInstance( vk_instance, NULL );
return ret; return ret;
...@@ -760,7 +759,7 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_ ...@@ -760,7 +759,7 @@ static BOOL xrandr14_get_gpus2( struct gdi_gpu **new_gpus, int *count, BOOL get_
if (!provider_resources) if (!provider_resources)
goto done; goto done;
gpus = heap_calloc( provider_resources->nproviders ? provider_resources->nproviders : 1, sizeof(*gpus) ); gpus = calloc( provider_resources->nproviders ? provider_resources->nproviders : 1, sizeof(*gpus) );
if (!gpus) if (!gpus)
goto done; goto done;
...@@ -828,7 +827,7 @@ done: ...@@ -828,7 +827,7 @@ done:
pXRRFreeScreenResources( screen_resources ); pXRRFreeScreenResources( screen_resources );
if (!ret) if (!ret)
{ {
heap_free( gpus ); free( gpus );
ERR("Failed to get gpus\n"); ERR("Failed to get gpus\n");
} }
return ret; return ret;
...@@ -841,7 +840,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count ) ...@@ -841,7 +840,7 @@ static BOOL xrandr14_get_gpus( struct gdi_gpu **new_gpus, int *count )
static void xrandr14_free_gpus( struct gdi_gpu *gpus ) static void xrandr14_free_gpus( struct gdi_gpu *gpus )
{ {
heap_free( gpus ); free( gpus );
} }
static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_adapters, int *count ) static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_adapters, int *count )
...@@ -883,7 +882,7 @@ static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad ...@@ -883,7 +882,7 @@ static BOOL xrandr14_get_adapters( ULONG_PTR gpu_id, struct gdi_adapter **new_ad
} }
/* Actual adapter count could be less */ /* Actual adapter count could be less */
adapters = heap_calloc( crtc_count, sizeof(*adapters) ); adapters = calloc( crtc_count, sizeof(*adapters) );
if (!adapters) if (!adapters)
goto done; goto done;
...@@ -999,7 +998,7 @@ done: ...@@ -999,7 +998,7 @@ done:
pXRRFreeCrtcInfo( crtc_info ); pXRRFreeCrtcInfo( crtc_info );
if (!ret) if (!ret)
{ {
heap_free( adapters ); free( adapters );
ERR("Failed to get adapters\n"); ERR("Failed to get adapters\n");
} }
return ret; return ret;
...@@ -1007,7 +1006,7 @@ done: ...@@ -1007,7 +1006,7 @@ done:
static void xrandr14_free_adapters( struct gdi_adapter *adapters ) static void xrandr14_free_adapters( struct gdi_adapter *adapters )
{ {
heap_free( adapters ); free( adapters );
} }
static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count ) static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **new_monitors, int *count )
...@@ -1030,7 +1029,7 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne ...@@ -1030,7 +1029,7 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
/* First start with a 2 monitors, should be enough for most cases */ /* First start with a 2 monitors, should be enough for most cases */
capacity = 2; capacity = 2;
monitors = heap_calloc( capacity, sizeof(*monitors) ); monitors = calloc( capacity, sizeof(*monitors) );
if (!monitors) if (!monitors)
goto done; goto done;
...@@ -1076,7 +1075,7 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne ...@@ -1076,7 +1075,7 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
if (monitor_count >= capacity) if (monitor_count >= capacity)
{ {
capacity *= 2; capacity *= 2;
realloc_monitors = heap_realloc( monitors, capacity * sizeof(*monitors) ); realloc_monitors = realloc( monitors, capacity * sizeof(*monitors) );
if (!realloc_monitors) if (!realloc_monitors)
goto done; goto done;
monitors = realloc_monitors; monitors = realloc_monitors;
...@@ -1154,7 +1153,7 @@ done: ...@@ -1154,7 +1153,7 @@ done:
if (monitors[i].edid) if (monitors[i].edid)
XFree( monitors[i].edid ); XFree( monitors[i].edid );
} }
heap_free( monitors ); free( monitors );
ERR("Failed to get monitors\n"); ERR("Failed to get monitors\n");
} }
return ret; return ret;
...@@ -1169,7 +1168,7 @@ static void xrandr14_free_monitors( struct gdi_monitor *monitors, int count ) ...@@ -1169,7 +1168,7 @@ static void xrandr14_free_monitors( struct gdi_monitor *monitors, int count )
if (monitors[i].edid) if (monitors[i].edid)
XFree( monitors[i].edid ); XFree( monitors[i].edid );
} }
heap_free( monitors ); free( monitors );
} }
static BOOL xrandr14_device_change_handler( HWND hwnd, XEvent *event ) static BOOL xrandr14_device_change_handler( HWND hwnd, XEvent *event )
...@@ -1235,11 +1234,7 @@ static BOOL xrandr14_get_id( const WCHAR *device_name, ULONG_PTR *id ) ...@@ -1235,11 +1234,7 @@ static BOOL xrandr14_get_id( const WCHAR *device_name, ULONG_PTR *id )
if (!xrandr14_get_adapters( gpus[gpu_idx].id, &adapters, &adapter_count )) if (!xrandr14_get_adapters( gpus[gpu_idx].id, &adapters, &adapter_count ))
break; break;
if (!new_current_modes) tmp_modes = realloc( new_current_modes, (new_current_mode_count + adapter_count) * sizeof(*tmp_modes) );
tmp_modes = heap_alloc( adapter_count * sizeof(*tmp_modes) );
else
tmp_modes = heap_realloc( new_current_modes, (new_current_mode_count + adapter_count) * sizeof(*tmp_modes) );
if (!tmp_modes) if (!tmp_modes)
{ {
xrandr14_free_adapters( adapters ); xrandr14_free_adapters( adapters );
...@@ -1259,7 +1254,7 @@ static BOOL xrandr14_get_id( const WCHAR *device_name, ULONG_PTR *id ) ...@@ -1259,7 +1254,7 @@ static BOOL xrandr14_get_id( const WCHAR *device_name, ULONG_PTR *id )
if (new_current_modes) if (new_current_modes)
{ {
heap_free( current_modes ); free( current_modes );
current_modes = new_current_modes; current_modes = new_current_modes;
current_mode_count = new_current_mode_count; current_mode_count = new_current_mode_count;
} }
...@@ -1371,8 +1366,8 @@ static BOOL xrandr14_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, ...@@ -1371,8 +1366,8 @@ static BOOL xrandr14_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes,
/* Allocate space for display modes in different color depths and orientations. /* Allocate space for display modes in different color depths and orientations.
* Store a RRMode at the end of each DEVMODEW as private driver data */ * Store a RRMode at the end of each DEVMODEW as private driver data */
modes = heap_calloc( output_info->nmode * DEPTH_COUNT * orientation_count, modes = calloc( output_info->nmode * DEPTH_COUNT * orientation_count,
sizeof(*modes) + sizeof(RRMode) ); sizeof(*modes) + sizeof(RRMode) );
if (!modes) if (!modes)
goto done; goto done;
...@@ -1418,7 +1413,7 @@ done: ...@@ -1418,7 +1413,7 @@ done:
static void xrandr14_free_modes( DEVMODEW *modes ) static void xrandr14_free_modes( DEVMODEW *modes )
{ {
heap_free( modes ); free( modes );
} }
static BOOL xrandr14_get_current_mode( ULONG_PTR id, DEVMODEW *mode ) static BOOL xrandr14_get_current_mode( ULONG_PTR id, DEVMODEW *mode )
......
...@@ -362,8 +362,7 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void) ...@@ -362,8 +362,7 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
return NULL; return NULL;
} }
glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, glyphsetCache = calloc( sizeof(*glyphsetCache), INIT_CACHE_SIZE );
sizeof(*glyphsetCache) * INIT_CACHE_SIZE);
glyphsetCacheSize = INIT_CACHE_SIZE; glyphsetCacheSize = INIT_CACHE_SIZE;
lastfree = 0; lastfree = 0;
...@@ -471,7 +470,7 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn ) ...@@ -471,7 +470,7 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn )
pXRenderSetPictureClipRectangles( gdi_display, dev->pict, pXRenderSetPictureClipRectangles( gdi_display, dev->pict,
dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top, dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount ); (XRectangle *)data->Buffer, data->rdh.nCount );
HeapFree( GetProcessHeap(), 0, data ); free( data );
} }
} }
...@@ -630,14 +629,14 @@ static void FreeEntry(int entry) ...@@ -630,14 +629,14 @@ static void FreeEntry(int entry)
formatEntry->glyphset = 0; formatEntry->glyphset = 0;
} }
if(formatEntry->nrealized) { if(formatEntry->nrealized) {
HeapFree(GetProcessHeap(), 0, formatEntry->realized); free( formatEntry->realized );
formatEntry->realized = NULL; formatEntry->realized = NULL;
HeapFree(GetProcessHeap(), 0, formatEntry->gis); free( formatEntry->gis );
formatEntry->gis = NULL; formatEntry->gis = NULL;
formatEntry->nrealized = 0; formatEntry->nrealized = 0;
} }
HeapFree(GetProcessHeap(), 0, formatEntry); free( formatEntry );
glyphsetCache[entry].format[type][format] = NULL; glyphsetCache[entry].format[type][format] = NULL;
} }
} }
...@@ -684,18 +683,12 @@ static int AllocEntry(void) ...@@ -684,18 +683,12 @@ static int AllocEntry(void)
TRACE("Growing cache\n"); TRACE("Growing cache\n");
if (glyphsetCache) glyphsetCache = realloc( glyphsetCache,
glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (glyphsetCacheSize + INIT_CACHE_SIZE) * sizeof(*glyphsetCache) );
glyphsetCache,
(glyphsetCacheSize + INIT_CACHE_SIZE) for (best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE; i++)
* sizeof(*glyphsetCache)); {
else memset( &glyphsetCache[i], 0, sizeof(glyphsetCache[i]) );
glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
(glyphsetCacheSize + INIT_CACHE_SIZE)
* sizeof(*glyphsetCache));
for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE;
i++) {
glyphsetCache[i].next = i + 1; glyphsetCache[i].next = i + 1;
glyphsetCache[i].count = -1; glyphsetCache[i].count = -1;
} }
...@@ -891,7 +884,7 @@ static void set_physdev_format( struct xrender_physdev *physdev, enum wxr_format ...@@ -891,7 +884,7 @@ static void set_physdev_format( struct xrender_physdev *physdev, enum wxr_format
static BOOL create_xrender_dc( PHYSDEV *pdev, enum wxr_format format ) static BOOL create_xrender_dc( PHYSDEV *pdev, enum wxr_format format )
{ {
X11DRV_PDEVICE *x11dev = get_x11drv_dev( *pdev ); X11DRV_PDEVICE *x11dev = get_x11drv_dev( *pdev );
struct xrender_physdev *physdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physdev) ); struct xrender_physdev *physdev = calloc( 1, sizeof(*physdev) );
if (!physdev) return FALSE; if (!physdev) return FALSE;
physdev->x11dev = x11dev; physdev->x11dev = x11dev;
...@@ -967,7 +960,7 @@ static BOOL CDECL xrenderdrv_DeleteDC( PHYSDEV dev ) ...@@ -967,7 +960,7 @@ static BOOL CDECL xrenderdrv_DeleteDC( PHYSDEV dev )
if (physdev->cache_index != -1) dec_ref_cache( physdev->cache_index ); if (physdev->cache_index != -1) dec_ref_cache( physdev->cache_index );
pthread_mutex_unlock( &xrender_mutex ); pthread_mutex_unlock( &xrender_mutex );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return TRUE; return TRUE;
} }
...@@ -1061,34 +1054,22 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_ ...@@ -1061,34 +1054,22 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_
/* If there is nothing for the current type, we create the entry. */ /* If there is nothing for the current type, we create the entry. */
if( !entry->format[type][format] ) { if( !entry->format[type][format] ) {
entry->format[type][format] = HeapAlloc(GetProcessHeap(), entry->format[type][format] = calloc( 1, sizeof(gsCacheEntryFormat) );
HEAP_ZERO_MEMORY,
sizeof(gsCacheEntryFormat));
} }
formatEntry = entry->format[type][format]; formatEntry = entry->format[type][format];
if(formatEntry->nrealized <= glyph) { if(formatEntry->nrealized <= glyph) {
formatEntry->nrealized = (glyph / 128 + 1) * 128; size_t new_size = (glyph / 128 + 1) * 128;
if (formatEntry->realized) formatEntry->realized = realloc( formatEntry->realized, new_size * sizeof(BOOL) );
formatEntry->realized = HeapReAlloc(GetProcessHeap(), memset( formatEntry->realized + formatEntry->nrealized, 0,
HEAP_ZERO_MEMORY, (new_size - formatEntry->nrealized) * sizeof(BOOL) );
formatEntry->realized,
formatEntry->nrealized * sizeof(BOOL)); formatEntry->gis = realloc( formatEntry->gis, new_size * sizeof(formatEntry->gis[0]) );
else memset( formatEntry->gis + formatEntry->nrealized, 0,
formatEntry->realized = HeapAlloc(GetProcessHeap(), (new_size - formatEntry->nrealized) * sizeof(formatEntry->gis[0]) );
HEAP_ZERO_MEMORY,
formatEntry->nrealized * sizeof(BOOL)); formatEntry->nrealized = new_size;
if (formatEntry->gis)
formatEntry->gis = HeapReAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
formatEntry->gis,
formatEntry->nrealized * sizeof(formatEntry->gis[0]));
else
formatEntry->gis = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
formatEntry->nrealized * sizeof(formatEntry->gis[0]));
} }
...@@ -1118,7 +1099,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_ ...@@ -1118,7 +1099,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_
} }
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen); buf = calloc( 1, buflen );
if (buflen) if (buflen)
NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity, FALSE ); NtGdiGetGlyphOutline( physDev->dev.hdc, glyph, ggo_format, &gm, buflen, buf, &identity, FALSE );
else else
...@@ -1209,7 +1190,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_ ...@@ -1209,7 +1190,7 @@ static void UploadGlyph(struct xrender_physdev *physDev, UINT glyph, enum glyph_
buflen ? buf : zero, buflen ? buflen : sizeof(zero)); buflen ? buf : zero, buflen ? buflen : sizeof(zero));
} }
HeapFree(GetProcessHeap(), 0, buf); free( buf );
formatEntry->gis[glyph] = gi; formatEntry->gis[glyph] = gi;
} }
...@@ -1369,7 +1350,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -1369,7 +1350,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count), TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count),
physdev->x11dev->dc_rect.left + x, physdev->x11dev->dc_rect.top + y); physdev->x11dev->dc_rect.left + x, physdev->x11dev->dc_rect.top + y);
elts = HeapAlloc(GetProcessHeap(), 0, sizeof(XGlyphElt16) * count); elts = malloc( sizeof(XGlyphElt16) * count );
/* There's a bug in XRenderCompositeText that ignores the xDst and yDst parameters. /* There's a bug in XRenderCompositeText that ignores the xDst and yDst parameters.
So we pass zeros to the function and move to our starting position using the first So we pass zeros to the function and move to our starting position using the first
...@@ -1431,7 +1412,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -1431,7 +1412,7 @@ static BOOL CDECL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
pict, pict,
formatEntry->font_format, formatEntry->font_format,
0, 0, 0, 0, elts, count); 0, 0, 0, 0, elts, count);
HeapFree(GetProcessHeap(), 0, elts); free( elts );
pthread_mutex_unlock( &xrender_mutex ); pthread_mutex_unlock( &xrender_mutex );
add_device_bounds( physdev->x11dev, &bounds ); add_device_bounds( physdev->x11dev, &bounds );
...@@ -1701,7 +1682,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask ...@@ -1701,7 +1682,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask
if (clip_data) if (clip_data)
pXRenderSetPictureClipRectangles( gdi_display, dst_pict, 0, 0, pXRenderSetPictureClipRectangles( gdi_display, dst_pict, 0, 0,
(XRectangle *)clip_data->Buffer, clip_data->rdh.nCount ); (XRectangle *)clip_data->Buffer, clip_data->rdh.nCount );
HeapFree( GetProcessHeap(), 0, clip_data ); free( clip_data );
} }
else else
{ {
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(xvidmode); WINE_DEFAULT_DEBUG_CHANNEL(xvidmode);
...@@ -134,7 +133,7 @@ static BOOL xf86vm_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UI ...@@ -134,7 +133,7 @@ static BOOL xf86vm_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UI
/* Display modes in different color depth, with a XF86VidModeModeInfo * at the end of each /* Display modes in different color depth, with a XF86VidModeModeInfo * at the end of each
* DEVMODEW as driver private data */ * DEVMODEW as driver private data */
size += (xf86vm_mode_count * DEPTH_COUNT) * (sizeof(DEVMODEW) + sizeof(XF86VidModeModeInfo *)); size += (xf86vm_mode_count * DEPTH_COUNT) * (sizeof(DEVMODEW) + sizeof(XF86VidModeModeInfo *));
ptr = heap_alloc_zero(size); ptr = calloc(1, size);
if (!ptr) if (!ptr)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
...@@ -168,7 +167,7 @@ static void xf86vm_free_modes(DEVMODEW *modes) ...@@ -168,7 +167,7 @@ static void xf86vm_free_modes(DEVMODEW *modes)
memcpy(&xf86vm_modes, (BYTE *)modes - sizeof(xf86vm_modes), sizeof(xf86vm_modes)); memcpy(&xf86vm_modes, (BYTE *)modes - sizeof(xf86vm_modes), sizeof(xf86vm_modes));
XFree(xf86vm_modes); XFree(xf86vm_modes);
} }
heap_free(modes); free(modes);
} }
static BOOL xf86vm_get_current_mode(ULONG_PTR id, DEVMODEW *mode) static BOOL xf86vm_get_current_mode(ULONG_PTR id, DEVMODEW *mode)
...@@ -454,7 +453,7 @@ static BOOL xf86vm_get_gamma_ramp(struct x11drv_gamma_ramp *ramp) ...@@ -454,7 +453,7 @@ static BOOL xf86vm_get_gamma_ramp(struct x11drv_gamma_ramp *ramp)
} }
else else
{ {
if (!(red = heap_calloc(xf86vm_gammaramp_size, 3 * sizeof(*red)))) if (!(red = calloc(xf86vm_gammaramp_size, 3 * sizeof(*red))))
return FALSE; return FALSE;
green = red + xf86vm_gammaramp_size; green = red + xf86vm_gammaramp_size;
blue = green + xf86vm_gammaramp_size; blue = green + xf86vm_gammaramp_size;
...@@ -466,7 +465,7 @@ static BOOL xf86vm_get_gamma_ramp(struct x11drv_gamma_ramp *ramp) ...@@ -466,7 +465,7 @@ static BOOL xf86vm_get_gamma_ramp(struct x11drv_gamma_ramp *ramp)
interpolate_gamma_ramp(ramp->red, ramp->green, ramp->blue, GAMMA_RAMP_SIZE, interpolate_gamma_ramp(ramp->red, ramp->green, ramp->blue, GAMMA_RAMP_SIZE,
red, green, blue, xf86vm_gammaramp_size); red, green, blue, xf86vm_gammaramp_size);
if (red != ramp->red) if (red != ramp->red)
heap_free(red); free(red);
return ret; return ret;
} }
...@@ -483,7 +482,7 @@ static BOOL xf86vm_set_gamma_ramp(struct x11drv_gamma_ramp *ramp) ...@@ -483,7 +482,7 @@ static BOOL xf86vm_set_gamma_ramp(struct x11drv_gamma_ramp *ramp)
} }
else else
{ {
if (!(red = heap_calloc(xf86vm_gammaramp_size, 3 * sizeof(*red)))) if (!(red = calloc(xf86vm_gammaramp_size, 3 * sizeof(*red))))
return FALSE; return FALSE;
green = red + xf86vm_gammaramp_size; green = red + xf86vm_gammaramp_size;
blue = green + xf86vm_gammaramp_size; blue = green + xf86vm_gammaramp_size;
...@@ -499,7 +498,7 @@ static BOOL xf86vm_set_gamma_ramp(struct x11drv_gamma_ramp *ramp) ...@@ -499,7 +498,7 @@ static BOOL xf86vm_set_gamma_ramp(struct x11drv_gamma_ramp *ramp)
if (X11DRV_check_error()) ret = FALSE; if (X11DRV_check_error()) ret = FALSE;
if (red != ramp->red) if (red != ramp->red)
heap_free(red); free(red);
return ret; return ret;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment