Removed HEAP_xalloc.

diff --git a/graphics/win16drv/graphics.c b/graphics/win16drv/graphics.c
index 9bf8b06..c45f50e 100644
--- a/graphics/win16drv/graphics.c
+++ b/graphics/win16drv/graphics.c
@@ -97,7 +97,9 @@
     if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
         count++; /* Ensure polygon is closed */
 
-    points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
+    points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
+    if(points == NULL) return FALSE;    
+ 
     for (i = 0; i < count - 1; i++)
     {
       points[i].x = XLPTODP( dc, pt[i].x );
@@ -128,7 +130,9 @@
 
     if(count < 2) return TRUE;
 
-    points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
+    points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
+    if(points == NULL) return FALSE;
+ 
     for (i = 0; i < count; i++)
     {
       points[i].x = XLPTODP( dc, pt[i].x );
diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c
index 4d3872f..1908721 100644
--- a/graphics/x11drv/oembitmap.c
+++ b/graphics/x11drv/oembitmap.c
@@ -383,8 +383,9 @@
     XpmAttributes *attrs;
     int err;
 
-    attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
-                                          XpmAttributesSize() );
+    attrs = (XpmAttributes *)HeapAlloc( GetProcessHeap(), 0,
+		                         XpmAttributesSize() );
+    if(attrs == NULL) return FALSE;
     attrs->valuemask    = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
     attrs->colormap     = X11DRV_PALETTE_PaletteXColormap;
     attrs->depth        = descr->color ? X11DRV_GetDepth() : 1;
diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c
index 9e42f80..cc80f78 100644
--- a/graphics/x11drv/text.c
+++ b/graphics/x11drv/text.c
@@ -35,14 +35,15 @@
 {
     int 	        i;
     fontObject*		pfo;
-    INT	 	width, ascent, descent, xwidth, ywidth;
+    INT	 	        width, ascent, descent, xwidth, ywidth;
     XFontStruct*	font;
     RECT 		rect;
     char		dfBreakChar, lfUnderline, lfStrikeOut;
     BOOL		rotated = FALSE;
     X11DRV_PDEVICE      *physDev = (X11DRV_PDEVICE *)dc->physDev;
-    XChar2b *str2b;
+    XChar2b		*str2b = NULL;
     BOOL		dibUpdateFlag = FALSE;
+    BOOL                result = TRUE; 
 
     if (!X11DRV_SetupGCForText( dc )) return TRUE;
 
@@ -224,6 +225,7 @@
     
     /* Draw the text (count > 0 verified) */
     str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) );
+    if( str2b == NULL) goto FAIL;
     for(i = 0; i < count; i++) {
       str2b[i].byte1 = wstr[i] >> 8;
       str2b[i].byte2 = wstr[i] & 0xff;
@@ -244,8 +246,9 @@
 
 	/* allocate max items */
 
-        pitem = items = HEAP_xalloc( GetProcessHeap(), 0,
-                                     count * sizeof(XTextItem16) );
+        pitem = items = HeapAlloc( GetProcessHeap(), 0,
+                                   count * sizeof(XTextItem16) );
+	if(items == NULL) goto FAIL; 
         delta = i = 0;
 	if( lpDx ) /* explicit character widths */
 	{
@@ -366,8 +369,14 @@
     if (flags & ETO_CLIPPED) 
         RestoreVisRgn16( dc->hSelf );
 
+    goto END;
+	    
+FAIL:
+    if(str2b != NULL) HeapFree( GetProcessHeap(), 0, str2b );
+    result = FALSE;
+    
 END:
     if (dibUpdateFlag) X11DRV_DIB_UpdateDIBSection( dc, TRUE );
-    return TRUE;
+    return result;
 }
 
diff --git a/include/heap.h b/include/heap.h
index 21180fa..8bd9518 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -16,7 +16,6 @@
 
 extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
 extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
-extern LPVOID HEAP_xalloc( HANDLE heap, DWORD flags, DWORD size );
 extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
 extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
 extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
diff --git a/memory/heap.c b/memory/heap.c
index 2bd6e2c..e4f97be 100644
--- a/memory/heap.c
+++ b/memory/heap.c
@@ -1634,31 +1634,15 @@
 
 
 /***********************************************************************
- *           HEAP_xalloc
- *
- * Same as HeapAlloc(), but die on failure.
- */
-LPVOID HEAP_xalloc( HANDLE heap, DWORD flags, DWORD size )
-{
-    LPVOID p = HeapAlloc( heap, flags, size );
-    if (!p)
-    {
-        MESSAGE("Virtual memory exhausted.\n" );
-        exit(1);
-    }
-    SET_EIP(p);
-    return p;
-}
-
-
-/***********************************************************************
  *           HEAP_strdupA
  */
 LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
 {
-    LPSTR p = HEAP_xalloc( heap, flags, strlen(str) + 1 );
-    SET_EIP(p);
-    strcpy( p, str );
+    LPSTR p = HeapAlloc( heap, flags, strlen(str) + 1 );
+    if(p) {
+        SET_EIP(p);
+        strcpy( p, str );
+    }
     return p;
 }
 
@@ -1669,9 +1653,11 @@
 LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str )
 {
     INT len = lstrlenW(str) + 1;
-    LPWSTR p = HEAP_xalloc( heap, flags, len * sizeof(WCHAR) );
-    SET_EIP(p);
-    lstrcpyW( p, str );
+    LPWSTR p = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
+    if(p) {
+        SET_EIP(p);
+        lstrcpyW( p, str );
+    }
     return p;
 }
 
@@ -1684,9 +1670,11 @@
     LPWSTR ret;
 
     if (!str) return NULL;
-    ret = HEAP_xalloc( heap, flags, (strlen(str)+1) * sizeof(WCHAR) );
-    SET_EIP(ret);
-    lstrcpyAtoW( ret, str );
+    ret = HeapAlloc( heap, flags, (strlen(str)+1) * sizeof(WCHAR) );
+    if (ret) {
+        SET_EIP(ret);
+        lstrcpyAtoW( ret, str );
+    }
     return ret;
 }
 
@@ -1699,9 +1687,11 @@
     LPSTR ret;
 
     if (!str) return NULL;
-    ret = HEAP_xalloc( heap, flags, lstrlenW(str) + 1 );
-    SET_EIP(ret);
-    lstrcpyWtoA( ret, str );
+    ret = HeapAlloc( heap, flags, lstrlenW(str) + 1 );
+    if(ret) {
+        SET_EIP(ret);
+        lstrcpyWtoA( ret, str );
+    }
     return ret;
 }
 
diff --git a/objects/text.c b/objects/text.c
index 48e704e..aa07e18 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -371,15 +371,15 @@
     RECT	rect32;
     LPINT	lpdx32 = NULL;
 
-    if (lpDx) lpdx32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
-                                             sizeof(INT)*count );
+    if (lpDx) {
+	lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
+	if(lpdx32 == NULL) return FALSE;
+	for (i=count;i--;) lpdx32[i]=lpDx[i];
+    }    
     if (lprect)	CONV_RECT16TO32(lprect,&rect32);
-    if (lpdx32)	for (i=count;i--;) lpdx32[i]=lpDx[i];
     ret = ExtTextOutA(hdc,x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
     if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
     return ret;
-
-
 }
 
 
@@ -715,7 +715,8 @@
     UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
 
     acount = WideCharToMultiByte(codepage,0,str,count,NULL,0,NULL,NULL);
-    p = HEAP_xalloc( GetProcessHeap(), 0, acount ); 
+    p = HeapAlloc( GetProcessHeap(), 0, acount );
+    if(p == NULL) return 0; /* FIXME: is this the correct return on failure */ 
     acount = WideCharToMultiByte(codepage,0,str,count,p,acount,NULL,NULL);
     ret = TabbedTextOutA( hdc, x, y, p, acount, cTabStops,
                             lpTabPos, nTabOrg );
@@ -762,7 +763,8 @@
     UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
 
     acount = WideCharToMultiByte(codepage,0,lpstr,count,NULL,0,NULL,NULL);
-    p = HEAP_xalloc( GetProcessHeap(), 0, acount );
+    p = HeapAlloc( GetProcessHeap(), 0, acount );
+    if(p == NULL) return 0; /* FIXME: is this the correct failure value? */
     acount = WideCharToMultiByte(codepage,0,lpstr,count,p,acount,NULL,NULL);
     ret = GetTabbedTextExtentA( hdc, p, acount, cTabStops, lpTabPos );
     HeapFree( GetProcessHeap(), 0, p );
diff --git a/windows/clipboard.c b/windows/clipboard.c
index 32569b6..62411b4 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -1126,8 +1126,11 @@
  */
 INT WINAPI GetClipboardFormatNameW( UINT wFormat, LPWSTR retStr, INT maxlen )
 {
-    LPSTR p = HEAP_xalloc( GetProcessHeap(), 0, maxlen );
-    INT ret = GetClipboardFormatNameA( wFormat, p, maxlen );
+    INT ret;
+    LPSTR p = HeapAlloc( GetProcessHeap(), 0, maxlen );
+    if(p == NULL) return 0; /* FIXME: is this the correct failure value? */
+    
+    ret = GetClipboardFormatNameA( wFormat, p, maxlen );
     lstrcpynAtoW( retStr, p, maxlen );
     HeapFree( GetProcessHeap(), 0, p );
     return ret;
diff --git a/windows/input.c b/windows/input.c
index 089e468..1adf1ae 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -940,10 +940,9 @@
  */
 INT WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
 {
-	LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1);
+	char buf[9];
 	int res = GetKeyboardLayoutNameA(buf);
 	lstrcpyAtoW(pwszKLID,buf);
-	HeapFree( GetProcessHeap(), 0, buf );
 	return res;
 }
 
@@ -960,8 +959,10 @@
  */
 INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
 {
-	LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, nSize );
-	int res = GetKeyNameTextA(lParam,buf,nSize);
+	int res;
+	LPSTR buf = HeapAlloc( GetProcessHeap(), 0, nSize );
+	if(buf == NULL) return 0; /* FIXME: is this the correct failure value?*/
+	res = GetKeyNameTextA(lParam,buf,nSize);
 
 	lstrcpynAtoW(lpBuffer,buf,nSize);
 	HeapFree( GetProcessHeap(), 0, buf );
@@ -1069,11 +1070,9 @@
  */
 HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
 {
-    LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1);
-    int res;
+    char buf[9];
+    
     lstrcpynWtoA(buf,pwszKLID,8);
     buf[8] = 0;
-    res = LoadKeyboardLayoutA(buf, Flags);
-    HeapFree( GetProcessHeap(), 0, buf );
-    return res;
+    return LoadKeyboardLayoutA(buf, Flags);
 }
diff --git a/windows/winproc.c b/windows/winproc.c
index 13a0fdb..7258aa3 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -620,7 +620,7 @@
 /* Multiline edit */
     case EM_GETLINE:
         { WORD len = (WORD)*plparam;
-	  LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
+	  LPARAM *ptr = (LPARAM *) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
           if (!ptr) return -1;
           *ptr++ = *plparam;  /* Store previous lParam */
 	  *((WORD *) ptr) = len;   /* Store the length */
@@ -844,7 +844,7 @@
 /* Multiline edit */
     case EM_GETLINE:
         { WORD len = (WORD)*plparam;
-	  LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
+	  LPARAM *ptr = (LPARAM *) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
           if (!ptr) return -1;
           *ptr++ = *plparam;  /* Store previous lParam */
 	  *((WORD *) ptr) = len;   /* Store the length */