[Xquartz-changes] xserver: Branch 'master' - 47 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed May 12 20:48:19 PDT 2010


 Xext/panoramiX.c                          |   34 ++--
 Xext/panoramiXprocs.c                     |   62 +++----
 Xext/saver.c                              |   28 +--
 Xext/security.c                           |   12 -
 Xext/shape.c                              |   18 +-
 Xext/shm.c                                |   22 +-
 Xext/sleepuntil.c                         |    6 
 Xext/sync.c                               |   73 ++++----
 Xext/xace.c                               |    4 
 Xext/xcmisc.c                             |    4 
 Xext/xf86bigfont.c                        |   40 +---
 Xext/xres.c                               |    8 
 Xext/xselinux_ext.c                       |   16 -
 Xext/xselinux_hooks.c                     |    4 
 Xext/xselinux_label.c                     |    8 
 Xext/xtest.c                              |    4 
 Xext/xvdisp.c                             |    6 
 Xext/xvmain.c                             |   14 -
 Xext/xvmc.c                               |   28 +--
 Xi/exevents.c                             |   54 +++---
 Xi/extinit.c                              |    3 
 Xi/getdctl.c                              |    4 
 Xi/getfctl.c                              |    4 
 Xi/getkmap.c                              |    4 
 Xi/getmmap.c                              |    2 
 Xi/getprop.c                              |    4 
 Xi/getselev.c                             |    4 
 Xi/gtmotion.c                             |    2 
 Xi/listdev.c                              |    8 
 Xi/queryst.c                              |    4 
 Xi/xichangehierarchy.c                    |   12 -
 Xi/xipassivegrab.c                        |    4 
 Xi/xiproperty.c                           |   37 ++--
 Xi/xiproperty.h                           |    3 
 Xi/xiquerydevice.c                        |    8 
 Xi/xiquerypointer.c                       |    4 
 Xi/xiselectev.c                           |    6 
 composite/compalloc.c                     |   28 +--
 composite/compinit.c                      |   10 -
 composite/compoverlay.c                   |    4 
 config/config.c                           |    2 
 config/dbus.c                             |   10 -
 config/hal.c                              |   62 +++----
 config/udev.c                             |   18 +-
 damageext/damageext.c                     |    9 -
 damageext/damageextint.h                  |    1 
 dbe/dbe.c                                 |   74 ++++-----
 dbe/midbe.c                               |    2 
 dix/atom.c                                |   54 +++---
 dix/colormap.c                            |  128 +++++++--------
 dix/cursor.c                              |   42 ++---
 dix/devices.c                             |  104 ++++++------
 dix/dispatch.c                            |   99 ++++--------
 dix/dixfonts.c                            |  167 ++++++++++----------
 dix/dixutils.c                            |   54 ++++--
 dix/eventconvert.c                        |    8 
 dix/events.c                              |   42 ++---
 dix/extension.c                           |   30 +--
 dix/gc.c                                  |  206 ++++++++-----------------
 dix/getevents.c                           |   18 +-
 dix/glyphcurs.c                           |    4 
 dix/grabs.c                               |   38 ++--
 dix/inpututils.c                          |    2 
 dix/main.c                                |    6 
 dix/pixmap.c                              |    2 
 dix/privates.c                            |   16 -
 dix/property.c                            |   44 ++---
 dix/ptrveloc.c                            |   10 -
 dix/registry.c                            |   14 -
 dix/resource.c                            |   40 ++--
 dix/selection.c                           |    6 
 dix/swaprep.c                             |   12 -
 dix/window.c                              |   42 ++---
 exa/exa.c                                 |    8 
 exa/exa_accel.c                           |   18 +-
 exa/exa_glyphs.c                          |    8 
 exa/exa_offscreen.c                       |    8 
 fb/fballpriv.c                            |    2 
 fb/fbcmap.c                               |   14 -
 fb/fbcopy.c                               |    4 
 fb/fboverlay.c                            |    2 
 fb/fbpixmap.c                             |    4 
 fb/fbscreen.c                             |   14 -
 fb/fbseg.c                                |    2 
 glx/glxcmds.c                             |   49 +++---
 glx/glxdri.c                              |   46 ++---
 glx/glxdri2.c                             |   38 ++--
 glx/glxdricommon.c                        |    2 
 glx/glxdriswrast.c                        |   24 +-
 glx/glxext.c                              |   12 -
 glx/glxscreens.c                          |    8 
 glx/glxscreens.h                          |    6 
 glx/indirect_util.c                       |    2 
 glx/single2.c                             |   24 +-
 glx/single2swap.c                         |    4 
 glx/unpack.h                              |    2 
 glx/xfont.c                               |   21 --
 hw/dmx/dmx.c                              |   48 ++---
 hw/dmx/dmx_glxvisuals.c                   |    4 
 hw/dmx/dmxcmap.c                          |    8 
 hw/dmx/dmxcursor.c                        |    4 
 hw/dmx/dmxextension.c                     |    2 
 hw/dmx/dmxfont.c                          |   44 ++---
 hw/dmx/dmxgc.c                            |    4 
 hw/dmx/dmxinit.c                          |   10 -
 hw/dmx/dmxpict.c                          |   32 +--
 hw/dmx/dmxpixmap.c                        |    2 
 hw/dmx/dmxprop.c                          |    8 
 hw/dmx/dmxscrinit.c                       |    4 
 hw/dmx/dmxsync.c                          |    2 
 hw/dmx/dmxwindow.c                        |    8 
 hw/dmx/glxProxy/glxcmds.c                 |   22 +-
 hw/dmx/glxProxy/glxext.c                  |    6 
 hw/dmx/glxProxy/glxscreens.c              |    8 
 hw/dmx/glxProxy/glxsingle.c               |    8 
 hw/dmx/glxProxy/glxswap.c                 |   10 -
 hw/dmx/glxProxy/glxutil.c                 |    2 
 hw/dmx/glxProxy/glxvendor.c               |    4 
 hw/dmx/glxProxy/glxvisuals.c              |    2 
 hw/dmx/glxProxy/unpack.h                  |    2 
 hw/dmx/input/dmxinputinit.c               |   24 +-
 hw/dmx/input/dmxmotion.c                  |    2 
 hw/dmx/input/lnx-keyboard.c               |    2 
 hw/dmx/input/usb-keyboard.c               |    2 
 hw/kdrive/ephyr/ephyr.c                   |   20 +-
 hw/kdrive/ephyr/ephyr_draw.c              |   13 -
 hw/kdrive/ephyr/ephyrdriext.c             |   20 +-
 hw/kdrive/ephyr/ephyrglxext.c             |   10 -
 hw/kdrive/ephyr/ephyrhostvideo.c          |    4 
 hw/kdrive/ephyr/ephyrvideo.c              |   20 +-
 hw/kdrive/fake/fake.c                     |   10 -
 hw/kdrive/fbdev/fbdev.c                   |   14 -
 hw/kdrive/linux/evdev.c                   |   20 +-
 hw/kdrive/linux/keyboard.c                |    4 
 hw/kdrive/linux/mouse.c                   |    4 
 hw/kdrive/linux/tslib.c                   |    4 
 hw/kdrive/src/kdrive.c                    |    8 
 hw/kdrive/src/kinfo.c                     |   36 ++--
 hw/kdrive/src/kinput.c                    |   24 +-
 hw/kdrive/src/kshadow.c                   |    6 
 hw/kdrive/src/kxv.c                       |   78 ++++-----
 hw/vfb/InitOutput.c                       |   18 +-
 hw/xfree86/common/xf86AutoConfig.c        |   20 +-
 hw/xfree86/common/xf86Bus.c               |    8 
 hw/xfree86/common/xf86Config.c            |   42 ++---
 hw/xfree86/common/xf86Configure.c         |   14 -
 hw/xfree86/common/xf86Cursor.c            |   12 -
 hw/xfree86/common/xf86DGA.c               |   26 +--
 hw/xfree86/common/xf86DPMS.c              |    4 
 hw/xfree86/common/xf86Events.c            |    4 
 hw/xfree86/common/xf86Helper.c            |   50 +++---
 hw/xfree86/common/xf86Init.c              |   14 -
 hw/xfree86/common/xf86Mode.c              |    4 
 hw/xfree86/common/xf86Option.c            |    8 
 hw/xfree86/common/xf86RandR.c             |    6 
 hw/xfree86/common/xf86ShowOpts.c          |    6 
 hw/xfree86/common/xf86VGAarbiter.c        |    4 
 hw/xfree86/common/xf86VidMode.c           |    6 
 hw/xfree86/common/xf86Xinput.c            |   18 +-
 hw/xfree86/common/xf86cmap.c              |   32 +--
 hw/xfree86/common/xf86fbman.c             |   40 ++--
 hw/xfree86/common/xf86pciBus.c            |   18 +-
 hw/xfree86/common/xf86sbusBus.c           |   18 +-
 hw/xfree86/common/xf86xv.c                |   84 +++++-----
 hw/xfree86/common/xf86xvmc.c              |   16 -
 hw/xfree86/common/xisb.c                  |   10 -
 hw/xfree86/ddc/ddc.c                      |   26 +--
 hw/xfree86/ddc/ddcProperty.c              |    2 
 hw/xfree86/ddc/interpret_edid.c           |    2 
 hw/xfree86/dixmods/extmod/modinit.c       |    4 
 hw/xfree86/dixmods/extmod/xf86dga2.c      |    6 
 hw/xfree86/dixmods/extmod/xf86vmode.c     |   52 +++---
 hw/xfree86/dri/dri.c                      |   36 ++--
 hw/xfree86/dri/xf86dri.c                  |    4 
 hw/xfree86/dri2/dri2.c                    |  182 ++++++++++++++++++----
 hw/xfree86/dri2/dri2.h                    |    3 
 hw/xfree86/dri2/dri2ext.c                 |    2 
 hw/xfree86/exa/examodule.c                |    6 
 hw/xfree86/fbdevhw/fbdevhw.c              |    2 
 hw/xfree86/i2c/bt829.c                    |    4 
 hw/xfree86/i2c/fi1236.c                   |    2 
 hw/xfree86/i2c/msp3430.c                  |   18 +-
 hw/xfree86/i2c/tda8425.c                  |    6 
 hw/xfree86/i2c/tda9850.c                  |    6 
 hw/xfree86/i2c/tda9885.c                  |    6 
 hw/xfree86/i2c/uda1380.c                  |    6 
 hw/xfree86/i2c/xf86i2c.c                  |    8 
 hw/xfree86/int10/generic.c                |   22 +-
 hw/xfree86/int10/helper_exec.c            |    2 
 hw/xfree86/int10/helper_mem.c             |    6 
 hw/xfree86/loader/loadext.c               |   10 -
 hw/xfree86/loader/loadmod.c               |   66 ++++----
 hw/xfree86/modes/xf86Crtc.c               |   68 ++++----
 hw/xfree86/modes/xf86Cursors.c            |    6 
 hw/xfree86/modes/xf86DiDGA.c              |    4 
 hw/xfree86/modes/xf86DisplayIDModes.c     |    2 
 hw/xfree86/modes/xf86EdidModes.c          |    2 
 hw/xfree86/modes/xf86Modes.c              |    8 
 hw/xfree86/modes/xf86RandR12.c            |   38 ++--
 hw/xfree86/modes/xf86Rotate.c             |    6 
 hw/xfree86/os-support/bsd/i386_video.c    |   12 -
 hw/xfree86/os-support/bus/Sbus.c          |   12 -
 hw/xfree86/os-support/linux/int10/linux.c |   18 +-
 hw/xfree86/os-support/linux/lnx_agp.c     |    2 
 hw/xfree86/os-support/linux/lnx_video.c   |   10 -
 hw/xfree86/os-support/shared/posix_tty.c  |   12 -
 hw/xfree86/os-support/shared/vidmem.c     |    4 
 hw/xfree86/os-support/solaris/sun_agp.c   |    2 
 hw/xfree86/ramdac/xf86Cursor.c            |   12 -
 hw/xfree86/ramdac/xf86HWCurs.c            |   32 +--
 hw/xfree86/ramdac/xf86RamDac.c            |   12 -
 hw/xfree86/shadowfb/shadow.c              |   10 -
 hw/xfree86/vbe/vbe.c                      |   32 +--
 hw/xfree86/vbe/vbe.h                      |    4 
 hw/xfree86/vbe/vbeModes.c                 |    2 
 hw/xfree86/vgahw/vgaCmap.c                |   12 -
 hw/xfree86/vgahw/vgaHW.c                  |   22 +-
 hw/xfree86/xaa/xaaBitBlt.c                |    4 
 hw/xfree86/xaa/xaaCpyArea.c               |   26 +--
 hw/xfree86/xaa/xaaCpyPlane.c              |    8 
 hw/xfree86/xaa/xaaCpyWin.c                |    4 
 hw/xfree86/xaa/xaaGC.c                    |    6 
 hw/xfree86/xaa/xaaImage.c                 |    4 
 hw/xfree86/xaa/xaaInit.c                  |   30 +--
 hw/xfree86/xaa/xaaInitAccel.c             |    2 
 hw/xfree86/xaa/xaaLineMisc.c              |    4 
 hw/xfree86/xaa/xaaNonTEText.c             |    4 
 hw/xfree86/xaa/xaaOffscreen.c             |    8 
 hw/xfree86/xaa/xaaOverlay.c               |    4 
 hw/xfree86/xaa/xaaOverlayDF.c             |   10 -
 hw/xfree86/xaa/xaaPCache.c                |   56 +++---
 hw/xfree86/xaa/xaaPict.c                  |    4 
 hw/xfree86/xaa/xaaStateChange.c           |    2 
 hw/xfree86/xaa/xaaTEGlyph.c               |    8 
 hw/xfree86/xaa/xaaTEText.c                |    4 
 hw/xfree86/xaa/xaaWrapper.c               |    2 
 hw/xfree86/xaa/xaalocal.h                 |    2 
 hw/xnest/Color.c                          |   36 ++--
 hw/xnest/Cursor.c                         |    4 
 hw/xnest/Display.c                        |    4 
 hw/xnest/Font.c                           |    4 
 hw/xnest/GC.c                             |    6 
 hw/xnest/Keyboard.c                       |    6 
 hw/xnest/Pixmap.c                         |    2 
 hw/xnest/Screen.c                         |   18 +-
 hw/xquartz/GL/glcontextmodes.c            |    6 
 hw/xquartz/GL/indirect.c                  |   28 +--
 hw/xquartz/GL/visualConfigs.c             |    2 
 hw/xquartz/applewm.c                      |   16 -
 hw/xquartz/darwin.c                       |    2 
 hw/xquartz/pseudoramiX.c                  |    2 
 hw/xquartz/quartz.c                       |    2 
 hw/xquartz/xpr/dri.c                      |   30 +--
 hw/xquartz/xpr/driWrap.c                  |    2 
 hw/xquartz/xpr/x-hook.c                   |    8 
 hw/xquartz/xpr/xprCursor.c                |    8 
 hw/xquartz/xpr/xprScreen.c                |    4 
 hw/xwin/glx/indirect.c                    |   26 +--
 hw/xwin/win.h                             |    2 
 hw/xwin/winauth.c                         |    4 
 hw/xwin/winconfig.c                       |    4 
 hw/xwin/windialogs.c                      |    2 
 hw/xwin/winerror.c                        |    4 
 hw/xwin/winvideo.c                        |    2 
 hw/xwin/winwindow.c                       |    4 
 hw/xwin/winwindowswm.c                    |   12 -
 include/dix.h                             |    6 
 include/dixfont.h                         |    3 
 include/eventstr.h                        |    4 
 include/gc.h                              |   11 -
 include/list.h                            |    6 
 include/misc.h                            |    6 
 include/os.h                              |   74 ++++++---
 include/regionstr.h                       |    4 
 include/xkbsrv.h                          |    2 
 mi/miarc.c                                |  180 +++++-----------------
 mi/mibitblt.c                             |   58 +++----
 mi/micmap.c                               |   24 +-
 mi/micopy.c                               |   10 -
 mi/midispcur.c                            |   36 ++--
 mi/mieq.c                                 |    4 
 mi/miexpose.c                             |   20 +-
 mi/mifillarc.c                            |   40 ++--
 mi/mifillrct.c                            |   12 -
 mi/mifpolycon.c                           |   18 +-
 mi/migc.c                                 |    2 
 mi/miglblt.c                              |   12 -
 mi/mioverlay.c                            |   14 -
 mi/mipointer.c                            |   10 -
 mi/mipolycon.c                            |   16 -
 mi/mipolygen.c                            |    6 
 mi/mipolypnt.c                            |   11 -
 mi/mipolyrect.c                           |    4 
 mi/mipolyutil.c                           |    4 
 mi/mipushpxl.c                            |    4 
 mi/miregion.c                             |   24 +-
 mi/miscrinit.c                            |    4 
 mi/mispans.c                              |   72 ++++----
 mi/misprite.c                             |   10 -
 mi/miwideline.c                           |  134 ++++++++++++----
 mi/miwideline.h                           |   68 --------
 mi/miwindow.c                             |    2 
 mi/mizerarc.c                             |   14 -
 mi/mizerline.c                            |    8 
 miext/cw/cw.c                             |    4 
 miext/cw/cw_render.c                      |    6 
 miext/damage/damage.c                     |   12 -
 miext/rootless/rootlessScreen.c           |   10 -
 miext/rootless/rootlessWindow.c           |   12 -
 miext/shadow/shadow.c                     |    6 
 miext/shadow/shalloc.c                    |    2 
 os/WaitFor.c                              |    6 
 os/access.c                               |   38 ++--
 os/auth.c                                 |   15 -
 os/connection.c                           |   20 +-
 os/io.c                                   |   48 ++---
 os/log.c                                  |   11 -
 os/mitauth.c                              |   22 +-
 os/osdep.h                                |   23 +-
 os/osinit.c                               |    5 
 os/rpcauth.c                              |   14 -
 os/utils.c                                |  147 ++++++------------
 os/xdmauth.c                              |   60 +++----
 os/xdmcp.c                                |   52 +++---
 os/xprintf.c                              |    4 
 os/xsha1.c                                |   20 +-
 randr/randr.c                             |   14 -
 randr/rrcrtc.c                            |   52 +++---
 randr/rrdispatch.c                        |    6 
 randr/rrinfo.c                            |   12 -
 randr/rrmode.c                            |   14 -
 randr/rroutput.c                          |   36 ++--
 randr/rrproperty.c                        |   42 ++---
 randr/rrscreen.c                          |   28 +--
 randr/rrtransform.c                       |    6 
 record/record.c                           |   54 +++---
 record/set.c                              |   12 -
 render/animcur.c                          |    8 
 render/filter.c                           |   28 +--
 render/glyph.c                            |   22 +-
 render/miindex.c                          |   10 -
 render/mipict.c                           |    2 
 render/mirect.c                           |    4 
 render/mitri.c                            |    8 
 render/picture.c                          |   58 +++----
 render/picturestr.h                       |    8 
 render/render.c                           |  245 ++++++++++++------------------
 test/xi2/protocol-common.c                |    4 
 test/xi2/protocol-eventconvert.c          |   18 +-
 xfixes/cursor.c                           |   28 +--
 xfixes/region.c                           |   16 -
 xfixes/select.c                           |    6 
 xkb/XKBAlloc.c                            |   54 +++---
 xkb/XKBGAlloc.c                           |   42 ++---
 xkb/XKBMAlloc.c                           |  124 +++++++--------
 xkb/XKBMisc.c                             |    6 
 xkb/ddxList.c                             |   10 -
 xkb/ddxLoad.c                             |   16 -
 xkb/maprules.c                            |   56 +++---
 xkb/xkb.c                                 |   70 ++++----
 xkb/xkbActions.c                          |    6 
 xkb/xkbEvents.c                           |    6 
 xkb/xkbInit.c                             |   62 +++----
 xkb/xkbLEDs.c                             |   24 +-
 xkb/xkbUtils.c                            |  226 +++++++++++++--------------
 xkb/xkmread.c                             |    6 
 366 files changed, 3717 insertions(+), 3820 deletions(-)

New commits:
commit 315041762313598aad90df84226e2d2def4a0fc9
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat May 8 18:55:55 2010 -0700

    CreateGC: Pass current client on to ChangeGC.
    
    Otherwise we can't check that the XIDs this GC is being initialized with
    are accessible to this client.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Cc: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Eamon Walsh <ewalsh at tycho.nsa.gov>

diff --git a/dix/gc.c b/dix/gc.c
index a7b335c..c9b704a 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -574,7 +574,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
     if (!(*pGC->pScreen->CreateGC)(pGC))
 	*pStatus = BadAlloc;
     else if (mask)
-        *pStatus = dixChangeGC(NullClient, pGC, mask, pval, NULL);
+        *pStatus = dixChangeGC(client, pGC, mask, pval, NULL);
     else
 	*pStatus = Success;
 
commit 04bad1b8a118a83064316d6e4327234aee19361e
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 21:56:10 2010 -0700

    Kill ChangeGC in favor of dixChangeGC.
    
    This doesn't change any behavior, but it isn't clear whether NullClient
    is correct in all cases. As ajax says,
    
    > For most of these changes, I think it's correct to use NullClient,
    > since they are server-initiated changes and should not fail for (eg)
    > xace reasons. ... At any rate, you're certainly not changing any
    > semantics by leaving them all as NullClient, so this patch can't be
    > more wrong than before.
    
    The call in CreateGC is particularly questionable.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 378c380..332fb97 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1261,7 +1261,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 	    {
 		if (pFont != c->pGC->font && c->pDraw)
 		{
-		    ChangeGC( c->pGC, GCFont, &fid);
+		    dixChangeGC(NullClient, c->pGC, GCFont, &fid, NULL);
 		    ValidateGC(c->pDraw, c->pGC);
 		    if (c->reqType == X_PolyText8)
 			c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
@@ -1404,7 +1404,7 @@ bail:
 	/* Step 4 */
 	if (pFont != origGC->font)
 	{
-	    ChangeGC(origGC, GCFont, &fid);
+	    dixChangeGC(NullClient, origGC, GCFont, &fid, NULL);
 	    ValidateGC(c->pDraw, origGC);
 	}
 
@@ -1423,7 +1423,7 @@ bail:
     if (c->slept)
     {
 	ClientWakeup(c->client);
-	ChangeGC(c->pGC, clearGCmask, clearGC);
+	dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
 
 	/* Unreference the font from the scratch GC */
 	CloseFont(c->pGC->font, (Font)0);
@@ -1580,7 +1580,7 @@ bail:
     if (c->slept)
     {
 	ClientWakeup(c->client);
-	ChangeGC(c->pGC, clearGCmask, clearGC);
+	dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
 
 	/* Unreference the font from the scratch GC */
 	CloseFont(c->pGC->font, (Font)0);
diff --git a/dix/gc.c b/dix/gc.c
index 3a008e0..a7b335c 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -491,14 +491,6 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 #undef NEXTVAL
 #undef NEXT_PTR
 
-/* Publically defined entry to ChangeGC.  Just calls dixChangeGC and tells
- * it that all of the entries are constants or IDs */
-int
-ChangeGC(GC *pGC, BITS32 mask, XID *pval)
-{
-    return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
-}
-
 /* CreateGC(pDrawable, mask, pval, pStatus)
    creates a default GC for the given drawable, using mask to fill
    in any non-default values.
@@ -582,7 +574,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
     if (!(*pGC->pScreen->CreateGC)(pGC))
 	*pStatus = BadAlloc;
     else if (mask)
-        *pStatus = ChangeGC(pGC, mask, pval);
+        *pStatus = dixChangeGC(NullClient, pGC, mask, pval, NULL);
     else
 	*pStatus = Success;
 
@@ -625,8 +617,7 @@ CreateDefaultTile (GCPtr pGC)
     tmpval[0] = GXcopy;
     tmpval[1] = pGC->tile.pixel;
     tmpval[2] = FillSolid;
-    (void)ChangeGC(pgcScratch, GCFunction | GCForeground | GCFillStyle, 
-		   tmpval);
+    (void)dixChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval, NULL);
     ValidateGC((DrawablePtr)pTile, pgcScratch);
     rect.x = 0;
     rect.y = 0;
@@ -965,7 +956,7 @@ CreateDefaultStipple(int screenNum)
 	(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
 	return FALSE;
     }
-    (void)ChangeGC(pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
+    (void)dixChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval, NULL);
     ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
     rect.x = 0;
     rect.y = 0;
diff --git a/dix/window.c b/dix/window.c
index 0d03219..313593b 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -328,7 +328,7 @@ MakeRootTile(WindowPtr pWin)
 	attributes[0] = pScreen->whitePixel;
 	attributes[1] = pScreen->blackPixel;
 
-	(void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
+	(void)dixChangeGC(NullClient, pGC, GCForeground | GCBackground, attributes, NULL);
     }
 
    ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index f25a9b4..672e0e4 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -107,8 +107,7 @@ ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
     tmpval[0] = alu;
     tmpval[1] = pm;
     tmpval[2] = fg;
-    ChangeGC(fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, 
-	     tmpval);
+    dixChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, tmpval, NULL);
 
     ValidateGC(&pPix->drawable, fakexa->pGC);
 
@@ -173,7 +172,7 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
 
     tmpval[0] = alu;
     tmpval[1] = pm;
-    ChangeGC (fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
+    dixChangeGC (NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval, NULL);
 
     ValidateGC(&pDst->drawable, fakexa->pGC);
 
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 56f101f..bf6600a 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -1892,7 +1892,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
 
     val[0] = fg;
     val[1] = IncludeInferiors;
-    ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
+    dixChangeGC (NullClient, pGC, GCForeground|GCSubwindowMode, val, NULL);
 
     ValidateGC (pDraw, pGC);
 
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 99d1fdf..e2d9c15 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1855,7 +1855,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
        if (pPriv) pPriv->pGC = pGC;
    } else if (key != pGC->fgPixel){
        pval[0] = key;
-       ChangeGC(pGC, GCForeground, pval);
+       dixChangeGC(NullClient, pGC, GCForeground, pval, NULL);
        ValidateGC(pDraw, pGC);
    }
 
@@ -1892,7 +1892,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
    gc = GetScratchGC(root->depth, pScreen);
    pval[0] = key;
    pval[1] = IncludeInferiors;
-   (void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
+   (void) dixChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval, NULL);
    ValidateGC(root, gc);
 
    rects = malloc(nbox * sizeof(xRectangle));
diff --git a/include/gc.h b/include/gc.h
index 7f481c3..3fa953d 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -88,11 +88,6 @@ extern _X_EXPORT void ValidateGC(
     DrawablePtr /*pDraw*/,
     GCPtr /*pGC*/);
 
-extern _X_EXPORT int ChangeGC(
-    GCPtr/*pGC*/,
-    BITS32 /*mask*/,
-    XID* /*pval*/);
-
 typedef union {
     CARD32 val;
     pointer ptr;
diff --git a/mi/midispcur.c b/mi/midispcur.c
index a107949..11547db 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -306,7 +306,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 			   0, 0, pCursor->bits->width, pCursor->bits->height,
  			   0, XYPixmap, (char *)pCursor->bits->source);
     gcvals[0] = GXand;
-    ChangeGC (pGC, GCFunction, gcvals);
+    dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
     ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC);
     (*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1,
 			   0, 0, pCursor->bits->width, pCursor->bits->height,
@@ -314,13 +314,13 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 
     /* mask bits -- pCursor->mask & ~pCursor->source */
     gcvals[0] = GXcopy;
-    ChangeGC (pGC, GCFunction, gcvals);
+    dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
     ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
     (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
 			   0, 0, pCursor->bits->width, pCursor->bits->height,
  			   0, XYPixmap, (char *)pCursor->bits->mask);
     gcvals[0] = GXandInverted;
-    ChangeGC (pGC, GCFunction, gcvals);
+    dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
     ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
     (*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
 			   0, 0, pCursor->bits->width, pCursor->bits->height,
diff --git a/render/mirect.c b/render/mirect.c
index b54fe6f..0030eff 100644
--- a/render/mirect.c
+++ b/render/mirect.c
@@ -70,7 +70,7 @@ miColorRects (PicturePtr    pDst,
 	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
     }
 
-    ChangeGC (pGC, mask, tmpval);
+    dixChangeGC (NullClient, pGC, mask, tmpval, NULL);
     ValidateGC (pDst->pDrawable, pGC);
     if (xoff || yoff)
     {
@@ -148,7 +148,7 @@ miCompositeRects (CARD8		op,
 	tmpval[0] = GXcopy;
 	tmpval[1] = pixel;
 
-	ChangeGC (pGC, GCFunction | GCForeground, tmpval);
+	dixChangeGC (NullClient, pGC, GCFunction | GCForeground, tmpval, NULL);
 	ValidateGC (&pPixmap->drawable, pGC);
 	one.x = 0;
 	one.y = 0;
commit 65cedf39054cf3a1e695e84ac228cce9e8d48097
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 21:39:43 2010 -0700

    Kill DoChangeGC in favor of dixChangeGC.
    
    This doesn't change any behavior, but it isn't clear whether NullClient
    is correct in all cases. As ajax says,
    
    > For most of these changes, I think it's correct to use NullClient,
    > since they are server-initiated changes and should not fail for (eg)
    > xace reasons. ... At any rate, you're certainly not changing any
    > semantics by leaving them all as NullClient, so this patch can't be
    > more wrong than before.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dbe/dbe.c b/dbe/dbe.c
index 1cda9f5..1d14bb3 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -1239,7 +1239,7 @@ SProcDbeDispatch(ClientPtr client)
 static Bool
 DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
 {
-    pointer	gcvalues[4];
+    ChangeGCVal	gcvalues[4];
     int		ts_x_origin, ts_y_origin;
     PixUnion	background;
     int		backgroundState;
@@ -1265,16 +1265,16 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
     switch (backgroundState)
     {
         case BackgroundPixel:
-            gcvalues[0] = (pointer)background.pixel;
-            gcvalues[1] = (pointer)FillSolid;
+            gcvalues[0].val = background.pixel;
+            gcvalues[1].val = FillSolid;
             gcmask = GCForeground|GCFillStyle;
             break;
 
         case BackgroundPixmap:
-            gcvalues[0] = (pointer)FillTiled;
-            gcvalues[1] = (pointer)background.pixmap;
-            gcvalues[2] = (pointer)(long)ts_x_origin;
-            gcvalues[3] = (pointer)(long)ts_y_origin;
+            gcvalues[0].val = FillTiled;
+            gcvalues[1].ptr = background.pixmap;
+            gcvalues[2].val = ts_x_origin;
+            gcvalues[3].val = ts_y_origin;
             gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
             break;
 
@@ -1283,13 +1283,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
             return(FALSE);
     }
 
-    if (DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE) != 0)
-    {
-        return(FALSE);
-    }
-
-    return(TRUE);
-
+    return dixChangeGC(NullClient, pGC, gcmask, NULL, gcvalues) == 0;
 } /* DbeSetupBackgroundPainter() */
 
 
diff --git a/dix/gc.c b/dix/gc.c
index e45378c..3a008e0 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -91,11 +91,9 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
  * pass NullClient for the client since any access checking should have
  * already been done at a higher level.
  * 
- * Since we had to create a new function anyway, we decided to change the
- * way the list of gc values is passed to eliminate the compiler warnings
- * caused by the DoChangeGC interface.  You can pass the values via pC32
- * or pUnion, but not both; one of them must be NULL.  If you don't need
- * to pass any pointers, you can use either one:
+ * You can pass the list of gc values via pC32 or pUnion, but not both;
+ * one of them must be NULL.  If you don't need to pass any pointers,
+ * you can use either one:
  * 
  *     example calling dixChangeGC using pC32 parameter
  *
@@ -126,13 +124,6 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
  * Note: we could have gotten by with just the pUnion parameter, but on
  * 64 bit machines that would have forced us to copy the value list that
  * comes in the ChangeGC request.
- * 
- * Ideally, we'd change all the DoChangeGC calls to dixChangeGC, but this
- * is far too many changes to consider at this time, so we've only
- * changed the ones that caused compiler warnings.  New code should use
- * dixChangeGC.
- * 
- * dpw
  */
 
 #define NEXTVAL(_type, _var) { \
@@ -508,37 +499,6 @@ ChangeGC(GC *pGC, BITS32 mask, XID *pval)
     return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
 }
 
-/* DoChangeGC(pGC, mask, pval, fPointer)
-   mask is a set of bits indicating which values to change.
-   pval contains an appropriate value for each mask.
-   fPointer is true if the values for tiles, stipples, fonts or clipmasks
-   are pointers instead of IDs.  Note: if you are passing pointers you
-   MUST declare the array of values as type pointer!  Other data types
-   may not be large enough to hold pointers on some machines.  Yes,
-   this means you have to cast to (XID *) when you pass the array to
-   DoChangeGC.  Similarly, if you are not passing pointers (fPointer = 0) you
-   MUST declare the array as type XID (not unsigned long!), or again the wrong
-   size data type may be used.  To avoid this cruftiness, use dixChangeGC
-   above.
-
-   if there is an error, the value is marked as changed 
-   anyway, which is probably wrong, but infrequent.
-
-NOTE:
-	all values sent over the protocol for ChangeGC requests are
-32 bits long
-*/
-int
-DoChangeGC(GC *pGC, BITS32 mask, XID *pval, int fPointer)
-{
-    if (fPointer)
-    /* XXX might be a problem on 64 bit big-endian servers */
-	return dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
-    else
-	return dixChangeGC(NullClient, pGC, mask, pval, NULL);
-}
-
-
 /* CreateGC(pDrawable, mask, pval, pStatus)
    creates a default GC for the given drawable, using mask to fill
    in any non-default values.
diff --git a/fb/fbseg.c b/fb/fbseg.c
index 80ce740..80dd480 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -250,7 +250,7 @@ fbSetFg (DrawablePtr	pDrawable,
 {
     if (fg != pGC->fgPixel)
     {
-	DoChangeGC (pGC, GCForeground, (XID *) &fg, FALSE);
+	dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL);
 	ValidateGC (pDrawable, pGC);
     }
 }
diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c
index e78a6f8..e62f280 100644
--- a/hw/xfree86/xaa/xaaPCache.c
+++ b/hw/xfree86/xaa/xaaPCache.c
@@ -1881,7 +1881,7 @@ XAAWriteBitmapToCacheLinear(
    pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
    gcvals[0] = fg;
    gcvals[1] = bg;
-   DoChangeGC(pGC, GCForeground | GCBackground, gcvals, 0);
+   dixChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals, NULL);
    ValidateGC((DrawablePtr)pDstPix, pGC);
 
    /* We've unwrapped already so these ops miss a sync */
diff --git a/include/gc.h b/include/gc.h
index e75cc5e..7f481c3 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -93,12 +93,6 @@ extern _X_EXPORT int ChangeGC(
     BITS32 /*mask*/,
     XID* /*pval*/);
 
-extern _X_EXPORT int DoChangeGC(
-    GCPtr/*pGC*/,
-    BITS32 /*mask*/,
-    XID* /*pval*/,
-    int /*fPointer*/);
-
 typedef union {
     CARD32 val;
     pointer ptr;
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 2ac6ce0..f02c04f 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -679,7 +679,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
  
 	    /* alu is already GXCopy */
 	    gcv[0] = (XID)planeMask;
-	    DoChangeGC(pGC, GCPlaneMask, gcv, 0);
+	    dixChangeGC(NullClient, pGC, GCPlaneMask, gcv, NULL);
 	    ValidateGC((DrawablePtr)pPixmap, pGC);
 	}
 
@@ -776,7 +776,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
 	oldBg = pGC->bgPixel;
 	gcv[0] = (XID)~0;
 	gcv[1] = (XID)0;
-	DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
+	dixChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv, NULL);
 	bytesPer = (long)h * BitmapBytePad(w + leftPad);
 
 	for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
@@ -784,7 +784,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
 	    if (i & oldPlanemask)
 	    {
 	        gcv[0] = (XID)i;
-	        DoChangeGC(pGC, GCPlaneMask, gcv, 0);
+	        dixChangeGC(NullClient, pGC, GCPlaneMask, gcv, NULL);
 	        ValidateGC(pDraw, pGC);
 	        (*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
 			         XYBitmap, (char *)pImage);
@@ -793,7 +793,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
 	gcv[0] = (XID)oldPlanemask;
 	gcv[1] = (XID)oldFg;
 	gcv[2] = (XID)oldBg;
-	DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
+	dixChangeGC(NullClient, pGC, GCPlaneMask | GCForeground | GCBackground, gcv, NULL);
 	ValidateGC(pDraw, pGC);
 	break;
 
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 06bddec..a107949 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -371,7 +371,7 @@ miDCPutBits (
     if (sourceGC->fgPixel != source)
     {
 	gcvals[0] = source;
-	DoChangeGC (sourceGC, GCForeground, gcvals, 0);
+	dixChangeGC (NullClient, sourceGC, GCForeground, gcvals, NULL);
     }
     if (sourceGC->serialNumber != pDrawable->serialNumber)
 	ValidateGC (pDrawable, sourceGC);
@@ -391,7 +391,7 @@ miDCPutBits (
     if (maskGC->fgPixel != mask)
     {
 	gcvals[0] = mask;
-	DoChangeGC (maskGC, GCForeground, gcvals, 0);
+	dixChangeGC (NullClient, maskGC, GCForeground, gcvals, NULL);
     }
     if (maskGC->serialNumber != pDrawable->serialNumber)
 	ValidateGC (pDrawable, maskGC);
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 2072e6a..b4d489a 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -691,9 +691,9 @@ miClearDrawable(DrawablePtr pDraw, GCPtr pGC)
     rect.y = 0;
     rect.width = pDraw->width;
     rect.height = pDraw->height;
-    DoChangeGC(pGC, GCForeground, &bg, 0);
+    dixChangeGC(NullClient, pGC, GCForeground, &bg, NULL);
     ValidateGC(pDraw, pGC);
     (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
-    DoChangeGC(pGC, GCForeground, &fg, 0);
+    dixChangeGC(NullClient, pGC, GCForeground, &fg, NULL);
     ValidateGC(pDraw, pGC);
 }
diff --git a/mi/miglblt.c b/mi/miglblt.c
index ea199dc..22a170a 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -138,7 +138,7 @@ miPolyGlyphBlt(
     gcvals[1] = 1;
     gcvals[2] = 0;
 
-    DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
+    dixChangeGC(NullClient, pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, NULL);
 
     nbyLine = BitmapBytePad(width);
     pbits = malloc(height*nbyLine);
@@ -237,13 +237,13 @@ miImageGlyphBlt(
     gcvals[0] = GXcopy;
     gcvals[1] = pGC->bgPixel;
     gcvals[2] = FillSolid;
-    DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
+    dixChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals, NULL);
     ValidateGC(pDrawable, pGC);
     (*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &backrect);
 
     /* put down the glyphs */
     gcvals[0] = oldFG;
-    DoChangeGC(pGC, GCForeground, gcvals, 0);
+    dixChangeGC(NullClient, pGC, GCForeground, gcvals, NULL);
     ValidateGC(pDrawable, pGC);
     (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci,
 			      pglyphBase);
@@ -252,7 +252,7 @@ miImageGlyphBlt(
     gcvals[0] = oldAlu;
     gcvals[1] = oldFG;
     gcvals[2] = oldFS;
-    DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
+    dixChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals, NULL);
     ValidateGC(pDrawable, pGC);
 
 }
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 5a0e523..b54a9fd 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -107,7 +107,7 @@ miPolyPoint(
     fsNew = FillSolid;
     if(pGC->fillStyle != FillSolid)
     {
-	DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
+	dixChangeGC(NullClient, pGC, GCFillStyle, &fsNew, NULL);
 	ValidateGC(pDrawable, pGC);
     }
     pwidth = pwidthInit;
@@ -117,7 +117,7 @@ miPolyPoint(
 
     if(fsOld != FillSolid)
     {
-	DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
+	dixChangeGC(NullClient, pGC, GCFillStyle, &fsOld, NULL);
 	ValidateGC(pDrawable, pGC);
     }
     free(pwidthInit);
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 57dda22..c54e2de 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -137,7 +137,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     	if (pixel != oldPixel)
     	{
 	    XID tmpPixel = (XID)pixel;
-    	    DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &tmpPixel, NULL);
     	    ValidateGC (pDrawable, pGC);
     	}
     }
@@ -233,7 +233,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
         free(pptInit);
     	if (pixel != oldPixel)
     	{
-	    DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
 	    ValidateGC (pDrawable, pGC);
     	}
     }
@@ -271,13 +271,13 @@ miFillRectPolyHelper (
     	if (pixel != oldPixel)
     	{
 	    XID tmpPixel = (XID)pixel;
-    	    DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &tmpPixel, NULL);
     	    ValidateGC (pDrawable, pGC);
     	}
 	(*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect);
     	if (pixel != oldPixel)
     	{
-	    DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
 	    ValidateGC (pDrawable, pGC);
     	}
     }
@@ -1120,7 +1120,7 @@ miLineArc (
     	if (pixel != oldPixel)
     	{
 	    XID tmpPixel = (XID)pixel;
-	    DoChangeGC(pGC, GCForeground, &tmpPixel, FALSE);
+	    dixChangeGC(NullClient, pGC, GCForeground, &tmpPixel, NULL);
 	    ValidateGC (pDraw, pGC);
     	}
     }
@@ -1152,7 +1152,7 @@ miLineArc (
         free(points);
     	if (pixel != oldPixel)
     	{
-	    DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
+	    dixChangeGC(NullClient, pGC, GCForeground, &oldPixel, NULL);
 	    ValidateGC (pDraw, pGC);
     	}
     }
@@ -1571,14 +1571,14 @@ miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
 	oldPixel = pGC->fgPixel;
     	if (pixel != oldPixel)
     	{
-    	    DoChangeGC (pGC, GCForeground, &pixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &pixel, NULL);
     	    ValidateGC (pDrawable, pGC);
     	}
 	miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup);
 	miFreeSpanGroup (&spanData->bgGroup);
     	if (pixel != oldPixel)
     	{
-	    DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
+	    dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
 	    ValidateGC (pDrawable, pGC);
     	}
     }
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 1665ebf..2ff36ed 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -78,13 +78,13 @@ typedef struct _LineFace {
 #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
     oldPixel = pGC->fgPixel; \
     if (pixel != oldPixel) { \
-	DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \
+	dixChangeGC (NullClient, pGC, GCForeground, (XID *) &pixel, NULL); \
 	ValidateGC (pDrawable, pGC); \
     } \
 }
 #define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
     if (pixel != oldPixel) { \
-	DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \
+	dixChangeGC (NullClient, pGC, GCForeground, (XID *) &oldPixel, NULL); \
 	ValidateGC (pDrawable, pGC); \
     } \
 }
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index 1175bc1..feaa3cb 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -803,7 +803,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
 	    if ((pGC->fillStyle == FillSolid) ||
 		(pGC->fillStyle == FillStippled))
 	    {
-		DoChangeGC(pGC, GCForeground, (XID *)&pGC->bgPixel, 0);
+		dixChangeGC(NullClient, pGC, GCForeground, (XID *)&pGC->bgPixel, NULL);
 		ValidateGC(pDraw, pGC);
 	    }
 	    pts = &points[numPts >> 1];
@@ -831,7 +831,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
 	    if ((pGC->fillStyle == FillSolid) ||
 		(pGC->fillStyle == FillStippled))
 	    {
-		DoChangeGC(pGC, GCForeground, &fgPixel, 0);
+		dixChangeGC(NullClient, pGC, GCForeground, &fgPixel, NULL);
 		ValidateGC(pDraw, pGC);
 	    }
 	}
diff --git a/xfixes/region.c b/xfixes/region.c
index 2649c06..5e16369 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -642,7 +642,7 @@ ProcXFixesSetGCClipRegion (ClientPtr client)
     
     vals[0] = stuff->xOrigin;
     vals[1] = stuff->yOrigin;
-    DoChangeGC (pGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
+    dixChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals, NULL);
     (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
 
     return (client->noClientException);
commit afcbbd6dfea51c5b0adca0d720edc02ba0c2dc16
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat May 8 15:19:03 2010 -0700

    doPolyText needs UseAccess to each font, not ReadAccess.
    
    In commit 42d6112ec21949a336ee8b34469f2695273ee2d6, Eamon changed
    dixChangeGC to require DixUseAccess on any GCFont XID. I think
    doPolyText needs to require the same level of access. Otherwise
    dixChangeGC could fail when it does the same lookup, which doPolyText
    doesn't check for.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Cc: Eamon Walsh <ewalsh at tycho.nsa.gov>
    Reviewed-by: Eamon Walsh <ewalsh at tycho.nsa.gov>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index e145254..378c380 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1235,7 +1235,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 		 | ((Font)*(c->pElt+2)) << 16
 		 | ((Font)*(c->pElt+1)) << 24;
 	    err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT,
-					  client, DixReadAccess);
+					  client, DixUseAccess);
 	    if (err != Success)
 	    {
 		err = (err == BadValue) ? BadFont : err;
commit 59857ee5da5f1f3f4900292581b9586477513211
Merge: 21ceae9... 432cbbe...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed May 12 16:48:08 2010 -0700

    Merge remote branch 'dottedmag/for-keithp'

commit 432cbbec194e47bf2a117c9302146e786c8a4ee1
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 03:51:00 2010 +0700

    Misc coding style cleanup
    
    Use a[b] instead of *(a+b), fix whitespace.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/atom.c b/dix/atom.c
index 7d04c68..88b40db 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -145,8 +145,8 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	*np = nd;
 	nd->left = nd->right = NULL;
 	nd->fingerPrint = fp;
-	nd->a = (++lastAtom);
-	*(nodeTable+lastAtom) = nd;
+	nd->a = ++lastAtom;
+	nodeTable[lastAtom] = nd;
 	return nd->a;
     }
     else
@@ -194,7 +194,7 @@ FreeAtom(NodePtr patom)
 void
 FreeAllAtoms(void)
 {
-    if(atomRoot == NULL)
+    if (atomRoot == NULL)
 	return;
     FreeAtom(atomRoot);
     atomRoot = NULL;
@@ -208,7 +208,7 @@ InitAtoms(void)
 {
     FreeAllAtoms();
     tableLength = InitialTableSize;
-    nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
+    nodeTable = malloc(InitialTableSize * sizeof(NodePtr));
     if (!nodeTable)
 	AtomError();
     nodeTable[None] = NULL;
commit 816b79dd061e9839cec94a4986a7820b70ca8a7f
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 03:45:21 2010 +0700

    Remove useless casts
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/atom.c b/dix/atom.c
index 02843d2..7d04c68 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -68,7 +68,7 @@ typedef struct _Node {
 } NodeRec, *NodePtr;
 
 static Atom lastAtom = None;
-static NodePtr atomRoot = (NodePtr)NULL;
+static NodePtr atomRoot = NULL;
 static unsigned long tableLength;
 static NodePtr *nodeTable;
 
@@ -88,7 +88,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	fp = fp * 27 + string[i];
 	fp = fp * 27 + string[len - 1 - i];
     }
-    while (*np != (NodePtr) NULL)
+    while (*np != NULL)
     {
 	if (fp < (*np)->fingerPrint)
 	    np = &((*np)->left);
@@ -130,11 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	if ((lastAtom + 1) >= tableLength) {
 	    NodePtr *table;
 
-	    table = (NodePtr *) realloc(nodeTable,
-					 tableLength * (2 * sizeof(NodePtr)));
+	    table = realloc(nodeTable, tableLength * (2 * sizeof(NodePtr)));
 	    if (!table) {
-		if (nd->string != string)
-		    free(nd->string);
+		if (nd->string != string) {
+                    /* nd->string has been strdup'ed */
+		    free((char *)nd->string);
+                }
 		free(nd);
 		return BAD_RESOURCE;
 	    }
@@ -142,7 +143,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	    nodeTable = table;
 	}
 	*np = nd;
-	nd->left = nd->right = (NodePtr) NULL;
+	nd->left = nd->right = NULL;
 	nd->fingerPrint = fp;
 	nd->a = (++lastAtom);
 	*(nodeTable+lastAtom) = nd;
@@ -163,7 +164,7 @@ NameForAtom(Atom atom)
 {
     NodePtr node;
     if (atom > lastAtom) return 0;
-    if ((node = nodeTable[atom]) == (NodePtr)NULL) return 0;
+    if ((node = nodeTable[atom]) == NULL) return 0;
     return node->string;
 }
 
@@ -193,12 +194,12 @@ FreeAtom(NodePtr patom)
 void
 FreeAllAtoms(void)
 {
-    if(atomRoot == (NodePtr)NULL)
+    if(atomRoot == NULL)
 	return;
     FreeAtom(atomRoot);
-    atomRoot = (NodePtr)NULL;
+    atomRoot = NULL;
     free(nodeTable);
-    nodeTable = (NodePtr *)NULL;
+    nodeTable = NULL;
     lastAtom = None;
 }
 
@@ -210,7 +211,7 @@ InitAtoms(void)
     nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
     if (!nodeTable)
 	AtomError();
-    nodeTable[None] = (NodePtr)NULL;
+    nodeTable[None] = NULL;
     MakePredeclaredAtoms();
     if (lastAtom != XA_LAST_PREDEFINED)
 	AtomError();
commit 63a647abd51f44226cbd16aa04ebc57d07463c6d
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 03:44:12 2010 +0700

    Fix code style: extra whitespace before ()
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/atom.c b/dix/atom.c
index 6910dd5..02843d2 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -213,5 +213,5 @@ InitAtoms(void)
     nodeTable[None] = (NodePtr)NULL;
     MakePredeclaredAtoms();
     if (lastAtom != XA_LAST_PREDEFINED)
-	AtomError ();
+	AtomError();
 }
commit 28211c443c693a1ca3db5740d0128274a3eef723
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 03:43:04 2010 +0700

    Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3)
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/atom.c b/dix/atom.c
index ecfe4b0..6910dd5 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -180,8 +180,13 @@ FreeAtom(NodePtr patom)
 	FreeAtom(patom->left);
     if(patom->right)
 	FreeAtom(patom->right);
-    if (patom->a > XA_LAST_PREDEFINED)
-	free(patom->string);
+    if (patom->a > XA_LAST_PREDEFINED) {
+        /*
+         * All strings above XA_LAST_PREDEFINED are strdup'ed, so it's safe to
+         * cast here
+         */
+	free((char *)patom->string);
+    }
     free(patom);
 }
 
commit 8b5326aa98eba201dd78aea3dd7114e1a084489b
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Wed May 12 20:27:02 2010 +0000

    Mark OsAbort as noreturn function to make gcc happier.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/include/os.h b/include/os.h
index 82d6694..d34e056 100644
--- a/include/os.h
+++ b/include/os.h
@@ -299,7 +299,7 @@ extern _X_EXPORT void OsBlockSignals (void);
 
 extern _X_EXPORT void OsReleaseSignals (void);
 
-extern _X_EXPORT void OsAbort (void);
+extern _X_EXPORT void OsAbort (void) X_NORETURN;
 
 #if !defined(WIN32)
 extern _X_EXPORT int System(char *);
commit 868e372a73b377705217e0379bc6e00f36c4d8e5
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 01:59:06 2010 +0700

    Introduce X_NORETURN macro defined as __attribute__((noreturn)) for gcc
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/include/misc.h b/include/misc.h
index c7add25..e4bdee4 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -106,6 +106,12 @@ typedef unsigned long ATOM;
 #define X_DEPRECATED
 #endif
 
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define X_NORETURN __attribute__((noreturn))
+#else
+#define X_NORETURN
+#endif
+
 #ifndef _XTYPEDEF_CALLBACKLISTPTR
 typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
 #define _XTYPEDEF_CALLBACKLISTPTR
diff --git a/include/os.h b/include/os.h
index 7f358ee..82d6694 100644
--- a/include/os.h
+++ b/include/os.h
@@ -547,10 +547,7 @@ extern _X_EXPORT void FreeAuditTimer(void);
 extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
 extern _X_EXPORT void VAuditF(const char *f, va_list args);
 extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
-#if defined(__GNUC__) && (__GNUC__ > 2)
-__attribute((noreturn))
-#endif
-;
+    X_NORETURN;
 
 #ifdef DEBUG
 #define DebugF ErrorF
diff --git a/os/log.c b/os/log.c
index ff78545..0781659 100644
--- a/os/log.c
+++ b/os/log.c
@@ -402,9 +402,8 @@ LogMessage(MessageType type, const char *format, ...)
     va_end(ap);
 }
 
-#ifdef __GNUC__
-void AbortServer(void) __attribute__((noreturn));
-#endif
+void
+AbortServer(void) X_NORETURN;
 
 void
 AbortServer(void)
commit 5a8e2f2745ae1f74501cd3f42614a1ed2cf974f2
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Wed May 12 18:54:51 2010 +0000

    Do not jump through the hoops to deallocate xkbbasedirflag variable
    
    Fixes gcc warning as well.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index a9b5ca9..b1d6294 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -186,7 +186,7 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
     char	*buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
 
     const char	*emptystring = "";
-    const char	*xkbbasedirflag = emptystring;
+    char *xkbbasedirflag = NULL;
     const char	*xkbbindir = emptystring;
     const char	*xkbbindirsep = emptystring;
 
@@ -230,13 +230,11 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
 		  xkbbindir, xkbbindirsep,
 		  ( (xkbDebugFlags < 2) ? 1 :
 		    ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
-		  xkbbasedirflag, xkmfile,
+		  xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
 		  PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
 		  xkm_output_dir, keymap);
 
-    if (xkbbasedirflag != emptystring) {
-	free(xkbbasedirflag);
-    }
+    free(xkbbasedirflag);
     
 #ifndef WIN32
     out= Popen(buf,"w");
commit ff2b4cf8329b1678adafcda02e5d47a072550d47
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 01:51:37 2010 +0700

    Turn sprintf argument into literaral string, shutting up gcc warning
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/os/osinit.c b/os/osinit.c
index e8fcd45..32747df 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -161,7 +161,6 @@ void
 OsInit(void)
 {
     static Bool been_here = FALSE;
-    static char* admpath = ADMPATH;
     static char* devnull = "/dev/null";
     char fname[PATH_MAX];
 
@@ -229,8 +228,8 @@ OsInit(void)
 	{
 	    FILE *err;
 
-	    if (strlen (display) + strlen (admpath) + 1 < sizeof fname)
-		sprintf (fname, admpath, display);
+	    if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
+		sprintf (fname, ADMPATH, display);
 	    else
 		strcpy (fname, devnull);
 	    /*
commit f62ba192c285b1e49bf299f03fc0b763680afaaf
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 13 01:47:26 2010 +0700

    Do not use deprecated Xalloc function
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 3c6ed4e..5a0e523 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -73,7 +73,7 @@ miPolyPoint(
     int			i;
     xPoint 		*ppt;
 
-    if(!(pwidthInit = xalloc(npt * sizeof(int))))
+    if(!(pwidthInit = malloc(npt * sizeof(int))))
 	return;
 
     /* make pointlist origin relative */
commit 21ceae9002c6364deb3d074cf2da7d3864cf6879
Author: Jamey Sharp <jamey at minilop.net>
Date:   Tue May 11 10:24:00 2010 -0700

    SetFontPath: set client->errorValue on failure.
    
    Previously the callers were only setting errorValue on Success, when
    it's ignored, and leaving it alone on failure, when it's sent to the
    client.
    
    Since SetFontPath takes the ClientPtr, let it set client->errorValue
    instead of letting the callers continue to get it wrong.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 63c978c..4dc9ecd 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3406,7 +3406,6 @@ ProcSetFontPath(ClientPtr client)
     unsigned long nbytes, total;
     long nfonts;
     int n, result;
-    int error;
     REQUEST(xSetFontPathReq);
     
     REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
@@ -3424,13 +3423,9 @@ ProcSetFontPath(ClientPtr client)
     }
     if (total >= 4)
 	return(BadLength);
-    result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
-			 &error);
+    result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
     if (!result)
-    {
 	result = client->noClientException;
-	client->errorValue = error;
-    }
     return (result);
 }
 
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index aaa992b..e145254 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1789,9 +1789,8 @@ bail:
     return FontToXError(err);
 }
 
-/* XXX -- do we need to pass error down to each renderer? */
 int
-SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
+SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
 {
     int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
     if (err != Success)
@@ -1801,7 +1800,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
 	if (SetDefaultFontPath(defaultFontPath) != Success)
 	    return BadValue;
     } else {
-	err = SetFontPathElements(npaths, paths, error, FALSE);
+	int bad;
+	err = SetFontPathElements(npaths, paths, &bad, FALSE);
+	client->errorValue = bad;
     }
     return err;
 }
diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c
index 8e4a17e..b6b2e31 100644
--- a/hw/dmx/dmxfont.c
+++ b/hw/dmx/dmxfont.c
@@ -172,7 +172,6 @@ static int dmxProcSetFontPath(ClientPtr client)
     unsigned long  nbytes, total, n;
     long           nfonts;
     int            i, result;
-    int            error;
     unsigned char *oldFontPath, *tmpFontPath;
     int            nOldPaths;
     int            lenOldPaths;
@@ -198,22 +197,19 @@ static int dmxProcSetFontPath(ClientPtr client)
     oldFontPath = malloc(nOldPaths + lenOldPaths);
     memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
 
-    result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
-			 &error);
+    result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
     if (!result) {
+	int error = 0;
 	for (i = 0; i < dmxNumScreens; i++)
 	    if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
 		break;
 
 	if (result) {
-	    int  ignoreresult, ignoreerror;
-
 	    /* Restore old fontpath in the DMX server */
-	    ignoreresult = SetFontPath(client, nOldPaths, oldFontPath,
-				       &ignoreerror);
+	    SetFontPath(client, nOldPaths, oldFontPath);
+	    client->errorValue = error;
 	} else {
 	    result = client->noClientException;
-	    client->errorValue = error;
 	}
     }
 
@@ -315,7 +311,6 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
 	    int   newnpaths = 0;
 	    int   len = 0;
 	    int   j = 0;
-	    int   error;
 
 	    dmxLog(dmxError,
 		   "These font paths will not be used because the "
@@ -361,8 +356,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
 		}
 	    }
 
-	    if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp,
-			    &error)) {
+	    if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp)) {
 		/* Note that this should never happen since all of the
 		 * FPEs were previously valid. */
 		dmxLog(dmxError, "Cannot reset the default font path.\n");
diff --git a/include/dixfont.h b/include/dixfont.h
index e444a20..cf86f54 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -96,8 +96,7 @@ extern _X_EXPORT int ImageText(ClientPtr /*client*/,
 
 extern _X_EXPORT int SetFontPath(ClientPtr /*client*/,
 		       int /*npaths*/,
-		       unsigned char * /*paths*/,
-		       int * /*error*/);
+		       unsigned char * /*paths*/);
 
 extern _X_EXPORT int SetDefaultFontPath(char * /*path*/);
 
commit 801162919d1c625d950a5d105ae4b3487ebc30a7
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 01:55:36 2010 +0700

    Removed outdated comments obsoleted by documentation in headers
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/utils.c b/os/utils.c
index c89da94..7aa392a 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1039,11 +1039,6 @@ Xalloc(unsigned long amount)
     return malloc(amount);
 }
 
-/*****************
- * XNFalloc
- * "no failure" alloc
- *****************/
-
 void *
 XNFalloc(unsigned long amount)
 {
@@ -1053,20 +1048,12 @@ XNFalloc(unsigned long amount)
     return ptr;
 }
 
-/*****************
- * Xcalloc
- *****************/
-
 void *
 Xcalloc(unsigned long amount)
 {
     return calloc(1, amount);
 }
 
-/*****************
- * XNFcalloc
- *****************/
-
 void *
 XNFcalloc(unsigned long amount)
 {
@@ -1076,10 +1063,6 @@ XNFcalloc(unsigned long amount)
     return ret;
 }
 
-/*****************
- * Xrealloc
- *****************/
-
 void *
 Xrealloc(void *ptr, unsigned long amount)
 {
@@ -1097,11 +1080,6 @@ Xrealloc(void *ptr, unsigned long amount)
 
     return realloc(ptr, amount);
 }
-                    
-/*****************
- * XNFrealloc 
- * "no failure" realloc
- *****************/
 
 void *
 XNFrealloc(void *ptr, unsigned long amount)
@@ -1112,11 +1090,6 @@ XNFrealloc(void *ptr, unsigned long amount)
     return ret;
 }
 
-/*****************
- *  Xfree
- *    calls free 
- *****************/    
-
 void
 Xfree(void *ptr)
 {
commit 4d55c8c4ffcb5d6c6500b462a41ace8e2359151d
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 01:54:13 2010 +0700

    Use lowercase variant of XNFalloc and Xstrdup
    
    Using one variant of function/macro makes it easier to fix the code
    later.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index cc58b89..aaa992b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1836,7 +1836,7 @@ SetDefaultFontPath(char *path)
     if (!start) {
 	temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
     } else {
-	temp_path = Xstrdup(path);
+	temp_path = xstrdup(path);
     }
     if (!temp_path)
         return BadAlloc;
diff --git a/os/xprintf.c b/os/xprintf.c
index 3fe19b3..71a4424 100644
--- a/os/xprintf.c
+++ b/os/xprintf.c
@@ -84,7 +84,7 @@ XNFvprintf(const char *format, va_list va)
     size = vsnprintf(NULL, 0, format, va2);
     va_end(va2);
 
-    ret = (char *)XNFalloc(size + 1);
+    ret = (char *)xnfalloc(size + 1);
     if (ret == NULL)
         return NULL;
 
commit 3f3ff971ecff9936cebafc813af9193b97bba89c
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 01:44:06 2010 +0700

    Replace X-allocation functions with their C89 counterparts
    
    The only remaining X-functions used in server are XNF*, the rest is converted to
    plain alloc/calloc/realloc/free/strdup.
    
    X* functions are still exported from server and x* macros are still defined in
    header file, so both ABI and API are not affected by this change.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index d5965c2..38b2f48 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -158,7 +158,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
     if (pScreen->myNum == 0)
 	REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
 
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
 
     return (*pScreen->CloseScreen) (i, pScreen);
 }
@@ -328,7 +328,7 @@ XineramaDestroyClip(GCPtr pGC)
 int
 XineramaDeleteResource(pointer data, XID id)
 {
-    xfree(data);
+    free(data);
     return 1;
 }
 
@@ -376,7 +376,7 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
 {
     XineramaConnectionCallbackList *newlist;
 
-    if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
+    if(!(newlist = malloc(sizeof(XineramaConnectionCallbackList))))
 	return FALSE;
 
     newlist->next = ConnectionCallbackList;
@@ -474,7 +474,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 	 */
 
 	panoramiXdataPtr = (PanoramiXData *) 
-		xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
+		calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
 
 	if (!panoramiXdataPtr)
 	    break;
@@ -486,7 +486,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
 	
 	for (i = 0; i < PanoramiXNumScreens; i++) {
 	   pScreen = screenInfo.screens[i];
-	   pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
+	   pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
 	   dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
 			 pScreenPriv);
 	   if(!pScreenPriv) {
@@ -675,8 +675,8 @@ Bool PanoramiXCreateConnectionBlock(void)
     connSetupPrefix.length = bytes_to_int32(length);
 
     for (i = 0; i < PanoramiXNumDepths; i++)
-	xfree(PanoramiXDepths[i].vids);
-    xfree(PanoramiXDepths);
+	free(PanoramiXDepths[i].vids);
+    free(PanoramiXDepths);
     PanoramiXDepths = NULL;
 
     /*
@@ -699,7 +699,7 @@ Bool PanoramiXCreateConnectionBlock(void)
 	tmp = (pointer)ConnectionCallbackList;
 	(*ConnectionCallbackList->func)();
 	ConnectionCallbackList = ConnectionCallbackList->next;
-	xfree(tmp);
+	free(tmp);
     }
 
     return TRUE;
@@ -750,13 +750,13 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
 
     j = PanoramiXNumDepths;
     PanoramiXNumDepths++;
-    PanoramiXDepths = xrealloc(PanoramiXDepths,
+    PanoramiXDepths = realloc(PanoramiXDepths,
 	    PanoramiXNumDepths * sizeof(DepthRec));
     PanoramiXDepths[j].depth = pDepth->depth;
     PanoramiXDepths[j].numVids = 0;
     /* XXX suboptimal, should grow these dynamically */
     if(pDepth->numVids)
-	PanoramiXDepths[j].vids = xalloc(sizeof(VisualID) * pDepth->numVids);
+	PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
     else
 	PanoramiXDepths[j].vids = NULL;
 }
@@ -792,7 +792,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
     /* found a matching visual on all screens, add it to the subset list */
     j = PanoramiXNumVisuals;
     PanoramiXNumVisuals++;
-    PanoramiXVisuals = xrealloc(PanoramiXVisuals,
+    PanoramiXVisuals = realloc(PanoramiXVisuals,
 	    PanoramiXNumVisuals * sizeof(VisualRec));
 
     memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
@@ -824,11 +824,11 @@ PanoramiXConsolidate(void)
     for (i = 0; i < pScreen->numVisuals; i++)
 	PanoramiXMaybeAddVisual(pVisual++);
 
-    root = xalloc(sizeof(PanoramiXRes));
+    root = malloc(sizeof(PanoramiXRes));
     root->type = XRT_WINDOW;
-    defmap = xalloc(sizeof(PanoramiXRes));
+    defmap = malloc(sizeof(PanoramiXRes));
     defmap->type = XRT_COLORMAP;
-    saver = xalloc(sizeof(PanoramiXRes));
+    saver = malloc(sizeof(PanoramiXRes));
     saver->type = XRT_WINDOW;
 
     for (i =  0; i < PanoramiXNumScreens; i++) {
@@ -893,7 +893,7 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
     for (i = 256; i--; )
 	ProcVector[i] = SavedProcVector[i];
 
-    Xfree(panoramiXdataPtr);    
+    free(panoramiXdataPtr);
 }
 
 
@@ -1202,7 +1202,7 @@ XineramaGetImageData(
 
 		if(sizeNeeded > size) {
 		    char *tmpdata = ScratchMem;
-		    ScratchMem = xrealloc(ScratchMem, sizeNeeded);
+		    ScratchMem = realloc(ScratchMem, sizeNeeded);
 		    if(ScratchMem)
 			size = sizeNeeded;
 		    else {
@@ -1277,7 +1277,7 @@ XineramaGetImageData(
     }
 
     if(ScratchMem)
-	xfree(ScratchMem);
+	free(ScratchMem);
 
     REGION_UNINIT(pScreen, &SrcRegion);
     REGION_UNINIT(pScreen, &GrabRegion);
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 6635db9..75f758d 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -120,7 +120,7 @@ int PanoramiXCreateWindow(ClientPtr client)
 	}
     }
 
-    if(!(newWin = xalloc(sizeof(PanoramiXRes))))
+    if(!(newWin = malloc(sizeof(PanoramiXRes))))
         return BadAlloc;
 
     newWin->type = XRT_WINDOW;
@@ -160,7 +160,7 @@ int PanoramiXCreateWindow(ClientPtr client)
     if (result == Success)
         AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
     else 
-        xfree(newWin);
+        free(newWin);
 
     return (result);
 }
@@ -666,7 +666,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
     if (result != Success)
 	return (result == BadValue) ? BadDrawable : result;
 
-    if(!(newPix = xalloc(sizeof(PanoramiXRes))))
+    if(!(newPix = malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPix->type = XRT_PIXMAP;
@@ -685,7 +685,7 @@ int PanoramiXCreatePixmap(ClientPtr client)
     if (result == Success)
 	AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
     else 
-	xfree(newPix);
+	free(newPix);
 
     return (result);
 }
@@ -771,7 +771,7 @@ int PanoramiXCreateGC(ClientPtr client)
 	}
     }
 
-    if(!(newGC = xalloc(sizeof(PanoramiXRes))))
+    if(!(newGC = malloc(sizeof(PanoramiXRes))))
         return BadAlloc;
 
     newGC->type = XRT_GC;
@@ -795,7 +795,7 @@ int PanoramiXCreateGC(ClientPtr client)
     if (result == Success)
         AddResource(newGC->info[0].id, XRT_GC, newGC);
     else 
-        xfree(newGC);
+        free(newGC);
 
     return (result);
 }
@@ -1064,7 +1064,7 @@ int PanoramiXCopyArea(ClientPtr client)
 	}
 
 	pitch = PixmapBytePad(stuff->width, drawables[0]->depth); 
-	if(!(data = xcalloc(1, stuff->height * pitch)))
+	if(!(data = calloc(1, stuff->height * pitch)))
 	    return BadAlloc;
 
 	XineramaGetImageData(drawables, srcx, srcy, 
@@ -1076,7 +1076,7 @@ int PanoramiXCopyArea(ClientPtr client)
 	    VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess);
 	    if(drawables[0]->depth != pDst->depth) {
 		client->errorValue = stuff->dstDrawable;
-		xfree(data);
+		free(data);
 		return (BadMatch);
 	    }
 
@@ -1087,7 +1087,7 @@ int PanoramiXCopyArea(ClientPtr client)
 	    if(dstShared) break;
 	}
 
-	xfree(data);
+	free(data);
 
 	result = Success;
     } else {
@@ -1301,7 +1301,7 @@ int PanoramiXPolyPoint(ClientPtr client)
     isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
     npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
     if (npoint > 0) {
-        origPts = xalloc(npoint * sizeof(xPoint));
+        origPts = malloc(npoint * sizeof(xPoint));
         memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1328,7 +1328,7 @@ int PanoramiXPolyPoint(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyPoint])(client);
 	    if(result != Success) break;
         }
-        xfree(origPts);
+        free(origPts);
         return (result);
     } else
 	return (client->noClientException);
@@ -1361,7 +1361,7 @@ int PanoramiXPolyLine(ClientPtr client)
     isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
     npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
     if (npoint > 0){
-        origPts = xalloc(npoint * sizeof(xPoint));
+        origPts = malloc(npoint * sizeof(xPoint));
         memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1388,7 +1388,7 @@ int PanoramiXPolyLine(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyLine])(client);
 	    if(result != Success) break;
         }
-        xfree(origPts);
+        free(origPts);
         return (result);
    } else
 	return (client->noClientException);
@@ -1424,7 +1424,7 @@ int PanoramiXPolySegment(ClientPtr client)
     if(nsegs & 4) return BadLength;
     nsegs >>= 3;
     if (nsegs > 0) {
-	origSegs = xalloc(nsegs * sizeof(xSegment));
+	origSegs = malloc(nsegs * sizeof(xSegment));
         memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1451,7 +1451,7 @@ int PanoramiXPolySegment(ClientPtr client)
 	    result = (* SavedProcVector[X_PolySegment])(client);
 	    if(result != Success) break;
     	}
-	xfree(origSegs);
+	free(origSegs);
 	return (result);
     } else
 	  return (client->noClientException);
@@ -1487,7 +1487,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
     if(nrects & 4) return BadLength;
     nrects >>= 3;
     if (nrects > 0){
-	origRecs = xalloc(nrects * sizeof(xRectangle));
+	origRecs = malloc(nrects * sizeof(xRectangle));
 	memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1513,7 +1513,7 @@ int PanoramiXPolyRectangle(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyRectangle])(client);
 	    if(result != Success) break;
 	}
-	xfree(origRecs);
+	free(origRecs);
 	return (result);
     } else
        return (client->noClientException);
@@ -1549,7 +1549,7 @@ int PanoramiXPolyArc(ClientPtr client)
     if(narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
     if (narcs > 0){
-	origArcs = xalloc(narcs * sizeof(xArc));
+	origArcs = malloc(narcs * sizeof(xArc));
 	memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1573,7 +1573,7 @@ int PanoramiXPolyArc(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyArc])(client);
 	    if(result != Success) break;
         }
-	xfree(origArcs);
+	free(origArcs);
 	return (result);
     } else
        return (client->noClientException);
@@ -1607,7 +1607,7 @@ int PanoramiXFillPoly(ClientPtr client)
 
     count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
     if (count > 0){
-	locPts = xalloc(count * sizeof(DDXPointRec));
+	locPts = malloc(count * sizeof(DDXPointRec));
 	memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1634,7 +1634,7 @@ int PanoramiXFillPoly(ClientPtr client)
 	    result = (* SavedProcVector[X_FillPoly])(client);
 	    if(result != Success) break;
 	}
-	xfree(locPts);
+	free(locPts);
 	return (result);
     } else
        return (client->noClientException);
@@ -1670,7 +1670,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
     if(things & 4) return BadLength;
     things >>= 3;
     if (things > 0){
-	origRects = xalloc(things * sizeof(xRectangle));
+	origRects = malloc(things * sizeof(xRectangle));
 	memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1695,7 +1695,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyFillRectangle])(client);
 	    if(result != Success) break;
 	}
-	xfree(origRects);
+	free(origRects);
 	return (result);
     } else
        return (client->noClientException);
@@ -1731,7 +1731,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
     if (narcs % sizeof(xArc)) return BadLength;
     narcs /= sizeof(xArc);
     if (narcs > 0) {
-	origArcs = xalloc(narcs * sizeof(xArc));
+	origArcs = malloc(narcs * sizeof(xArc));
 	memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
         FOR_NSCREENS_FORWARD(j){
 
@@ -1756,7 +1756,7 @@ int PanoramiXPolyFillArc(ClientPtr client)
 	    result = (* SavedProcVector[X_PolyFillArc])(client);
 	    if(result != Success) break;
 	}
-	xfree(origArcs);
+	free(origArcs);
 	return (result);
     } else
        return (client->noClientException);
@@ -1907,7 +1907,7 @@ int PanoramiXGetImage(ClientPtr client)
 	    linesPerBuf = h;
     }
     length = linesPerBuf * widthBytesLine;
-    if(!(pBuf = xalloc(length)))
+    if(!(pBuf = malloc(length)))
 	return (BadAlloc);
 
     WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
@@ -1953,7 +1953,7 @@ int PanoramiXGetImage(ClientPtr client)
             }
 	}
     }
-    xfree(pBuf);
+    free(pBuf);
     return (client->noClientException);
 }
 
@@ -2141,7 +2141,7 @@ int PanoramiXCreateColormap(ClientPtr client)
     if (result != Success)
 	return (result == BadValue) ? BadWindow : result;
 
-    if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
+    if(!(newCmap = malloc(sizeof(PanoramiXRes))))
         return BadAlloc;
 
     newCmap->type = XRT_COLORMAP;
@@ -2161,7 +2161,7 @@ int PanoramiXCreateColormap(ClientPtr client)
     if (result == Success)
         AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
     else 
-        xfree(newCmap);
+        free(newCmap);
 
     return (result);
 }
@@ -2212,7 +2212,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
     if (result != Success)
         return (result == BadValue) ? BadColor : result;
 
-    if(!(newCmap = xalloc(sizeof(PanoramiXRes))))
+    if(!(newCmap = malloc(sizeof(PanoramiXRes))))
         return BadAlloc;
 
     newCmap->type = XRT_COLORMAP;
@@ -2230,7 +2230,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
     if (result == Success)
         AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
     else 
-        xfree(newCmap);
+        free(newCmap);
 
     return (result);
 }
diff --git a/Xext/saver.c b/Xext/saver.c
index aa2e614..f89ee18 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -235,7 +235,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
     dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
 #define SetupScreen(s)	ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
 
-#define New(t)	(xalloc (sizeof (t)))
+#define New(t)	(malloc(sizeof (t)))
 
 /****************
  * ScreenSaverExtensionInit
@@ -283,7 +283,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
     if (!pPriv->attr && !pPriv->events &&
 	!pPriv->hasWindow && pPriv->installedMap == None)
     {
-	xfree (pPriv);
+	free(pPriv);
 	SetScreenPrivate (pScreen, NULL);
 	savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
     }
@@ -343,7 +343,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
     {
 	FreeResource (pEv->resource, SaverEventType);
 	*pPrev = pEv->next;
-	xfree (pEv);
+	free(pEv);
 	CheckScreenPrivate (pScreen);
     }
     else
@@ -387,8 +387,8 @@ static void
 FreeScreenAttr (ScreenSaverAttrPtr pAttr)
 {
     FreeAttrs (pAttr);
-    xfree (pAttr->values);
-    xfree (pAttr);
+    free(pAttr->values);
+    free(pAttr);
 }
 
 static int
@@ -407,7 +407,7 @@ ScreenSaverFreeEvents (pointer value, XID id)
     if (!pEv)
 	return TRUE;
     *pPrev = pEv->next;
-    xfree (pEv);
+    free(pEv);
     CheckScreenPrivate (pScreen);
     return TRUE;
 }
@@ -446,7 +446,7 @@ ScreenSaverFreeSuspend (pointer value, XID id)
 	if (this == data)
 	{
 	    *prev = this->next;
-	    xfree (this);
+	    free(this);
 	    break;
 	}
     }
@@ -644,14 +644,14 @@ CreateSaverWindow (ScreenPtr pScreen)
     wantMap = wColormap (pWin);
     if (wantMap == None)
 	return TRUE;
-    installedMaps = xalloc (pScreen->maxInstalledCmaps * sizeof (Colormap));
+    installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof (Colormap));
     numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
 						    (pScreen, installedMaps);
     for (i = 0; i < numInstalled; i++) 
 	if (installedMaps[i] == wantMap)
 	    break;
 
-    xfree ((char *) installedMaps);
+    free((char *) installedMaps);
 
     if (i < numInstalled)
 	return TRUE;
@@ -982,7 +982,7 @@ ScreenSaverSetAttributes (ClientPtr client)
 	goto bail;
     }
     /* over allocate for override redirect */
-    values = xalloc ((len + 1) * sizeof (unsigned long));
+    values = malloc((len + 1) * sizeof (unsigned long));
     if (!values)
     {
 	ret = BadAlloc;
@@ -1219,8 +1219,8 @@ PatchUp:
     FreeAttrs (pAttr);
 bail:
     CheckScreenPrivate (pScreen);
-    if (pAttr) xfree (pAttr->values);
-    xfree (pAttr);
+    if (pAttr) free(pAttr->values);
+    free(pAttr);
     return ret;
 }
 
@@ -1392,7 +1392,7 @@ ProcScreenSaverSuspend (ClientPtr client)
      * to the record, so the screensaver will be reenabled and the record freed
      * if the client disconnects without reenabling it first.
      */
-    this = xalloc (sizeof (ScreenSaverSuspensionRec));
+    this = malloc(sizeof (ScreenSaverSuspensionRec));
 
     if (!this)
 	return BadAlloc;
@@ -1404,7 +1404,7 @@ ProcScreenSaverSuspend (ClientPtr client)
 
     if (!AddResource (this->clientResource, SuspendType, (pointer) this))
     {
-	xfree (this);
+	free(this);
 	return BadAlloc;
     }
 
diff --git a/Xext/security.c b/Xext/security.c
index af8d205..2685815 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -222,7 +222,7 @@ SecurityDeleteAuthorization(
 	}
 
     SecurityAudit("revoked authorization ID %d\n", pAuth->id);
-    xfree(pAuth);
+    free(pAuth);
     return Success;
 
 } /* SecurityDeleteAuthorization */
@@ -247,7 +247,7 @@ SecurityDeleteAuthorizationEventClient(
 		prev->next = pEventClient->next;
 	    else
 		pAuth->eventClients = pEventClient->next;
-	    xfree(pEventClient);
+	    free(pEventClient);
 	    return(Success);
 	}
 	prev = pEventClient;
@@ -409,7 +409,7 @@ SecurityEventSelectForAuthorization(
 	}
     }
     
-    pEventClient = xalloc(sizeof(OtherClients));
+    pEventClient = malloc(sizeof(OtherClients));
     if (!pEventClient)
 	return BadAlloc;
     pEventClient->mask = mask;
@@ -418,7 +418,7 @@ SecurityEventSelectForAuthorization(
     if (!AddResource(pEventClient->resource, RTEventClient,
 		     (pointer)pAuth))
     {
-	xfree(pEventClient);
+	free(pEventClient);
 	return BadAlloc;
     }
     pAuth->eventClients = pEventClient;
@@ -541,7 +541,7 @@ ProcSecurityGenerateAuthorization(
 
     /* associate additional information with this auth ID */
 
-    pAuth = xalloc(sizeof(SecurityAuthorizationRec));
+    pAuth = malloc(sizeof(SecurityAuthorizationRec));
     if (!pAuth)
     {
 	err = BadAlloc;
@@ -613,7 +613,7 @@ bailout:
     if (removeAuth)
 	RemoveAuthorization(stuff->nbytesAuthProto, protoname,
 			    authdata_len, pAuthdata);
-    if (pAuth) xfree(pAuth);
+    if (pAuth) free(pAuth);
     return err;
 
 } /* ProcSecurityGenerateAuthorization */
diff --git a/Xext/shape.c b/Xext/shape.c
index 58b5c23..f21d633 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -764,7 +764,7 @@ ShapeFreeClient (pointer data, XID id)
 	    	*pHead = pShapeEvent->next;
 	}
     }
-    xfree ((pointer) pShapeEvent);
+    free((pointer) pShapeEvent);
     return 1;
 }
 
@@ -778,9 +778,9 @@ ShapeFreeEvents (pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
 	pNext = pCur->next;
 	FreeResource (pCur->clientResource, ClientType);
-	xfree ((pointer) pCur);
+	free((pointer) pCur);
     }
-    xfree ((pointer) pHead);
+    free((pointer) pHead);
     return 1;
 }
 
@@ -817,7 +817,7 @@ ProcShapeSelectInput (ClientPtr client)
 	}
 
 	/* build the entry */
-    	pNewShapeEvent = xalloc (sizeof (ShapeEventRec));
+	pNewShapeEvent = malloc(sizeof (ShapeEventRec));
     	if (!pNewShapeEvent)
 	    return BadAlloc;
     	pNewShapeEvent->next = 0;
@@ -839,7 +839,7 @@ ProcShapeSelectInput (ClientPtr client)
      	 */
     	if (!pHead)
     	{
-	    pHead = xalloc (sizeof (ShapeEventPtr));
+	    pHead = malloc(sizeof (ShapeEventPtr));
 	    if (!pHead ||
 		!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
 	    {
@@ -866,7 +866,7 @@ ProcShapeSelectInput (ClientPtr client)
 		    pNewShapeEvent->next = pShapeEvent->next;
 		else
 		    *pHead = pShapeEvent->next;
-		xfree (pShapeEvent);
+		free(pShapeEvent);
 	    }
 	}
 	break;
@@ -1030,7 +1030,7 @@ ProcShapeGetRectangles (ClientPtr client)
     }
     if (!region) {
 	nrects = 1;
-	rects = xalloc (sizeof (xRectangle));
+	rects = malloc(sizeof (xRectangle));
 	if (!rects)
 	    return BadAlloc;
 	switch (stuff->kind) {
@@ -1057,7 +1057,7 @@ ProcShapeGetRectangles (ClientPtr client)
 	BoxPtr box;
 	nrects = REGION_NUM_RECTS(region);
 	box = REGION_RECTS(region);
-	rects = xalloc (nrects * sizeof (xRectangle));
+	rects = malloc(nrects * sizeof (xRectangle));
 	if (!rects && nrects)
 	    return BadAlloc;
 	for (i = 0; i < nrects; i++, box++) {
@@ -1080,7 +1080,7 @@ ProcShapeGetRectangles (ClientPtr client)
     }
     WriteToClient (client, sizeof (rep), (char *) &rep);
     WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
-    xfree (rects);
+    free(rects);
     return client->noClientException;
 }
 
diff --git a/Xext/shm.c b/Xext/shm.c
index ab58c27..39b3929 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -226,7 +226,7 @@ ShmCloseScreen(int i, ScreenPtr pScreen)
     ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
     pScreen->CloseScreen = screen_priv->CloseScreen;
     dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
-    xfree (screen_priv);
+    free(screen_priv);
     return (*pScreen->CloseScreen) (i, pScreen);
 }
 
@@ -236,7 +236,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
     ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
     if (!screen_priv)
     {
-	screen_priv = xcalloc (1, sizeof (ShmScrPrivateRec));
+	screen_priv = calloc(1, sizeof (ShmScrPrivateRec));
 	screen_priv->CloseScreen = pScreen->CloseScreen;
 	dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
 	pScreen->CloseScreen = ShmCloseScreen;
@@ -454,7 +454,7 @@ ProcShmAttach(ClientPtr client)
     }
     else
     {
-	shmdesc = xalloc(sizeof(ShmDescRec));
+	shmdesc = malloc(sizeof(ShmDescRec));
 	if (!shmdesc)
 	    return BadAlloc;
 	shmdesc->addr = shmat(stuff->shmid, 0,
@@ -462,7 +462,7 @@ ProcShmAttach(ClientPtr client)
 	if ((shmdesc->addr == ((char *)-1)) ||
 	    SHMSTAT(stuff->shmid, &buf))
 	{
-	    xfree(shmdesc);
+	    free(shmdesc);
 	    return BadAccess;
 	}
 
@@ -472,7 +472,7 @@ ProcShmAttach(ClientPtr client)
 
 	if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
 	    shmdt(shmdesc->addr);
-	    xfree(shmdesc);
+	    free(shmdesc);
 	    return BadAccess;
 	}
 
@@ -502,7 +502,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
     for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
 	;
     *prev = shmdesc->next;
-    xfree(shmdesc);
+    free(shmdesc);
     return Success;
 }
 
@@ -671,7 +671,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
 	    return(BadMatch);
     }
 
-    drawables = xcalloc(PanoramiXNumScreens, sizeof(DrawablePtr));
+    drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
     if(!drawables)
 	return(BadAlloc);
 
@@ -681,7 +681,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
 			       DixReadAccess);
 	if (rc != Success)
 	{
-	    xfree(drawables);
+	    free(drawables);
 	    return rc;
 	}
     }
@@ -722,7 +722,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
 	    }
 	}
     }
-    xfree(drawables);
+    free(drawables);
     
     if (client->swapped) {
 	int n;
@@ -795,7 +795,7 @@ CreatePmap:
 
     VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
 
-    if(!(newPix = xalloc(sizeof(PanoramiXRes))))
+    if(!(newPix = malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPix->type = XRT_PIXMAP;
@@ -836,7 +836,7 @@ CreatePmap:
 	    (*pScreen->DestroyPixmap)(pMap);
 	    FreeResource(newPix->info[j].id, RT_NONE);
 	}
-	xfree(newPix);
+	free(newPix);
     } else 
 	AddResource(stuff->pid, XRT_PIXMAP, newPix);
 
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 075f428..3fd06ac 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -94,7 +94,7 @@ ClientSleepUntil (ClientPtr client,
 	SertafiedGeneration = serverGeneration;
 	BlockHandlerRegistered = FALSE;
     }
-    pRequest = xalloc (sizeof (SertafiedRec));
+    pRequest = malloc(sizeof (SertafiedRec));
     if (!pRequest)
 	return FALSE;
     pRequest->pClient = client;
@@ -107,7 +107,7 @@ ClientSleepUntil (ClientPtr client,
 					     SertafiedWakeupHandler,
 					     (pointer) 0))
 	{
-	    xfree (pRequest);
+	    free(pRequest);
 	    return FALSE;
 	}
 	BlockHandlerRegistered = TRUE;
@@ -161,7 +161,7 @@ SertafiedDelete (pointer value, XID id)
 	}
     if (pRequest->notifyFunc)
 	(*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
-    xfree (pRequest);
+    free(pRequest);
     return TRUE;
 }
 
diff --git a/Xext/sync.c b/Xext/sync.c
index e865e52..94ac5df 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -158,7 +158,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger)
 	    else
 		pTrigger->pCounter->pTriglist = pCur->next;
 
-	    xfree(pCur);
+	    free(pCur);
 	    break;
 	}
 	
@@ -186,7 +186,7 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger)
 	    return Success;
     }
 
-    if (!(pCur = xalloc(sizeof(SyncTriggerList))))
+    if (!(pCur = malloc(sizeof(SyncTriggerList))))
 	return BadAlloc;
 
     pCur->pTrigger = pTrigger;
@@ -417,7 +417,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
 
     if (client->clientGone)
 	return;
-    pev = pEvents = xalloc(num_events * sizeof(xSyncCounterNotifyEvent));
+    pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
     if (!pEvents)
 	return;
     UpdateCurrentTime();
@@ -438,7 +438,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
     }
     /* swapping will be taken care of by this */
     WriteEventsToClient(client, num_events, (xEvent *)pEvents);
-    xfree(pEvents);
+    free(pEvents);
 }
 
 
@@ -545,7 +545,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
 
     pAwaitUnion = (SyncAwaitUnion *)pAwait->pHeader;
     numwaits = pAwaitUnion->header.num_waitconditions;
-    ppAwait = xalloc(numwaits * sizeof(SyncAwait *));
+    ppAwait = malloc(numwaits * sizeof(SyncAwait *));
     if (!ppAwait)
 	goto bail;
 
@@ -614,7 +614,7 @@ SyncAwaitTriggerFired(SyncTrigger *pTrigger)
     if (num_events)
 	SyncSendCounterNotifyEvents(pAwaitUnion->header.client, ppAwait,
 				    num_events);
-    xfree(ppAwait);
+    free(ppAwait);
 
 bail:
     /* unblock the client */
@@ -695,7 +695,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
 
     /* add new client to pAlarm->pEventClients */
 
-    pClients = xalloc(sizeof(SyncAlarmClientList));
+    pClients = malloc(sizeof(SyncAlarmClientList));
     if (!pClients)
 	return BadAlloc;
 
@@ -706,7 +706,7 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents)
     pClients->delete_id = FakeClientID(client->index);
     if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm))
     {
-	xfree(pClients);
+	free(pClients);
 	return BadAlloc;
     }
 
@@ -824,12 +824,12 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue)
 {
     SyncCounter *pCounter;
 
-    if (!(pCounter = xalloc(sizeof(SyncCounter))))
+    if (!(pCounter = malloc(sizeof(SyncCounter))))
 	return NULL;
 
     if (!AddResource(id, RTCounter, (pointer) pCounter))
     {
-	xfree(pCounter);
+	free(pCounter);
 	return NULL;
     }
 
@@ -863,7 +863,7 @@ SyncCreateSystemCounter(
 {
     SyncCounter    *pCounter;
 
-    SysCounterList = xrealloc(SysCounterList,
+    SysCounterList = realloc(SysCounterList,
 			    (SyncNumSystemCounters+1)*sizeof(SyncCounter *));
     if (!SysCounterList)
 	return NULL;
@@ -886,7 +886,7 @@ SyncCreateSystemCounter(
     {
 	SysCounterInfo *psci;
 
-	psci = xalloc(sizeof(SysCounterInfo));
+	psci = malloc(sizeof(SysCounterInfo));
 	if (!psci)
 	{
 	    FreeResource(pCounter->id, RT_NONE);
@@ -1008,7 +1008,7 @@ FreeAlarm(void *addr, XID id)
 
     SyncDeleteTriggerFromCounter(&pAlarm->trigger);
 
-    xfree(pAlarm);
+    free(pAlarm);
     return Success;
 }
 
@@ -1029,13 +1029,13 @@ FreeCounter(void *env, XID id)
     {
 	(*ptl->pTrigger->CounterDestroyed)(ptl->pTrigger);
 	pnext = ptl->next;
-	xfree(ptl); /* destroy the trigger list as we go */
+	free(ptl); /* destroy the trigger list as we go */
     }
     if (IsSystemCounter(pCounter))
     {
 	int i, found = 0;
 
-	xfree(pCounter->pSysCounterInfo);
+	free(pCounter->pSysCounterInfo);
 
 	/* find the counter in the list of system counters and remove it */
 
@@ -1059,7 +1059,7 @@ FreeCounter(void *env, XID id)
 	}
 	SyncNumSystemCounters--;
     }
-    xfree(pCounter);
+    free(pCounter);
     return Success;
 }
 
@@ -1088,7 +1088,7 @@ FreeAwait(void *addr, XID id)
 	if (pCounter && !pCounter->beingDestroyed)
 	    SyncDeleteTriggerFromCounter(&pAwait->trigger);
     }
-    xfree(pAwaitUnion);
+    free(pAwaitUnion);
     return Success;
 }
 
@@ -1109,7 +1109,7 @@ FreeAlarmClient(void *value, XID id)
 		pPrev->next = pCur->next;
 	    else
 		pAlarm->pEventClients = pCur->next;
-	    xfree(pCur);
+	    free(pCur);
 	    return Success;
 	}
     }
@@ -1174,7 +1174,7 @@ ProcSyncListSystemCounters(ClientPtr client)
 
     if (len)
     {
-	walklist = list = xalloc(len);
+	walklist = list = malloc(len);
 	if (!list)
 	    return BadAlloc;
     }
@@ -1220,7 +1220,7 @@ ProcSyncListSystemCounters(ClientPtr client)
     if (len)
     {
 	WriteToClient(client, len, (char *) list);
-	xfree(list);
+	free(list);
     }
 
     return client->noClientException;
@@ -1448,7 +1448,7 @@ ProcSyncAwait(ClientPtr client)
     /*  all the memory for the entire await list is allocated
      *  here in one chunk
      */
-    pAwaitUnion = xalloc((items+1) * sizeof(SyncAwaitUnion));
+    pAwaitUnion = malloc((items+1) * sizeof(SyncAwaitUnion));
     if (!pAwaitUnion)
 	return BadAlloc;
 
@@ -1457,7 +1457,7 @@ ProcSyncAwait(ClientPtr client)
     pAwaitUnion->header.delete_id = FakeClientID(client->index);
     if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion))
     {
-	xfree(pAwaitUnion);
+	free(pAwaitUnion);
 	return BadAlloc;
     }
 
@@ -1595,7 +1595,7 @@ ProcSyncCreateAlarm(ClientPtr client)
     if (len != (Ones(vmask) + Ones(vmask & (XSyncCAValue|XSyncCADelta))))
 	return BadLength;
 
-    if (!(pAlarm = xalloc(sizeof(SyncAlarm))))
+    if (!(pAlarm = malloc(sizeof(SyncAlarm))))
     {
 	return BadAlloc;
     }
@@ -1612,7 +1612,7 @@ ProcSyncCreateAlarm(ClientPtr client)
     status = SyncInitTrigger(client, pTrigger, None, XSyncCAAllTrigger);
     if (status != Success)
     {
-	xfree(pAlarm);
+	free(pAlarm);
 	return status;
     }
 
@@ -1626,13 +1626,13 @@ ProcSyncCreateAlarm(ClientPtr client)
 				       (CARD32 *)&stuff[1]);
     if (status != Success)
     {
-	xfree(pAlarm);
+	free(pAlarm);
 	return status;
     }
 
     if (!AddResource(stuff->id, RTAlarm, pAlarm))
     {
-	xfree(pAlarm);
+	free(pAlarm);
 	return BadAlloc;
     }
 
@@ -2091,7 +2091,7 @@ SAlarmNotifyEvent(xSyncAlarmNotifyEvent *from, xSyncAlarmNotifyEvent *to)
 static void
 SyncResetProc(ExtensionEntry *extEntry)
 {
-    xfree(SysCounterList);
+    free(SysCounterList);
     SysCounterList = NULL;
     RTCounter = 0;
 }
diff --git a/Xext/xace.c b/Xext/xace.c
index bf0e98f..53f4b4d 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -274,7 +274,7 @@ XaceCensorImage(
 
 	/* convert region to list-of-rectangles for PolyFillRect */
 
-	pRects = xalloc(nRects * sizeof(xRectangle));
+	pRects = malloc(nRects * sizeof(xRectangle));
 	if (!pRects)
 	{
 	    failed = TRUE;
@@ -326,7 +326,7 @@ XaceCensorImage(
 	     */
 	    bzero(pBuf, (int)(widthBytesLine * h));
 	}
-	if (pRects)     xfree(pRects);
+	if (pRects)     free(pRects);
 	if (pScratchGC) FreeScratchGC(pScratchGC);
 	if (pPix)       FreeScratchPixmapHeader(pPix);
     }
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 39079a2..1c8e3f2 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -123,7 +123,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
     if (stuff->count > UINT32_MAX / sizeof(XID))
 	    return BadAlloc;
 
-    pids = (XID *)Xalloc(stuff->count * sizeof(XID));
+    pids = (XID *)malloc(stuff->count * sizeof(XID));
     if (!pids)
     {
 	return BadAlloc;
@@ -144,7 +144,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
     	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	WriteSwappedDataToClient(client, count * sizeof(XID), pids);
     }
-    Xfree(pids);
+    free(pids);
     return(client->noClientException);
 }
 
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 68c5d52..312fcc9 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -230,7 +230,7 @@ shmalloc(
     if (size < 3500)
 	return (ShmDescPtr) NULL;
 
-    pDesc = xalloc(sizeof(ShmDescRec));
+    pDesc = malloc(sizeof(ShmDescRec));
     if (!pDesc)
 	return (ShmDescPtr) NULL;
 
@@ -239,7 +239,7 @@ shmalloc(
     if (shmid == -1) {
 	ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
 	       size, strerror(errno));
-	xfree(pDesc);
+	free(pDesc);
 	return (ShmDescPtr) NULL;
     }
 
@@ -247,7 +247,7 @@ shmalloc(
 	ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
 	       size, strerror(errno));
 	shmctl(shmid, IPC_RMID, (void *) 0);
-	xfree(pDesc);
+	free(pDesc);
 	return (ShmDescPtr) NULL;
     }
 
@@ -276,7 +276,7 @@ shmdealloc(
 
     if (pDesc->next) pDesc->next->prev = pDesc->prev;
     *pDesc->prev = pDesc->next;
-    xfree(pDesc);
+    free(pDesc);
 }
 
 #endif
@@ -464,7 +464,7 @@ ProcXF86BigfontQueryFont(
 		shmid = pDesc->shmid;
 	    } else {
 #endif
-		pCI = xalloc(nCharInfos * sizeof(xCharInfo));
+		pCI = malloc(nCharInfos * sizeof(xCharInfo));
 		if (!pCI)
 		    return BadAlloc;
 #ifdef HAS_SHM
@@ -526,9 +526,9 @@ ProcXF86BigfontQueryFont(
 	    if (hashModulus > nCharInfos+1)
 		hashModulus = nCharInfos+1;
 
-	    tmp = xalloc((4*nCharInfos+1) * sizeof(CARD16));
+	    tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
 	    if (!tmp) {
-		if (!pDesc) xfree(pCI);
+		if (!pDesc) free(pCI);
 		return BadAlloc;
 	    }
 	    pIndex2UniqIndex = tmp;
@@ -610,12 +610,12 @@ ProcXF86BigfontQueryFont(
 	      ? nUniqCharInfos * sizeof(xCharInfo)
 	        + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
 	      : 0);
-	xXF86BigfontQueryFontReply* reply = xalloc(rlength);
+	xXF86BigfontQueryFontReply* reply = malloc(rlength);
 	char* p;
 	if (!reply) {
 	    if (nCharInfos > 0) {
-		if (shmid == -1) xfree(pIndex2UniqIndex);
-		if (!pDesc) xfree(pCI);
+		if (shmid == -1) free(pIndex2UniqIndex);
+		if (!pDesc) free(pCI);
 	    }
 	    return BadAlloc;
 	}
@@ -693,10 +693,10 @@ ProcXF86BigfontQueryFont(
 	    }
 	}
 	WriteToClient(client, rlength, (char *)reply);
-	xfree(reply);
+	free(reply);
 	if (nCharInfos > 0) {
-	    if (shmid == -1) xfree(pIndex2UniqIndex);
-	    if (!pDesc) xfree(pCI);
+	    if (shmid == -1) free(pIndex2UniqIndex);
+	    if (!pDesc) free(pCI);
 	}
 	return (client->noClientException);
     }
diff --git a/Xext/xres.c b/Xext/xres.c
index 109aa63..14641f7 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -63,7 +63,7 @@ ProcXResQueryClients (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXResQueryClientsReq);
 
-    current_clients = xalloc(currentMaxClients * sizeof(int));
+    current_clients = malloc(currentMaxClients * sizeof(int));
 
     num_clients = 0;
     for(i = 0; i < currentMaxClients; i++) {
@@ -101,7 +101,7 @@ ProcXResQueryClients (ClientPtr client)
         }
     }
 
-    xfree(current_clients);
+    free(current_clients);
 
     return (client->noClientException);
 }
@@ -132,7 +132,7 @@ ProcXResQueryClientResources (ClientPtr client)
         return BadValue;
     }
 
-    counts = xcalloc(lastResourceType + 1, sizeof(int));
+    counts = calloc(lastResourceType + 1, sizeof(int));
 
     FindAllClientResources(clients[clientID], ResFindAllRes, counts);
 
@@ -182,7 +182,7 @@ ProcXResQueryClientResources (ClientPtr client)
         }
     }
 
-    xfree(counts);
+    free(counts);
     
     return (client->noClientException);
 }
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index aa55734..4d55e15 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -52,7 +52,7 @@ typedef struct {
 static security_context_t
 SELinuxCopyContext(char *ptr, unsigned len)
 {
-    security_context_t copy = xalloc(len + 1);
+    security_context_t copy = malloc(len + 1);
     if (!copy)
 	return NULL;
     strncpy(copy, ptr, len);
@@ -141,7 +141,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
 	    rc = BadValue;
     }
 
-    xfree(ctx);
+    free(ctx);
     return rc;
 }
 
@@ -198,7 +198,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
 
     rc = Success;
 out:
-    xfree(ctx);
+    free(ctx);
     return rc;
 }
 
@@ -334,7 +334,7 @@ SELinuxFreeItems(SELinuxListItemRec *items, int count)
 	freecon(items[k].octx);
 	freecon(items[k].dctx);
     }
-    xfree(items);
+    free(items);
 }
 
 static int
@@ -345,7 +345,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
     SELinuxListItemsReply rep;
     CARD32 *buf;
 
-    buf = xcalloc(size, sizeof(CARD32));
+    buf = calloc(size, sizeof(CARD32));
     if (size && !buf) {
 	rc = BadAlloc;
 	goto out;
@@ -391,7 +391,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
 
     /* Free stuff and return */
     rc = client->noClientException;
-    xfree(buf);
+    free(buf);
 out:
     SELinuxFreeItems(items, count);
     return rc;
@@ -417,7 +417,7 @@ ProcSELinuxListProperties(ClientPtr client)
     count = 0;
     for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
 	count++;
-    items = xcalloc(count, sizeof(SELinuxListItemRec));
+    items = calloc(count, sizeof(SELinuxListItemRec));
     if (count && !items)
 	return BadAlloc;
 
@@ -451,7 +451,7 @@ ProcSELinuxListSelections(ClientPtr client)
     count = 0;
     for (pSel = CurrentSelections; pSel; pSel = pSel->next)
 	count++;
-    items = xcalloc(count, sizeof(SELinuxListItemRec));
+    items = calloc(count, sizeof(SELinuxListItemRec));
     if (count && !items)
 	return BadAlloc;
 
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index 6c8c8cd..135992a 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -151,7 +151,7 @@ SELinuxLabelClient(ClientPtr client)
 	if (bytes <= 0)
 	    goto finish;
 
-	subj->command = xalloc(bytes);
+	subj->command = malloc(bytes);
 	if (!subj->command)
 	    goto finish;
 
@@ -830,7 +830,7 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     PrivateCallbackRec *rec = calldata;
     SELinuxSubjectRec *subj = *rec->value;
 
-    xfree(subj->command);
+    free(subj->command);
 }
 
 static void
diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c
index 9b5023a..e5929fa 100644
--- a/Xext/xselinux_label.c
+++ b/Xext/xselinux_label.c
@@ -62,7 +62,7 @@ SELinuxArraySet(SELinuxArrayRec *rec, unsigned key, void *val)
 {
     if (key >= rec->size) {
 	/* Need to increase size of array */
-	rec->array = xrealloc(rec->array, (key + 1) * sizeof(val));
+	rec->array = realloc(rec->array, (key + 1) * sizeof(val));
 	if (!rec->array)
 	    return FALSE;
 	memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
@@ -79,10 +79,10 @@ SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
     if (free_elements) {
 	unsigned i = rec->size;
 	while (i)
-	    xfree(rec->array[--i]);
+	    free(rec->array[--i]);
     }
 
-    xfree(rec->array);
+    free(rec->array);
     rec->size = 0;
     rec->array = NULL;
 }
@@ -132,7 +132,7 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
 
     rec = SELinuxArrayGet(&arr_atoms, atom);
     if (!rec) {
-	rec = xcalloc(1, sizeof(SELinuxAtomRec));
+	rec = calloc(1, sizeof(SELinuxAtomRec));
 	if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
 	    return BadAlloc;
     }
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 99b6711..bb5bae6 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -637,7 +637,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
 {
     int retval;
     int len = strlen(name);
-    char *xtestname = xcalloc(len + 7, 1 );
+    char *xtestname = calloc(len + 7, 1 );
     char dummy = 1;
 
     strncpy( xtestname, name, len);
@@ -660,7 +660,7 @@ int AllocXTestDevice (ClientPtr client, char* name,
         XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
     }
 
-    xfree( xtestname );
+    free( xtestname );
 
     return retval;
 }
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 4345672..b8d8d17 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1157,7 +1157,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
 
   num_planes = pImage->num_planes;
 
-  if(!(offsets = xalloc(num_planes << 3)))
+  if(!(offsets = malloc(num_planes << 3)))
 	return BadAlloc;
   pitches = offsets + num_planes;
 
@@ -1180,7 +1180,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
     SwapLongs((CARD32*)offsets, planeLength);
   WriteToClient(client, planeLength << 2, (char*)offsets);
 
-  xfree(offsets);
+  free(offsets);
 
   return Success;
 }
@@ -1924,7 +1924,7 @@ void XineramifyXv(void)
 
       /* now create a resource for each port */
       for(j = 0; j < refAdapt->nPorts; j++) {
-	 PanoramiXRes *port = xalloc(sizeof(PanoramiXRes));
+	 PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
 	 if(!port)
 	    break;
 
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 05a6890..13cd600 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -277,7 +277,7 @@ XvScreenInit(ScreenPtr pScreen)
 
   /* ALLOCATE SCREEN PRIVATE RECORD */
   
-  pxvs = xalloc (sizeof (XvScreenRec));
+  pxvs = malloc(sizeof (XvScreenRec));
   if (!pxvs)
     {
       ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
@@ -314,7 +314,7 @@ XvCloseScreen(
 
   (* pxvs->ddCloseScreen)(ii, pScreen); 
 
-  xfree(pxvs);
+  free(pxvs);
 
   dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
 
@@ -509,7 +509,7 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
     {
       npn = cpn->next;
       if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
-      xfree(cpn);
+      free(cpn);
       cpn = npn;
     }
   return Success;
@@ -928,12 +928,12 @@ XvdiSelectVideoNotify(
 
   if (!pn) 
     {
-      if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
+      if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
 	return BadAlloc;
       tpn->next = NULL;
       if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
 	{
-	  xfree(tpn);
+	  free(tpn);
 	  return BadAlloc;
 	}
     }
@@ -966,7 +966,7 @@ XvdiSelectVideoNotify(
 	}
       else
 	{
-	  if (!(tpn = xalloc(sizeof(XvVideoNotifyRec))))
+	  if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
 	    return BadAlloc;
 	  tpn->next = pn->next;
 	  pn->next = tpn;
@@ -1024,7 +1024,7 @@ XvdiSelectPortNotify(
 
   if (!tpn)
     {
-      if (!(tpn = xalloc(sizeof(XvPortNotifyRec))))
+      if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
 	return BadAlloc;
       tpn->next = pPort->pNotify;
       pPort->pNotify = tpn;
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index c85f85e..abb8e02 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -71,7 +71,7 @@ XvMCDestroyContextRes(pointer data, XID id)
    if(!pContext->refcnt) {
   	 XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
 	(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext)(pContext);
-	xfree(pContext);
+	free(pContext);
    }	   
 
    return Success;
@@ -85,7 +85,7 @@ XvMCDestroySurfaceRes(pointer data, XID id)
    XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
 
    (*pScreenPriv->adaptors[pContext->adapt_num].DestroySurface)(pSurface); 
-   xfree(pSurface);
+   free(pSurface);
 
    XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
 
@@ -101,7 +101,7 @@ XvMCDestroySubpictureRes(pointer data, XID id)
    XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
 
    (*pScreenPriv->adaptors[pContext->adapt_num].DestroySubpicture)(pSubpict); 
-   xfree(pSubpict);
+   free(pSubpict);
 
    XvMCDestroyContextRes((pointer)pContext, pContext->context_id);
 
@@ -226,7 +226,7 @@ ProcXvMCCreateContext(ClientPtr client)
        (stuff->height > surface->max_height))
         return BadValue;
 
-    if(!(pContext = xalloc(sizeof(XvMCContextRec)))) {
+    if(!(pContext = malloc(sizeof(XvMCContextRec)))) {
 	return BadAlloc;
     }
 
@@ -243,7 +243,7 @@ ProcXvMCCreateContext(ClientPtr client)
     result = (*adaptor->CreateContext)(pPort, pContext, &dwords, &data);
 
     if(result != Success) {
-	xfree(pContext);
+	free(pContext);
 	return result;
     }
 
@@ -260,7 +260,7 @@ ProcXvMCCreateContext(ClientPtr client)
     AddResource(pContext->context_id, XvMCRTContext, pContext);
 
     if(data)
-	xfree(data);
+	free(data);
 
     return Success;
 }
@@ -303,7 +303,7 @@ ProcXvMCCreateSurface(ClientPtr client)
 
     pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
 
-    if(!(pSurface = xalloc(sizeof(XvMCSurfaceRec)))) 
+    if(!(pSurface = malloc(sizeof(XvMCSurfaceRec)))) 
         return BadAlloc;
 
     pSurface->surface_id = stuff->surface_id;
@@ -314,7 +314,7 @@ ProcXvMCCreateSurface(ClientPtr client)
                 pSurface, &dwords, &data);
 
     if(result != Success) {
-        xfree(pSurface);
+        free(pSurface);
         return result;
     }
 
@@ -328,7 +328,7 @@ ProcXvMCCreateSurface(ClientPtr client)
     AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
 
     if(data)
-        xfree(data);
+        free(data);
 
     pContext->refcnt++;
 
@@ -404,7 +404,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
        (stuff->height > surface->subpicture_max_height))
 	return BadValue;
 
-    if(!(pSubpicture = xalloc(sizeof(XvMCSubpictureRec))))
+    if(!(pSubpicture = malloc(sizeof(XvMCSubpictureRec))))
         return BadAlloc;
 
     pSubpicture->subpicture_id = stuff->subpicture_id;
@@ -423,7 +423,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
                 pSubpicture, &dwords, &data);
 
     if(result != Success) {
-        xfree(pSubpicture);
+        free(pSubpicture);
         return result;
     }
 
@@ -445,7 +445,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
     AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
 
     if(data)
-        xfree(data);
+        free(data);
 
     pContext->refcnt++;
 
@@ -704,7 +704,7 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
 
-    xfree(pScreenPriv);
+    free(pScreenPriv);
 
     return (*pScreen->CloseScreen)(i, pScreen);
 }
@@ -717,7 +717,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
 
    XvMCScreenKey = &XvMCScreenKeyIndex;
 
-   if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec))))
+   if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
 	return BadAlloc;
 
    dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 949efe7..3ddee77 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -234,7 +234,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*i))
             {
-                *i = xcalloc(1, sizeof(IntegerFeedbackClassRec));
+                *i = calloc(1, sizeof(IntegerFeedbackClassRec));
                 if (!(*i))
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -269,7 +269,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*s))
             {
-                *s = xcalloc(1, sizeof(StringFeedbackClassRec));
+                *s = calloc(1, sizeof(StringFeedbackClassRec));
                 if (!(*s))
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -304,7 +304,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*b))
             {
-                *b = xcalloc(1, sizeof(BellFeedbackClassRec));
+                *b = calloc(1, sizeof(BellFeedbackClassRec));
                 if (!(*b))
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -340,7 +340,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*l))
             {
-                *l = xcalloc(1, sizeof(LedFeedbackClassRec));
+                *l = calloc(1, sizeof(LedFeedbackClassRec));
                 if (!(*l))
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -390,7 +390,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*k))
             {
-                *k = xcalloc(1, sizeof(KbdFeedbackClassRec));
+                *k = calloc(1, sizeof(KbdFeedbackClassRec));
                 if (!*k)
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -471,7 +471,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
             to->focus = classes->focus;
             if (!to->focus)
             {
-                to->focus = xcalloc(1, sizeof(FocusClassRec));
+                to->focus = calloc(1, sizeof(FocusClassRec));
                 if (!to->focus)
                     FatalError("[Xi] no memory for class shift.\n");
             } else
@@ -479,7 +479,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
 
             oldTrace = to->focus->trace;
             memcpy(to->focus, from->focus, sizeof(FocusClassRec));
-            to->focus->trace = xrealloc(oldTrace,
+            to->focus->trace = realloc(oldTrace,
                                   to->focus->traceSize * sizeof(WindowPtr));
             if (!to->focus->trace && to->focus->traceSize)
                 FatalError("[Xi] no memory for trace.\n");
@@ -517,7 +517,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!(*p))
             {
-                *p = xcalloc(1, sizeof(PtrFeedbackClassRec));
+                *p = calloc(1, sizeof(PtrFeedbackClassRec));
                 if (!*p)
                 {
                     ErrorF("[Xi] Cannot alloc memory for class copy.");
@@ -548,7 +548,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
                 classes->valuator = NULL;
         }
 
-        to->valuator = xrealloc(to->valuator, sizeof(ValuatorClassRec) +
+        to->valuator = realloc(to->valuator, sizeof(ValuatorClassRec) +
                 from->valuator->numAxes * sizeof(AxisInfo) +
                 from->valuator->numAxes * sizeof(double));
         v = to->valuator;
@@ -578,7 +578,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
             to->button = classes->button;
             if (!to->button)
             {
-                to->button = xcalloc(1, sizeof(ButtonClassRec));
+                to->button = calloc(1, sizeof(ButtonClassRec));
                 if (!to->button)
                     FatalError("[Xi] no memory for class shift.\n");
             } else
@@ -589,14 +589,14 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             if (!to->button->xkb_acts)
             {
-                to->button->xkb_acts = xcalloc(1, sizeof(XkbAction));
+                to->button->xkb_acts = calloc(1, sizeof(XkbAction));
                 if (!to->button->xkb_acts)
                     FatalError("[Xi] not enough memory for xkb_acts.\n");
             }
             memcpy(to->button->xkb_acts, from->button->xkb_acts,
                     sizeof(XkbAction));
         } else
-            xfree(to->button->xkb_acts);
+            free(to->button->xkb_acts);
 
          memcpy(to->button->labels, from->button->labels,
                 from->button->numButtons * sizeof(Atom));
@@ -617,7 +617,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
             to->proximity = classes->proximity;
             if (!to->proximity)
             {
-                to->proximity = xcalloc(1, sizeof(ProximityClassRec));
+                to->proximity = calloc(1, sizeof(ProximityClassRec));
                 if (!to->proximity)
                     FatalError("[Xi] no memory for class shift.\n");
             } else
@@ -641,7 +641,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
             to->absolute = classes->absolute;
             if (!to->absolute)
             {
-                to->absolute = xcalloc(1, sizeof(AbsoluteClassRec));
+                to->absolute = calloc(1, sizeof(AbsoluteClassRec));
                 if (!to->absolute)
                     FatalError("[Xi] no memory for class shift.\n");
             } else
@@ -698,7 +698,7 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChanged
     /* we don't actually swap if there's a NullClient, swapping is done
      * later when event is delivered. */
     SendEventToAllWindows(master, XI_DeviceChangedMask, (xEvent*)dcce, 1);
-    xfree(dcce);
+    free(dcce);
 }
 
 static void
@@ -928,7 +928,7 @@ ProcessRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
         for (i = 0; i < screenInfo.numScreens; i++)
             DeliverEventsToWindow(device, WindowTable[i], xi, 1,
                                   GetEventFilter(device, xi), NULL);
-        xfree(xi);
+        free(xi);
     }
 }
 
@@ -1116,7 +1116,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
 {
     ProximityClassPtr proxc;
 
-    proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec));
+    proxc = (ProximityClassPtr) malloc(sizeof(ProximityClassRec));
     if (!proxc)
 	return FALSE;
     proxc->sourceid = dev->id;
@@ -1232,7 +1232,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
     btlen = bytes_to_int32(btlen);
     len = sizeof(xXIFocusInEvent) + btlen * 4;
 
-    xi2event = xcalloc(1, len);
+    xi2event = calloc(1, len);
     xi2event->type         = GenericEvent;
     xi2event->extension    = IReqCode;
     xi2event->evtype       = type;
@@ -1268,7 +1268,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
     DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1,
                           GetEventFilter(dev, (xEvent*)xi2event), NullGrab);
 
-    xfree(xi2event);
+    free(xi2event);
 
     /* XI 1.x event */
     event.deviceid = dev->id;
@@ -1322,7 +1322,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
 	    }
 	}
 
-	sev = ev = (deviceStateNotify *) xalloc(evcount * sizeof(xEvent));
+	sev = ev = (deviceStateNotify *) malloc(evcount * sizeof(xEvent));
 	FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first);
 
 	if (b != NULL) {
@@ -1377,7 +1377,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
 
 	DeliverEventsToWindow(dev, pWin, (xEvent *) sev, evcount,
 				    DeviceStateNotifyMask, NullGrab);
-	xfree(sev);
+	free(sev);
     }
 }
 
@@ -1627,7 +1627,7 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
 
     if (!pWin->optional && !MakeWindowOptional(pWin))
 	return BadAlloc;
-    others = xcalloc(1, sizeof(InputClients));
+    others = calloc(1, sizeof(InputClients));
     if (!others)
 	return BadAlloc;
     if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
@@ -1646,7 +1646,7 @@ MakeInputMasks(WindowPtr pWin)
 {
     struct _OtherInputMasks *imasks;
 
-    imasks = xcalloc(1, sizeof(struct _OtherInputMasks));
+    imasks = calloc(1, sizeof(struct _OtherInputMasks));
     if (!imasks)
 	return FALSE;
     pWin->optional->inputMasks = imasks;
@@ -1709,14 +1709,14 @@ InputClientGone(WindowPtr pWin, XID id)
 	if (other->resource == id) {
 	    if (prev) {
 		prev->next = other->next;
-		xfree(other);
+		free(other);
 	    } else if (!(other->next)) {
 		if (ShouldFreeInputMasks(pWin, TRUE)) {
 		    wOtherInputMasks(pWin)->inputClients = other->next;
-		    xfree(wOtherInputMasks(pWin));
+		    free(wOtherInputMasks(pWin));
 		    pWin->optional->inputMasks = (OtherInputMasks *) NULL;
 		    CheckWindowOptionalNeed(pWin);
-		    xfree(other);
+		    free(other);
 		} else {
 		    other->resource = FakeClientID(0);
 		    if (!AddResource(other->resource, RT_INPUTCLIENT,
@@ -1725,7 +1725,7 @@ InputClientGone(WindowPtr pWin, XID id)
 		}
 	    } else {
 		wOtherInputMasks(pWin)->inputClients = other->next;
-		xfree(other);
+		free(other);
 	    }
 	    RecalculateDeviceDeliverableEvents(pWin);
 	    return (Success);
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 37f9856..f9d8dc8 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1156,7 +1156,7 @@ void
 AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
 {
     dev->xinput_type = type;
-    dev->name = (char *)xalloc(strlen(name) + 1);
+    dev->name = (char *)malloc(strlen(name) + 1);
     strcpy(dev->name, name);
 }
 
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 68181fa..3e81e94 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -281,7 +281,7 @@ ProcXGetDeviceControl(ClientPtr client)
 	return BadValue;
     }
 
-    buf = (char *)xalloc(total_length);
+    buf = (char *)malloc(total_length);
     if (!buf)
 	return BadAlloc;
     savbuf = buf;
@@ -309,6 +309,6 @@ ProcXGetDeviceControl(ClientPtr client)
     rep.length = bytes_to_int32(total_length);
     WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
     WriteToClient(client, total_length, savbuf);
-    xfree(savbuf);
+    free(savbuf);
     return Success;
 }
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 607765e..9563d63 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -340,7 +340,7 @@ ProcXGetFeedbackControl(ClientPtr client)
     if (total_length == 0)
 	return BadMatch;
 
-    buf = (char *)xalloc(total_length);
+    buf = (char *)malloc(total_length);
     if (!buf)
 	return BadAlloc;
     savbuf = buf;
@@ -361,6 +361,6 @@ ProcXGetFeedbackControl(ClientPtr client)
     rep.length = bytes_to_int32(total_length);
     WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
     WriteToClient(client, total_length, savbuf);
-    xfree(savbuf);
+    free(savbuf);
     return Success;
 }
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 78449e2..c38467b 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -133,8 +133,8 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
                              syms->mapWidth * stuff->count * sizeof(KeySym),
                              &syms->map[syms->mapWidth * (stuff->firstKeyCode -
                                                           syms->minKeyCode)]);
-    xfree(syms->map);
-    xfree(syms);
+    free(syms->map);
+    free(syms);
 
     return Success;
 }
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index ddf27a5..bd652e9 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -113,7 +113,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
     WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep);
     WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
 
-    xfree(modkeymap);
+    free(modkeymap);
 
     return Success;
 }
diff --git a/Xi/getprop.c b/Xi/getprop.c
index 1f28a8a..2460459 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -119,7 +119,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
 				 &count, COUNT);
 	if (count) {
 	    rep.count = count;
-	    buf = (XEventClass *) xalloc(rep.count * sizeof(XEventClass));
+	    buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
 	    rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
 
 	    tbuf = buf;
@@ -134,7 +134,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
     if (count) {
 	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf);
-	xfree(buf);
+	free(buf);
     }
     return Success;
 }
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 90f6284..d63b661 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -132,7 +132,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
 	total_length = (rep.all_clients_count + rep.this_client_count) *
 	    sizeof(XEventClass);
 	rep.length = bytes_to_int32(total_length);
-	buf = (XEventClass *) xalloc(total_length);
+	buf = (XEventClass *) malloc(total_length);
 
 	tclient = buf;
 	aclient = buf + rep.this_client_count;
@@ -152,7 +152,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
     if (total_length) {
 	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	WriteSwappedDataToClient(client, total_length, buf);
-	xfree(buf);
+	free(buf);
     }
     return Success;
 }
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 8e91c5a..32d80ee 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -154,7 +154,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
 	WriteToClient(client, length * 4, (char *)coords);
     }
     if (coords)
-	xfree(coords);
+	free(coords);
     return Success;
 }
 
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 98ef7aa..db7e540 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -360,7 +360,7 @@ ProcXListInputDevices(ClientPtr client)
     AddOtherInputDevices();
 
     /* allocate space for saving skip value */
-    skip = xcalloc(sizeof(Bool), inputInfo.numDevices);
+    skip = calloc(sizeof(Bool), inputInfo.numDevices);
     if (!skip)
         return BadAlloc;
 
@@ -386,7 +386,7 @@ ProcXListInputDevices(ClientPtr client)
 
     /* allocate space for reply */
     total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
-    devbuf = (char *)xcalloc(1, total_length);
+    devbuf = (char *)calloc(1, total_length);
     classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
     namebuf = classbuf + size;
     savbuf = devbuf;
@@ -411,8 +411,8 @@ ProcXListInputDevices(ClientPtr client)
     rep.length = bytes_to_int32(total_length);
     WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
     WriteToClient(client, total_length, savbuf);
-    xfree(savbuf);
-    xfree(skip);
+    free(savbuf);
+    free(skip);
     return Success;
 }
 
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 78b97a7..65a43d1 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -119,7 +119,7 @@ ProcXQueryDeviceState(ClientPtr client)
 	total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
 	num_classes++;
     }
-    buf = (char *)xcalloc(total_length, 1);
+    buf = (char *)calloc(total_length, 1);
     if (!buf)
 	return BadAlloc;
     savbuf = buf;
@@ -169,7 +169,7 @@ ProcXQueryDeviceState(ClientPtr client)
     WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
     if (total_length > 0)
 	WriteToClient(client, total_length, savbuf);
-    xfree(savbuf);
+    free(savbuf);
     return Success;
 }
 
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 1a06e45..c1899e1 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -68,7 +68,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
     if (!flags)
         return;
 
-    ev = xcalloc(1, sizeof(xXIHierarchyEvent) +
+    ev = calloc(1, sizeof(xXIHierarchyEvent) +
                  MAXDEVICES * sizeof(xXIHierarchyInfo));
     ev->type = GenericEvent;
     ev->extension = IReqCode;
@@ -116,7 +116,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
 
     dummyDev.id = XIAllDevices;
     SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
-    xfree(ev);
+    free(ev);
 }
 
 
@@ -172,7 +172,7 @@ ProcXIChangeHierarchy(ClientPtr client)
                     char* name;
 
                     SWAPIF(swaps(&c->name_len, n));
-                    name = xcalloc(c->name_len + 1, sizeof(char));
+                    name = calloc(c->name_len + 1, sizeof(char));
                     strncpy(name, (char*)&c[1], c->name_len);
 
 
@@ -181,7 +181,7 @@ ProcXIChangeHierarchy(ClientPtr client)
                                          TRUE);
                     if (rc != Success)
                     {
-                        xfree(name);
+                        free(name);
                         goto unwind;
                     }
 
@@ -194,7 +194,7 @@ ProcXIChangeHierarchy(ClientPtr client)
                     if (rc != Success)
                     {
 
-                        xfree(name);
+                        free(name);
                         goto unwind;
                     }
 
@@ -228,7 +228,7 @@ ProcXIChangeHierarchy(ClientPtr client)
                     flags[XTestptr->id] |= XISlaveAttached;
                     flags[XTestkeybd->id] |= XISlaveAttached;
 
-                    xfree(name);
+                    free(name);
                 }
                 break;
             case XIRemoveMaster:
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 41a56b1..a62fe79 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -158,7 +158,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     status = CheckGrabValues(client, &param);
 
     modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
-    modifiers_failed = xcalloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
+    modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
     if (!modifiers_failed)
         return BadAlloc;
 
@@ -204,7 +204,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
 	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
         WriteSwappedDataToClient(client, rep.num_modifiers * 4, (char*)modifiers_failed);
     }
-    xfree(modifiers_failed);
+    free(modifiers_failed);
     return ret;
 }
 
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index 8b80637..8bb1962 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -225,7 +225,7 @@ static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
     {
         Atom *a;
 
-        atoms = xalloc(nprops * sizeof(Atom));
+        atoms = malloc(nprops * sizeof(Atom));
         if(!atoms)
             return BadAlloc;
         a = atoms;
@@ -457,7 +457,7 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
 
     if (!buf && !(*nelem_return))
     {
-        buf = xcalloc(val->size, sizeof(int));
+        buf = calloc(val->size, sizeof(int));
         if (!buf)
             return BadAlloc;
         *buf_return = buf;
@@ -517,7 +517,7 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
 
     if (!buf && !(*nelem_return))
     {
-        buf = xcalloc(val->size, sizeof(float));
+        buf = calloc(val->size, sizeof(float));
         if (!buf)
             return BadAlloc;
         *buf_return = buf;
@@ -549,7 +549,7 @@ XIRegisterPropertyHandler(DeviceIntPtr         dev,
 {
     XIPropertyHandlerPtr new_handler;
 
-    new_handler = xcalloc(1, sizeof(XIPropertyHandler));
+    new_handler = calloc(1, sizeof(XIPropertyHandler));
     if (!new_handler)
         return 0;
 
@@ -583,7 +583,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
     else
         prev->next = curr->next;
 
-    xfree(curr);
+    free(curr);
 }
 
 static XIPropertyPtr
@@ -591,7 +591,7 @@ XICreateDeviceProperty (Atom property)
 {
     XIPropertyPtr   prop;
 
-    prop = (XIPropertyPtr)xalloc(sizeof(XIPropertyRec));
+    prop = (XIPropertyPtr)malloc(sizeof(XIPropertyRec));
     if (!prop)
         return NULL;
 
@@ -621,8 +621,8 @@ static void
 XIDestroyDeviceProperty (XIPropertyPtr prop)
 {
     if (prop->value.data)
-        xfree(prop->value.data);
-    xfree(prop);
+        free(prop->value.data);
+    free(prop);
 }
 
 /* This function destroys all of the device's property-related stuff,
@@ -649,7 +649,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
     while(curr_handler)
     {
         next_handler = curr_handler->next;
-        xfree(curr_handler);
+        free(curr_handler);
         curr_handler = next_handler;
     }
 
@@ -745,7 +745,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
         pointer            new_data = NULL, old_data = NULL;
 
         total_size = total_len * size_in_bytes;
-        new_value.data = (pointer)xalloc (total_size);
+        new_value.data = (pointer)malloc(total_size);
         if (!new_value.data && total_size)
         {
             if (add)
@@ -797,7 +797,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
                         if (checkonly && rc != Success)
                         {
                             if (new_value.data)
-                                xfree (new_value.data);
+                                free(new_value.data);
                             return (rc);
                         }
                     }
@@ -807,7 +807,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
             } while (!checkonly);
         }
         if (prop_value->data)
-            xfree (prop_value->data);
+            free(prop_value->data);
         *prop_value = new_value;
     } else if (len == 0)
     {
@@ -905,7 +905,7 @@ ProcXListDeviceProperties (ClientPtr client)
     {
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
-        xfree(atoms);
+        free(atoms);
     }
     return rc;
 }
@@ -1149,7 +1149,7 @@ ProcXIListProperties(ClientPtr client)
     {
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
-        xfree(atoms);
+        free(atoms);
     }
     return rc;
 }
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 47ab688..303c8b2 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -87,7 +87,7 @@ ProcXIQueryDevice(ClientPtr client)
     }
     else
     {
-        skip = xcalloc(sizeof(Bool), inputInfo.numDevices);
+        skip = calloc(sizeof(Bool), inputInfo.numDevices);
         if (!skip)
             return BadAlloc;
 
@@ -106,7 +106,7 @@ ProcXIQueryDevice(ClientPtr client)
         }
     }
 
-    info = xcalloc(1, len);
+    info = calloc(1, len);
     if (!info)
         return BadAlloc;
 
@@ -155,8 +155,8 @@ ProcXIQueryDevice(ClientPtr client)
 
     WriteReplyToClient(client, sizeof(xXIQueryDeviceReply), &rep);
     WriteToClient(client, rep.length * 4, ptr);
-    xfree(ptr);
-    xfree(skip);
+    free(ptr);
+    free(skip);
     return rc;
 }
 
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index 93ceba4..41253fb 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -144,7 +144,7 @@ ProcXIQueryPointer(ClientPtr client)
         rep.buttons_len = bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
         rep.length += rep.buttons_len;
         buttons_size = rep.buttons_len * 4;
-        buttons = xcalloc(1, buttons_size);
+        buttons = calloc(1, buttons_size);
         if (!buttons)
             return BadAlloc;
 
@@ -195,7 +195,7 @@ ProcXIQueryPointer(ClientPtr client)
     if (buttons)
         WriteToClient(client, buttons_size, buttons);
 
-    xfree(buttons);
+    free(buttons);
 
     return Success;
 }
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 672edab..7aa3f0a 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -173,7 +173,7 @@ ProcXISelectEvents(ClientPtr client)
 
     RecalculateDeliverableEvents(win);
 
-    xfree(types);
+    free(types);
     return Success;
 }
 
@@ -234,7 +234,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
         return Success;
     }
 
-    buffer = xcalloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
+    buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
     if (!buffer)
         return BadAlloc;
 
@@ -281,7 +281,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
     if (reply.num_masks)
         WriteToClient(client, reply.length * 4, buffer);
 
-    xfree(buffer);
+    free(buffer);
     return Success;
 }
 
diff --git a/composite/compalloc.c b/composite/compalloc.c
index 73adc72..a764972 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -99,7 +99,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
      * The client *could* allocate multiple, but while supported,
      * it is not expected to be common
      */
-    ccw = xalloc (sizeof (CompClientWindowRec));
+    ccw = malloc(sizeof (CompClientWindowRec));
     if (!ccw)
 	return BadAlloc;
     ccw->id = FakeClientID (pClient->index);
@@ -109,10 +109,10 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
      */
     if (!cw)
     {
-	cw = xalloc (sizeof (CompWindowRec));
+	cw = malloc(sizeof (CompWindowRec));
 	if (!cw)
 	{
-	    xfree (ccw);
+	    free(ccw);
 	    return BadAlloc;
 	}
 	cw->damage = DamageCreate (compReportDamage,
@@ -123,8 +123,8 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
 				   pWin);
 	if (!cw->damage)
 	{
-	    xfree (ccw);
-	    xfree (cw);
+	    free(ccw);
+	    free(cw);
 	    return BadAlloc;
 	}
 	if (wasMapped)
@@ -207,7 +207,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
 	    *prev = ccw->next;
 	    if (ccw->update == CompositeRedirectManual)
 		cw->update = CompositeRedirectAutomatic;
-	    xfree (ccw);
+	    free(ccw);
 	    break;
 	}
     }
@@ -229,7 +229,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
 	REGION_UNINIT (pScreen, &cw->borderClip);
     
 	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL);
-	xfree (cw);
+	free(cw);
     }
     else if (cw->update == CompositeRedirectAutomatic &&
 	     !cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
@@ -295,7 +295,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
      * The client *could* allocate multiple, but while supported,
      * it is not expected to be common
      */
-    ccw = xalloc (sizeof (CompClientWindowRec));
+    ccw = malloc(sizeof (CompClientWindowRec));
     if (!ccw)
 	return BadAlloc;
     ccw->id = FakeClientID (pClient->index);
@@ -305,10 +305,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
      */
     if (!csw)
     {
-	csw = xalloc (sizeof (CompSubwindowsRec));
+	csw = malloc(sizeof (CompSubwindowsRec));
 	if (!csw)
 	{
-	    xfree (ccw);
+	    free(ccw);
 	    return BadAlloc;
 	}
 	csw->update = CompositeRedirectAutomatic;
@@ -327,10 +327,10 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
 		(void) compUnredirectWindow (pClient, pChild, update);
 	    if (!csw->clients)
 	    {
-		xfree (csw);
+		free(csw);
 		dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
 	    }
-	    xfree (ccw);
+	    free(ccw);
 	    return ret;
 	}
     }
@@ -391,7 +391,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
 	    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
 		(void) compUnredirectWindow (pClient, pChild, ccw->update);
 
-	    xfree (ccw);
+	    free(ccw);
 	    break;
 	}
     }
@@ -402,7 +402,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
     if (!csw->clients)
     {
 	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
-	xfree (csw);
+	free(csw);
     }
 }
 
diff --git a/composite/compinit.c b/composite/compinit.c
index e8b563d..a81cc74 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -62,7 +62,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
     CompScreenPtr   cs = GetCompScreen (pScreen);
     Bool	    ret;
 
-    xfree (cs->alternateVisuals);
+    free(cs->alternateVisuals);
 
     pScreen->CloseScreen = cs->CloseScreen;
     pScreen->BlockHandler = cs->BlockHandler;
@@ -81,7 +81,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
     pScreen->CopyWindow = cs->CopyWindow;
     pScreen->PositionWindow = cs->PositionWindow;
 
-    xfree (cs);
+    free(cs);
     dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
     ret = (*pScreen->CloseScreen) (index, pScreen);
 
@@ -202,7 +202,7 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
 {
     VisualID *p;
 
-    p = xrealloc(cs->alternateVisuals,
+    p = realloc(cs->alternateVisuals,
 		 sizeof(VisualID) * (cs->numAlternateVisuals + nVisuals));
     if(p == NULL)
 	return FALSE;
@@ -323,7 +323,7 @@ compScreenInit (ScreenPtr pScreen)
 
     if (GetCompScreen (pScreen))
 	return TRUE;
-    cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec));
+    cs = (CompScreenPtr) malloc(sizeof (CompScreenRec));
     if (!cs)
 	return FALSE;
 
@@ -337,7 +337,7 @@ compScreenInit (ScreenPtr pScreen)
 
     if (!compAddAlternateVisuals (pScreen, cs))
     {
-	xfree (cs);
+	free(cs);
 	return FALSE;
     }
 
diff --git a/composite/compoverlay.c b/composite/compoverlay.c
index 6d73f00..2158cdb 100644
--- a/composite/compoverlay.c
+++ b/composite/compoverlay.c
@@ -62,7 +62,7 @@ compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
     {
 	if (pOc == pOcToDel) {
 	    *pPrev = pOc->pNext;
-	    xfree (pOc);
+	    free(pOc);
 	    break;
 	}
     }
@@ -97,7 +97,7 @@ compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
     CompScreenPtr    cs = GetCompScreen(pScreen);
     CompOverlayClientPtr pOc;
 
-    pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
+    pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
     if (pOc == NULL)
 	return NULL;
 
diff --git a/config/config.c b/config/config.c
index 7bf5e41..65ef679 100644
--- a/config/config.c
+++ b/config/config.c
@@ -130,7 +130,7 @@ add_option(InputOption **options, const char *key, const char *value)
 
     for (; *options; options = &(*options)->next)
         ;
-    *options = xcalloc(sizeof(**options), 1);
+    *options = calloc(sizeof(**options), 1);
     if (!*options) /* Yeesh. */
         return;
     (*options)->key = xstrdup(key);
diff --git a/config/dbus.c b/config/dbus.c
index 86d9d28..72a0a05 100644
--- a/config/dbus.c
+++ b/config/dbus.c
@@ -81,7 +81,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
         MALFORMED_MESSAGE();
     }
 
-    options = xcalloc(sizeof(*options), 1);
+    options = calloc(sizeof(*options), 1);
     if (!options) {
         ErrorF("[config/dbus] couldn't allocate option\n");
         return BadAlloc;
@@ -97,7 +97,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
 
     /* signature should be [ss][ss]... */
     while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
-        tmpo = xcalloc(sizeof(*tmpo), 1);
+        tmpo = calloc(sizeof(*tmpo), 1);
         if (!tmpo) {
             ErrorF("[config/dbus] couldn't allocate option\n");
             ret = BadAlloc;
@@ -185,10 +185,10 @@ unwind:
         tmpo = options;
         options = options->next;
         if (tmpo->key)
-            xfree(tmpo->key);
+            free(tmpo->key);
         if (tmpo->value)
-            xfree(tmpo->value);
-        xfree(tmpo);
+            free(tmpo->value);
+        free(tmpo);
     }
 
     return ret;
diff --git a/config/hal.c b/config/hal.c
index d3daa84..6a22323 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -63,14 +63,14 @@ device_removed(LibHalContext *ctx, const char *udi)
 {
     char *value;
 
-    value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */
+    value = malloc(strlen(udi) + 5); /* "hal:" + NULL */
     if (!value)
         return;
     sprintf(value, "hal:%s", udi);
 
     remove_devices("hal", value);
 
-    xfree(value);
+    free(value);
 }
 
 static char *
@@ -102,7 +102,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
         for (i = 0; props[i]; i++)
             len += strlen(props[i]);
 
-        ret = xcalloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
+        ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
         if (!ret) {
             libhal_free_string_array(props);
             return NULL;
@@ -179,7 +179,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL))
         attrs.flags |= ATTR_TOUCHSCREEN;
 
-    options = xcalloc(sizeof(*options), 1);
+    options = calloc(sizeof(*options), 1);
     if (!options){
         LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
         goto unwind;
@@ -200,7 +200,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     add_option(&options, "driver", driver);
     add_option(&options, "name", name);
 
-    config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
+    config_info = malloc(strlen(udi) + 5); /* "hal:" and NULL */
     if (!config_info) {
         LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
         goto unwind;
@@ -252,34 +252,34 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                         if (!strcasecmp(&tmp[3], "layout"))
                         {
                             if (xkb_opts.layout)
-                                xfree(xkb_opts.layout);
+                                free(xkb_opts.layout);
                             xkb_opts.layout = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "model"))
                         {
                             if (xkb_opts.model)
-                                xfree(xkb_opts.model);
+                                free(xkb_opts.model);
                             xkb_opts.model = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "rules"))
                         {
                             if (xkb_opts.rules)
-                                xfree(xkb_opts.rules);
+                                free(xkb_opts.rules);
                             xkb_opts.rules = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "variant"))
                         {
                             if (xkb_opts.variant)
-                                xfree(xkb_opts.variant);
+                                free(xkb_opts.variant);
                             xkb_opts.variant = strdup(tmp_val);
                         } else if (!strcasecmp(&tmp[3], "options"))
                         {
                             if (xkb_opts.options)
-                                xfree(xkb_opts.options);
+                                free(xkb_opts.options);
                             xkb_opts.options = strdup(tmp_val);
                         }
                     } else
                     {
                         /* all others */
                         add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
-                        xfree(tmp_val);
+                        free(tmp_val);
                     }
                 } else
                 {
@@ -290,7 +290,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                         (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
                     {
                         if (xkb_opts.options)
-                            xfree(xkb_opts.options);
+                            free(xkb_opts.options);
                         xkb_opts.options = strdup(tmp_val);
                     }
                 }
@@ -325,7 +325,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
                         if (!xkb_opts.options)
                             xkb_opts.options = strdup(tmp_val);
                     }
-                    xfree(tmp_val);
+                    free(tmp_val);
                 } else
                 {
                     /* server 1.4 had xkb options as strlist */
@@ -367,7 +367,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
 
     for (; dev; dev = dev->next){
         if (dev->config_info)
-            xfree(dev->config_info);
+            free(dev->config_info);
         dev->config_info = xstrdup(config_info);
     }
 
@@ -375,42 +375,42 @@ unwind:
     if (set)
         libhal_free_property_set(set);
     if (path)
-        xfree(path);
+        free(path);
     if (driver)
-        xfree(driver);
+        free(driver);
     if (name)
-        xfree(name);
+        free(name);
     if (config_info)
-        xfree(config_info);
+        free(config_info);
     while (!dev && (tmpo = options)) {
         options = tmpo->next;
-        xfree(tmpo->key);
-        xfree(tmpo->value);
-        xfree(tmpo);
+        free(tmpo->key);
+        free(tmpo->value);
+        free(tmpo);
     }
 
-    xfree(attrs.product);
-    xfree(attrs.vendor);
-    xfree(attrs.device);
+    free(attrs.product);
+    free(attrs.vendor);
+    free(attrs.device);
     if (attrs.tags) {
         char **tag = attrs.tags;
         while (*tag) {
-            xfree(*tag);
+            free(*tag);
             tag++;
         }
-        xfree(attrs.tags);
+        free(attrs.tags);
     }
 
     if (xkb_opts.layout)
-        xfree(xkb_opts.layout);
+        free(xkb_opts.layout);
     if (xkb_opts.rules)
-        xfree(xkb_opts.rules);
+        free(xkb_opts.rules);
     if (xkb_opts.model)
-        xfree(xkb_opts.model);
+        free(xkb_opts.model);
     if (xkb_opts.variant)
-        xfree(xkb_opts.variant);
+        free(xkb_opts.variant);
     if (xkb_opts.options)
-        xfree(xkb_opts.options);
+        free(xkb_opts.options);
 
     dbus_error_free(&error);
 
diff --git a/config/udev.c b/config/udev.c
index 452fb5a..5e8d8da 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -63,7 +63,7 @@ device_added(struct udev_device *udev_device)
     if (!udev_device_get_property_value(udev_device, "ID_INPUT"))
         return;
 
-    options = xcalloc(sizeof(*options), 1);
+    options = calloc(sizeof(*options), 1);
     if (!options)
         return;
 
@@ -141,26 +141,26 @@ device_added(struct udev_device *udev_device)
         goto unwind;
 
     for (; dev; dev = dev->next) {
-        xfree(dev->config_info);
+        free(dev->config_info);
         dev->config_info = xstrdup(config_info);
     }
 
  unwind:
-    xfree(config_info);
+    free(config_info);
     while (!dev && (tmpo = options)) {
         options = tmpo->next;
-        xfree(tmpo->key);
-        xfree(tmpo->value);
-        xfree(tmpo);
+        free(tmpo->key);
+        free(tmpo->value);
+        free(tmpo);
     }
 
     if (attrs.tags) {
         char **tag = attrs.tags;
         while (*tag) {
-            xfree(*tag);
+            free(*tag);
             tag++;
         }
-        xfree(attrs.tags);
+        free(attrs.tags);
     }
 
     return;
@@ -178,7 +178,7 @@ device_removed(struct udev_device *device)
 
     remove_devices("udev", value);
 
-    xfree(value);
+    free(value);
 }
 
 static void
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 4e9019c..f2630fe 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -201,7 +201,7 @@ ProcDamageCreate (ClientPtr client)
 	return BadValue;
     }
     
-    pDamageExt = xalloc (sizeof (DamageExtRec));
+    pDamageExt = malloc(sizeof (DamageExtRec));
     if (!pDamageExt)
 	return BadAlloc;
     pDamageExt->id = stuff->damage;
@@ -217,7 +217,7 @@ ProcDamageCreate (ClientPtr client)
 					pDamageExt);
     if (!pDamageExt->pDamage)
     {
-	xfree (pDamageExt);
+	free(pDamageExt);
 	return BadAlloc;
     }
     if (!AddResource (stuff->damage, DamageExtType, (pointer) pDamageExt))
@@ -457,7 +457,7 @@ FreeDamageExt (pointer value, XID did)
 	DamageUnregister (pDamageExt->pDrawable, pDamageExt->pDamage);
 	DamageDestroy (pDamageExt->pDamage);
     }
-    xfree (pDamageExt);
+    free(pDamageExt);
     return Success;
 }
 
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 825d2e0..1cda9f5 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -241,7 +241,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
     }
 
     /* Free what was allocated by the GetVisualInfo() call above. */
-    xfree(scrVisInfo.visinfo);
+    free(scrVisInfo.visinfo);
 
     if (!visualMatched)
     {
@@ -254,7 +254,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
          * Allocate a window priv.
          */
 
-        pDbeWindowPriv = xcalloc(1, sizeof(DbeWindowPrivRec));
+        pDbeWindowPriv = calloc(1, sizeof(DbeWindowPrivRec));
 	if (!pDbeWindowPriv)
             return(BadAlloc);
 
@@ -319,7 +319,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
             }
 
             /* malloc/realloc a new array and initialize all elements to 0. */
-            pDbeWindowPriv->IDs = (XID *)xrealloc(pIDs,
+            pDbeWindowPriv->IDs = (XID *)realloc(pIDs,
                 (pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
             if (!pDbeWindowPriv->IDs)
             {
@@ -383,7 +383,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
 
 out_free:
     dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
-    xfree(pDbeWindowPriv);
+    free(pDbeWindowPriv);
     return (status);
 
 } /* ProcDbeAllocateBackBufferName() */
@@ -508,7 +508,7 @@ ProcDbeSwapBuffers(ClientPtr client)
     dbeSwapInfo = (xDbeSwapInfo *)&stuff[1];
 
     /* Allocate array to record swap information. */ 
-    swapInfo = (DbeSwapInfoPtr)Xalloc(nStuff * sizeof(DbeSwapInfoRec));
+    swapInfo = (DbeSwapInfoPtr)malloc(nStuff * sizeof(DbeSwapInfoRec));
     if (swapInfo == NULL)
     {
         return(BadAlloc);
@@ -523,14 +523,14 @@ ProcDbeSwapBuffers(ClientPtr client)
 	error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
 				DixWriteAccess);
 	if (error != Success) {
-            Xfree(swapInfo);
+            free(swapInfo);
 	    return error;
         }
 
         /* Each window must be double-buffered - BadMatch. */
         if (DBE_WINDOW_PRIV(pWin) == NULL)
         {
-            Xfree(swapInfo);
+            free(swapInfo);
             return(BadMatch);
         }
 
@@ -539,7 +539,7 @@ ProcDbeSwapBuffers(ClientPtr client)
         {
             if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
             {
-                Xfree(swapInfo);
+                free(swapInfo);
                 return(BadMatch);
 	    }
         }
@@ -550,7 +550,7 @@ ProcDbeSwapBuffers(ClientPtr client)
             (dbeSwapInfo[i].swapAction != XdbeUntouched ) &&
             (dbeSwapInfo[i].swapAction != XdbeCopied    ))
         {
-            Xfree(swapInfo);
+            free(swapInfo);
             return(BadValue);
         }
 
@@ -580,12 +580,12 @@ ProcDbeSwapBuffers(ClientPtr client)
         error = (*pDbeScreenPriv->SwapBuffers)(client, &nStuff, swapInfo);
         if (error != Success)
         {
-            Xfree(swapInfo);
+            free(swapInfo);
             return(error);
         }
     }
     
-    Xfree(swapInfo);
+    free(swapInfo);
     return(Success);
 
 } /* ProcDbeSwapBuffers() */
@@ -672,7 +672,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
     /* Make sure any specified drawables are valid. */
     if (stuff->n != 0)
     {
-        if (!(pDrawables = (DrawablePtr *)Xalloc(stuff->n *
+        if (!(pDrawables = (DrawablePtr *)malloc(stuff->n *
                                                  sizeof(DrawablePtr))))
         {
             return(BadAlloc);
@@ -685,19 +685,19 @@ ProcDbeGetVisualInfo(ClientPtr client)
 	    rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
 				   DixGetAttrAccess);
 	    if (rc != Success) {
-                Xfree(pDrawables);
+                free(pDrawables);
                 return rc;
             }
         }
     }
 
     count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
-    if (!(pScrVisInfo = (XdbeScreenVisualInfo *)xalloc(count *
+    if (!(pScrVisInfo = (XdbeScreenVisualInfo *)malloc(count *
                         sizeof(XdbeScreenVisualInfo))))
     {
         if (pDrawables)
         {
-            Xfree(pDrawables);
+            free(pDrawables);
         }
 
         return(BadAlloc);
@@ -720,13 +720,13 @@ ProcDbeGetVisualInfo(ClientPtr client)
             /* Free visinfos that we allocated for previous screen infos.*/
             for (j = 0; j < i; j++)
             {
-                xfree(pScrVisInfo[j].visinfo);
+                free(pScrVisInfo[j].visinfo);
             }
 
             /* Free pDrawables if we needed to allocate it above. */
             if (pDrawables)
             {
-                Xfree(pDrawables);
+                free(pDrawables);
             }
 
             return (rc == Success) ? BadAlloc : rc;
@@ -801,13 +801,13 @@ ProcDbeGetVisualInfo(ClientPtr client)
     /* Clean up memory. */
     for (i = 0; i < count; i++)
     {
-        xfree(pScrVisInfo[i].visinfo);
+        free(pScrVisInfo[i].visinfo);
     }
-    xfree(pScrVisInfo);
+    free(pScrVisInfo);
 
     if (pDrawables)
     {
-        Xfree(pDrawables);
+        free(pDrawables);
     }
 
     return(client->noClientException);
@@ -1385,7 +1385,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
                DBE_INIT_MAX_IDS * sizeof(XID));
 
         /* Free the extended array; use the static array. */
-        xfree(pDbeWindowPriv->IDs);
+        free(pDbeWindowPriv->IDs);
         pDbeWindowPriv->IDs = pDbeWindowPriv->initIDs;
         pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
     }
@@ -1417,7 +1417,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
 
         /* We are done with the window priv. */
 	dixFreePrivates(pDbeWindowPriv->devPrivates);
-        xfree(pDbeWindowPriv);
+        free(pDbeWindowPriv);
     }
 
     return(Success);
@@ -1457,7 +1457,7 @@ DbeResetProc(ExtensionEntry *extEntry)
 		(*pDbeScreenPriv->ResetProc)(pScreen);
 
 	    dixFreePrivates(pDbeScreenPriv->devPrivates);
-	    xfree(pDbeScreenPriv);
+	    free(pDbeScreenPriv);
 	}
     }
 } /* DbeResetProc() */
@@ -1596,7 +1596,7 @@ DbeExtensionInit(void)
 	pScreen = screenInfo.screens[i];
 
 	if (!(pDbeScreenPriv =
-             (DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
+              (DbeScreenPrivPtr)calloc(1, sizeof(DbeScreenPrivRec))))
 	{
             /* If we can not alloc a window or screen private,
              * then free any privates that we already alloc'ed and return
@@ -1604,7 +1604,7 @@ DbeExtensionInit(void)
 
 	    for (j = 0; j < i; j++)
 	    {
-		xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
+		free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
 				       dbeScreenPrivKey));
 		dixSetPrivate(&screenInfo.screens[j]->devPrivates,
 			      dbeScreenPrivKey, NULL);
@@ -1666,7 +1666,7 @@ DbeExtensionInit(void)
 
         for (i = 0; i < screenInfo.numScreens; i++)
         {
-		xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
+		free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
 				       dbeScreenPrivKey));
 		dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
         }
diff --git a/dbe/midbe.c b/dbe/midbe.c
index 4426c9d..e47a253 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -100,7 +100,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
     }
 
     /* Allocate an array of XdbeVisualInfo items. */
-    if (!(visInfo = (XdbeVisualInfo *)xalloc(count * sizeof(XdbeVisualInfo))))
+    if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo))))
     {
         return(FALSE); /* memory alloc failure */
     }
diff --git a/dix/atom.c b/dix/atom.c
index f5bf8ad..ecfe4b0 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -109,7 +109,7 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
     {
 	NodePtr nd;
 
-	nd = xalloc(sizeof(NodeRec));
+	nd = malloc(sizeof(NodeRec));
 	if (!nd)
 	    return BAD_RESOURCE;
 	if (lastAtom < XA_LAST_PREDEFINED)
@@ -118,9 +118,9 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	}
 	else
 	{
-	    char *newstring = xalloc(len + 1);
+	    char *newstring = malloc(len + 1);
 	    if (!newstring) {
-		xfree(nd);
+		free(nd);
 		return BAD_RESOURCE;
 	    }
 	    strncpy(newstring, string, (int)len);
@@ -130,12 +130,12 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
 	if ((lastAtom + 1) >= tableLength) {
 	    NodePtr *table;
 
-	    table = (NodePtr *) xrealloc(nodeTable,
+	    table = (NodePtr *) realloc(nodeTable,
 					 tableLength * (2 * sizeof(NodePtr)));
 	    if (!table) {
 		if (nd->string != string)
-		    xfree(nd->string);
-		xfree(nd);
+		    free(nd->string);
+		free(nd);
 		return BAD_RESOURCE;
 	    }
 	    tableLength <<= 1;
@@ -181,8 +181,8 @@ FreeAtom(NodePtr patom)
     if(patom->right)
 	FreeAtom(patom->right);
     if (patom->a > XA_LAST_PREDEFINED)
-	xfree(patom->string);
-    xfree(patom);
+	free(patom->string);
+    free(patom);
 }
 
 void
@@ -192,7 +192,7 @@ FreeAllAtoms(void)
 	return;
     FreeAtom(atomRoot);
     atomRoot = (NodePtr)NULL;
-    xfree(nodeTable);
+    free(nodeTable);
     nodeTable = (NodePtr *)NULL;
     lastAtom = None;
 }
@@ -202,7 +202,7 @@ InitAtoms(void)
 {
     FreeAllAtoms();
     tableLength = InitialTableSize;
-    nodeTable = xalloc(InitialTableSize*sizeof(NodePtr));
+    nodeTable = malloc(InitialTableSize*sizeof(NodePtr));
     if (!nodeTable)
 	AtomError();
     nodeTable[None] = (NodePtr)NULL;
diff --git a/dix/colormap.c b/dix/colormap.c
index bf97941..9a4ff28 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -274,7 +274,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
     if ((class | DynamicClass) == DirectColor)
 	sizebytes *= 3;
     sizebytes += sizeof(ColormapRec);
-    pmap = xalloc(sizebytes);
+    pmap = malloc(sizebytes);
     if (!pmap)
 	return (BadAlloc);
 #if defined(_XSERVER64)
@@ -310,10 +310,10 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
 	for (pent = &pmap->red[size - 1]; pent >= pmap->red; pent--)
 	    pent->refcnt = AllocPrivate;
 	pmap->freeRed = 0;
-	ppix = xalloc(size * sizeof(Pixel));
+	ppix = malloc(size * sizeof(Pixel));
 	if (!ppix)
 	{
-	    xfree(pmap);
+	    free(pmap);
 	    return (BadAlloc);
 	}
 	pmap->clientPixelsRed[client] = ppix;
@@ -356,11 +356,11 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
 	    for(pent = &pmap->green[size-1]; pent >= pmap->green; pent--)
 		pent->refcnt = AllocPrivate;
 	    pmap->freeGreen = 0;
-	    ppix = xalloc(size * sizeof(Pixel));
+	    ppix = malloc(size * sizeof(Pixel));
 	    if (!ppix)
 	    {
-		xfree(pmap->clientPixelsRed[client]);
-		xfree(pmap);
+		free(pmap->clientPixelsRed[client]);
+		free(pmap);
 		return(BadAlloc);
 	    }
 	    pmap->clientPixelsGreen[client] = ppix;
@@ -372,12 +372,12 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
 	    for(pent = &pmap->blue[size-1]; pent >= pmap->blue; pent--)
 		pent->refcnt = AllocPrivate;
 	    pmap->freeBlue = 0;
-	    ppix = xalloc(size * sizeof(Pixel));
+	    ppix = malloc(size * sizeof(Pixel));
 	    if (!ppix)
 	    {
-		xfree(pmap->clientPixelsGreen[client]);
-		xfree(pmap->clientPixelsRed[client]);
-		xfree(pmap);
+		free(pmap->clientPixelsGreen[client]);
+		free(pmap->clientPixelsRed[client]);
+		free(pmap);
 		return(BadAlloc);
 	    }
 	    pmap->clientPixelsBlue[client] = ppix;
@@ -439,7 +439,7 @@ FreeColormap (pointer value, XID mid)
     if(pmap->clientPixelsRed)
     {
 	for(i = 0; i < MAXCLIENTS; i++)
-	    xfree(pmap->clientPixelsRed[i]);
+	    free(pmap->clientPixelsRed[i]);
     }
 
     if ((pmap->class == PseudoColor) || (pmap->class == GrayScale))
@@ -451,11 +451,11 @@ FreeColormap (pointer value, XID mid)
 	    if(pent->fShared)
 	    {
 		if (--pent->co.shco.red->refcnt == 0)
-		    xfree(pent->co.shco.red);
+		    free(pent->co.shco.red);
 		if (--pent->co.shco.green->refcnt == 0)
-		    xfree(pent->co.shco.green);
+		    free(pent->co.shco.green);
 		if (--pent->co.shco.blue->refcnt == 0)
-		    xfree(pent->co.shco.blue);
+		    free(pent->co.shco.blue);
 	    }
 	}
     }
@@ -463,13 +463,13 @@ FreeColormap (pointer value, XID mid)
     {
         for(i = 0; i < MAXCLIENTS; i++)
 	{
-            xfree(pmap->clientPixelsGreen[i]);
-            xfree(pmap->clientPixelsBlue[i]);
+            free(pmap->clientPixelsGreen[i]);
+            free(pmap->clientPixelsBlue[i]);
         }
     }
 
     dixFreePrivates(pmap->devPrivates);
-    xfree(pmap);
+    free(pmap);
     return(Success);
 }
 
@@ -720,11 +720,11 @@ FreeCell (ColormapPtr pmap, Pixel i, int channel)
         if (pent->fShared)
 	{
 	    if(--pent->co.shco.red->refcnt == 0)
-		xfree(pent->co.shco.red);
+		free(pent->co.shco.red);
 	    if(--pent->co.shco.green->refcnt == 0)
-		xfree(pent->co.shco.green);
+		free(pent->co.shco.green);
 	    if(--pent->co.shco.blue->refcnt == 0)
-		xfree(pent->co.shco.blue);
+		free(pent->co.shco.blue);
 	    pent->fShared = FALSE;
 	}
 	pent->refcnt = 0;
@@ -743,7 +743,7 @@ UpdateColors (ColormapPtr pmap)
 
     pVisual = pmap->pVisual;
     size = pVisual->ColormapEntries;
-    defs = xalloc(size * sizeof(xColorItem));
+    defs = malloc(size * sizeof(xColorItem));
     if (!defs)
 	return;
     n = 0;
@@ -793,7 +793,7 @@ UpdateColors (ColormapPtr pmap)
     }
     if (n)
 	(*pmap->pScreen->StoreColors)(pmap, n, defs);
-    xfree(defs);
+    free(defs);
 }
 
 /* Get a read-only color from a ColorMap (probably slow for large maps)
@@ -840,7 +840,7 @@ AllocColor (ColormapPtr pmap,
 	*pgreen = pmap->red[pixR].co.local.green;
 	*pblue = pmap->red[pixR].co.local.blue;
 	npix = pmap->numPixelsRed[client];
-	ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+	ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
 				  (npix + 1) * sizeof(Pixel));
 	if (!ppix)
 	    return (BadAlloc);
@@ -863,21 +863,21 @@ AllocColor (ColormapPtr pmap,
 	*pgreen = pmap->green[pixG].co.local.green;
 	*pblue = pmap->blue[pixB].co.local.blue;
 	npix = pmap->numPixelsRed[client];
-	ppix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+	ppix = (Pixel *) realloc(pmap->clientPixelsRed[client],
 				  (npix + 1) * sizeof(Pixel));
 	if (!ppix)
 	    return (BadAlloc);
 	ppix[npix] = pixR;
 	pmap->clientPixelsRed[client] = ppix;
 	npix = pmap->numPixelsGreen[client];
-	ppix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client],
+	ppix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
 				  (npix + 1) * sizeof(Pixel));
 	if (!ppix)
 	    return (BadAlloc);
 	ppix[npix] = pixG;
 	pmap->clientPixelsGreen[client] = ppix;
 	npix = pmap->numPixelsBlue[client];
-	ppix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client],
+	ppix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
 				  (npix + 1) * sizeof(Pixel));
 	if (!ppix)
 	    return (BadAlloc);
@@ -962,7 +962,7 @@ AllocColor (ColormapPtr pmap,
     {
 	colorResource	*pcr;
 
-	pcr = xalloc(sizeof(colorResource));
+	pcr = malloc(sizeof(colorResource));
 	if (!pcr)
 	{
 	    (void)FreeColors(pmap, client, 1, pPix, (Pixel)0);
@@ -1348,7 +1348,7 @@ gotit:
 	break;
     }
     npix = nump[client];
-    ppix = (Pixel *) xrealloc (pixp[client], (npix + 1) * sizeof(Pixel));
+    ppix = (Pixel *) realloc(pixp[client], (npix + 1) * sizeof(Pixel));
     if (!ppix)
     {
 	pent->refcnt--;
@@ -1518,7 +1518,7 @@ FreePixels(ColormapPtr pmap, int client)
 	}
     }
 
-    xfree(ppixStart);
+    free(ppixStart);
     pmap->clientPixelsRed[client] = (Pixel *) NULL;
     pmap->numPixelsRed[client] = 0;
     if ((class | DynamicClass) == DirectColor) 
@@ -1527,7 +1527,7 @@ FreePixels(ColormapPtr pmap, int client)
 	if (class & DynamicClass)
 	    for (ppix = ppixStart, n = pmap->numPixelsGreen[client]; --n >= 0;)
 		FreeCell(pmap, *ppix++, GREENMAP);
-	xfree(ppixStart);
+	free(ppixStart);
 	pmap->clientPixelsGreen[client] = (Pixel *) NULL;
 	pmap->numPixelsGreen[client] = 0;
 
@@ -1535,7 +1535,7 @@ FreePixels(ColormapPtr pmap, int client)
 	if (class & DynamicClass)
 	    for (ppix = ppixStart, n = pmap->numPixelsBlue[client]; --n >= 0; )
 		FreeCell(pmap, *ppix++, BLUEMAP);
-	xfree(ppixStart);
+	free(ppixStart);
 	pmap->clientPixelsBlue[client] = (Pixel *) NULL;
 	pmap->numPixelsBlue[client] = 0;
     }
@@ -1558,7 +1558,7 @@ FreeClientPixels (pointer value, XID fakeid)
 				 DixRemoveAccess);
     if (rc == Success)
 	FreePixels((ColormapPtr)pmap, pcr->client);
-    xfree(pcr);
+    free(pcr);
     return Success;
 }
 
@@ -1580,7 +1580,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
 	oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
     if (!oldcount && (CLIENT_ID(pmap->mid) != client))
     {
-	pcr = xalloc(sizeof(colorResource));
+	pcr = malloc(sizeof(colorResource));
 	if (!pcr)
 	    return (BadAlloc);
     }
@@ -1628,7 +1628,7 @@ AllocColorCells (int client, ColormapPtr pmap, int colors, int planes,
 	if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
 	    ok = BadAlloc;
     } else if (pcr)
-	xfree(pcr);
+	free(pcr);
 
     return (ok);
 }
@@ -1655,7 +1655,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
 	oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
     if (!oldcount && (CLIENT_ID(pmap->mid) != client))
     {
-	pcr = xalloc(sizeof(colorResource));
+	pcr = malloc(sizeof(colorResource));
 	if (!pcr)
 	    return (BadAlloc);
     }
@@ -1719,7 +1719,7 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
 	if (!AddResource(FakeClientID(client), RT_CMAPENTRY, (pointer)pcr))
 	    ok = BadAlloc;
     } else if (pcr)
-	xfree(pcr);
+	free(pcr);
 
     return (ok);
 }
@@ -1747,14 +1747,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
     for(p = pixels; p < pixels + c; p++)
 	*p = 0;
 
-    ppixRed = xalloc(npixR * sizeof(Pixel));
-    ppixGreen = xalloc(npixG * sizeof(Pixel));
-    ppixBlue = xalloc(npixB * sizeof(Pixel));
+    ppixRed = malloc(npixR * sizeof(Pixel));
+    ppixGreen = malloc(npixG * sizeof(Pixel));
+    ppixBlue = malloc(npixB * sizeof(Pixel));
     if (!ppixRed || !ppixGreen || !ppixBlue)
     {
-	if (ppixBlue) xfree(ppixBlue);
-	if (ppixGreen) xfree(ppixGreen);
-	if (ppixRed) xfree(ppixRed);
+	if (ppixBlue) free(ppixBlue);
+	if (ppixGreen) free(ppixGreen);
+	if (ppixRed) free(ppixRed);
 	return(BadAlloc);
     }
 
@@ -1764,17 +1764,17 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
 
     if (okR && okG && okB)
     {
-	rpix = (Pixel *) xrealloc(pmap->clientPixelsRed[client],
+	rpix = (Pixel *) realloc(pmap->clientPixelsRed[client],
 				  (pmap->numPixelsRed[client] + (c << r)) *
 				  sizeof(Pixel));
 	if (rpix)
 	    pmap->clientPixelsRed[client] = rpix;
-	gpix = (Pixel *) xrealloc(pmap->clientPixelsGreen[client],
+	gpix = (Pixel *) realloc(pmap->clientPixelsGreen[client],
 				  (pmap->numPixelsGreen[client] + (c << g)) *
 				  sizeof(Pixel));
 	if (gpix)
 	    pmap->clientPixelsGreen[client] = gpix;
-	bpix = (Pixel *) xrealloc(pmap->clientPixelsBlue[client],
+	bpix = (Pixel *) realloc(pmap->clientPixelsBlue[client],
 				  (pmap->numPixelsBlue[client] + (c << b)) *
 				  sizeof(Pixel));
 	if (bpix)
@@ -1792,9 +1792,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
 	if (okB)
 	    for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
 		pmap->blue[*ppix].refcnt = 0;
-	xfree(ppixBlue);
-	xfree(ppixGreen);
-	xfree(ppixRed);
+	free(ppixBlue);
+	free(ppixGreen);
+	free(ppixRed);
 	return(BadAlloc);
     }
 
@@ -1836,9 +1836,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
     for (pDst = pixels; pDst < pixels + c; pDst++)
 	*pDst |= ALPHAMASK(pmap->pVisual);
 
-    xfree(ppixBlue);
-    xfree(ppixGreen);
-    xfree(ppixRed);
+    free(ppixBlue);
+    free(ppixGreen);
+    free(ppixRed);
 
     return (Success);
 }
@@ -1854,7 +1854,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
     npix = c << r;
     if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
 	return(BadAlloc);
-    if(!(ppixTemp = xalloc(npix * sizeof(Pixel))))
+    if(!(ppixTemp = malloc(npix * sizeof(Pixel))))
 	return(BadAlloc);
     ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
 
@@ -1863,7 +1863,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
 
 	/* all the allocated pixels are added to the client pixel list,
 	 * but only the unique ones are returned to the client */
-	ppix = (Pixel *)xrealloc(pmap->clientPixelsRed[client],
+	ppix = (Pixel *)realloc(pmap->clientPixelsRed[client],
 			 (pmap->numPixelsRed[client] + npix) * sizeof(Pixel));
 	if (!ppix)
 	{
@@ -1884,7 +1884,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
 	pmap->numPixelsRed[client] += npix;
 	pmap->freeRed -= npix;
     }
-    xfree(ppixTemp);
+    free(ppixTemp);
     return (ok ? Success : BadAlloc);
 }
 
@@ -2084,16 +2084,16 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
 
     npixClientNew = c << (r + g + b);
     npixShared = (c << r) + (c << g) + (c << b);
-    psharedList = xalloc(npixShared * sizeof(SHAREDCOLOR *));
+    psharedList = malloc(npixShared * sizeof(SHAREDCOLOR *));
     if (!psharedList)
 	return FALSE;
     ppshared = psharedList;
     for (z = npixShared; --z >= 0; )
     {
-	if (!(ppshared[z] = xalloc(sizeof(SHAREDCOLOR))))
+	if (!(ppshared[z] = malloc(sizeof(SHAREDCOLOR))))
 	{
 	    for (z++ ; z < npixShared; z++)
-		xfree(ppshared[z]);
+		free(ppshared[z]);
 	    return FALSE;
 	}
     }
@@ -2198,7 +2198,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
 	    }
 	}
     }
-    xfree(psharedList);
+    free(psharedList);
     return TRUE;
 }
 
@@ -2366,7 +2366,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
 		    npix++;
     	        }
     	    }
-	    pptr = (Pixel *)xrealloc(ppixClient, npixNew * sizeof(Pixel));
+	    pptr = (Pixel *)realloc(ppixClient, npixNew * sizeof(Pixel));
 	    if (pptr)
 		ppixClient = pptr;
 	    npixClient = npixNew;
@@ -2374,7 +2374,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
 	else
 	{
 	    npixClient = 0;
-	    xfree(ppixClient);
+	    free(ppixClient);
     	    ppixClient = (Pixel *)NULL;
 	}
 	switch(color)
@@ -2673,7 +2673,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
     Colormap	*pmaps;
     int		imap, nummaps, found;
 
-    pmaps = xalloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap));
+    pmaps = malloc(pWin->drawable.pScreen->maxInstalledCmaps*sizeof(Colormap));
     if(!pmaps)
 	return(FALSE);
     nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
@@ -2687,7 +2687,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
 	    break;
 	}
     }
-    xfree(pmaps);
+    free(pmaps);
     return (found);
 }
 
@@ -2727,7 +2727,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
     first_new_vid = depth->numVids;
     first_new_visual = pScreen->numVisuals;
 
-    vids = xrealloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID));
+    vids = realloc(depth->vids, (depth->numVids + new_visual_count) * sizeof(XID));
     if (!vids)
         return FALSE;
 
@@ -2735,7 +2735,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count,
     depth->vids = vids;
 
     numVisuals = pScreen->numVisuals + new_visual_count;
-    visuals = xrealloc(pScreen->visuals, numVisuals * sizeof(VisualRec));
+    visuals = realloc(pScreen->visuals, numVisuals * sizeof(VisualRec));
     if (!visuals) {
 	return FALSE;
     }
diff --git a/dix/cursor.c b/dix/cursor.c
index 5d9c8b0..a512309 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -81,10 +81,10 @@ FreeCursorBits(CursorBitsPtr bits)
 {
     if (--bits->refcnt > 0)
 	return;
-    xfree(bits->source);
-    xfree(bits->mask);
+    free(bits->source);
+    free(bits->mask);
 #ifdef ARGB_CURSOR
-    xfree(bits->argb);
+    free(bits->argb);
 #endif
     dixFreePrivates(bits->devPrivates);
     bits->devPrivates = NULL;
@@ -100,9 +100,9 @@ FreeCursorBits(CursorBitsPtr bits)
 	{
 	    *prev = this->next;
 	    CloseFont(this->font, (Font)0);
-	    xfree(this);
+	    free(this);
 	}
-	xfree(bits);
+	free(bits);
     }
 }
 
@@ -130,7 +130,7 @@ FreeCursor(pointer value, XID cid)
     }
     dixFreePrivates(pCurs->devPrivates);
     FreeCursorBits(pCurs->bits);
-    xfree( pCurs);
+    free( pCurs);
     return(Success);
 }
 
@@ -237,11 +237,11 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
     int rc;
 
     *ppCurs = NULL;
-    pCurs = (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
+    pCurs = (CursorPtr)calloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
     if (!pCurs)
     {
-	xfree(psrcbits);
-	xfree(pmaskbits);
+	free(psrcbits);
+	free(pmaskbits);
 	return BadAlloc;
     }
     bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
@@ -291,7 +291,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
 error:
     dixFreePrivates(pCurs->devPrivates);
     FreeCursorBits(bits);
-    xfree(pCurs);
+    free(pCurs);
 
     return rc;
 }
@@ -339,7 +339,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
     }
     if (pShare)
     {
-	pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1);
+	pCurs = (CursorPtr)calloc(sizeof(CursorRec), 1);
 	if (!pCurs)
 	    return BadAlloc;
 	bits = pShare->bits;
@@ -358,7 +358,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
 	    unsigned char *mskptr;
 
 	    n = BitmapBytePad(cm.width)*(long)cm.height;
-	    mskptr = mskbits = xalloc(n);
+	    mskptr = mskbits = malloc(n);
 	    if (!mskptr)
 		return BadAlloc;
 	    while (--n >= 0)
@@ -376,13 +376,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
 	}
 	if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)))
 	{
-	    xfree(mskbits);
+	    free(mskbits);
 	    return rc;
 	}
 	if (sourcefont != maskfont)
 	{
 	    pCurs = 
-                (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
+                (CursorPtr)calloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
 	    if (pCurs)
 		bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
 	    else
@@ -390,17 +390,17 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
 	}
 	else
 	{
-	    pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1);
+	    pCurs = (CursorPtr)calloc(sizeof(CursorRec), 1);
 	    if (pCurs)
-		bits = (CursorBitsPtr)xcalloc(sizeof(CursorBits), 1);
+		bits = (CursorBitsPtr)calloc(sizeof(CursorBits), 1);
 	    else
 		bits = (CursorBitsPtr)NULL;
 	}
 	if (!bits)
 	{
-	    xfree(pCurs);
-	    xfree(mskbits);
-	    xfree(srcbits);
+	    free(pCurs);
+	    free(mskbits);
+	    free(srcbits);
 	    return BadAlloc;
 	}
 	bits->source = srcbits;
@@ -418,7 +418,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
 	else
 	{
 	    bits->refcnt = 1;
-	    pShare = xalloc(sizeof(GlyphShare));
+	    pShare = malloc(sizeof(GlyphShare));
 	    if (!pShare)
 	    {
 		FreeCursorBits(bits);
@@ -469,7 +469,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
 error:
     dixFreePrivates(pCurs->devPrivates);
     FreeCursorBits(bits);
-    xfree(pCurs);
+    free(pCurs);
 
     return rc;
 }
diff --git a/dix/devices.c b/dix/devices.c
index a33df4d..db5c4a1 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -141,7 +141,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
 
     if (kbd->spriteInfo->spriteOwner)
     {
-        xfree(kbd->spriteInfo->sprite);
+        free(kbd->spriteInfo->sprite);
         kbd->spriteInfo->sprite = NULL;
         kbd->spriteInfo->spriteOwner = FALSE;
     }
@@ -195,7 +195,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
 
     if (devid >= MAXDEVICES)
 	return (DeviceIntPtr)NULL;
-    dev =  xcalloc(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec), 1);
+    dev =  calloc(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec), 1);
     if (!dev)
 	return (DeviceIntPtr)NULL;
     dev->id = devid;
@@ -218,7 +218,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     /*  security creation/labeling check
      */
     if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
-	xfree(dev);
+	free(dev);
 	return NULL;
     }
 
@@ -664,15 +664,15 @@ FreeDeviceClass(int type, pointer *class)
                     XkbFreeInfo((*k)->xkbInfo);
                     (*k)->xkbInfo = NULL;
                 }
-                xfree((*k));
+                free((*k));
                 break;
             }
         case ButtonClass:
             {
                 ButtonClassPtr *b = (ButtonClassPtr*)class;
                 if ((*b)->xkb_acts)
-                    xfree((*b)->xkb_acts);
-                xfree((*b));
+                    free((*b)->xkb_acts);
+                free((*b));
                 break;
             }
         case ValuatorClass:
@@ -680,21 +680,21 @@ FreeDeviceClass(int type, pointer *class)
                 ValuatorClassPtr *v = (ValuatorClassPtr*)class;
 
                 if ((*v)->motion)
-                    xfree((*v)->motion);
-                xfree((*v));
+                    free((*v)->motion);
+                free((*v));
                 break;
             }
         case FocusClass:
             {
                 FocusClassPtr *f = (FocusClassPtr*)class;
-                xfree((*f)->trace);
-                xfree((*f));
+                free((*f)->trace);
+                free((*f));
                 break;
             }
         case ProximityClass:
             {
                 ProximityClassPtr *p = (ProximityClassPtr*)class;
-                xfree((*p));
+                free((*p));
                 break;
             }
     }
@@ -717,7 +717,7 @@ FreeFeedbackClass(int type, pointer *class)
                     knext = k->next;
                     if (k->xkb_sli)
                         XkbFreeSrvLedInfo(k->xkb_sli);
-                    xfree(k);
+                    free(k);
                 }
                 break;
             }
@@ -728,7 +728,7 @@ FreeFeedbackClass(int type, pointer *class)
 
                 for (p = (*ptrfeed); p; p = pnext) {
                     pnext = p->next;
-                    xfree(p);
+                    free(p);
                 }
                 break;
             }
@@ -739,7 +739,7 @@ FreeFeedbackClass(int type, pointer *class)
 
                 for (i = (*intfeed); i; i = inext) {
                     inext = i->next;
-                    xfree(i);
+                    free(i);
                 }
                 break;
             }
@@ -750,9 +750,9 @@ FreeFeedbackClass(int type, pointer *class)
 
                 for (s = (*stringfeed); s; s = snext) {
                     snext = s->next;
-                    xfree(s->ctrl.symbols_supported);
-                    xfree(s->ctrl.symbols_displayed);
-                    xfree(s);
+                    free(s->ctrl.symbols_supported);
+                    free(s->ctrl.symbols_displayed);
+                    free(s);
                 }
                 break;
             }
@@ -763,7 +763,7 @@ FreeFeedbackClass(int type, pointer *class)
 
                 for (b = (*bell); b; b = bnext) {
                     bnext = b->next;
-                    xfree(b);
+                    free(b);
                 }
                 break;
             }
@@ -776,7 +776,7 @@ FreeFeedbackClass(int type, pointer *class)
                     lnext = l->next;
                     if (l->xkb_sli)
                         XkbFreeSrvLedInfo(l->xkb_sli);
-                    xfree(l);
+                    free(l);
                 }
                 break;
             }
@@ -838,7 +838,7 @@ CloseDevice(DeviceIntPtr dev)
     while (dev->xkb_interest)
 	XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
 
-    xfree(dev->name);
+    free(dev->name);
 
     classes = (ClassesPtr)&dev->key;
     FreeAllDeviceClasses(classes);
@@ -847,14 +847,14 @@ CloseDevice(DeviceIntPtr dev)
     {
         classes = dev->unused_classes;
         FreeAllDeviceClasses(classes);
-	xfree(classes);
+	free(classes);
     }
 
     if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
 	if (dev->spriteInfo->sprite->current)
 	    FreeCursor(dev->spriteInfo->sprite->current, None);
-        xfree(dev->spriteInfo->sprite->spriteTrace);
-        xfree(dev->spriteInfo->sprite);
+        free(dev->spriteInfo->sprite->spriteTrace);
+        free(dev->spriteInfo->sprite);
     }
 
     /* a client may have the device set as client pointer */
@@ -867,9 +867,9 @@ CloseDevice(DeviceIntPtr dev)
         }
     }
 
-    xfree(dev->deviceGrab.sync.event);
+    free(dev->deviceGrab.sync.event);
     dixFreePrivates(dev->devPrivates);
-    xfree(dev);
+    free(dev);
 }
 
 /**
@@ -1110,7 +1110,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
     else if (src->mapWidth > dst->mapWidth) {
         i = sizeof(KeySym) * src->mapWidth *
              (dst->maxKeyCode - dst->minKeyCode + 1);
-        tmp = xcalloc(sizeof(KeySym), i);
+        tmp = calloc(sizeof(KeySym), i);
         if (!tmp)
             return FALSE;
 
@@ -1118,7 +1118,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
             for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++)
                 memmove(&tmp[i * src->mapWidth], &dst->map[i * dst->mapWidth],
                         dst->mapWidth * sizeof(KeySym));
-            xfree(dst->map);
+            free(dst->map);
         }
         dst->mapWidth = src->mapWidth;
         dst->map = tmp;
@@ -1126,7 +1126,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
     else if (!dst->map) {
         i = sizeof(KeySym) * src->mapWidth *
              (dst->maxKeyCode - dst->minKeyCode + 1);
-        tmp = xcalloc(sizeof(KeySym), i);
+        tmp = calloc(sizeof(KeySym), i);
         if (!tmp)
             return FALSE;
 
@@ -1148,7 +1148,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, Atom* labels,
     ButtonClassPtr butc;
     int i;
 
-    butc = xcalloc(1, sizeof(ButtonClassRec));
+    butc = calloc(1, sizeof(ButtonClassRec));
     if (!butc)
 	return FALSE;
     butc->numButtons = numButtons;
@@ -1180,7 +1180,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
         numAxes = MAX_VALUATORS;
     }
 
-    valc = (ValuatorClassPtr)xcalloc(1, sizeof(ValuatorClassRec) +
+    valc = (ValuatorClassPtr)calloc(1, sizeof(ValuatorClassRec) +
 				    numAxes * sizeof(AxisInfo) +
 				    numAxes * sizeof(double));
     if (!valc)
@@ -1263,7 +1263,7 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
         case PtrAccelPredictable:
         {
             DeviceVelocityPtr s;
-            s = xalloc(sizeof(DeviceVelocityRec));
+            s = malloc(sizeof(DeviceVelocityRec));
             if(!s)
         	return FALSE;
             InitVelocityData(s);
@@ -1295,7 +1295,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
 {
     AbsoluteClassPtr abs;
 
-    abs = xalloc(sizeof(AbsoluteClassRec));
+    abs = malloc(sizeof(AbsoluteClassRec));
     if (!abs)
         return FALSE;
 
@@ -1328,7 +1328,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
 {
     FocusClassPtr focc;
 
-    focc = xalloc(sizeof(FocusClassRec));
+    focc = malloc(sizeof(FocusClassRec));
     if (!focc)
 	return FALSE;
     focc->win = PointerRootWin;
@@ -1347,7 +1347,7 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
 {
     PtrFeedbackPtr feedc;
 
-    feedc = xalloc(sizeof(PtrFeedbackClassRec));
+    feedc = malloc(sizeof(PtrFeedbackClassRec));
     if (!feedc)
 	return FALSE;
     feedc->CtrlProc = controlProc;
@@ -1385,22 +1385,22 @@ InitStringFeedbackClassDeviceStruct (
     int i;
     StringFeedbackPtr feedc;
 
-    feedc = xalloc(sizeof(StringFeedbackClassRec));
+    feedc = malloc(sizeof(StringFeedbackClassRec));
     if (!feedc)
 	return FALSE;
     feedc->CtrlProc = controlProc;
     feedc->ctrl.num_symbols_supported = num_symbols_supported;
     feedc->ctrl.num_symbols_displayed = 0;
     feedc->ctrl.max_symbols = max_symbols;
-    feedc->ctrl.symbols_supported = xalloc (sizeof (KeySym) * num_symbols_supported);
-    feedc->ctrl.symbols_displayed = xalloc (sizeof (KeySym) * max_symbols);
+    feedc->ctrl.symbols_supported = malloc(sizeof (KeySym) * num_symbols_supported);
+    feedc->ctrl.symbols_displayed = malloc(sizeof (KeySym) * max_symbols);
     if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
     {
 	if (feedc->ctrl.symbols_supported)
-	    xfree(feedc->ctrl.symbols_supported);
+	    free(feedc->ctrl.symbols_supported);
 	if (feedc->ctrl.symbols_displayed)
-	    xfree(feedc->ctrl.symbols_displayed);
-	xfree(feedc);
+	    free(feedc->ctrl.symbols_displayed);
+	free(feedc);
 	return FALSE;
     }
     for (i=0; i<num_symbols_supported; i++)
@@ -1421,7 +1421,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
 {
     BellFeedbackPtr feedc;
 
-    feedc = xalloc(sizeof(BellFeedbackClassRec));
+    feedc = malloc(sizeof(BellFeedbackClassRec));
     if (!feedc)
 	return FALSE;
     feedc->CtrlProc = controlProc;
@@ -1440,7 +1440,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
 {
     LedFeedbackPtr feedc;
 
-    feedc = xalloc(sizeof(LedFeedbackClassRec));
+    feedc = malloc(sizeof(LedFeedbackClassRec));
     if (!feedc)
 	return FALSE;
     feedc->CtrlProc = controlProc;
@@ -1459,7 +1459,7 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
 {
     IntegerFeedbackPtr feedc;
 
-    feedc = xalloc(sizeof(IntegerFeedbackClassRec));
+    feedc = malloc(sizeof(IntegerFeedbackClassRec));
     if (!feedc)
 	return FALSE;
     feedc->CtrlProc = controlProc;
@@ -1559,7 +1559,7 @@ ProcGetModifierMapping(ClientPtr client)
     WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
     (void)WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap);
 
-    xfree(modkeymap);
+    free(modkeymap);
 
     return client->noClientException;
 }
@@ -1719,8 +1719,8 @@ ProcGetKeyboardMapping(ClientPtr client)
                              syms->mapWidth * stuff->count * sizeof(KeySym),
                              &syms->map[syms->mapWidth * (stuff->firstKeyCode -
                                                           syms->minKeyCode)]);
-    xfree(syms->map);
-    xfree(syms);
+    free(syms->map);
+    free(syms);
 
     return client->noClientException;
 }
@@ -2215,7 +2215,7 @@ ProcGetMotionEvents(ClientPtr client)
 				 (char *)coords);
     }
     if (coords)
-	xfree(coords);
+	free(coords);
     return Success;
 }
 
@@ -2348,7 +2348,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
     {
         screen = miPointerGetScreen(dev);
         screen->DeviceCursorCleanup(dev, screen);
-        xfree(dev->spriteInfo->sprite);
+        free(dev->spriteInfo->sprite);
     }
 
     oldmaster = dev->u.master;
@@ -2467,7 +2467,7 @@ AllocDevicePair (ClientPtr client, char* name,
     if (!pointer)
         return BadAlloc;
 
-    pointer->name = xcalloc(strlen(name) + strlen(" pointer") + 1, sizeof(char));
+    pointer->name = calloc(strlen(name) + strlen(" pointer") + 1, sizeof(char));
     strcpy(pointer->name, name);
     strcat(pointer->name, " pointer");
 
@@ -2490,7 +2490,7 @@ AllocDevicePair (ClientPtr client, char* name,
         return BadAlloc;
     }
 
-    keyboard->name = xcalloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
+    keyboard->name = calloc(strlen(name) + strlen(" keyboard") + 1, sizeof(char));
     strcpy(keyboard->name, name);
     strcat(keyboard->name, " keyboard");
 
@@ -2507,8 +2507,8 @@ AllocDevicePair (ClientPtr client, char* name,
     keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
 
     /* The ClassesRec stores the device classes currently not used. */
-    pointer->unused_classes = xcalloc(1, sizeof(ClassesRec));
-    keyboard->unused_classes = xcalloc(1, sizeof(ClassesRec));
+    pointer->unused_classes = calloc(1, sizeof(ClassesRec));
+    keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
 
     *ptr = pointer;
     *keybd = keyboard;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index a2cffac..63c978c 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -359,7 +359,7 @@ Dispatch(void)
     nextFreeClientID = 1;
     nClients = 0;
 
-    clientReady = xalloc(sizeof(int) * MaxClients);
+    clientReady = malloc(sizeof(int) * MaxClients);
     if (!clientReady)
 	return;
 
@@ -466,7 +466,7 @@ Dispatch(void)
     ddxBeforeReset ();
 #endif
     KillAllClients();
-    xfree(clientReady);
+    free(clientReady);
     dispatchException &= ~DE_RESET;
     SmartScheduleLatencyLimited = 0;
 }
@@ -530,7 +530,7 @@ CreateConnectionBlock(void)
             pad_to_int32(setup.nbytesVendor) +
 	    (setup.numFormats * sizeof(xPixmapFormat)) +
             (setup.numRoots * sizeof(xWindowRoot));
-    ConnectionInfo = xalloc(lenofblock);
+    ConnectionInfo = malloc(lenofblock);
     if (!ConnectionInfo)
 	return FALSE;
 
@@ -592,10 +592,10 @@ CreateConnectionBlock(void)
 	{
 	    lenofblock += sizeof(xDepth) +
 		    (pDepth->numVids * sizeof(xVisualType));
-	    pBuf = (char *)xrealloc(ConnectionInfo, lenofblock);
+	    pBuf = (char *)realloc(ConnectionInfo, lenofblock);
 	    if (!pBuf)
 	    {
-		xfree(ConnectionInfo);
+		free(ConnectionInfo);
 		return FALSE;
 	    }
 	    ConnectionInfo = pBuf;
@@ -1019,7 +1019,7 @@ ProcQueryTree(ClientPtr client)
     {
 	int curChild = 0;
 
-	childIDs = xalloc(numChildren * sizeof(Window));
+	childIDs = malloc(numChildren * sizeof(Window));
 	if (!childIDs)
 	    return BadAlloc;
 	for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
@@ -1034,7 +1034,7 @@ ProcQueryTree(ClientPtr client)
     {
     	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
-	xfree(childIDs);
+	free(childIDs);
     }
 
     return(client->noClientException);
@@ -1308,7 +1308,7 @@ ProcQueryFont(ClientPtr client)
 	rlength = sizeof(xQueryFontReply) +
 	             FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp)  +
 		     nprotoxcistructs * sizeof(xCharInfo);
-	reply = xcalloc(1, rlength);
+	reply = calloc(1, rlength);
 	if(!reply)
 	{
 	    return(BadAlloc);
@@ -1320,7 +1320,7 @@ ProcQueryFont(ClientPtr client)
 	QueryFont( pFont, reply, nprotoxcistructs);
 
         WriteReplyToClient(client, rlength, reply);
-	xfree(reply);
+	free(reply);
 	return(client->noClientException);
     }
 }
@@ -2154,7 +2154,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
     xgi.length = length;
 
     if (im_return) {
-	pBuf = xcalloc(1, sz_xGetImageReply + length);
+	pBuf = calloc(1, sz_xGetImageReply + length);
 	if (!pBuf)
 	    return (BadAlloc);
 	if (widthBytesLine == 0)
@@ -2192,7 +2192,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
 		length += widthBytesLine;
 	    }
 	}
-	if(!(pBuf = xcalloc(1, length)))
+	if(!(pBuf = calloc(1, length)))
 	    return (BadAlloc);
 	WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
     }
@@ -2293,7 +2293,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
     if (pVisibleRegion)
 	REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
     if (!im_return)
-	xfree(pBuf);
+	free(pBuf);
     return (client->noClientException);
 }
 
@@ -2564,7 +2564,7 @@ ProcListInstalledColormaps(ClientPtr client)
     if (rc != Success)
 	goto out;
 
-    preply = xalloc(sizeof(xListInstalledColormapsReply) +
+    preply = malloc(sizeof(xListInstalledColormapsReply) +
 		     pWin->drawable.pScreen->maxInstalledCmaps *
 		     sizeof(Colormap));
     if(!preply)
@@ -2579,7 +2579,7 @@ ProcListInstalledColormaps(ClientPtr client)
     WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
     client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
     WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
-    xfree(preply);
+    free(preply);
     rc = client->noClientException;
 out:
     return rc;
@@ -2708,7 +2708,7 @@ ProcAllocColorCells (ClientPtr client)
 	}
 	nmasks = stuff->planes;
 	length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
-	ppixels = xalloc(length);
+	ppixels = malloc(length);
 	if(!ppixels)
             return(BadAlloc);
 	pmasks = ppixels + npixels;
@@ -2716,7 +2716,7 @@ ProcAllocColorCells (ClientPtr client)
 	if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks, 
 				    (Bool)stuff->contiguous, ppixels, pmasks)) )
 	{
-	    xfree(ppixels);
+	    free(ppixels);
             if (client->noClientException != Success)
                 return(client->noClientException);
 	    else
@@ -2735,7 +2735,7 @@ ProcAllocColorCells (ClientPtr client)
 	    client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	    WriteSwappedDataToClient(client, length, ppixels);
 	}
-	xfree(ppixels);
+	free(ppixels);
         return (client->noClientException);        
     }
     else
@@ -2777,7 +2777,7 @@ ProcAllocColorPlanes(ClientPtr client)
 	acpr.sequenceNumber = client->sequence;
 	acpr.nPixels = npixels;
 	length = (long)npixels * sizeof(Pixel);
-	ppixels = xalloc(length);
+	ppixels = malloc(length);
 	if(!ppixels)
             return(BadAlloc);
 	if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
@@ -2785,7 +2785,7 @@ ProcAllocColorPlanes(ClientPtr client)
 	    (Bool)stuff->contiguous, ppixels,
 	    &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) )
 	{
-            xfree(ppixels);
+            free(ppixels);
             if (client->noClientException != Success)
                 return(client->noClientException);
 	    else
@@ -2800,7 +2800,7 @@ ProcAllocColorPlanes(ClientPtr client)
 	    client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	    WriteSwappedDataToClient(client, length, ppixels);
 	}
-	xfree(ppixels);
+	free(ppixels);
         return (client->noClientException);        
     }
     else
@@ -2930,12 +2930,12 @@ ProcQueryColors(ClientPtr client)
 	xQueryColorsReply	qcr;
 
 	count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
-	prgbs = xcalloc(1, count * sizeof(xrgb));
+	prgbs = calloc(1, count * sizeof(xrgb));
 	if(!prgbs && count)
             return(BadAlloc);
 	if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
 	{
-   	    if (prgbs) xfree(prgbs);
+	    if (prgbs) free(prgbs);
 	    if (client->noClientException != Success)
                 return(client->noClientException);
 	    else
@@ -2955,7 +2955,7 @@ ProcQueryColors(ClientPtr client)
 	    client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
 	    WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
 	}
-	if (prgbs) xfree(prgbs);
+	if (prgbs) free(prgbs);
 	return(client->noClientException);
 	
     }
@@ -3054,13 +3054,13 @@ ProcCreateCursor (ClientPtr client)
 	return (BadMatch);
 
     n = BitmapBytePad(width)*height;
-    srcbits = xcalloc(1, n);
+    srcbits = calloc(1, n);
     if (!srcbits)
 	return (BadAlloc);
-    mskbits = xalloc(n);
+    mskbits = malloc(n);
     if (!mskbits)
     {
-	xfree(srcbits);
+	free(srcbits);
 	return (BadAlloc);
     }
 
@@ -3323,7 +3323,7 @@ ProcListHosts(ClientPtr client)
 	client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
 	WriteSwappedDataToClient(client, len, pdata);
     }
-    xfree(pdata);
+    free(pdata);
     return (client->noClientException);
 }
 
@@ -3619,7 +3619,7 @@ CloseDownClient(ClientPtr client)
 	clients[client->index] = NullClient;
 	SmartLastClient = NullClient;
 	dixFreePrivates(client->devPrivates);
-	xfree(client);
+	free(client);
 
 	while (!clients[currentMaxClients-1])
 	    currentMaxClients--;
@@ -3668,13 +3668,13 @@ ClientPtr NextAvailableClient(pointer ospriv)
     i = nextFreeClientID;
     if (i == MAXCLIENTS)
 	return (ClientPtr)NULL;
-    clients[i] = client = xalloc(sizeof(ClientRec));
+    clients[i] = client = malloc(sizeof(ClientRec));
     if (!client)
 	return (ClientPtr)NULL;
     InitClient(client, i, ospriv);
     if (!InitClientResources(client))
     {
-	xfree(client);
+	free(client);
 	return (ClientPtr)NULL;
     }
     data.reqType = 1;
@@ -3682,7 +3682,7 @@ ClientPtr NextAvailableClient(pointer ospriv)
     if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
     {
 	FreeClientResources(client);
-	xfree(client);
+	free(client);
 	return (ClientPtr)NULL;
     }
     if (i == currentMaxClients)
@@ -3985,7 +3985,7 @@ AddScreen(
     if (i == MAXSCREENS)
 	return -1;
 
-    pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec));
+    pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
     if (!pScreen)
 	return -1;
 
@@ -4044,7 +4044,7 @@ AddScreen(
     if (!(*pfnInit)(i, pScreen, argc, argv))
     {
 	dixFreePrivates(pScreen->devPrivates);
-	xfree(pScreen);
+	free(pScreen);
 	screenInfo.numScreens--;
 	return -1;
     }
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 6dc8193..cc58b89 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -166,7 +166,7 @@ QueueFontWakeup(FontPathElementPtr fpe)
     }
     if (num_slept_fpes == size_slept_fpes) {
 	new = (FontPathElementPtr *)
-	    xrealloc(slept_fpes,
+	    realloc(slept_fpes,
 		     sizeof(FontPathElementPtr) * (size_slept_fpes + 4));
 	if (!new)
 	    return;
@@ -222,8 +222,8 @@ FreeFPE (FontPathElementPtr fpe)
     fpe->refcount--;
     if (fpe->refcount == 0) {
 	(*fpe_functions[fpe->type].free_fpe) (fpe);
-	xfree(fpe->name);
-	xfree(fpe);
+	free(fpe->name);
+	free(fpe);
     }
 }
 
@@ -297,7 +297,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
 
 	if (err == FontNameAlias && alias) {
 	    newlen = strlen(alias);
-	    newname = (char *) xrealloc(c->fontname, newlen);
+	    newname = (char *) realloc(c->fontname, newlen);
 	    if (!newname) {
 		err = AllocError;
 		break;
@@ -378,9 +378,9 @@ bail:
     for (i = 0; i < c->num_fpes; i++) {
 	FreeFPE(c->fpe_list[i]);
     }
-    xfree(c->fpe_list);
-    xfree(c->fontname);
-    xfree(c);
+    free(c->fpe_list);
+    free(c->fontname);
+    free(c);
     return TRUE;
 }
 
@@ -393,11 +393,11 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
 
 #ifdef FONTDEBUG
     char *f;
-    f = xalloc(lenfname + 1);
+    f = malloc(lenfname + 1);
     memmove(f, pfontname, lenfname);
     f[lenfname] = '\0';
     ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f);
-    xfree(f);
+    free(f);
 #endif
     if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
 	return BadName;
@@ -430,24 +430,24 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
 	    return Success;
 	}
     }
-    c = xalloc(sizeof(OFclosureRec));
+    c = malloc(sizeof(OFclosureRec));
     if (!c)
 	return BadAlloc;
-    c->fontname = xalloc(lenfname);
+    c->fontname = malloc(lenfname);
     c->origFontName = pfontname;
     c->origFontNameLen = lenfname;
     if (!c->fontname) {
-	xfree(c);
+	free(c);
 	return BadAlloc;
     }
     /*
      * copy the current FPE list, so that if it gets changed by another client
      * while we're blocking, the request still appears atomic
      */
-    c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
+    c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
     if (!c->fpe_list) {
-	xfree(c->fontname);
-	xfree(c);
+	free(c->fontname);
+	free(c);
 	return BadAlloc;
     }
     memmove(c->fontname, pfontname, lenfname);
@@ -677,8 +677,8 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		    return TRUE;
 		}
 		if (err == FontNameAlias) {
-		    if (resolved) xfree(resolved);
-		    resolved = xalloc(resolvedlen + 1);
+		    if (resolved) free(resolved);
+		    resolved = malloc(resolvedlen + 1);
 		    if (resolved)
 			memmove(resolved, tmpname, resolvedlen + 1);
 		}
@@ -732,8 +732,8 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
 		    c->saved = c->current;
 		    c->haveSaved = TRUE;
 		    if (c->savedName)
-			xfree(c->savedName);
-		    c->savedName = xalloc(namelen + 1);
+			free(c->savedName);
+		    c->savedName = malloc(namelen + 1);
 		    if (c->savedName)
 			memmove(c->savedName, name, namelen + 1);
 		    c->savedNameLen = namelen;
@@ -795,7 +795,7 @@ finish:
     reply.nFonts = nnames;
     reply.sequenceNumber = client->sequence;
 
-    bufptr = bufferStart = xalloc(reply.length << 2);
+    bufptr = bufferStart = malloc(reply.length << 2);
 
     if (!bufptr && reply.length) {
 	SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
@@ -820,18 +820,18 @@ finish:
     client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
     WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
     (void) WriteToClient(client, stringLens + nnames, bufferStart);
-    xfree(bufferStart);
+    free(bufferStart);
 
 bail:
     if (c->slept)
 	ClientWakeup(client);
     for (i = 0; i < c->num_fpes; i++)
 	FreeFPE(c->fpe_list[i]);
-    xfree(c->fpe_list);
-    if (c->savedName) xfree(c->savedName);
+    free(c->fpe_list);
+    if (c->savedName) free(c->savedName);
     FreeFontNames(names);
-    xfree(c);
-    if (resolved) xfree(resolved);
+    free(c);
+    if (resolved) free(resolved);
     return TRUE;
 }
 
@@ -855,18 +855,18 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
     if (i != Success)
 	return i;
 
-    if (!(c = xalloc(sizeof *c)))
+    if (!(c = malloc(sizeof *c)))
 	return BadAlloc;
-    c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
+    c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
     if (!c->fpe_list) {
-	xfree(c);
+	free(c);
 	return BadAlloc;
     }
     c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
     if (!c->names)
     {
-	xfree(c->fpe_list);
-	xfree(c);
+	free(c->fpe_list);
+	free(c);
 	return BadAlloc;
     }
     memmove( c->current.pattern, pattern, length);
@@ -995,8 +995,8 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 		c->haveSaved = TRUE;
 		c->savedNumFonts = numFonts;
 		if (c->savedName)
-		  xfree(c->savedName);
-		c->savedName = xalloc(namelen + 1);
+		  free(c->savedName);
+		c->savedName = malloc(namelen + 1);
 		if (c->savedName)
 		  memmove(c->savedName, name, namelen + 1);
 		aliascount = 20;
@@ -1039,7 +1039,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 	    reply = c->reply;
 	    if (c->length < length)
  	    {
-		reply = (xListFontsWithInfoReply *) xrealloc(c->reply, length);
+		reply = (xListFontsWithInfoReply *) realloc(c->reply, length);
 		if (!reply)
  		{
 		    err = AllocError;
@@ -1085,8 +1085,8 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
 	    (void) WriteToClient(client, namelen, name);
 	    if (pFontInfo == &fontInfo)
  	    {
-		xfree(fontInfo.props);
-		xfree(fontInfo.isStringProp);
+		free(fontInfo.props);
+		free(fontInfo.isStringProp);
 	    }
 	    --c->current.max_names;
 	}
@@ -1104,10 +1104,10 @@ bail:
 	ClientWakeup(client);
     for (i = 0; i < c->num_fpes; i++)
 	FreeFPE(c->fpe_list[i]);
-    xfree(c->reply);
-    xfree(c->fpe_list);
-    if (c->savedName) xfree(c->savedName);
-    xfree(c);
+    free(c->reply);
+    free(c->fpe_list);
+    if (c->savedName) free(c->savedName);
+    free(c);
     return TRUE;
 }
 
@@ -1131,12 +1131,12 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
     if (i != Success)
 	return i;
 
-    if (!(c = xalloc(sizeof *c)))
+    if (!(c = malloc(sizeof *c)))
 	goto badAlloc;
-    c->fpe_list = xalloc(sizeof(FontPathElementPtr) * num_fpes);
+    c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
     if (!c->fpe_list)
     {
-	xfree(c);
+	free(c);
 	goto badAlloc;
     }
     memmove(c->current.pattern, pattern, length);
@@ -1320,7 +1320,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 		    /* Step 1 */
 		    /* Allocate a malloc'd closure structure to replace
 		       the local one we were passed */
-		    new_closure = xalloc(sizeof(PTclosureRec));
+		    new_closure = malloc(sizeof(PTclosureRec));
 		    if (!new_closure)
 		    {
 			err = BadAlloc;
@@ -1330,10 +1330,10 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 		    c = new_closure;
 
 		    len = c->endReq - c->pElt;
-		    c->data = xalloc(len);
+		    c->data = malloc(len);
 		    if (!c->data)
 		    {
-			xfree(c);
+			free(c);
 			err = BadAlloc;
 			goto bail;
 		    }
@@ -1346,8 +1346,8 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 		    pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
 		    if (!pGC)
 		    {
-			xfree(c->data);
-			xfree(c);
+			free(c->data);
+			free(c);
 			err = BadAlloc;
 			goto bail;
 		    }
@@ -1362,8 +1362,8 @@ doPolyText(ClientPtr client, PTclosurePtr c)
 				      Success)
 		    {
 			FreeScratchGC(pGC);
-			xfree(c->data);
-			xfree(c);
+			free(c->data);
+			free(c);
 			err = BadAlloc;
 			goto bail;
 		    }
@@ -1430,8 +1430,8 @@ bail:
 	c->pGC->font = NullFont;
 
 	FreeScratchGC(c->pGC);
-	xfree(c->data);
-	xfree(c);
+	free(c->data);
+	free(c);
     }
     return TRUE;
 }
@@ -1513,7 +1513,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
 	       in doPolyText, but much simpler because the
 	       request structure is much simpler. */
 
-	    new_closure = xalloc(sizeof(ITclosureRec));
+	    new_closure = malloc(sizeof(ITclosureRec));
 	    if (!new_closure)
 	    {
 		err = BadAlloc;
@@ -1522,10 +1522,10 @@ doImageText(ClientPtr client, ITclosurePtr c)
 	    *new_closure = *c;
 	    c = new_closure;
 
-	    data = xalloc(c->nChars * c->itemSize);
+	    data = malloc(c->nChars * c->itemSize);
 	    if (!data)
 	    {
-		xfree(c);
+		free(c);
 		err = BadAlloc;
 		goto bail;
 	    }
@@ -1535,8 +1535,8 @@ doImageText(ClientPtr client, ITclosurePtr c)
 	    pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
 	    if (!pGC)
 	    {
-		xfree(c->data);
-		xfree(c);
+		free(c->data);
+		free(c);
 		err = BadAlloc;
 		goto bail;
 	    }
@@ -1548,8 +1548,8 @@ doImageText(ClientPtr client, ITclosurePtr c)
 			      GCClipYOrigin | GCClipMask)) != Success)
 	    {
 		FreeScratchGC(pGC);
-		xfree(c->data);
-		xfree(c);
+		free(c->data);
+		free(c);
 		err = BadAlloc;
 		goto bail;
 	    }
@@ -1587,8 +1587,8 @@ bail:
 	c->pGC->font = NullFont;
 
 	FreeScratchGC(c->pGC);
-	xfree(c->data);
-	xfree(c);
+	free(c->data);
+	free(c);
     }
     return TRUE;
 }
@@ -1659,7 +1659,7 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force)
 	}
 	FreeFPE(list[i]);
     }
-    xfree(list);
+    free(list);
 }
 
 static FontPathElementPtr
@@ -1686,7 +1686,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
     unsigned char *cp = paths;
     FontPathElementPtr fpe = NULL, *fplist;
 
-    fplist = xalloc(sizeof(FontPathElementPtr) * npaths);
+    fplist = malloc(sizeof(FontPathElementPtr) * npaths);
     if (!fplist) {
 	*bad = 0;
 	return BadAlloc;
@@ -1727,16 +1727,16 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
 	    /* if error or can't do it, act like it's a new one */
 	    if (!fpe)
 	    {
-		fpe = xalloc(sizeof(FontPathElementRec));
+		fpe = malloc(sizeof(FontPathElementRec));
 		if (!fpe) 
 		{
 		    err = BadAlloc;
 		    goto bail;
 		}
-		fpe->name = xalloc(len + 1);
+		fpe->name = malloc(len + 1);
 		if (!fpe->name) 
 		{
-		    xfree(fpe);
+		    free(fpe);
 		    err = BadAlloc;
 		    goto bail;
 		}
@@ -1757,8 +1757,8 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
 			ErrorF("[dix] Could not init font path element %s, removing from list!\n",
 			       fpe->name);
 		    }
-		    xfree (fpe->name);
-		    xfree (fpe);
+		    free(fpe->name);
+		    free(fpe);
 		}
 	    }
 	}
@@ -1785,7 +1785,7 @@ bail:
     *bad = i;
     while (--valid_paths >= 0)
 	FreeFPE(fplist[valid_paths]);
-    xfree(fplist);
+    free(fplist);
     return FontToXError(err);
 }
 
@@ -1843,7 +1843,7 @@ SetDefaultFontPath(char *path)
 
     /* get enough for string, plus values -- use up commas */
     len = strlen(temp_path) + 1;
-    nump = cp = newpath = xalloc(len);
+    nump = cp = newpath = malloc(len);
     if (!newpath)
 	return BadAlloc;
     pp = (unsigned char *) temp_path;
@@ -1864,8 +1864,8 @@ SetDefaultFontPath(char *path)
 
     err = SetFontPathElements(num, newpath, &bad, TRUE);
 
-    xfree(newpath);
-    xfree(temp_path);
+    free(newpath);
+    free(temp_path);
 
     return err;
 }
@@ -1887,7 +1887,7 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
 	fpe = font_path_elements[i];
 	len += fpe->name_length + 1;
     }
-    font_path_string = (unsigned char *) xrealloc(font_path_string, len);
+    font_path_string = (unsigned char *) realloc(font_path_string, len);
     if (!font_path_string)
 	return BadAlloc;
 
@@ -1988,7 +1988,7 @@ RegisterFPEFunctions(NameCheckFunc name_func,
     FPEFunctions *new;
 
     /* grow the list */
-    new = (FPEFunctions *) xrealloc(fpe_functions,
+    new = (FPEFunctions *) realloc(fpe_functions,
 				 (num_fpe_types + 1) * sizeof(FPEFunctions));
     if (!new)
 	return -1;
@@ -2027,7 +2027,7 @@ FreeFonts(void)
     FreeFontPath(font_path_elements, num_fpes, TRUE);
     font_path_elements = 0;
     num_fpes = 0;
-    xfree(fpe_functions);
+    free(fpe_functions);
     num_fpe_types = 0;
     fpe_functions = (FPEFunctions *) 0;
 }
diff --git a/dix/dixutils.c b/dix/dixutils.c
index d610836..5955eb8 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -300,7 +300,7 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
 	if (j < numnow)         /* duplicate */
 	   return(Success);
 	numnow++;
-	pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow);
+	pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
 	if (!pTmp)
 	    return(BadAlloc);
 	client->saveSet = pTmp;
@@ -320,13 +320,13 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
 	numnow--;
         if (numnow)
 	{
-	    pTmp = (SaveSetElt *)xrealloc(client->saveSet, sizeof(*pTmp) * numnow);
+	    pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
 	    if (pTmp)
 		client->saveSet = pTmp;
 	}
         else
         {
-            xfree(client->saveSet);
+            free(client->saveSet);
 	    client->saveSet = (SaveSetElt *)NULL;
 	}
 	client->numSaved = numnow;
@@ -453,7 +453,7 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
 
     if (numHandlers >= sizeHandlers)
     {
-    	new = (BlockHandlerPtr) xrealloc (handlers, (numHandlers + 1) *
+        new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
 				      	  sizeof (BlockHandlerRec));
     	if (!new)
 	    return FALSE;
@@ -498,7 +498,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
 void
 InitBlockAndWakeupHandlers (void)
 {
-    xfree (handlers);
+    free(handlers);
     handlers = (BlockHandlerPtr) 0;
     numHandlers = 0;
     sizeHandlers = 0;
@@ -530,7 +530,7 @@ ProcessWorkQueue(void)
 	{
 	    /* remove q from the list */
 	    *p = q->next;    /* don't fetch until after func called */
-	    xfree (q);
+	    free(q);
 	}
 	else
 	{
@@ -553,7 +553,7 @@ ProcessWorkQueueZombies(void)
 	    (void) (*q->function) (q->client, q->closure);
 	    /* remove q from the list */
 	    *p = q->next;    /* don't fetch until after func called */
-	    xfree (q);
+	    free(q);
 	}
 	else
 	{
@@ -570,7 +570,7 @@ QueueWorkProc (
 {
     WorkQueuePtr    q;
 
-    q = xalloc (sizeof *q);
+    q = malloc(sizeof *q);
     if (!q)
 	return FALSE;
     q->function = function;
@@ -604,7 +604,7 @@ ClientSleep (ClientPtr client, ClientSleepProcPtr function, pointer closure)
 {
     SleepQueuePtr   q;
 
-    q = xalloc (sizeof *q);
+    q = malloc(sizeof *q);
     if (!q)
 	return FALSE;
 
@@ -641,7 +641,7 @@ ClientWakeup (ClientPtr client)
 	if (q->client == client)
 	{
 	    *prev = q->next;
-	    xfree (q);
+	    free(q);
 	    if (client->clientGone)
 		/* Oops -- new zombie cleanup code ensures this only
 		 * happens from inside CloseDownClient; don't want to
@@ -684,7 +684,7 @@ _AddCallback(
 {
     CallbackPtr     cbr;
 
-    cbr = xalloc(sizeof(CallbackRec));
+    cbr = malloc(sizeof(CallbackRec));
     if (!cbr)
 	return FALSE;
     cbr->proc = callback;
@@ -724,7 +724,7 @@ _DeleteCallback(
 		cbl->list = cbr->next;
 	    else
 		pcbr->next = cbr->next;
-	    xfree(cbr);
+	    free(cbr);
 	}
 	return TRUE;
     }
@@ -769,12 +769,12 @@ _CallCallbacks(
 		if (pcbr)
 		{
 		    cbr = cbr->next;
-		    xfree(pcbr->next);
+		    free(pcbr->next);
 		    pcbr->next = cbr;
 		} else
 		{
 		    cbr = cbr->next;
-		    xfree(cbl->list);
+		    free(cbl->list);
 		    cbl->list = cbr;
 		}
 		cbl->numDeleted--;
@@ -814,9 +814,9 @@ _DeleteCallbackList(
     for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
     {
 	nextcbr = cbr->next;
-	xfree(cbr);
+	free(cbr);
     }
-    xfree(cbl);
+    free(cbl);
     *pcbl = NULL;
 }
 
@@ -827,7 +827,7 @@ CreateCallbackList(CallbackListPtr *pcbl)
     int i;
 
     if (!pcbl) return FALSE;
-    cbl = xalloc(sizeof(CallbackListRec));
+    cbl = malloc(sizeof(CallbackListRec));
     if (!cbl) return FALSE;
     cbl->inCallback = 0;
     cbl->deleted = FALSE;
@@ -895,7 +895,7 @@ InitCallbackManager(void)
     {
 	DeleteCallbackList(listsToCleanup[i]);
     }
-    if (listsToCleanup) xfree(listsToCleanup);
+    if (listsToCleanup) free(listsToCleanup);
 
     numCallbackListsToCleanup = 0;
     listsToCleanup = NULL;
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 878dba5..4e3de0b 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -254,7 +254,7 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
     num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */
     num_events++; /* the actual event event */
 
-    *xi = xcalloc(num_events, sizeof(xEvent));
+    *xi = calloc(num_events, sizeof(xEvent));
     if (!(*xi))
     {
         return BadAlloc;
@@ -462,7 +462,7 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
         len += sizeof(CARD32) * nkeys; /* keycodes */
     }
 
-    dcce = xcalloc(1, len);
+    dcce = calloc(1, len);
     if (!dcce)
     {
         ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n");
@@ -545,7 +545,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
     vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
     len += vallen * 4; /* valuators mask */
 
-    *xi = xcalloc(1, len);
+    *xi = calloc(1, len);
     xde = (xXIDeviceEvent*)*xi;
     xde->type           = GenericEvent;
     xde->extension      = IReqCode;
@@ -612,7 +612,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
     vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
     len += vallen * 4; /* valuators mask */
 
-    *xi = xcalloc(1, len);
+    *xi = calloc(1, len);
     raw = (xXIRawEvent*)*xi;
     raw->type           = GenericEvent;
     raw->extension      = IReqCode;
diff --git a/dix/events.c b/dix/events.c
index f96fe1c..3ed344d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1159,7 +1159,7 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
 
     eventlen = event->length;
 
-    qe = xalloc(sizeof(QdEventRec) + eventlen);
+    qe = malloc(sizeof(QdEventRec) + eventlen);
     if (!qe)
 	return;
     qe->next = (QdEventPtr)NULL;
@@ -1229,7 +1229,7 @@ PlayReleasedEvents(void)
 	    }
 #endif
 	    (*qe->device->public.processInputProc)(qe->event, qe->device);
-	    xfree(qe);
+	    free(qe);
 	    for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next)
 		;
 	    if (!dev)
@@ -2435,7 +2435,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                     FixUpEventFromWindow(dev, xi2, pWin, child, FALSE);
                     deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1,
                                                        filter, grab);
-                    xfree(xi2);
+                    free(xi2);
                     if (deliveries > 0)
                         goto unwind;
                 } else if (rc != BadMatch)
@@ -2492,7 +2492,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
     }
 
 unwind:
-    xfree(xE);
+    free(xE);
     return deliveries;
 }
 
@@ -2633,7 +2633,7 @@ XYToWindow(DeviceIntPtr pDev, int x, int y)
 	    if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize)
 	    {
 		pSprite->spriteTraceSize += 10;
-		pSprite->spriteTrace = xrealloc(pSprite->spriteTrace,
+		pSprite->spriteTrace = realloc(pSprite->spriteTrace,
 		                    pSprite->spriteTraceSize*sizeof(WindowPtr));
 	    }
 	    pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
@@ -2938,7 +2938,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
     {
         DeviceIntPtr it;
 
-        pDev->spriteInfo->sprite = (SpritePtr)xcalloc(1, sizeof(SpriteRec));
+        pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec));
         if (!pDev->spriteInfo->sprite)
             FatalError("InitializeSprite: failed to allocate sprite struct");
 
@@ -2977,7 +2977,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
     if (pWin)
     {
 	pCursor = wCursor(pWin);
-	pSprite->spriteTrace = (WindowPtr *)xcalloc(1, 32*sizeof(WindowPtr));
+	pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr));
 	if (!pSprite->spriteTrace)
 	    FatalError("Failed to allocate spriteTrace");
 	pSprite->spriteTraceSize = 32;
@@ -3638,13 +3638,13 @@ CheckPassiveGrabsOnWindow(
 	    if (grabinfo->sync.state == FROZEN_NO_EVENT)
 	    {
                 if (!grabinfo->sync.event)
-                    grabinfo->sync.event = xcalloc(1, sizeof(InternalEvent));
+                    grabinfo->sync.event = calloc(1, sizeof(InternalEvent));
                 *grabinfo->sync.event = *event;
 		grabinfo->sync.state = FROZEN_WITH_EVENT;
             }
 
             if (match & (XI_MATCH | XI2_MATCH))
-                xfree(xE); /* on core match xE == &core */
+                free(xE); /* on core match xE == &core */
 	    return TRUE;
 	}
     }
@@ -3813,9 +3813,9 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
 
 unwind:
     if (xE)
-        xfree(xE);
+        free(xE);
     if (xi2)
-        xfree(xi2);
+        free(xi2);
     return;
 }
 
@@ -3989,16 +3989,16 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 	    grabinfo->sync.state = FROZEN_WITH_EVENT;
 	    FreezeThaw(thisDev, TRUE);
 	    if (!grabinfo->sync.event)
-		grabinfo->sync.event = xcalloc(1, sizeof(InternalEvent));
+		grabinfo->sync.event = calloc(1, sizeof(InternalEvent));
 	    *grabinfo->sync.event = event->device_event;
 	    break;
 	}
     }
 
     if (xi)
-        xfree(xi);
+        free(xi);
     if (xi2)
-        xfree(xi2);
+        free(xi2);
 }
 
 /* This function is used to set the key pressed or key released state -
@@ -4104,7 +4104,7 @@ OtherClientGone(pointer value, XID id)
 		if (!(pWin->optional->otherClients = other->next))
 		    CheckWindowOptionalNeed (pWin);
 	    }
-	    xfree(other);
+	    free(other);
 	    RecalculateDeliverableEvents(pWin);
 	    return(Success);
 	}
@@ -4176,7 +4176,7 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
 	check = 0;
 	if (!pWin->optional && !MakeWindowOptional (pWin))
 	    return BadAlloc;
-	others = xalloc(sizeof(OtherClients));
+	others = malloc(sizeof(OtherClients));
 	if (!others)
 	    return BadAlloc;
 	others->mask = mask;
@@ -4367,7 +4367,7 @@ DeviceEnterLeaveEvent(
     btlen = bytes_to_int32(btlen);
     len = sizeof(xXIEnterEvent) + btlen * 4;
 
-    event = xcalloc(1, len);
+    event = calloc(1, len);
     event->type         = GenericEvent;
     event->extension    = IReqCode;
     event->evtype       = type;
@@ -4417,7 +4417,7 @@ DeviceEnterLeaveEvent(
     }
 
 out:
-    xfree(event);
+    free(event);
 }
 
 void
@@ -4548,7 +4548,7 @@ SetInputFocus(
         if (depth > focus->traceSize)
         {
 	    focus->traceSize = depth+1;
-	    focus->trace = xrealloc(focus->trace,
+	    focus->trace = realloc(focus->trace,
 				    focus->traceSize * sizeof(WindowPtr));
 	}
 	focus->traceGood = depth;
@@ -5058,7 +5058,7 @@ InitEvents(void)
     while (syncEvents.pending)
     {
 	QdEventPtr next = syncEvents.pending->next;
-	xfree(syncEvents.pending);
+	free(syncEvents.pending);
 	syncEvents.pending = next;
     }
     syncEvents.pendtail = &syncEvents.pending;
@@ -5743,7 +5743,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
         if (eventlength > swapEventLen)
         {
             swapEventLen = eventlength;
-            swapEvent = Xrealloc(swapEvent, swapEventLen);
+            swapEvent = realloc(swapEvent, swapEventLen);
             if (!swapEvent)
             {
                 FatalError("WriteEventsToClient: Out of memory.\n");
diff --git a/dix/extension.c b/dix/extension.c
index f348665..6940b68 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -89,26 +89,26 @@ AddExtension(char *name, int NumEvents, int NumErrors,
         return((ExtensionEntry *) NULL);
     }
 
-    ext = xalloc(sizeof(ExtensionEntry));
+    ext = malloc(sizeof(ExtensionEntry));
     if (!ext)
 	return(NULL);
-    ext->name = xalloc(strlen(name) + 1);
+    ext->name = malloc(strlen(name) + 1);
     ext->num_aliases = 0;
     ext->aliases = (char **)NULL;
     ext->devPrivates = NULL;
     if (!ext->name)
     {
-	xfree(ext);
+	free(ext);
 	return((ExtensionEntry *) NULL);
     }
     strcpy(ext->name,  name);
     i = NumExtensions;
-    newexts = (ExtensionEntry **) xrealloc(extensions,
+    newexts = (ExtensionEntry **) realloc(extensions,
 					   (i + 1) * sizeof(ExtensionEntry *));
     if (!newexts)
     {
-	xfree(ext->name);
-	xfree(ext);
+	free(ext->name);
+	free(ext);
 	return((ExtensionEntry *) NULL);
     }
     NumExtensions++;
@@ -154,12 +154,12 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
 
     if (!ext)
         return FALSE ;
-    aliases = (char **)xrealloc(ext->aliases,
+    aliases = (char **)realloc(ext->aliases,
 				(ext->num_aliases + 1) * sizeof(char *));
     if (!aliases)
 	return FALSE;
     ext->aliases = aliases;
-    name = xalloc(strlen(alias) + 1);
+    name = malloc(strlen(alias) + 1);
     if (!name)
 	return FALSE;
     strcpy(name,  alias);
@@ -249,14 +249,14 @@ CloseDownExtensions(void)
 	if (extensions[i]->CloseDown)
 	    extensions[i]->CloseDown(extensions[i]);
 	NumExtensions = i;
-	xfree(extensions[i]->name);
+	free(extensions[i]->name);
 	for (j = extensions[i]->num_aliases; --j >= 0;)
-	    xfree(extensions[i]->aliases[j]);
-	xfree(extensions[i]->aliases);
+	    free(extensions[i]->aliases[j]);
+	free(extensions[i]->aliases);
 	dixFreePrivates(extensions[i]->devPrivates);
-	xfree(extensions[i]);
+	free(extensions[i]);
     }
-    xfree(extensions);
+    free(extensions);
     extensions = (ExtensionEntry **)NULL;
     lastEvent = EXTENSION_EVENT_BASE;
     lastError = FirstExtensionError;
@@ -328,7 +328,7 @@ ProcListExtensions(ClientPtr client)
 		total_length += strlen(extensions[i]->aliases[j]) + 1;
 	}
         reply.length = bytes_to_int32(total_length);
-	buffer = bufptr = xalloc(total_length);
+	buffer = bufptr = malloc(total_length);
 	if (!buffer)
 	    return(BadAlloc);
         for (i=0;  i<NumExtensions; i++)
@@ -352,7 +352,7 @@ ProcListExtensions(ClientPtr client)
     if (reply.length)
     {
         WriteToClient(client, total_length, buffer);
-    	xfree(buffer);
+        free(buffer);
     }
     return(client->noClientException);
 }
diff --git a/dix/gc.c b/dix/gc.c
index 3058e15..e45378c 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -436,7 +436,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		{
 		    if (pGC->dash != DefaultDash)
 		    {
-			xfree(pGC->dash);
+			free(pGC->dash);
 			pGC->numInDashList = 2;
 			pGC->dash = DefaultDash;
 		    }
@@ -445,11 +445,11 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
  		{
 		    unsigned char *dash;
 
-		    dash = xalloc(2 * sizeof(unsigned char));
+		    dash = malloc(2 * sizeof(unsigned char));
 		    if (dash)
 		    {
 			if (pGC->dash != DefaultDash)
-			    xfree(pGC->dash);
+			    free(pGC->dash);
 			pGC->numInDashList = 2;
 			pGC->dash = dash;
 			dash[0] = newdash;
@@ -554,7 +554,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
 {
     GCPtr pGC;
 
-    pGC = xalloc(sizeof(GC));
+    pGC = malloc(sizeof(GC));
     if (!pGC)
     {
 	*pStatus = BadAlloc;
@@ -794,7 +794,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
 		{
 		    if (pgcDst->dash != DefaultDash)
 		    {
-			xfree(pgcDst->dash);
+			free(pgcDst->dash);
 			pgcDst->numInDashList = pgcSrc->numInDashList;
 			pgcDst->dash = pgcSrc->dash;
 		    }
@@ -804,11 +804,11 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
 		    unsigned char *dash;
 		    unsigned int i;
 
-		    dash = xalloc(pgcSrc->numInDashList * sizeof(unsigned char));
+		    dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char));
 		    if (dash)
 		    {
 			if (pgcDst->dash != DefaultDash)
-			    xfree(pgcDst->dash);
+			    free(pgcDst->dash);
 			pgcDst->numInDashList = pgcSrc->numInDashList;
 			pgcDst->dash = dash;
 			for (i=0; i<pgcSrc->numInDashList; i++)
@@ -859,9 +859,9 @@ FreeGC(pointer value, XID gid)
 
     (*pGC->funcs->DestroyGC) (pGC);
     if (pGC->dash != DefaultDash)
-	xfree(pGC->dash);
+	free(pGC->dash);
     dixFreePrivates(pGC->devPrivates);
-    xfree(pGC);
+    free(pGC);
     return(Success);
 }
 
@@ -883,7 +883,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
 {
     GCPtr pGC;
 
-    pGC = xalloc(sizeof(GC));
+    pGC = malloc(sizeof(GC));
     if (!pGC)
 	return (GCPtr)NULL;
 
@@ -1044,9 +1044,9 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
     }
 
     if (ndash & 1)
-	p = xalloc(2 * ndash * sizeof(unsigned char));
+	p = malloc(2 * ndash * sizeof(unsigned char));
     else
-	p = xalloc(ndash * sizeof(unsigned char));
+	p = malloc(ndash * sizeof(unsigned char));
     if (!p)
 	return BadAlloc;
 
@@ -1059,7 +1059,7 @@ SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
     }
 
     if (pGC->dash != DefaultDash)
-	xfree(pGC->dash);
+	free(pGC->dash);
     pGC->numInDashList = ndash;
     pGC->dash = p;
     if (ndash & 1)
@@ -1141,7 +1141,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
     if (newct < 0)
 	return(BadMatch);
     size = nrects * sizeof(xRectangle);
-    prectsNew = xalloc(size);
+    prectsNew = malloc(size);
     if (!prectsNew && size)
 	return BadAlloc;
 
diff --git a/dix/getevents.c b/dix/getevents.c
index 197deb4..62aaff9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -326,7 +326,7 @@ AllocateMotionHistory(DeviceIntPtr pDev)
 {
     int size;
     if (pDev->valuator->motion)
-        xfree(pDev->valuator->motion);
+        free(pDev->valuator->motion);
 
     if (pDev->valuator->numMotionEvents < 1)
         return;
@@ -342,7 +342,7 @@ AllocateMotionHistory(DeviceIntPtr pDev)
 
     size += sizeof(Time);
 
-    pDev->valuator->motion = xcalloc(pDev->valuator->numMotionEvents, size);
+    pDev->valuator->motion = calloc(pDev->valuator->numMotionEvents, size);
     pDev->valuator->first_motion = 0;
     pDev->valuator->last_motion = 0;
     if (!pDev->valuator->motion)
@@ -384,7 +384,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
     else
         size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
 
-    *buff = xalloc(size * pDev->valuator->numMotionEvents);
+    *buff = malloc(size * pDev->valuator->numMotionEvents);
     if (!(*buff))
         return 0;
     obuff = (char *)*buff;
@@ -959,20 +959,20 @@ InitEventList(int num_events)
     EventListPtr events;
     int i;
 
-    events = (EventListPtr)xcalloc(num_events, sizeof(EventList));
+    events = (EventListPtr)calloc(num_events, sizeof(EventList));
     if (!events)
         return NULL;
 
     for (i = 0; i < num_events; i++)
     {
         events[i].evlen = sizeof(InternalEvent);
-        events[i].event = xcalloc(1, sizeof(InternalEvent));
+        events[i].event = calloc(1, sizeof(InternalEvent));
         if (!events[i].event)
         {
             /* rollback */
             while(i--)
-                xfree(events[i].event);
-            xfree(events);
+                free(events[i].event);
+            free(events);
             events = NULL;
             break;
         }
@@ -993,8 +993,8 @@ FreeEventList(EventListPtr list, int num_events)
     if (!list)
         return;
     while(num_events--)
-        xfree(list[num_events].event);
-    xfree(list);
+        free(list[num_events].event);
+    free(list);
 }
 
 /**
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index f74b137..f10400f 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -91,7 +91,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
 
     pScreen = screenInfo.screens[0];
     nby = BitmapBytePad(cm->width) * (long)cm->height;
-    pbits = xcalloc(1, nby);
+    pbits = calloc(1, nby);
     if (!pbits)
 	return BadAlloc;
 
@@ -105,7 +105,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
 	    (*pScreen->DestroyPixmap)(ppix);
 	if (pGC)
 	    FreeScratchGC(pGC);
-	xfree(pbits);
+	free(pbits);
 	return BadAlloc;
     }
 
diff --git a/dix/grabs.c b/dix/grabs.c
index 4a351d6..2931631 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -84,7 +84,7 @@ CreateGrab(
 {
     GrabPtr grab;
 
-    grab = xcalloc(1, sizeof(GrabRec));
+    grab = calloc(1, sizeof(GrabRec));
     if (!grab)
 	return (GrabPtr)NULL;
     grab->resource = FakeClientID(client);
@@ -118,15 +118,15 @@ static void
 FreeGrab(GrabPtr pGrab)
 {
     if (pGrab->modifiersDetail.pMask != NULL)
-	xfree(pGrab->modifiersDetail.pMask);
+	free(pGrab->modifiersDetail.pMask);
 
     if (pGrab->detail.pMask != NULL)
-	xfree(pGrab->detail.pMask);
+	free(pGrab->detail.pMask);
 
     if (pGrab->cursor)
 	FreeCursor(pGrab->cursor, (Cursor)0);
 
-    xfree(pGrab);
+    free(pGrab);
 }
 
 int
@@ -160,7 +160,7 @@ DeleteDetailFromMask(Mask *pDetailMask, unsigned int detail)
     Mask *mask;
     int i;
 
-    mask = xalloc(sizeof(Mask) * MasksPerDetailMask);
+    mask = malloc(sizeof(Mask) * MasksPerDetailMask);
     if (mask)
     {
 	if (pDetailMask)
@@ -435,16 +435,16 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 	i++;
     if (!i)
 	return TRUE;
-    deletes = xalloc(i * sizeof(GrabPtr));
-    adds = xalloc(i * sizeof(GrabPtr));
-    updates = xalloc(i * sizeof(Mask **));
-    details = xalloc(i * sizeof(Mask *));
+    deletes = malloc(i * sizeof(GrabPtr));
+    adds = malloc(i * sizeof(GrabPtr));
+    updates = malloc(i * sizeof(Mask **));
+    details = malloc(i * sizeof(Mask *));
     if (!deletes || !adds || !updates || !details)
     {
-	if (details) xfree(details);
-	if (updates) xfree(updates);
-	if (adds) xfree(adds);
-	if (deletes) xfree(deletes);
+	if (details) free(details);
+	if (updates) free(updates);
+	if (adds) free(adds);
+	if (deletes) free(deletes);
 	return FALSE;
     }
 
@@ -532,7 +532,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 	for (i = 0; i < nadds; i++)
 	    FreeResource(adds[i]->resource, RT_NONE);
 	for (i = 0; i < nups; i++)
-	    xfree(details[i]);
+	    free(details[i]);
     }
     else
     {
@@ -546,14 +546,14 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
 	}
 	for (i = 0; i < nups; i++)
 	{
-	    xfree(*updates[i]);
+	    free(*updates[i]);
 	    *updates[i] = details[i];
 	}
     }
-    xfree(details);
-    xfree(updates);
-    xfree(adds);
-    xfree(deletes);
+    free(details);
+    free(updates);
+    free(adds);
+    free(deletes);
     return ok;
 
 #undef UPDATE
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 4848c1b..e3b44fc 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -311,7 +311,7 @@ int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
         }
     }
 
-    modkeymap = xcalloc(max_keys_per_mod * 8, sizeof(KeyCode));
+    modkeymap = calloc(max_keys_per_mod * 8, sizeof(KeyCode));
     if (!modkeymap)
         return BadAlloc;
 
diff --git a/dix/main.c b/dix/main.c
index 2cff59c..3e500ba 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -174,7 +174,7 @@ int main(int argc, char *argv[], char *envp[])
 	    InitProcVectors();
 	    for (i=1; i<MAXCLIENTS; i++)
 		clients[i] = NullClient;
-	    serverClient = xalloc(sizeof(ClientRec));
+	    serverClient = malloc(sizeof(ClientRec));
 	    if (!serverClient)
 		FatalError("couldn't create server client");
 	    InitClient(serverClient, 0, (pointer)NULL);
@@ -314,7 +314,7 @@ int main(int argc, char *argv[], char *envp[])
 	    FreeDefaultStipple(i);
 	    (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
 	    dixFreePrivates(screenInfo.screens[i]->devPrivates);
-	    xfree(screenInfo.screens[i]);
+	    free(screenInfo.screens[i]);
 	    screenInfo.numScreens = i;
 	}
 	FreeFonts();
@@ -337,7 +337,7 @@ int main(int argc, char *argv[], char *envp[])
 	    break;
 	}
 
-	xfree(ConnectionInfo);
+	free(ConnectionInfo);
 	ConnectionInfo = NULL;
     }
     return(0);
diff --git a/dix/pixmap.c b/dix/pixmap.c
index 10ec02a..a4ad255 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -113,7 +113,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
     if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
 	return NullPixmap;
     
-    pPixmap = xalloc(pScreen->totalPixmapSize + pixDataSize);
+    pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize);
     if (!pPixmap)
 	return NullPixmap;
 
diff --git a/dix/privates.c b/dix/privates.c
index e3e7274..27694cb 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -115,7 +115,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
 
     /* initialize privates array if necessary */
     if (!*privates) {
-	ptr = xcalloc(newsize, sizeof(*ptr));
+	ptr = calloc(newsize, sizeof(*ptr));
 	if (!ptr)
 	    return NULL;
 	*privates = ptr;
@@ -126,7 +126,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
 
     /* resize privates array if necessary */
     if (*key >= oldsize) {
-	ptr = xrealloc(*privates, newsize * sizeof(*ptr));
+	ptr = realloc(*privates, newsize * sizeof(*ptr));
 	if (!ptr)
 	    return NULL;
 	memset(ptr + oldsize, 0, (newsize - oldsize) * sizeof(*ptr));
@@ -138,7 +138,7 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
     ptr = *privates + *key;
     ptr->state = 1;
     if (item->size) {
-	value = xcalloc(item->size, 1);
+	value = calloc(item->size, 1);
 	if (!value)
 	    return NULL;
 	ptr->value = value;
@@ -214,10 +214,10 @@ dixFreePrivates(PrivateRec *privates)
 
 		/* free pre-allocated memory */
 		if (items[i].size)
-		    xfree(privates[i].value);
+		    free(privates[i].value);
 	    }
 
-    xfree(privates);
+    free(privates);
 }
 
 /*
@@ -273,7 +273,7 @@ dixRegisterPrivateOffset(RESTYPE type, int offset)
     /* resize offsets table if necessary */
     while (type >= offsetsSize) {
 	unsigned i = offsetsSize * 2 * sizeof(int);
-	offsets = (int *)xrealloc(offsets, i);
+	offsets = (int *)realloc(offsets, i);
 	if (!offsets) {
 	    offsetsSize = 0;
 	    return FALSE;
@@ -311,9 +311,9 @@ dixResetPrivates(void)
 
     /* reset offsets */
     if (offsets)
-	xfree(offsets);
+	free(offsets);
     offsetsSize = sizeof(offsetDefaults);
-    offsets = xalloc(offsetsSize);
+    offsets = malloc(offsetsSize);
     offsetsSize /= sizeof(int);
     if (!offsets)
 	return FALSE;
diff --git a/dix/property.c b/dix/property.c
index 9ec5dc6..74d3d78 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -137,8 +137,8 @@ ProcRotateProperties(ClientPtr client)
         return rc;
 
     atoms = (Atom *) & stuff[1];
-    props = xalloc(stuff->nAtoms * sizeof(PropertyPtr));
-    saved = xalloc(stuff->nAtoms * sizeof(PropertyRec));
+    props = malloc(stuff->nAtoms * sizeof(PropertyPtr));
+    saved = malloc(stuff->nAtoms * sizeof(PropertyRec));
     if (!props || !saved) {
 	rc = BadAlloc;
 	goto out;
@@ -188,8 +188,8 @@ ProcRotateProperties(ClientPtr client)
 	}
     }
 out:
-    xfree(saved);
-    xfree(props);
+    free(saved);
+    free(props);
     return rc;
 }
 
@@ -269,13 +269,13 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
     {
 	if (!pWin->optional && !MakeWindowOptional (pWin))
 	    return(BadAlloc);
-        pProp = xalloc(sizeof(PropertyRec));
+        pProp = malloc(sizeof(PropertyRec));
 	if (!pProp)
 	    return(BadAlloc);
-        data = xalloc(totalSize);
+        data = malloc(totalSize);
 	if (!data && len)
 	{
-	    xfree(pProp);
+	    free(pProp);
 	    return(BadAlloc);
 	}
         memcpy(data, value, totalSize);
@@ -288,8 +288,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 	rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
 				    DixCreateAccess|DixWriteAccess);
 	if (rc != Success) {
-	    xfree(data);
-	    xfree(pProp);
+	    free(data);
+	    free(pProp);
 	    pClient->errorValue = property;
 	    return rc;
 	}
@@ -313,7 +313,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 
         if (mode == PropModeReplace)
         {
-	    data = xalloc(totalSize);
+	    data = malloc(totalSize);
 	    if (!data && len)
 		return(BadAlloc);
 	    memcpy(data, value, totalSize);
@@ -328,7 +328,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 	}
         else if (mode == PropModeAppend)
         {
-	    data = xalloc((pProp->size + len) * sizeInBytes);
+	    data = malloc((pProp->size + len) * sizeInBytes);
 	    if (!data)
 		return(BadAlloc);
 	    memcpy(data, pProp->data, pProp->size * sizeInBytes);
@@ -338,7 +338,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 	}
         else if (mode == PropModePrepend)
         {
-            data = xalloc(sizeInBytes * (len + pProp->size));
+            data = malloc(sizeInBytes * (len + pProp->size));
 	    if (!data)
 		return(BadAlloc);
             memcpy(data + totalSize, pProp->data, pProp->size * sizeInBytes);
@@ -353,12 +353,12 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
 	if (rc == Success)
 	{
 	    if (savedProp.data != pProp->data)
-		xfree(savedProp.data);
+		free(savedProp.data);
 	}
 	else
 	{
 	    if (savedProp.data != pProp->data)
-		xfree(pProp->data);
+		free(pProp->data);
 	    *pProp = savedProp;
 	    return rc;
 	}
@@ -406,8 +406,8 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
 
 	deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
 	dixFreePrivates(pProp->devPrivates);
-	xfree(pProp->data);
-        xfree(pProp);
+	free(pProp->data);
+        free(pProp);
     }
     return rc;
 }
@@ -423,8 +423,8 @@ DeleteAllWindowProperties(WindowPtr pWin)
 	deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
 	pNextProp = pProp->next;
 	dixFreePrivates(pProp->devPrivates);
-        xfree(pProp->data);
-        xfree(pProp);
+        free(pProp->data);
+        free(pProp);
 	pProp = pNextProp;
     }
 }
@@ -571,8 +571,8 @@ ProcGetProperty(ClientPtr client)
 	}
 
 	dixFreePrivates(pProp->devPrivates);
-	xfree(pProp->data);
-	xfree(pProp);
+	free(pProp->data);
+	free(pProp);
     }
     return(client->noClientException);
 }
@@ -595,7 +595,7 @@ ProcListProperties(ClientPtr client)
     for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
 	numProps++;
 
-    if (numProps && !(pAtoms = xalloc(numProps * sizeof(Atom))))
+    if (numProps && !(pAtoms = malloc(numProps * sizeof(Atom))))
 	return BadAlloc;
 
     numProps = 0;
@@ -619,7 +619,7 @@ ProcListProperties(ClientPtr client)
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
     }
-    xfree(pAtoms);
+    free(pAtoms);
     return(client->noClientException);
 }
 
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 100d6f8..cedc829 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -111,7 +111,7 @@ InitVelocityData(DeviceVelocityPtr vel)
  */
 void
 FreeVelocityData(DeviceVelocityPtr vel){
-    xfree(vel->tracker);
+    free(vel->tracker);
     SetAccelerationProfile(vel, PROFILE_UNINITIALIZE);
 }
 
@@ -127,7 +127,7 @@ AccelerationDefaultCleanup(DeviceIntPtr dev)
             && dev->valuator->accelScheme.accelData != NULL){
         dev->valuator->accelScheme.AccelSchemeProc = NULL;
         FreeVelocityData(dev->valuator->accelScheme.accelData);
-        xfree(dev->valuator->accelScheme.accelData);
+        free(dev->valuator->accelScheme.accelData);
         dev->valuator->accelScheme.accelData = NULL;
         DeletePredictableAccelerationProperties(dev);
     }
@@ -372,8 +372,8 @@ InitTrackers(DeviceVelocityPtr vel, int ntracker)
 	ErrorF("(dix ptracc) invalid number of trackers\n");
 	return;
     }
-    xfree(vel->tracker);
-    vel->tracker = (MotionTrackerPtr)xalloc(ntracker * sizeof(MotionTracker));
+    free(vel->tracker);
+    vel->tracker = (MotionTrackerPtr)malloc(ntracker * sizeof(MotionTracker));
     memset(vel->tracker, 0, ntracker * sizeof(MotionTracker));
     vel->num_tracker = ntracker;
 }
@@ -954,7 +954,7 @@ SetAccelerationProfile(
 
     if(vel->profile_private != NULL){
         /* Here one could free old profile-private data */
-        xfree(vel->profile_private);
+        free(vel->profile_private);
         vel->profile_private = NULL;
     }
     /* Here one could init profile-private data */
diff --git a/dix/registry.c b/dix/registry.c
index 1381a3d..fc35dbb 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -61,7 +61,7 @@ static int double_size(void *p, unsigned n, unsigned size)
 	n = f = BASE_SIZE * size;
     }
 
-    *ptr = xrealloc(*ptr, n);
+    *ptr = realloc(*ptr, n);
     if (!*ptr) {
 	dixResetRegistry();
 	return FALSE;
@@ -285,20 +285,20 @@ dixResetRegistry(void)
     while (nmajor--) {
 	while (nminor[nmajor])
 	    free(requests[nmajor][--nminor[nmajor]]);
-	xfree(requests[nmajor]);
+	free(requests[nmajor]);
     }
-    xfree(requests);
-    xfree(nminor);
+    free(requests);
+    free(nminor);
 
     while (nevent--)
 	free(events[nevent]);
-    xfree(events);
+    free(events);
 
     while (nerror--)
 	free(errors[nerror]);
-    xfree(errors);
+    free(errors);
 
-    xfree(resources);
+    free(resources);
 
     requests = NULL;
     nminor = NULL;
diff --git a/dix/resource.c b/dix/resource.c
index ab3762e..143b51a 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -204,7 +204,7 @@ CreateNewResourceType(DeleteType deleteFunc, char *name)
 
     if (next & lastResourceClass)
 	return 0;
-    funcs = (DeleteType *)xrealloc(DeleteFuncs,
+    funcs = (DeleteType *)realloc(DeleteFuncs,
 				   (next + 1) * sizeof(DeleteType));
     if (!funcs)
 	return 0;
@@ -252,8 +252,8 @@ InitClientResources(ClientPtr client)
 	lastResourceClass = RC_LASTPREDEF;
 	TypeMask = RC_LASTPREDEF - 1;
 	if (DeleteFuncs)
-	    xfree(DeleteFuncs);
-	DeleteFuncs = xalloc((lastResourceType + 1) * sizeof(DeleteType));
+	    free(DeleteFuncs);
+	DeleteFuncs = malloc((lastResourceType + 1) * sizeof(DeleteType));
 	if (!DeleteFuncs)
 	    return FALSE;
 	DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA;
@@ -268,7 +268,7 @@ InitClientResources(ClientPtr client)
 	DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
     }
     clientTable[i = client->index].resources =
-	xalloc(INITBUCKETS*sizeof(ResourcePtr));
+	malloc(INITBUCKETS*sizeof(ResourcePtr));
     if (!clientTable[i].resources)
 	return FALSE;
     clientTable[i].buckets = INITBUCKETS;
@@ -459,7 +459,7 @@ AddResource(XID id, RESTYPE type, pointer value)
 	(rrec->hashsize < MAXHASHSIZE))
 	RebuildTable(client);
     head = &rrec->resources[Hash(client, id)];
-    res = xalloc(sizeof(ResourceRec));
+    res = malloc(sizeof(ResourceRec));
     if (!res)
     {
 	(*DeleteFuncs[type & TypeMask])(value, id);
@@ -491,13 +491,13 @@ RebuildTable(int client)
      */
 
     j = 2 * clientTable[client].buckets;
-    tails = xalloc(j * sizeof(ResourcePtr *));
+    tails = malloc(j * sizeof(ResourcePtr *));
     if (!tails)
 	return;
-    resources = xalloc(j * sizeof(ResourcePtr));
+    resources = malloc(j * sizeof(ResourcePtr));
     if (!resources)
     {
-	xfree(tails);
+	free(tails);
 	return;
     }
     for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++)
@@ -520,9 +520,9 @@ RebuildTable(int client)
 	    *tptr = &res->next;
 	}
     }
-    xfree(tails);
+    free(tails);
     clientTable[client].buckets *= 2;
-    xfree(clientTable[client].resources);
+    free(clientTable[client].resources);
     clientTable[client].resources = resources;
 }
 
@@ -558,7 +558,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
 
 		if (rtype != skipDeleteFuncType)
 		    (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
-		xfree(res);
+		free(res);
 		if (*eltptr != elements)
 		    prev = head; /* prev may no longer be valid */
 	    }
@@ -595,7 +595,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
 
 		if (!skipFree)
 		    (*DeleteFuncs[type & TypeMask])(res->value, res->id);
-		xfree(res);
+		free(res);
 		break;
 	    }
 	    else
@@ -762,7 +762,7 @@ FreeClientNeverRetainResources(ClientPtr client)
 
 		elements = *eltptr;
 		(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
-		xfree(this);
+		free(this);
 		if (*eltptr != elements)
 		    prev = &resources[j]; /* prev may no longer be valid */
 	    }
@@ -816,10 +816,10 @@ FreeClientResources(ClientPtr client)
 	    CallResourceStateCallback(ResourceStateFreeing, this);
 
 	    (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
-	    xfree(this);
+	    free(this);
 	}
     }
-    xfree(clientTable[client->index].resources);
+    free(clientTable[client->index].resources);
     clientTable[client->index].resources = NULL;
     clientTable[client->index].buckets = 0;
 }
diff --git a/dix/selection.c b/dix/selection.c
index d72f381..6a13572 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -95,7 +95,7 @@ InitSelections(void)
     while (pSel) {
 	pNextSel = pSel->next;
 	dixFreePrivates(pSel->devPrivates);
-	xfree(pSel);
+	free(pSel);
 	pSel = pNextSel;
     }
 
@@ -198,7 +198,7 @@ ProcSetSelectionOwner(ClientPtr client)
 	/*
 	 * It doesn't exist, so add it...
 	 */
-	pSel = xalloc(sizeof(Selection));
+	pSel = malloc(sizeof(Selection));
 	if (!pSel)
 	    return BadAlloc;
 
@@ -209,7 +209,7 @@ ProcSetSelectionOwner(ClientPtr client)
 	rc = XaceHookSelectionAccess(client, &pSel,
 				     DixCreateAccess|DixSetAttrAccess);
 	if (rc != Success) {
-	    xfree(pSel);
+	    free(pSel);
 	    return rc;
 	}
 
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 12c6dbd..c173411 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -99,7 +99,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
     CARD32 tmpbuf[1];
     
     /* Allocate as big a buffer as we can... */
-    while (!(pbufT = xalloc(bufsize)))
+    while (!(pbufT = malloc(bufsize)))
     {
         bufsize >>= 1;
 	if (bufsize == 4)
@@ -131,7 +131,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
 	}
 
     if (pbufT != tmpbuf)
-	xfree (pbufT);
+	free(pbufT);
 }
 
 /**
@@ -147,7 +147,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
     short tmpbuf[2];
     
     /* Allocate as big a buffer as we can... */
-    while (!(pbufT = xalloc(bufsize)))
+    while (!(pbufT = malloc(bufsize)))
     {
         bufsize >>= 1;
 	if (bufsize == 4)
@@ -179,7 +179,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
 	}
 
     if (pbufT != tmpbuf)
-	xfree (pbufT);
+	free(pbufT);
 }
 
 
@@ -1262,7 +1262,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
 {
     char	*pInfoTBase;
 
-    pInfoTBase = xalloc(size);
+    pInfoTBase = malloc(size);
     if (!pInfoTBase)
     {
 	pClient->noClientException = -1;
@@ -1270,7 +1270,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
     }
     SwapConnSetupInfo(pInfo, pInfoTBase);
     (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
-    xfree(pInfoTBase);
+    free(pInfoTBase);
 }
 
 void
diff --git a/dix/window.c b/dix/window.c
index 02451fc..0d03219 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -359,7 +359,7 @@ CreateRootWindow(ScreenPtr pScreen)
     BoxRec	box;
     PixmapFormatRec *format;
 
-    pWin = xalloc(sizeof(WindowRec));
+    pWin = malloc(sizeof(WindowRec));
     if (!pWin)
 	return FALSE;
 
@@ -386,7 +386,7 @@ CreateRootWindow(ScreenPtr pScreen)
     pWin->parent = NullWindow;
     SetWindowToDefaults(pWin);
 
-    pWin->optional = xalloc (sizeof (WindowOptRec));
+    pWin->optional = malloc(sizeof (WindowOptRec));
     if (!pWin->optional)
         return FALSE;
 
@@ -639,7 +639,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
 	return NullWindow;
     }
 
-    pWin = xalloc(sizeof(WindowRec));
+    pWin = malloc(sizeof(WindowRec));
     if (!pWin)
     {
 	*error = BadAlloc;
@@ -670,7 +670,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
     {
 	if (!MakeWindowOptional (pWin))
 	{
-	    xfree (pWin);
+	    free(pWin);
 	    *error = BadAlloc;
 	    return NullWindow;
 	}
@@ -685,7 +685,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
     *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
 		RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess);
     if (*error != Success) {
-	xfree(pWin);
+	free(pWin);
 	return NullWindow;
     }
 
@@ -809,12 +809,12 @@ DisposeWindowOptional (WindowPtr pWin)
                 FreeCursor(pList->cursor, (XID)0);
             pPrev = pList;
             pList = pList->next;
-            xfree(pPrev);
+            free(pPrev);
         }
         pWin->optional->deviceCursors = NULL;
     }
 
-    xfree (pWin->optional);
+    free(pWin->optional);
     pWin->optional = NULL;
 }
 
@@ -884,7 +884,7 @@ CrushTree(WindowPtr pWin)
 	    }
 	    FreeWindowResources(pChild);
 	    dixFreePrivates(pChild->devPrivates);
-	    xfree(pChild);
+	    free(pChild);
 	    if ( (pChild = pSib) )
 		break;
 	    pChild = pParent;
@@ -934,9 +934,9 @@ DeleteWindow(pointer value, XID wid)
 	if (pWin->prevSib)
 	    pWin->prevSib->nextSib = pWin->nextSib;
     }
-    xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
+    free(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
     dixFreePrivates(pWin->devPrivates);
-    xfree(pWin);
+    free(pWin);
     return Success;
 }
 
@@ -2996,7 +2996,7 @@ HandleSaveSet(ClientPtr client)
 		MapWindow(pWin, client);
 	}
     }
-    xfree(client->saveSet);
+    free(client->saveSet);
     client->numSaved = 0;
     client->saveSet = (SaveSetElt *)NULL;
 }
@@ -3298,12 +3298,12 @@ TileScreenSaver(int i, int kind)
     cm.height=16;
     cm.xhot=8;
     cm.yhot=8;
-    srcbits = xalloc( BitmapBytePad(32)*16);
-    mskbits = xalloc( BitmapBytePad(32)*16);
+    srcbits = malloc( BitmapBytePad(32)*16);
+    mskbits = malloc( BitmapBytePad(32)*16);
     if (!srcbits || !mskbits)
     {
-	xfree(srcbits);
-	xfree(mskbits);
+	free(srcbits);
+	free(mskbits);
 	cursor = 0;
     }
     else
@@ -3325,8 +3325,8 @@ TileScreenSaver(int i, int kind)
 	}
 	else
 	{
-	    xfree (srcbits);
-	    xfree (mskbits);
+	    free(srcbits);
+	    free(mskbits);
 	}
     }
 
@@ -3456,7 +3456,7 @@ MakeWindowOptional (WindowPtr pWin)
 
     if (pWin->optional)
 	return TRUE;
-    optional = xalloc (sizeof (WindowOptRec));
+    optional = malloc(sizeof (WindowOptRec));
     if (!optional)
 	return FALSE;
     optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
@@ -3547,7 +3547,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
                     /* first item in list */
                     pWin->optional->deviceCursors = pNode->next;
 
-            xfree(pNode);
+            free(pNode);
             goto out;
         }
 
@@ -3559,7 +3559,7 @@ ChangeWindowDeviceCursor(WindowPtr pWin,
         if (!pCursor)
             return Success;
 
-        pNewNode = xalloc(sizeof(DevCursNodeRec));
+        pNewNode = malloc(sizeof(DevCursNodeRec));
         pNewNode->dev = pDev;
         pNewNode->next = pWin->optional->deviceCursors;
         pWin->optional->deviceCursors = pNewNode;
diff --git a/exa/exa.c b/exa/exa.c
index da37972..7b3b9a0 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -783,7 +783,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
     unwrap(pExaScr, ps, Triangles);
     unwrap(pExaScr, ps, AddTraps);
 
-    xfree (pExaScr);
+    free(pExaScr);
 
     return (*pScreen->CloseScreen) (i, pScreen);
 }
@@ -794,14 +794,14 @@ exaCloseScreen(int i, ScreenPtr pScreen)
  * without breaking ABI between EXA and the drivers.  The driver's
  * responsibility is to check beforehand that the EXA module has a matching
  * major number and sufficient minor.  Drivers are responsible for freeing the
- * driver structure using xfree().
+ * driver structure using free().
  *
  * @return a newly allocated, zero-filled driver structure
  */
 ExaDriverPtr
 exaDriverAlloc(void)
 {
-    return xcalloc(1, sizeof(ExaDriverRec));
+    return calloc(1, sizeof(ExaDriverRec));
 }
 
 /**
@@ -889,7 +889,7 @@ exaDriverInit (ScreenPtr		pScreen,
 
     ps = GetPictureScreenIfSet(pScreen);
 
-    pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
+    pExaScr = calloc(sizeof (ExaScreenPrivRec), 1);
     if (!pExaScr) {
         LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
 		   pScreen->myNum);
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 57029fd..4164ff7 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -394,7 +394,7 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
     exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
     exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
 
-    rects = xalloc(nbox * sizeof(xRectangle));
+    rects = malloc(nbox * sizeof(xRectangle));
 
     if (rects) {
 	int i;
@@ -417,7 +417,7 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 	    ordering = CT_UNSORTED;
 
 	srcregion  = RECTS_TO_REGION(pScreen, nbox, rects, ordering);
-	xfree(rects);
+	free(rects);
 
 	if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
 					   pGC->fillStyle, pGC->alu,
@@ -626,7 +626,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	return;
     }
 
-    prect = xalloc(sizeof(xRectangle) * npt);
+    prect = malloc(sizeof(xRectangle) * npt);
     for (i = 0; i < npt; i++) {
 	prect[i].x = ppt[i].x;
 	prect[i].y = ppt[i].y;
@@ -638,7 +638,7 @@ exaPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	prect[i].height = 1;
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, npt, prect);
-    xfree(prect);
+    free(prect);
 }
 
 /**
@@ -667,7 +667,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	return;
     }
 
-    prect = xalloc(sizeof(xRectangle) * (npt - 1));
+    prect = malloc(sizeof(xRectangle) * (npt - 1));
     x1 = ppt[0].x;
     y1 = ppt[0].y;
     /* If we have any non-horizontal/vertical, fall back. */
@@ -681,7 +681,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	}
 
 	if (x1 != x2 && y1 != y2) {
-	    xfree(prect);
+	    free(prect);
 	    ExaCheckPolylines(pDrawable, pGC, mode, npt, ppt);
 	    return;
 	}
@@ -705,7 +705,7 @@ exaPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
 	y1 = y2;
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, npt - 1, prect);
-    xfree(prect);
+    free(prect);
 }
 
 /**
@@ -737,7 +737,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 	}
     }
 
-    prect = xalloc(sizeof(xRectangle) * nseg);
+    prect = malloc(sizeof(xRectangle) * nseg);
     for (i = 0; i < nseg; i++) {
 	if (pSeg[i].x1 < pSeg[i].x2) {
 	    prect[i].x = pSeg[i].x1;
@@ -763,7 +763,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 	}
     }
     pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect);
-    xfree(prect);
+    free(prect);
 }
 
 static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index fd14e9b..b09db46 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -128,12 +128,12 @@ exaUnrealizeGlyphCaches(ScreenPtr    pScreen,
 	}
 
 	if (cache->hashEntries) {
-	    xfree(cache->hashEntries);
+	    free(cache->hashEntries);
 	    cache->hashEntries = NULL;
 	}
 	
 	if (cache->glyphs) {
-	    xfree(cache->glyphs);
+	    free(cache->glyphs);
 	    cache->glyphs = NULL;
 	}
 	cache->glyphCount = 0;
@@ -213,8 +213,8 @@ exaRealizeGlyphCaches(ScreenPtr    pScreen,
 
 	cache->picture = pPicture;
 	cache->picture->refcnt++;
-	cache->hashEntries = xalloc(sizeof(int) * cache->hashSize);
-	cache->glyphs = xalloc(sizeof(ExaCachedGlyphRec) * cache->size);
+	cache->hashEntries = malloc(sizeof(int) * cache->hashSize);
+	cache->glyphs = malloc(sizeof(ExaCachedGlyphRec) * cache->size);
 	cache->glyphCount = 0;
 
 	if (!cache->hashEntries || !cache->glyphs)
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index e3a9ab2..5abe3b8 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -245,7 +245,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
     /* save extra space in new area */
     if (real_size < area->size)
     {
-	ExaOffscreenArea   *new_area = xalloc (sizeof (ExaOffscreenArea));
+	ExaOffscreenArea   *new_area = malloc(sizeof (ExaOffscreenArea));
 	if (!new_area)
 	    return NULL;
 	new_area->base_offset = area->base_offset;
@@ -408,7 +408,7 @@ ExaOffscreenMerge (ExaScreenPrivPtr pExaScr, ExaOffscreenArea *area)
 	area->next->prev = area;
     else
 	pExaScr->info->offScreenAreas->prev = area;
-    xfree (next);
+    free(next);
 
     pExaScr->numOffscreenAvailable--;
 }
@@ -655,7 +655,7 @@ exaOffscreenInit (ScreenPtr pScreen)
     ExaOffscreenArea *area;
 
     /* Allocate a big free area */
-    area = xalloc (sizeof (ExaOffscreenArea));
+    area = malloc(sizeof (ExaOffscreenArea));
 
     if (!area)
 	return FALSE;
@@ -691,6 +691,6 @@ ExaOffscreenFini (ScreenPtr pScreen)
     while ((area = pExaScr->info->offScreenAreas))
     {
 	pExaScr->info->offScreenAreas = area->next;
-	xfree (area);
+	free(area);
     }
 }
diff --git a/fb/fballpriv.c b/fb/fballpriv.c
index c40796c..569391b 100644
--- a/fb/fballpriv.c
+++ b/fb/fballpriv.c
@@ -61,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)
     {
 	FbScreenPrivPtr	pScreenPriv;
 
-	pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec));
+	pScreenPriv = (FbScreenPrivPtr) malloc(sizeof (FbScreenPrivRec));
 	if (!pScreenPriv)
 	    return FALSE;
 	dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv);
diff --git a/fb/fbcmap.c b/fb/fbcmap.c
index b775bc3..ce6fcd5 100644
--- a/fb/fbcmap.c
+++ b/fb/fbcmap.c
@@ -388,7 +388,7 @@ fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB,
 {
     fbVisualsPtr   new, *prev, v;
 
-    new = (fbVisualsPtr) xalloc (sizeof *new);
+    new = (fbVisualsPtr) malloc(sizeof *new);
     if (!new)
 	return FALSE;
     if (!redMask || !greenMask || !blueMask)
@@ -485,12 +485,12 @@ fbInitVisuals (VisualPtr    *visualp,
 	ndepth++;
 	nvisual += visuals->count;
     }
-    depth = (DepthPtr) xalloc (ndepth * sizeof (DepthRec));
-    visual = (VisualPtr) xalloc (nvisual * sizeof (VisualRec));
+    depth = (DepthPtr) malloc(ndepth * sizeof (DepthRec));
+    visual = (VisualPtr) malloc(nvisual * sizeof (VisualRec));
     if (!depth || !visual)
     {
-	xfree (depth);
-	xfree (visual);
+	free(depth);
+	free(visual);
 	return FALSE;
     }
     *depthp = depth;
@@ -506,7 +506,7 @@ fbInitVisuals (VisualPtr    *visualp,
 	vid = NULL;
 	if (nvtype)
 	{
-	    vid = (VisualID *) xalloc (nvtype * sizeof (VisualID));
+	    vid = (VisualID *) malloc(nvtype * sizeof (VisualID));
 	    if (!vid)
 		return FALSE;
 	}
@@ -547,7 +547,7 @@ fbInitVisuals (VisualPtr    *visualp,
 	    vid++;
 	    visual++;
 	}
-	xfree (visuals);
+	free(visuals);
     }
     fbVisuals = NULL;
     visual = *visualp;
diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 07eb663..9a7c49a 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -275,7 +275,7 @@ fbCopyNto1 (DrawablePtr	pSrcDrawable,
 	    height = pbox->y2 - pbox->y1;
 	    
 	    tmpStride = ((width + FB_STIP_MASK) >> FB_STIP_SHIFT);
-	    tmp = xalloc (tmpStride * height * sizeof (FbStip));
+	    tmp = malloc(tmpStride * height * sizeof (FbStip));
 	    if (!tmp)
 		return;
 	    
@@ -313,7 +313,7 @@ fbCopyNto1 (DrawablePtr	pSrcDrawable,
     
 		      pPriv->and, pPriv->xor,
 		      pPriv->bgand, pPriv->bgxor);
-	    xfree (tmp);
+	    free(tmp);
 
 	    fbFinishAccess (pDstDrawable);
 	    fbFinishAccess (pSrcDrawable);
diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 99939e8..3eb1b03 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -348,7 +348,7 @@ fbOverlayFinishScreenInit(ScreenPtr	pScreen,
     VisualID	defaultVisual;
     FbOverlayScrPrivPtr	pScrPriv;
 
-    pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec));
+    pScrPriv = malloc(sizeof (FbOverlayScrPrivRec));
     if (!pScrPriv)
 	return FALSE;
  
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index 311da9e..c73f9f4 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -101,7 +101,7 @@ fbDestroyPixmap (PixmapPtr pPixmap)
     if(--pPixmap->refcnt)
 	return TRUE;
     dixFreePrivates(pPixmap->devPrivates);
-    xfree(pPixmap);
+    free(pPixmap);
     return TRUE;
 }
 
@@ -308,7 +308,7 @@ fbPixmapToRegion(PixmapPtr pPix)
 	pReg->extents.y2 = REGION_END(pReg)->y2;
 	if (pReg->data->numRects == 1)
 	{
-	    xfree(pReg->data);
+	    free(pReg->data);
 	    pReg->data = (RegDataPtr)NULL;
 	}
     }
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 53e2ada..9b789b0 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -33,12 +33,12 @@ fbCloseScreen (int index, ScreenPtr pScreen)
     DepthPtr	depths = pScreen->allowedDepths;
 
     for (d = 0; d < pScreen->numDepths; d++)
-	xfree (depths[d].vids);
-    xfree (depths);
-    xfree (pScreen->visuals);
-    xfree (pScreen->devPrivate);
+	free(depths[d].vids);
+    free(depths);
+    free(pScreen->visuals);
+    free(pScreen->devPrivate);
 #ifdef FB_SCREEN_PRIVATE
-    xfree (dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
+    free(dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey()));
 #endif
     return TRUE;
 }
@@ -229,8 +229,8 @@ fbFinishScreenInit(ScreenPtr	pScreen,
     if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
 			&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
     {
-	xfree (visuals);
-	xfree (depths);
+	free(visuals);
+	free(depths);
 	return FALSE;
     }
     if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index ec3bbe6..25346f9 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -196,7 +196,7 @@ __glXContextDestroy(__GLXcontext *context)
 static void __glXdirectContextDestroy(__GLXcontext *context)
 {
     __glXContextDestroy(context);
-    xfree(context);
+    free(context);
 }
 
 static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
@@ -205,7 +205,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
 {
     __GLXcontext *context;
 
-    context = xcalloc (1, sizeof (__GLXcontext));
+    context = calloc(1, sizeof (__GLXcontext));
     if (context == NULL)
 	return NULL;
 
@@ -407,9 +407,9 @@ static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc)
     ** Didn't find a free slot, so we'll have to grow the table.
     */
     if (!num) {
-	table = (__GLXcontext **) xalloc(sizeof(__GLXcontext *));
+	table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
     } else {
-	table = (__GLXcontext **) xrealloc(table,
+	table = (__GLXcontext **) realloc(table,
 					   (num+1)*sizeof(__GLXcontext *));
     }
     table[num] = glxc;
@@ -1527,7 +1527,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
     reply.n = nProps;
 
     nReplyBytes = reply.length << 2;
-    sendBuf = (int *)xalloc((size_t)nReplyBytes);
+    sendBuf = (int *)malloc((size_t)nReplyBytes);
     if (sendBuf == NULL) {
 	return __glXError(GLXBadContext);	/* XXX: Is this correct? */
     }
@@ -1545,7 +1545,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
 	WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
 	WriteToClient(client, nReplyBytes, (char *)sendBuf);
     }
-    xfree((char *)sendBuf);
+    free((char *)sendBuf);
 
     return Success;
 }
@@ -1947,9 +1947,9 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc)
 	*/
 	if (cl->largeCmdBufSize < cmdlen) {
 	    if (!cl->largeCmdBuf) {
-		cl->largeCmdBuf = (GLbyte *) xalloc(cmdlen);
+		cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
 	    } else {
-		cl->largeCmdBuf = (GLbyte *) xrealloc(cl->largeCmdBuf, cmdlen);
+		cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
 	    }
 	    if (!cl->largeCmdBuf) {
 		return BadAlloc;
@@ -2351,7 +2351,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
     reply.n = n;
 
     /* Allocate buffer to make sure it's a multiple of 4 bytes big.*/
-    buf = (char *) xalloc(length << 2);
+    buf = (char *) malloc(length << 2);
     if (buf == NULL)
         return BadAlloc;
     memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2363,7 +2363,7 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
         WriteToClient(client, (int)(length << 2), (char *)buf);
     }
 
-    xfree(buf);
+    free(buf);
     return Success;
 }
 
@@ -2407,7 +2407,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
     reply.length = length;
     reply.n = n;
 
-    buf = (char *) xalloc(length << 2);
+    buf = (char *) malloc(length << 2);
     if (buf == NULL) {
         return BadAlloc;
     }
@@ -2420,7 +2420,7 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc)
         WriteToClient(client, (int)(length << 2), buf);
     }
 
-    xfree(buf);
+    free(buf);
     return Success;
 }
 
@@ -2432,7 +2432,7 @@ int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc)
     cl->GLClientmajorVersion = req->major;
     cl->GLClientminorVersion = req->minor;
     if (cl->GLClientextensions)
-	xfree(cl->GLClientextensions);
+	free(cl->GLClientextensions);
     buf = (const char *)(req+1);
     cl->GLClientextensions = xstrdup(buf);
 
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 1d8c902..131efcf 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -242,7 +242,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
 
     __glXDrawableRelease(drawable);
 
-    xfree(private);
+    free(private);
 }
 
 static GLboolean
@@ -299,7 +299,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
     __glXleaveServer(GL_FALSE);
 
     __glXContextDestroy(&context->base);
-    xfree(context);
+    free(context);
 }
 
 static int
@@ -495,7 +495,7 @@ nooverride:
 	    unsigned pitch = PixmapBytePad(pixmap->drawable.width,
 					   pixmap->drawable.depth); 
 
-	    data = xalloc(pitch * pixmap->drawable.height);
+	    data = malloc(pitch * pixmap->drawable.height);
 
 	    __glXenterServer(GL_FALSE);
 	    pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
@@ -526,7 +526,7 @@ nooverride:
 			  type,
 			  data) );
 
-	xfree(data);
+	free(data);
     } else if (!override) {
         int i, numRects;
 	BoxPtr p;
@@ -541,7 +541,7 @@ nooverride:
 	{
 	    unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1,
 					   pixmap->drawable.depth);
-	    void *data = xalloc(pitch * (p[i].y2 - p[i].y1));
+	    void *data = malloc(pitch * (p[i].y2 - p[i].y1));
 
 	    __glXenterServer(GL_FALSE);
 	    pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
@@ -567,7 +567,7 @@ nooverride:
 				 type,
 				 data) );
 
-	    xfree(data);
+	    free(data);
 	}
     }
 
@@ -607,7 +607,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
-    xfree(screen);
+    free(screen);
 }
 
 static __GLXcontext *
@@ -634,7 +634,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     if (baseShareContext && baseShareContext->isDirect)
         return NULL;
 
-    context = xcalloc(1, sizeof *context);
+    context = calloc(1, sizeof *context);
     if (context == NULL)
 	return NULL;
 
@@ -675,7 +675,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     	__glXenterServer(GL_FALSE);
 	retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
     	__glXleaveServer(GL_FALSE);
-	xfree(context);
+	free(context);
 	return NULL;
     }
 
@@ -697,13 +697,13 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     GLboolean retval;
     drm_drawable_t hwDrawable;
 
-    private = xcalloc(1, sizeof *private);
+    private = calloc(1, sizeof *private);
     if (private == NULL)
 	return NULL;
 
     if (!__glXDrawableInit(&private->base, screen,
 			   pDraw, type, glxDrawId, glxConfig)) {
-        xfree(private);
+        free(private);
 	return NULL;
     }
 
@@ -719,7 +719,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     __glXleaveServer(GL_FALSE);
 
     if (!retval) {
-    	xfree(private);
+        free(private);
     	return NULL;
     }
 
@@ -735,7 +735,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
 	__glXenterServer(GL_FALSE);
 	DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
 	__glXleaveServer(GL_FALSE);
-	xfree(private);
+	free(private);
 	return NULL;
     }
 
@@ -772,7 +772,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
 
     if (retval && *numClipRects > 0) {
 	size = sizeof (drm_clip_rect_t) * *numClipRects;
-	*ppClipRects = xalloc (size);
+	*ppClipRects = malloc(size);
 
 	/* Clip cliprects to screen dimensions (redirected windows) */
 	if (*ppClipRects != NULL) {
@@ -792,7 +792,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
 
 	    if (*numClipRects != j) {
 		*numClipRects = j;
-		*ppClipRects = xrealloc (*ppClipRects,
+		*ppClipRects = realloc(*ppClipRects,
 					 sizeof (drm_clip_rect_t) *
 					 *numClipRects);
 	    }
@@ -806,7 +806,7 @@ getDrawableInfo(__DRIdrawable *driDrawable,
       
     if (retval && *numBackClipRects > 0) {
 	size = sizeof (drm_clip_rect_t) * *numBackClipRects;
-	*ppBackClipRects = xalloc (size);
+	*ppBackClipRects = malloc(size);
 	if (*ppBackClipRects != NULL)
 	    memcpy (*ppBackClipRects, pBackClipRects, size);
 	else
@@ -977,7 +977,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 	return NULL;
     }
 
-    screen = xcalloc(1, sizeof *screen);
+    screen = calloc(1, sizeof *screen);
     if (screen == NULL)
       return NULL;
 
@@ -1148,7 +1148,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
     if (buffer_size > 0) {
 	if (screen->base.GLXextensions != NULL) {
-	    xfree(screen->base.GLXextensions);
+	    free(screen->base.GLXextensions);
 	}
 
 	screen->base.GLXextensions = xnfalloc(buffer_size);
@@ -1183,7 +1183,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     if (screen->driver)
         dlclose(screen->driver);
 
-    xfree(screen);
+    free(screen);
 
     LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
 
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index bad4516..4f8e020 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -107,7 +107,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
 
     __glXDrawableRelease(drawable);
 
-    xfree(private);
+    free(private);
 }
 
 static void
@@ -248,7 +248,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
 
     (*screen->core->destroyContext)(context->driContext);
     __glXContextDestroy(&context->base);
-    xfree(context);
+    free(context);
 }
 
 static int
@@ -386,7 +386,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
-    xfree(screen);
+    free(screen);
 }
 
 static __GLXcontext *
@@ -405,7 +405,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     else
 	driShare = NULL;
 
-    context = xcalloc(1, sizeof *context);
+    context = calloc(1, sizeof *context);
     if (context == NULL)
 	return NULL;
 
@@ -422,7 +422,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 					  config->driConfig,
 					  driShare, context);
     if (context->driContext == NULL) {
-	    xfree(context);
+	    free(context);
         return NULL;
     }
 
@@ -442,14 +442,14 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
     __GLXDRIdrawable *private;
 
-    private = xcalloc(1, sizeof *private);
+    private = calloc(1, sizeof *private);
     if (private == NULL)
 	return NULL;
 
     private->screen = driScreen;
     if (!__glXDrawableInit(&private->base, screen,
 			   pDraw, type, glxDrawId, glxConfig)) {
-        xfree(private);
+        free(private);
 	return NULL;
     }
 
@@ -460,7 +460,7 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     private->base.waitX		= __glXDRIdrawableWaitX;
 
     if (DRI2CreateDrawable(client, pDraw, drawId)) {
-	    xfree(private);
+	    free(private);
 	    return NULL;
     }
 
@@ -676,7 +676,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     const __DRIconfig **driConfigs;
     int i;
 
-    screen = xcalloc(1, sizeof *screen);
+    screen = calloc(1, sizeof *screen);
     if (screen == NULL)
 	return NULL;
 
@@ -759,7 +759,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
     if (buffer_size > 0) {
 	if (screen->base.GLXextensions != NULL) {
-	    xfree(screen->base.GLXextensions);
+	    free(screen->base.GLXextensions);
 	}
 
 	screen->base.GLXextensions = xnfalloc(buffer_size);
@@ -793,7 +793,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     if (screen->driver)
         dlclose(screen->driver);
 
-    xfree(screen);
+    free(screen);
 
     LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n");
 
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 454aa55..86797a0 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -127,7 +127,7 @@ createModeFromConfig(const __DRIcoreExtension *core,
     unsigned int attrib, value;
     int i;
 
-    config = xalloc(sizeof *config);
+    config = malloc(sizeof *config);
 
     config->driConfig = driConfig;
 
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 4ba448a..a005451 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -104,7 +104,7 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
 
     __glXDrawableRelease(drawable);
 
-    xfree(private);
+    free(private);
 }
 
 static GLboolean
@@ -138,7 +138,7 @@ __glXDRIcontextDestroy(__GLXcontext *baseContext)
 
     (*screen->core->destroyContext)(context->driContext);
     __glXContextDestroy(&context->base);
-    xfree(context);
+    free(context);
 }
 
 static int
@@ -254,7 +254,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
 
     __glXScreenDestroy(baseScreen);
 
-    xfree(screen);
+    free(screen);
 }
 
 static __GLXcontext *
@@ -274,7 +274,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
     else
 	driShare = NULL;
 
-    context = xcalloc(1, sizeof *context);
+    context = calloc(1, sizeof *context);
     if (context == NULL)
 	return NULL;
 
@@ -315,14 +315,14 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
 
     ScreenPtr pScreen = driScreen->base.pScreen;
 
-    private = xcalloc(1, sizeof *private);
+    private = calloc(1, sizeof *private);
     if (private == NULL)
 	return NULL;
 
     private->screen = driScreen;
     if (!__glXDrawableInit(&private->base, screen,
 			   pDraw, type, glxDrawId, glxConfig)) {
-        xfree(private);
+        free(private);
 	return NULL;
     }
 
@@ -450,7 +450,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     const __DRIconfig **driConfigs;
     int i;
 
-    screen = xcalloc(1, sizeof *screen);
+    screen = calloc(1, sizeof *screen);
     if (screen == NULL)
 	return NULL;
 
@@ -527,7 +527,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     if (screen->driver)
         dlclose(screen->driver);
 
-    xfree(screen);
+    free(screen);
 
     LogMessage(X_ERROR, "GLX: could not load software renderer\n");
 
diff --git a/glx/glxext.c b/glx/glxext.c
index 89e58b0..593e053 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -205,8 +205,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
 {
     if (cx->idExists || cx->isCurrent) return GL_FALSE;
     
-    if (cx->feedbackBuf) xfree(cx->feedbackBuf);
-    if (cx->selectBuf) xfree(cx->selectBuf);
+    if (cx->feedbackBuf) free(cx->feedbackBuf);
+    if (cx->selectBuf) free(cx->selectBuf);
     if (cx == __glXLastContext) {
 	__glXFlushContextCache();
     }
@@ -323,10 +323,10 @@ glxClientCallback (CallbackListPtr	*list,
 	    }
 	}
 
-	if (cl->returnBuf) xfree(cl->returnBuf);
-	if (cl->largeCmdBuf) xfree(cl->largeCmdBuf);
-	if (cl->currentContexts) xfree(cl->currentContexts);
-	if (cl->GLClientextensions) xfree(cl->GLClientextensions);
+	if (cl->returnBuf) free(cl->returnBuf);
+	if (cl->largeCmdBuf) free(cl->largeCmdBuf);
+	if (cl->currentContexts) free(cl->currentContexts);
+	if (cl->GLClientextensions) free(cl->GLClientextensions);
 	break;
 
     default:
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index b75aea6..ffe70c3 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -378,7 +378,7 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
     pGlxScreen->numFBConfigs = i;
 
     pGlxScreen->visuals =
-	xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
+	calloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
 
     /* First, try to choose featureful FBconfigs for the existing X visuals.
      * Note that if multiple X visuals end up with the same FBconfig being
@@ -436,7 +436,7 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
 
 void __glXScreenDestroy(__GLXscreen *screen)
 {
-    xfree(screen->GLXvendor);
-    xfree(screen->GLXextensions);
-    xfree(screen->GLextensions);
+    free(screen->GLXvendor);
+    free(screen->GLXextensions);
+    free(screen->GLextensions);
 }
diff --git a/glx/indirect_util.c b/glx/indirect_util.c
index 4430910..46a2706 100644
--- a/glx/indirect_util.c
+++ b/glx/indirect_util.c
@@ -88,7 +88,7 @@ __glXGetAnswerBuffer( __GLXclientState * cl, size_t required_size,
         intptr_t  temp_buf;
 
         if ( cl->returnBufSize < worst_case_size ) {
-	    void * temp = xrealloc( cl->returnBuf, worst_case_size );
+	    void * temp = realloc( cl->returnBuf, worst_case_size );
 	    
 	    if ( temp == NULL ) {
 	        return NULL;
diff --git a/glx/single2.c b/glx/single2.c
index 50a59ed..0700626 100644
--- a/glx/single2.c
+++ b/glx/single2.c
@@ -62,7 +62,7 @@ int __glXDisp_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
     size = *(GLsizei *)(pc+0);
     type = *(GLenum *)(pc+4);
     if (cx->feedbackBufSize < size) {
-	cx->feedbackBuf = (GLfloat *) xrealloc(cx->feedbackBuf,
+	cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
 						   (size_t)size 
 						   * __GLX_SIZE_FLOAT32);
 	if (!cx->feedbackBuf) {
@@ -90,7 +90,7 @@ int __glXDisp_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
     pc += __GLX_SINGLE_HDR_SIZE;
     size = *(GLsizei *)(pc+0);
     if (cx->selectBufSize < size) {
-	cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
+	cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
 						(size_t) size 
 						* __GLX_SIZE_CARD32);
 	if (!cx->selectBuf) {
@@ -261,21 +261,21 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
    clen = strlen(cext_string);
    slen = strlen(sext_string);
    if (clen > slen) {
-	combo_string = (char *) xalloc(slen + 2);
-	s1 = (char *) xalloc(slen + 2);
+	combo_string = (char *) malloc(slen + 2);
+	s1 = (char *) malloc(slen + 2);
 	if (s1) strcpy(s1, sext_string);
 	s2 = cext_string;
    } else {
-	combo_string = (char *) xalloc(clen + 2);
-	s1 = (char *) xalloc(clen + 2);
+	combo_string = (char *) malloc(clen + 2);
+	s1 = (char *) malloc(clen + 2);
 	if (s1) strcpy(s1, cext_string);
 	s2 = sext_string;
    }
    if (!combo_string || !s1) {
 	if (combo_string)
-	    xfree(combo_string);
+	    free(combo_string);
 	if (s1)
-	    xfree(s1);
+	    free(s1);
 	return NULL;
    }
    combo_string[0] = '\0';
@@ -302,7 +302,7 @@ char *__glXcombine_strings(const char *cext_string, const char *sext_string)
 	/* Get next extension token */
 	token = strtok( NULL, SEPARATOR);
    }
-   xfree(s1);
+   free(s1);
    return combo_string;
 }
 
@@ -349,13 +349,13 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
 	buf = __glXcombine_strings(buf1,
 				      cx->pGlxScreen->GLextensions);
 	if (buf1 != NULL) {
-	    xfree(buf1);
+	    free(buf1);
 	}
 	string = buf;
     }
     else if ( name == GL_VERSION ) {
 	if ( atof( string ) > atof( GLServerVersion ) ) {
-	    buf = xalloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
+	    buf = malloc( strlen( string ) + strlen( GLServerVersion ) + 4 );
 	    if ( buf == NULL ) {
 		string = GLServerVersion;
 	    }
@@ -380,7 +380,7 @@ int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap)
     __GLX_SEND_HEADER();
     WriteToClient(client, length, (char *) string); 
     if (buf != NULL)
-	xfree(buf);
+	free(buf);
 
     return Success;
 }
diff --git a/glx/single2swap.c b/glx/single2swap.c
index cf83bdc..04e50b4 100644
--- a/glx/single2swap.c
+++ b/glx/single2swap.c
@@ -62,7 +62,7 @@ int __glXDispSwap_FeedbackBuffer(__GLXclientState *cl, GLbyte *pc)
     size = *(GLsizei *)(pc+0);
     type = *(GLenum *)(pc+4);
     if (cx->feedbackBufSize < size) {
-	cx->feedbackBuf = (GLfloat *) xrealloc(cx->feedbackBuf,
+	cx->feedbackBuf = (GLfloat *) realloc(cx->feedbackBuf,
 						   (size_t) size 
 						   * __GLX_SIZE_FLOAT32);
 	if (!cx->feedbackBuf) {
@@ -93,7 +93,7 @@ int __glXDispSwap_SelectBuffer(__GLXclientState *cl, GLbyte *pc)
     __GLX_SWAP_INT(pc+0);
     size = *(GLsizei *)(pc+0);
     if (cx->selectBufSize < size) {
-	cx->selectBuf = (GLuint *) xrealloc(cx->selectBuf,
+	cx->selectBuf = (GLuint *) realloc(cx->selectBuf,
 						(size_t) size 
 						* __GLX_SIZE_CARD32);
 	if (!cx->selectBuf) {
diff --git a/glx/unpack.h b/glx/unpack.h
index 90cb71b..a4e6d7e 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -86,7 +86,7 @@ extern xGLXSingleReply __glXReply;
     if ((size) > sizeof(answerBuffer)) {				 \
 	int bump;							 \
 	if ((cl)->returnBufSize < (size)+(align)) {			 \
-	    (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf,	 \
+	    (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf,	 	 \
 						(size)+(align));         \
 	    if (!(cl)->returnBuf) {					 \
 		return BadAlloc;					 \
diff --git a/glx/xfont.c b/glx/xfont.c
index e3c7f32..35fad4d 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -76,7 +76,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
 	p = buf;
 	allocbuf = 0;
     } else {
-	p = (unsigned char *) xalloc(allocBytes);
+	p = (unsigned char *) malloc(allocBytes);
 	if (!p)
 	    return BadAlloc;
 	allocbuf = p;
@@ -100,7 +100,7 @@ static int __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci)
 				  allocbuf ? allocbuf : buf) );
 
     if (allocbuf) {
-	xfree(allocbuf);
+	free(allocbuf);
     }
     return Success;
 #undef __GL_CHAR_BUF_SIZE
diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index a1afe76..95e7adc 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -419,7 +419,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
     
     if (!_DMXXineramaActive()) goto noxinerama;
 
-    if (!(attribs = xalloc(stuff->screenCount * sizeof(*attribs))))
+    if (!(attribs = malloc(stuff->screenCount * sizeof(*attribs))))
         return BadAlloc;
 
     for (i = 0; i < stuff->screenCount; i++) {
@@ -438,7 +438,7 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
 				       &errorScreen);
 #endif
 
-    xfree(attribs);
+    free(attribs);
 
     if (status == BadValue) return status;
 
@@ -484,7 +484,7 @@ static int ProcDMXAddScreen(ClientPtr client)
     value_list = (CARD32 *)(stuff + 1);
     count      = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
     
-    if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
+    if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
         return BadAlloc;
     memcpy(name, &value_list[count], stuff->displayNameLength);
     name[stuff->displayNameLength] = '\0';
@@ -492,7 +492,7 @@ static int ProcDMXAddScreen(ClientPtr client)
 
     status = dmxAttachScreen(stuff->physicalScreen, &attr);
 
-    xfree(name);
+    free(name);
 
     rep.type           = X_Reply;
     rep.sequenceNumber = client->sequence;
@@ -612,30 +612,30 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
 
-    if (!(screens = xalloc(count * sizeof(*screens))))
+    if (!(screens = malloc(count * sizeof(*screens))))
         return BadAlloc;
-    if (!(windows = xalloc(count * sizeof(*windows)))) {
-        xfree(screens);
+    if (!(windows = malloc(count * sizeof(*windows)))) {
+        free(screens);
         return BadAlloc;
     }
-    if (!(pos = xalloc(count * sizeof(*pos)))) {
-        xfree(windows);
-        xfree(screens);
+    if (!(pos = malloc(count * sizeof(*pos)))) {
+        free(windows);
+        free(screens);
         return BadAlloc;
     }
-    if (!(vis = xalloc(count * sizeof(*vis)))) {
-        xfree(pos);
-        xfree(windows);
-        xfree(screens);
+    if (!(vis = malloc(count * sizeof(*vis)))) {
+        free(pos);
+        free(windows);
+        free(screens);
         return BadAlloc;
     }
 
     if ((count = dmxPopulate(client, stuff->window, screens, windows,
                              pos, vis)) < 0) {
-        xfree(vis);
-        xfree(pos);
-        xfree(windows);
-        xfree(screens);
+        free(vis);
+        free(pos);
+        free(windows);
+        free(screens);
         return BadWindow;
     }
 
@@ -673,10 +673,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
         WriteToClient(client, count * sizeof(*vis),     (char *)vis);
     }
 
-    xfree(vis);
-    xfree(pos);
-    xfree(windows);
-    xfree(screens);
+    free(vis);
+    free(pos);
+    free(windows);
+    free(screens);
 
     return client->noClientException;
 }
@@ -837,7 +837,7 @@ static int ProcDMXAddInput(ClientPtr client)
     value_list = (CARD32 *)(stuff + 1);
     count      = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
     
-    if (!(name = xalloc(stuff->displayNameLength + 1 + 4)))
+    if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
         return BadAlloc;
     memcpy(name, &value_list[count], stuff->displayNameLength);
     name[stuff->displayNameLength] = '\0';
@@ -845,7 +845,7 @@ static int ProcDMXAddInput(ClientPtr client)
 
     status = dmxAddInput(&attr, &id);
 
-    xfree(name);
+    free(name);
 
     if (status) return status;
 
diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c
index ec33468..59173ca 100644
--- a/hw/dmx/dmx_glxvisuals.c
+++ b/hw/dmx/dmx_glxvisuals.c
@@ -94,7 +94,7 @@ __GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
     config = (__GLXvisualConfig*)
 	Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
     if (!config) {
-	Xfree(props);
+	free(props);
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return NULL;
@@ -284,7 +284,7 @@ __GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
     config = (__GLXFBConfig*)
 	Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
     if (!config) {
-	Xfree(attrs);
+	free(attrs);
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return NULL;
diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index 4aa586a..e3d2fdc 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -50,7 +50,7 @@ static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
 {
     dmxColormapPrivPtr   pCmapPriv;
 
-    pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv));
+    pCmapPriv = (dmxColormapPrivPtr)malloc(sizeof(*pCmapPriv));
     if (!pCmapPriv)
 	return FALSE;
     pCmapPriv->cmap = (Colormap)0;
@@ -133,7 +133,7 @@ void dmxDestroyColormap(ColormapPtr pColormap)
 
     if (dmxScreen->beDisplay)
 	dmxBEFreeColormap(pColormap);
-    xfree(pCmapPriv);
+    free(pCmapPriv);
     DMX_SET_COLORMAP_PRIV(pColormap, NULL);
 
     DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
@@ -170,7 +170,7 @@ void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
     dmxColormapPrivPtr  pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
 
     if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
-        XColor *color = xalloc(sizeof(*color) * ndef);
+        XColor *color = malloc(sizeof(*color) * ndef);
         int    i;
         
         if (color) {
@@ -183,7 +183,7 @@ void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
                 color[i].pad   = pdef[i].pad;
             }
             XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
-            xfree(color);
+            free(color);
         } else {                /* xalloc failed, so fallback */
             XColor c;
             for (i = 0; i < ndef; i++) {
diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index 37e66d7..bf5640d 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -663,7 +663,7 @@ static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 
     DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
 
-    DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv)));
+    DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
     if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
 	return FALSE;
 
@@ -701,7 +701,7 @@ static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
 
     if (dmxScreen->beDisplay) {
 	if (dmxBEFreeCursor(pScreen, pCursor))
-	    xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
+	    free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
     }
     DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
 
diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c
index c33aee7..8e4a17e 100644
--- a/hw/dmx/dmxfont.c
+++ b/hw/dmx/dmxfont.c
@@ -68,9 +68,9 @@ static char **dmxGetFontPath(int *npaths)
 
     GetFontPath(serverClient, npaths, &len, &paths);
 
-    newfp = xalloc(*npaths + len);
+    newfp = malloc(*npaths + len);
     c = (unsigned char *)newfp;
-    fp = xalloc(*npaths * sizeof(*fp));
+    fp = malloc(*npaths * sizeof(*fp));
 
     memmove(newfp, paths+1, *npaths + len - 1);
     l = *paths;
@@ -91,8 +91,8 @@ static char **dmxGetFontPath(int *npaths)
 
 static void dmxFreeFontPath(char **fp)
 {
-    xfree(fp[0]);
-    xfree(fp);
+    free(fp[0]);
+    free(fp);
 }
 
 static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp)
@@ -195,7 +195,7 @@ static int dmxProcSetFontPath(ClientPtr client)
         return BadLength;
 
     GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
-    oldFontPath = xalloc(nOldPaths + lenOldPaths);
+    oldFontPath = malloc(nOldPaths + lenOldPaths);
     memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
 
     result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1],
@@ -217,7 +217,7 @@ static int dmxProcSetFontPath(ClientPtr client)
 	}
     }
 
-    xfree(oldFontPath);
+    free(oldFontPath);
     return result;
 }
 
@@ -300,7 +300,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
 	if (!dmxFontPath)
 	    dmxLog(dmxWarning, "No default font path is set.\n");
 
-	goodfps = xalloc(npaths * sizeof(*goodfps));
+	goodfps = malloc(npaths * sizeof(*goodfps));
 
 	dmxLog(dmxError,
 	       "The DMX server failed to set the following font paths on "
@@ -347,11 +347,11 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
 		       "more information on font paths.\n");
 		dmxFreeFontPath(fp);
 		XFreeFontPath(oldFontPath);
-		xfree(goodfps);
+		free(goodfps);
 		return FALSE;
 	    }
 
-	    newfp = xalloc(len * sizeof(*newfp));
+	    newfp = malloc(len * sizeof(*newfp));
 	    for (i = 0; i < npaths; i++) {
 		if (goodfps[i]) {
 		    int n = strlen(fp[i]);
@@ -398,7 +398,7 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
 	    /* We still have errors so return with error */
 	    dmxFreeFontPath(fp);
 	    XFreeFontPath(oldFontPath);
-	    xfree(goodfps);
+	    free(goodfps);
 	    return FALSE;
 	}
     }
@@ -440,12 +440,12 @@ Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
 
     if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
 	FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
-	pFontPriv = xalloc(sizeof(dmxFontPrivRec));
+	pFontPriv = malloc(sizeof(dmxFontPrivRec));
 	if (!pFontPriv) return FALSE;
         pFontPriv->font = NULL;
         MAXSCREENSALLOC(pFontPriv->font);
         if (!pFontPriv->font) {
-            xfree(pFontPriv);
+            free(pFontPriv);
             return FALSE;
         }
 	pFontPriv->refcnt = 0;
@@ -491,7 +491,7 @@ Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
 	/* In case the font failed to load properly */
 	if (!pFontPriv->refcnt) {
             MAXSCREENSFREE(pFontPriv->font);
-	    xfree(pFontPriv);
+	    free(pFontPriv);
 	    FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
 	} else if (pFontPriv->font[pScreen->myNum]) {
 	    if (dmxScreen->beDisplay)
@@ -549,7 +549,7 @@ Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
 #endif
 		) {
                 MAXSCREENSFREE(pFontPriv->font);
-		xfree(pFontPriv);
+		free(pFontPriv);
 		FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
 	    }
 	}
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index eb21d3c..a761ea8 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -364,7 +364,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
     case CT_REGION:
 	if (dmxScreen->beDisplay) {
 	    nRects = REGION_NUM_RECTS((RegionPtr)pGC->clientClip);
-	    pRects = xalloc(nRects * sizeof(*pRects));
+	    pRects = malloc(nRects * sizeof(*pRects));
 	    pBox   = REGION_RECTS((RegionPtr)pGC->clientClip);
 
 	    for (i = 0; i < nRects; i++) {
@@ -378,7 +378,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
 			       pGC->clipOrg.x, pGC->clipOrg.y,
 			       pRects, nRects, Unsorted);
 
-	    xfree(pRects);
+	    free(pRects);
 	}
 	break;
 
diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index cc9ea0b..8a03c65 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -412,7 +412,7 @@ void dmxGetColormaps(DMXScreenInfo *dmxScreen)
     int i;
 
     dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
-    dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps *
+    dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
 				       sizeof(*dmxScreen->beDefColormaps));
 
     for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
@@ -738,7 +738,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
 		nconfigs = dmxScreen->numGlxVisuals;
 	    }
 
-	    configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
+	    configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
 
 	    if (configs != NULL && configprivs != NULL) {
 
@@ -748,7 +748,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
 		for (i = 0; i < nconfigs; i++) {
 
 		    configprivs[i] = (dmxGlxVisualPrivate *)
-			xalloc(sizeof(dmxGlxVisualPrivate));
+			malloc(sizeof(dmxGlxVisualPrivate));
 		    configprivs[i]->x_visual_depth = 0;
 		    configprivs[i]->x_visual_class = 0;
 
@@ -816,11 +816,11 @@ static void dmxSetDefaultFontPath(char *fp)
 	int len;
 
 	len = strlen(dmxFontPath);
-	dmxFontPath = xrealloc(dmxFontPath, len+fplen+1);
+	dmxFontPath = realloc(dmxFontPath, len+fplen+1);
 	dmxFontPath[len] = ',';
 	strncpy(&dmxFontPath[len+1], fp, fplen);
     } else {
-	dmxFontPath = xalloc(fplen);
+	dmxFontPath = malloc(fplen);
 	strncpy(dmxFontPath, fp, fplen);
     }
 
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 8398be7..0544c88 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -274,7 +274,7 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
 	
 	glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
 					  DixDestroyAccess);
-	glyphPriv = xalloc(sizeof(dmxGlyphPrivRec));
+	glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
 	if (!glyphPriv) return BadAlloc;
         glyphPriv->glyphSets = NULL;
         MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
@@ -331,7 +331,7 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client)
 	}
 
         MAXSCREENSFREE(glyphPriv->glyphSets);
-	xfree(glyphPriv);
+	free(glyphPriv);
 	DMX_SET_GLYPH_PRIV(glyphSet, NULL);
     }
 
@@ -369,7 +369,7 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
 		  sizeof(xRenderAddGlyphsReq) -
 		  (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
 
-        gidsCopy = xalloc(sizeof(*gidsCopy) * nglyphs);
+        gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
         for (i = 0; i < nglyphs; i++) gidsCopy[i] = gids[i];
 
 	/* FIXME: Will this ever fail? */
@@ -387,7 +387,7 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
 		dmxSync(dmxScreen, FALSE);
 	    }
 	}
-        xfree(gidsCopy);
+        free(gidsCopy);
     }
 
     return ret;
@@ -411,7 +411,7 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client)
 
 	nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
 	if (nglyphs) {
-            gids    = xalloc(sizeof(*gids) * nglyphs);
+            gids    = malloc(sizeof(*gids) * nglyphs);
             for (i = 0; i < nglyphs; i++)
                 gids[i] = ((CARD32 *)(stuff + 1))[i];
             
@@ -424,7 +424,7 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client)
 		    dmxSync(dmxScreen, FALSE);
 		}
 	    }
-            xfree(gids);
+            free(gids);
 	}
     }
 
@@ -531,13 +531,13 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
 	/* The following only works for Render version > 0.2 */
 
 	/* All of the XGlyphElt* structure sizes are identical */
-	elts = xalloc(nelt * sizeof(XGlyphElt8));
+	elts = malloc(nelt * sizeof(XGlyphElt8));
 	if (!elts)
 	    return BadAlloc;
 
-	glyphs = xalloc(nglyph * size);
+	glyphs = malloc(nglyph * size);
 	if (!glyphs) {
-	    xfree(elts);
+	    free(elts);
 	    return BadAlloc;
 	}
 
@@ -605,8 +605,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
 
 	dmxSync(dmxScreen, FALSE);
 
-	xfree(elts);
-	xfree(glyphs);
+	free(elts);
+	free(glyphs);
     }
 
     return ret;
@@ -878,7 +878,7 @@ int dmxChangePictureClip(PicturePtr pPicture, int clipType,
 	    int         nRects;
 
 	    nRects = nBox;
-	    pRects = pRect = xalloc(nRects * sizeof(*pRect));
+	    pRects = pRect = malloc(nRects * sizeof(*pRect));
 
 	    while (nBox--) {
 		pRect->x      = pBox->x1;
@@ -894,7 +894,7 @@ int dmxChangePictureClip(PicturePtr pPicture, int clipType,
 					    0, 0,
 					    pRects,
 					    nRects);
-	    xfree(pRects);
+	    free(pRects);
 	} else {
 	    XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
 					    pPictPriv->pict,
diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c
index 6622403..c8b064b 100644
--- a/hw/dmx/dmxpixmap.c
+++ b/hw/dmx/dmxpixmap.c
@@ -175,7 +175,7 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap)
 	}
     }
     dixFreePrivates(pPixmap->devPrivates);
-    xfree(pPixmap);
+    free(pPixmap);
 
 #if 0
     if (pScreen->DestroyPixmap)
diff --git a/hw/dmx/dmxprop.c b/hw/dmx/dmxprop.c
index 376313d..d4618e3 100644
--- a/hw/dmx/dmxprop.c
+++ b/hw/dmx/dmxprop.c
@@ -157,8 +157,8 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
                     dmxLogOutputWarning(dmxScreen,
                                         "%s also running on %s\n",
                                         tp.value, dmxScreen->name);
-                    list = xrealloc(list, ++count * sizeof(*list));
-                    list[count-1] = xalloc(tp.nitems + 2);
+                    list = realloc(list, ++count * sizeof(*list));
+                    list[count-1] = malloc(tp.nitems + 2);
                     strncpy(list[count-1], (char *)tp.value, tp.nitems + 1);
                 }
                 XFree(tp.value);
@@ -167,8 +167,8 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
     }
     XSetErrorHandler(dmxOldHandler);
 
-    for (i = 0; i < count; i++) xfree(list[i]);
-    xfree(list);
+    for (i = 0; i < count; i++) free(list[i]);
+    free(list);
     XFree(tproot.value);
     if (!retcode)
         dmxLogOutput(dmxScreen, "No Xdmx server running on backend\n");
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index c1beb9b..068e809 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -393,7 +393,7 @@ void dmxBECloseScreen(ScreenPtr pScreen)
     /* Free resources allocated during initialization (in dmxinit.c) */
     for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
 	XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
-    xfree(dmxScreen->beDefColormaps);
+    free(dmxScreen->beDefColormaps);
     dmxScreen->beDefColormaps = NULL;
 
 #if 0
@@ -435,7 +435,7 @@ Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
 
     if (dmxShadowFB) {
 	/* Free the shadow framebuffer */
-	xfree(dmxScreen->shadow);
+	free(dmxScreen->shadow);
     } else {
 
 	/* Unwrap Shape functions */
diff --git a/hw/dmx/dmxsync.c b/hw/dmx/dmxsync.c
index 2cec1b9..2c7ccb8 100644
--- a/hw/dmx/dmxsync.c
+++ b/hw/dmx/dmxsync.c
@@ -159,7 +159,7 @@ void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
              * 2) freed, if it was on a queue (dmxSyncPending != 0), or
              * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
              */
-            if (dmxSyncTimer && !dmxSyncPending) xfree(dmxSyncTimer);
+            if (dmxSyncTimer && !dmxSyncPending) free(dmxSyncTimer);
             dmxSyncTimer  = NULL;
             now           = TRUE;
             dmxGeneration = serverGeneration;
diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c
index ea2f2c5..39af510 100644
--- a/hw/dmx/dmxwindow.c
+++ b/hw/dmx/dmxwindow.c
@@ -942,7 +942,7 @@ static void dmxDoSetShape(WindowPtr pWindow)
     if (wBoundingShape(pWindow)) {
 	pBox = REGION_RECTS(wBoundingShape(pWindow));
 	nRect = nBox = REGION_NUM_RECTS(wBoundingShape(pWindow));
-	pRectFirst = pRect = xalloc(nRect * sizeof(*pRect));
+	pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
 	while (nBox--) {
 	    pRect->x      = pBox->x1;
 	    pRect->y      = pBox->y1;
@@ -955,7 +955,7 @@ static void dmxDoSetShape(WindowPtr pWindow)
 				ShapeBounding, 0, 0,
 				pRectFirst, nRect,
 				ShapeSet, YXBanded);
-	xfree(pRectFirst);
+	free(pRectFirst);
     } else {
 	XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
 			  ShapeBounding, 0, 0, None, ShapeSet);
@@ -965,7 +965,7 @@ static void dmxDoSetShape(WindowPtr pWindow)
     if (wClipShape(pWindow)) {
 	pBox = REGION_RECTS(wClipShape(pWindow));
 	nRect = nBox = REGION_NUM_RECTS(wClipShape(pWindow));
-	pRectFirst = pRect = xalloc(nRect * sizeof(*pRect));
+	pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
 	while (nBox--) {
 	    pRect->x      = pBox->x1;
 	    pRect->y      = pBox->y1;
@@ -978,7 +978,7 @@ static void dmxDoSetShape(WindowPtr pWindow)
 				ShapeClip, 0, 0,
 				pRectFirst, nRect,
 				ShapeSet, YXBanded);
-	xfree(pRectFirst);
+	free(pRectFirst);
     } else {
 	XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
 			  ShapeClip, 0, 0, None, ShapeSet);
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 31fd431..d9b884a 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -2448,7 +2448,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
     len = (int)be_reply.length;
     numbytes = (int)be_reply.n;
     slop = numbytes * __GLX_SIZE_INT8 & 3;
-    be_buf = (char *)Xalloc(numbytes);
+    be_buf = (char *)malloc(numbytes);
     if (!be_buf) {
         /* Throw data on the floor */
         _XEatData(dpy, len);
@@ -2526,7 +2526,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
     len = (int)be_reply.length;
     numbytes = (int)be_reply.n;
     slop = numbytes * __GLX_SIZE_INT8 & 3;
-    be_buf = (char *)Xalloc(numbytes);
+    be_buf = (char *)malloc(numbytes);
     if (!be_buf) {
         /* Throw data on the floor */
         _XEatData(dpy, len);
@@ -2947,7 +2947,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
 	return BadAlloc;
     }
 
-    pGlxWindow = (__glXWindow *) xalloc(sizeof(__glXWindow));
+    pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow));
     if (!pGlxWindow) {
 	return BadAlloc;
     }
@@ -3016,7 +3016,7 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
     reply.n = nProps;
 
     nReplyBytes = reply.length << 2;
-    sendBuf = (int *)xalloc(nReplyBytes);
+    sendBuf = (int *)malloc(nReplyBytes);
     pSendBuf = sendBuf;
     *pSendBuf++ = GLX_FBCONFIG_ID;
     *pSendBuf++ = (int)(ctx->pFBConfig->id);
@@ -3031,7 +3031,7 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
         WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
         WriteToClient(client, nReplyBytes, (char *)sendBuf);
     }
-    xfree((char *)sendBuf);
+    free((char *)sendBuf);
 
     return Success;
 }
@@ -3061,7 +3061,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
     reply.n = nProps;
 
     nReplyBytes = reply.length << 2;
-    sendBuf = (int *)xalloc(nReplyBytes);
+    sendBuf = (int *)malloc(nReplyBytes);
     pSendBuf = sendBuf;
     *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
     *pSendBuf++ = (int)(ctx->share_id);
@@ -3078,7 +3078,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
         WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
         WriteToClient(client, nReplyBytes, (char *)sendBuf);
     }
-    xfree((char *)sendBuf);
+    free((char *)sendBuf);
 
     return Success;
 }
@@ -3124,14 +3124,14 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
     /*
     ** Create the GLX part of the Pbuffer.
     */
-    pGlxPbuffer = (__glXPbuffer *) xalloc(sizeof(__glXPbuffer));
+    pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer));
     if (!pGlxPbuffer) {
         return BadAlloc;
     }
 
-    pGlxPbuffer->be_xids = (XID *) xalloc( sizeof(XID) * screenInfo.numScreens );
+    pGlxPbuffer->be_xids = (XID *) malloc( sizeof(XID) * screenInfo.numScreens );
     if (!pGlxPbuffer->be_xids) {
-        xfree(pGlxPbuffer);
+        free(pGlxPbuffer);
         return BadAlloc;
     }
 
@@ -3380,7 +3380,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
 
    if (reply.numAttribs) {
       attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
-      attribs = (CARD32 *) Xalloc(attribs_size);
+      attribs = (CARD32 *) malloc(attribs_size);
       if (attribs == NULL) {
 	 UnlockDisplay(dpy);
 	 SyncHandle();
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index 6cd8bb4..4adfbff 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -191,7 +191,7 @@ void __glXFreeGLXWindow(__glXWindow *pGlxWindow)
             (*pGlxWindow->pScreen->DestroyWindow)(pWindow);
         }
 
-	xfree(pGlxWindow);
+	free(pGlxWindow);
     }
 }
 
@@ -204,8 +204,8 @@ static void WindowGone(__glXWindow *pGlxWindow, XID id)
 void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer)
 {
     if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
-        xfree(pGlxPbuffer->be_xids);
-        xfree(pGlxPbuffer);
+        free(pGlxPbuffer->be_xids);
+        free(pGlxPbuffer);
     }
 }
 
diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c
index 39978a7..7be7ac4 100644
--- a/hw/dmx/glxProxy/glxscreens.c
+++ b/hw/dmx/glxProxy/glxscreens.c
@@ -135,7 +135,7 @@ static void CalcServerVersionAndExtensions( void )
    /*
     * read extensions strings of all back-end servers
     */
-   be_extensions = (char **)Xalloc( __glXNumActiveScreens * sizeof(char *) );
+   be_extensions = (char **)malloc( __glXNumActiveScreens * sizeof(char *) );
    if (!be_extensions)
       return;
 
@@ -158,7 +158,7 @@ static void CalcServerVersionAndExtensions( void )
       length = (int)reply.length;
       numbytes = (int)reply.n;
       slop = numbytes * __GLX_SIZE_INT8 & 3;
-      be_extensions[s] = (char *)Xalloc(numbytes);
+      be_extensions[s] = (char *)malloc(numbytes);
       if (!be_extensions[s]) {
 	 /* Throw data on the floor */
 	 _XEatData(dpy, length);
@@ -244,7 +244,7 @@ void __glXScreenInit(GLint numscreens)
       // find the set of FBConfigs that are present on all back-end
       // servers - only those configs will be supported
        */
-      __glXFBConfigs = (__GLXFBConfig **)Xalloc( dmxScreen0->numFBConfigs * 
+      __glXFBConfigs = (__GLXFBConfig **)malloc( dmxScreen0->numFBConfigs *
 	                      (numscreens+1) * sizeof(__GLXFBConfig *) );
       __glXNumFBConfigs = 0;
    
@@ -282,7 +282,7 @@ void __glXScreenInit(GLint numscreens)
 	       __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 1 ] = 
 	               &dmxScreen0->fbconfigs[c];
 
-	       proxy_cfg = Xalloc( sizeof(__GLXFBConfig) );
+	       proxy_cfg = malloc( sizeof(__GLXFBConfig) );
 	       memcpy( proxy_cfg, cfg, sizeof(__GLXFBConfig) );
 	       proxy_cfg->id =  FakeClientID(0);
 	       /* visual will be associated later in __glXGetFBConfigs */
diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c
index dcc6040..8c7fdfc 100644
--- a/hw/dmx/glxProxy/glxsingle.c
+++ b/hw/dmx/glxProxy/glxsingle.c
@@ -254,7 +254,7 @@ int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
     _XReply(dpy, (xReply*) &be_reply, 0, False);
     be_buf_size = be_reply.length << 2;
     if (be_buf_size > 0) {
-       be_buf = (char *)Xalloc( be_buf_size );
+       be_buf = (char *)malloc( be_buf_size );
        if (be_buf) {
 	  _XRead(dpy, be_buf, be_buf_size);
        }
@@ -349,7 +349,7 @@ int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
        _XReply(dpy, (xReply*) &be_reply, 0, False);
        be_buf_size = be_reply.length << 2;
        if (be_buf_size > 0) {
-	  be_buf = (char *)Xalloc( be_buf_size );
+	  be_buf = (char *)malloc( be_buf_size );
 	  if (be_buf) {
 	     _XRead(dpy, be_buf, be_buf_size);
 	  }
@@ -801,7 +801,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
 
     buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
     if (buf_size > 0) {
-       buf = (char *) Xalloc( buf_size );
+       buf = (char *) malloc( buf_size );
        if ( !buf ) {
 	  return( BadAlloc );
        }
@@ -880,7 +880,7 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
 		char *be_buf;
 		int be_buf_size = be_reply.length << 2;
 
-		be_buf = (char *) Xalloc( be_buf_size );
+		be_buf = (char *) malloc( be_buf_size );
 		if (be_buf) {
 		   _XRead(dpy, be_buf, be_buf_size);
 
diff --git a/hw/dmx/glxProxy/glxswap.c b/hw/dmx/glxProxy/glxswap.c
index 1e184f9..6d9b4fc 100644
--- a/hw/dmx/glxProxy/glxswap.c
+++ b/hw/dmx/glxProxy/glxswap.c
@@ -183,7 +183,7 @@ static SwapGroupPtr CreateSwapEntry(WindowPtr pWin)
     SwapGroupPtr  pEntry;
 
     /* Allocate new swap group */
-    pEntry = xalloc(sizeof(*pEntry));
+    pEntry = malloc(sizeof(*pEntry));
     if (!pEntry) return NULL;
 
     /* Initialize swap group */
@@ -223,7 +223,7 @@ static void FreeSwapEntry(SwapGroupPtr pEntry)
 
     /* We can free the pEntry entry since it has already been removed
      * from the swap group list and it won't be needed any longer */
-    xfree(pEntry);
+    free(pEntry);
 }
 
 int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
@@ -407,7 +407,7 @@ void SwapBarrierReset(void)
 	     pBarrier;
 	     pBarrier = pNextBarrier) {
 	    pNextBarrier = pBarrier->pNext;
-	    xfree(pBarrier);
+	    free(pBarrier);
 	}
 	SwapBarrierList[i] = NULL;
     }
@@ -422,7 +422,7 @@ static Bool BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
 {
     SwapBarrierPtr  pBarrier;
 
-    pBarrier = xalloc(sizeof(*pBarrier));
+    pBarrier = malloc(sizeof(*pBarrier));
     if (!pBarrier) return FALSE;
 
     /* Add the swap group to barrier's list */
@@ -448,7 +448,7 @@ static Bool UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
     else              SwapBarrierList[barrier] = pBarrier->pNext;
 
     /* Free memory */
-    xfree(pBarrier);
+    free(pBarrier);
 
     return TRUE;
 }
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
index d0ce504..cfd0269 100644
--- a/hw/dmx/glxProxy/glxutil.c
+++ b/hw/dmx/glxProxy/glxutil.c
@@ -83,7 +83,7 @@ __glXRealloc(void *addr, size_t newSize)
 
     if (addr) {
 	if (newSize == 0) {
-	    xfree(addr);
+	    free(addr);
 	    return NULL;
 	} else {
 	    newAddr = realloc(addr, newSize);
diff --git a/hw/dmx/glxProxy/glxvendor.c b/hw/dmx/glxProxy/glxvendor.c
index 6b1f9a8..6af53e2 100644
--- a/hw/dmx/glxProxy/glxvendor.c
+++ b/hw/dmx/glxProxy/glxvendor.c
@@ -242,7 +242,7 @@ int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
     _XReply(dpy, (xReply*) &be_reply, 0, False);
     be_buf_size = be_reply.length << 2;
     if (be_buf_size > 0) {
-       be_buf = (char *)Xalloc( be_buf_size );
+       be_buf = (char *)malloc( be_buf_size );
        if (be_buf) {
 	  _XRead(dpy, be_buf, be_buf_size);
        }
@@ -334,7 +334,7 @@ int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
        _XReply(dpy, (xReply*) &be_reply, 0, False);
        be_buf_size = be_reply.length << 2;
        if (be_buf_size > 0) {
-	  be_buf = (char *)Xalloc( be_buf_size );
+	  be_buf = (char *)malloc( be_buf_size );
 	  if (be_buf) {
 	     _XRead(dpy, be_buf, be_buf_size);
 	  }
diff --git a/hw/dmx/glxProxy/glxvisuals.c b/hw/dmx/glxProxy/glxvisuals.c
index 898c6be..58151b7 100644
--- a/hw/dmx/glxProxy/glxvisuals.c
+++ b/hw/dmx/glxProxy/glxvisuals.c
@@ -532,7 +532,7 @@ Bool glxInitVisuals(int *nvisualp, VisualPtr *visualp,
 
     /* Free the private list created by DDX HW driver */
     if (visualPrivates)
-        xfree(visualPrivates);
+        free(visualPrivates);
     visualPrivates = NULL;
 
     return TRUE;
diff --git a/hw/dmx/glxProxy/unpack.h b/hw/dmx/glxProxy/unpack.h
index 98fa10e..880f9ae 100644
--- a/hw/dmx/glxProxy/unpack.h
+++ b/hw/dmx/glxProxy/unpack.h
@@ -82,7 +82,7 @@ extern xGLXSingleReply __glXReply;
     if ((size) > sizeof(answerBuffer)) {				 \
 	int bump;							 \
 	if ((cl)->returnBufSize < (size)+(align)) {			 \
-	    (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf,	 \
+	    (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf,		 \
 						(size)+(align));         \
 	    if (!(cl)->returnBuf) {					 \
 		return BadAlloc;					 \
diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c
index 5a486a4..9da4aba 100644
--- a/hw/dmx/input/dmxinputinit.c
+++ b/hw/dmx/input/dmxinputinit.c
@@ -672,7 +672,7 @@ static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
     static int           o = 0;
     static unsigned long dmxGeneration = 0;
 #define LEN  32
-    char *               buf = xalloc(LEN);
+    char *               buf = malloc(LEN);
 
     if (dmxGeneration != serverGeneration) {
         k = m = o     = 0;
@@ -776,7 +776,7 @@ static DMXLocalInputInfoPtr dmxLookupLocal(const char *name)
 DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
                                        DMXLocalInputInfoPtr s)
 {
-    DMXLocalInputInfoPtr dmxLocal = xalloc(sizeof(*dmxLocal));
+    DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal));
     
     if (!dmxLocal)
         dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n");
@@ -788,7 +788,7 @@ DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
     dmxLocal->deviceId       = -1;
 
     ++dmxInput->numDevs;
-    dmxInput->devs = xrealloc(dmxInput->devs,
+    dmxInput->devs = realloc(dmxInput->devs,
                               dmxInput->numDevs * sizeof(*dmxInput->devs));
     dmxInput->devs[dmxInput->numDevs-1] = dmxLocal;
     
@@ -1085,13 +1085,13 @@ static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
     if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
         dmxLocalCoreKeyboard = NULL;
     if (local->destroy_private) local->destroy_private(local->private);
-    if (local->history)         xfree(local->history);
-    if (local->valuators)       xfree(local->valuators);
-    if (local->deviceName)      xfree(local->deviceName);
+    if (local->history)         free(local->history);
+    if (local->valuators)       free(local->valuators);
+    if (local->deviceName)      free(local->deviceName);
     local->private    = NULL;
     local->history    = NULL;
     local->deviceName = NULL;
-    xfree(local);
+    free(local);
 }
 
 /** Free all of the memory associated with \a dmxInput */
@@ -1101,18 +1101,18 @@ void dmxInputFree(DMXInputInfo *dmxInput)
     
     if (!dmxInput) return;
 
-    if (dmxInput->keycodes) xfree(dmxInput->keycodes);
-    if (dmxInput->symbols)  xfree(dmxInput->symbols);
-    if (dmxInput->geometry) xfree(dmxInput->geometry);
+    if (dmxInput->keycodes) free(dmxInput->keycodes);
+    if (dmxInput->symbols)  free(dmxInput->symbols);
+    if (dmxInput->geometry) free(dmxInput->geometry);
 
     for (i = 0; i < dmxInput->numDevs; i++) {
         dmxInputFreeLocal(dmxInput->devs[i]);
         dmxInput->devs[i] = NULL;
     }
-    xfree(dmxInput->devs);
+    free(dmxInput->devs);
     dmxInput->devs    = NULL;
     dmxInput->numDevs = 0;
-    if (dmxInput->freename) xfree(dmxInput->name);
+    if (dmxInput->freename) free(dmxInput->name);
     dmxInput->name    = NULL;
 }
 
diff --git a/hw/dmx/input/dmxmotion.c b/hw/dmx/input/dmxmotion.c
index 73580a2..a86b62e 100644
--- a/hw/dmx/input/dmxmotion.c
+++ b/hw/dmx/input/dmxmotion.c
@@ -108,7 +108,7 @@ void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
     int           i;
 
     if (!dmxLocal->history) {
-        dmxLocal->history   = xalloc(sizeof(*dmxLocal->history)
+        dmxLocal->history   = malloc(sizeof(*dmxLocal->history)
                                      * (numAxes + 1)
                                      * DMX_MOTION_SIZE);
         dmxLocal->head      = 0;
diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c
index 939a32f..050c80e 100644
--- a/hw/dmx/input/lnx-keyboard.c
+++ b/hw/dmx/input/lnx-keyboard.c
@@ -938,7 +938,7 @@ static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
     int           i;
 
 #if 00/*BP*/
-    mapCopy = xalloc(sizeof(map));
+    mapCopy = malloc(sizeof(map));
     memcpy(mapCopy, map, sizeof(map));
 #else
     ErrorF("kbdLinuxGetMap() is broken/no-op'd\n");
diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c
index c4667a3..dc575fe 100644
--- a/hw/dmx/input/usb-keyboard.c
+++ b/hw/dmx/input/usb-keyboard.c
@@ -398,7 +398,7 @@ static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
     KeySym        *k, *mapCopy;
     int           i;
 
-    mapCopy = xalloc(sizeof(map));
+    mapCopy = malloc(sizeof(map));
     memcpy(mapCopy, map, sizeof(map));
 
     /* compute the modifier map */
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index b21559b..b968516 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -73,13 +73,13 @@ ephyrCardInit (KdCardInfo *card)
 {
   EphyrPriv	*priv;
   
-  priv = (EphyrPriv *) xalloc (sizeof (EphyrPriv));
+  priv = (EphyrPriv *) malloc(sizeof (EphyrPriv));
   if (!priv)
     return FALSE;
   
   if (!ephyrInitialize (card, priv))
     {
-      xfree (priv);
+      free(priv);
       return FALSE;
     }
   card->driver = priv;
@@ -185,7 +185,7 @@ ephyrScreenInit (KdScreenInfo *screen)
 {
   EphyrScrPriv *scrpriv;
   
-  scrpriv = xcalloc (1, sizeof (EphyrScrPriv));
+  scrpriv = calloc(1, sizeof (EphyrScrPriv));
 
   if (!scrpriv)
     return FALSE;
@@ -195,7 +195,7 @@ ephyrScreenInit (KdScreenInfo *screen)
   if (!ephyrScreenInitialize (screen, scrpriv))
     {
       screen->driver = 0;
-      xfree (scrpriv);
+      free(scrpriv);
       return FALSE;
     }
 
@@ -737,7 +737,7 @@ ephyrScreenFini (KdScreenInfo *screen)
     if (scrpriv->shadow) {
         KdShadowFbFree (screen);
     }
-    xfree(screen->driver);
+    free(screen->driver);
     screen->driver = NULL;
 }
 
@@ -1023,7 +1023,7 @@ void
 ephyrCardFini (KdCardInfo *card)
 {
   EphyrPriv	*priv = card->driver;
-  xfree (priv);
+  free(priv);
 }
 
 void
@@ -1075,11 +1075,11 @@ static Status
 MouseInit (KdPointerInfo *pi)
 {
     pi->driverPrivate = (EphyrPointerPrivate *)
-                         xcalloc(sizeof(EphyrPointerPrivate), 1);
+                         calloc(sizeof(EphyrPointerPrivate), 1);
     ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
     pi->nAxes = 3;
     pi->nButtons = 32;
-    xfree(pi->name);
+    free(pi->name);
     pi->name = strdup("Xephyr virtual mouse");
     ephyrMouse = pi;
     return Success;
@@ -1121,7 +1121,7 @@ static Status
 EphyrKeyboardInit (KdKeyboardInfo *ki)
 {
   ki->driverPrivate = (EphyrKbdPrivate *)
-                       xcalloc(sizeof(EphyrKbdPrivate), 1);
+                       calloc(sizeof(EphyrKbdPrivate), 1);
   hostx_load_keymap();
   if (!ephyrKeySyms.map) {
       ErrorF("Couldn't load keymap from host\n");
@@ -1129,7 +1129,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
   }
   ki->minScanCode = ephyrKeySyms.minKeyCode;
   ki->maxScanCode = ephyrKeySyms.maxKeyCode;
-  xfree(ki->name);
+  free(ki->name);
   ki->name = strdup("Xephyr virtual keyboard");
   ephyrKbd = ki;
   return Success;
diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c
index f9fac80..f25a9b4 100644
--- a/hw/kdrive/ephyr/ephyr_draw.c
+++ b/hw/kdrive/ephyr/ephyr_draw.c
@@ -432,13 +432,13 @@ ephyrDrawInit(ScreenPtr pScreen)
     EphyrFakexaPriv *fakexa;
     Bool success;
 
-    fakexa = xcalloc(1, sizeof(*fakexa));
+    fakexa = calloc(1, sizeof(*fakexa));
     if (fakexa == NULL)
 	return FALSE;
 
     fakexa->exa = exaDriverAlloc();
     if (fakexa->exa == NULL) {
-	xfree(fakexa);
+	free(fakexa);
 	return FALSE;
     }
 
@@ -487,8 +487,8 @@ ephyrDrawInit(ScreenPtr pScreen)
 	scrpriv->fakexa = fakexa;
     } else {
 	ErrorF("Failed to initialize EXA\n");
-	xfree(fakexa->exa);
-	xfree(fakexa);
+	free(fakexa->exa);
+	free(fakexa);
     }
 
     return success;
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 5f5fd3b..0773338 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -160,7 +160,7 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
         EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
         goto out ;
     }
-    screen_priv = xcalloc (1, sizeof (EphyrDRIScreenPrivRec)) ;
+    screen_priv = calloc(1, sizeof (EphyrDRIScreenPrivRec)) ;
     if (!screen_priv) {
         EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
         goto out ;
@@ -258,7 +258,7 @@ ephyrDRIDestroyWindow (WindowPtr a_win)
         EphyrDRIWindowPrivPtr win_priv=GET_EPHYR_DRI_WINDOW_PRIV (a_win) ;
         if (win_priv) {
             destroyHostPeerWindow (a_win) ;
-            xfree (win_priv) ;
+            free(win_priv) ;
 	    dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
             EPHYR_LOG ("destroyed the remote peer window\n") ;
         }
@@ -418,7 +418,7 @@ ephyrDRIClipNotify (WindowPtr a_win,
         EPHYR_LOG_ERROR ("failed to get window pair\n") ;
         goto out ;
     }
-    rects = xcalloc (REGION_NUM_RECTS (&a_win->clipList),
+    rects = calloc(REGION_NUM_RECTS (&a_win->clipList),
                      sizeof (EphyrRect)) ;
     for (i=0; i < REGION_NUM_RECTS (&a_win->clipList); i++) {
         memmove (&rects[i],
@@ -440,7 +440,7 @@ ephyrDRIClipNotify (WindowPtr a_win,
     is_ok = TRUE ;
 
 out:
-    xfree (rects) ;
+    free(rects) ;
     rects = NULL ;
 
     EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
@@ -511,7 +511,7 @@ EphyrDuplicateVisual (unsigned int a_screen,
     /*
      * be prepare to extend screen->visuals to add new_visual to it
      */
-    new_visuals = xcalloc (screen->numVisuals+1, sizeof (VisualRec)) ;
+    new_visuals = calloc(screen->numVisuals+1, sizeof (VisualRec)) ;
     memmove (new_visuals,
              screen->visuals,
              screen->numVisuals*sizeof (VisualRec)) ;
@@ -535,7 +535,7 @@ EphyrDuplicateVisual (unsigned int a_screen,
          * extend the list of visual IDs in that entry,
          * so to add a_new_id in there.
          */
-        vids = xrealloc (cur_depth->vids,
+        vids = realloc(cur_depth->vids,
                          (cur_depth->numVids+1)*sizeof (VisualID));
         if (!vids) {
             EPHYR_LOG_ERROR ("failed to realloc numids\n") ;
@@ -558,14 +558,14 @@ EphyrDuplicateVisual (unsigned int a_screen,
     /*
      * Commit our change to screen->visuals
      */
-    xfree (screen->visuals) ;
+    free(screen->visuals) ;
     screen->visuals = new_visuals ;
     screen->numVisuals++ ;
     new_visuals = NULL ;
 
     is_ok = TRUE ;
 out:
-    xfree (new_visuals) ;
+    free(new_visuals) ;
     new_visuals = NULL ;
 
     EPHYR_LOG ("leave\n") ; 
@@ -1067,7 +1067,7 @@ ProcXF86DRICreateDrawable (ClientPtr client)
 
     win_priv = GET_EPHYR_DRI_WINDOW_PRIV (window) ;
     if (!win_priv) {
-        win_priv = xcalloc (1, sizeof (EphyrDRIWindowPrivRec)) ;
+        win_priv = calloc(1, sizeof (EphyrDRIWindowPrivRec)) ;
         if (!win_priv) {
             EPHYR_LOG_ERROR ("failed to allocate window private\n") ;
             return BadAlloc ;
@@ -1252,7 +1252,7 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client)
                       sizeof(drm_clip_rect_t) * rep.numBackClipRects,
                       (char *)backClipRects);
     }
-    xfree(clipRects);
+    free(clipRects);
     clipRects = NULL ;
 
     EPHYR_LOG ("leave\n") ;
diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c
index a0278cc..dfc43e1 100644
--- a/hw/kdrive/ephyr/ephyrglxext.c
+++ b/hw/kdrive/ephyr/ephyrglxext.c
@@ -243,7 +243,7 @@ ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl,
 
 out:
     EPHYR_LOG ("leave\n") ;
-    xfree (props_buf) ;
+    free(props_buf) ;
     props_buf = NULL ;
 
     return res ;
@@ -300,7 +300,7 @@ ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
 
 out:
     EPHYR_LOG ("leave\n") ;
-    xfree (props_buf) ;
+    free(props_buf) ;
     props_buf = NULL ;
 
     return res ;
@@ -375,7 +375,7 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
     reply.sequenceNumber = client->sequence ;
     reply.length = __GLX_PAD (length) >> 2 ;
     reply.n = length ;
-    buf = xcalloc (reply.length << 2, 1);
+    buf = calloc(reply.length << 2, 1);
     if (!buf) {
         EPHYR_LOG_ERROR ("failed to allocate string\n;");
         return BadAlloc;
@@ -389,10 +389,10 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
 
 out:
     EPHYR_LOG ("leave\n") ;
-    xfree (server_string) ;
+    free(server_string) ;
     server_string = NULL;
 
-    xfree (buf);
+    free(buf);
     buf = NULL;
 
     return res ;
diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c
index f4a1b9d..53cd12e 100644
--- a/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -485,10 +485,10 @@ ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
     if (!a_encodings)
         return ;
     for (i=0; i < a_num_encodings; i++) {
-        xfree (a_encodings[i].name) ;
+        free(a_encodings[i].name) ;
         a_encodings[i].name = NULL ;
     }
-    xfree (a_encodings) ;
+    free(a_encodings) ;
 }
 
 void
diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c
index 6624ab9..65127ce 100644
--- a/hw/kdrive/ephyr/ephyrvideo.c
+++ b/hw/kdrive/ephyr/ephyrvideo.c
@@ -332,7 +332,7 @@ ephyrXVPrivNew (void)
 
     EPHYR_LOG ("enter\n") ;
 
-    xv_priv = xcalloc (1, sizeof (EphyrXVPriv)) ;
+    xv_priv = calloc(1, sizeof (EphyrXVPriv)) ;
     if (!xv_priv) {
         EPHYR_LOG_ERROR ("failed to create EphyrXVPriv\n") ;
         goto error ;
@@ -371,9 +371,9 @@ ephyrXVPrivDelete (EphyrXVPriv *a_this)
         ephyrHostXVAdaptorArrayDelete (a_this->host_adaptors) ;
         a_this->host_adaptors = NULL ;
     }
-    xfree (a_this->adaptors) ;
+    free(a_this->adaptors) ;
     a_this->adaptors = NULL ;
-    xfree (a_this) ;
+    free(a_this) ;
     EPHYR_LOG ("leave\n") ;
 }
 
@@ -386,7 +386,7 @@ videoEncodingDup (EphyrHostEncoding *a_encodings,
 
     EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
 
-    result = xcalloc (a_num_encodings, sizeof (KdVideoEncodingRec)) ;
+    result = calloc(a_num_encodings, sizeof (KdVideoEncodingRec)) ;
     for (i=0 ; i < a_num_encodings; i++) {
         result[i].id = a_encodings[i].id ;
         result[i].name = strdup (a_encodings[i].name) ;
@@ -407,7 +407,7 @@ portAttributesDup (EphyrHostAttribute *a_encodings,
 
     EPHYR_RETURN_VAL_IF_FAIL (a_encodings && a_num_encodings, NULL) ;
 
-    result = xcalloc (a_num_encodings, sizeof (KdAttributeRec)) ;
+    result = calloc(a_num_encodings, sizeof (KdAttributeRec)) ;
     if (!result) {
         EPHYR_LOG_ERROR ("failed to allocate attributes\n") ;
         return NULL ;
@@ -455,7 +455,7 @@ ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this)
      * copy what we can from adaptors into a_this->adaptors
      */
     if (a_this->num_adaptors) {
-        a_this->adaptors = xcalloc (a_this->num_adaptors,
+        a_this->adaptors = calloc(a_this->num_adaptors,
                                     sizeof (KdVideoAdaptorRec)) ;
         if (!a_this->adaptors) {
             EPHYR_LOG_ERROR ("failed to create internal adaptors\n") ;
@@ -513,7 +513,7 @@ ephyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this)
                             ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ;
         */
         a_this->adaptors[i].pPortPrivates =
-                xcalloc (a_this->adaptors[i].nPorts,
+                calloc(a_this->adaptors[i].nPorts,
                          sizeof (DevUnion) + sizeof (EphyrPortPriv)) ;
         port_priv_offset = a_this->adaptors[i].nPorts;
         for (j=0; j < a_this->adaptors[i].nPorts; j++) {
@@ -656,7 +656,7 @@ ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
                 KdXVListGenericAdaptors (screen, &registered_adaptors);
 
     num_adaptors = num_registered_adaptors + a_this->num_adaptors ;
-    adaptors = xcalloc (num_adaptors, sizeof (KdVideoAdaptorPtr)) ;
+    adaptors = calloc(num_adaptors, sizeof (KdVideoAdaptorPtr)) ;
     if (!adaptors) {
         EPHYR_LOG_ERROR ("failed to allocate adaptors tab\n") ;
         goto out ;
@@ -673,9 +673,9 @@ ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
     is_ok = TRUE ;
 
 out:
-    xfree (registered_adaptors) ;
+    free(registered_adaptors) ;
     registered_adaptors = NULL ;
-    xfree (adaptors) ;
+    free(adaptors) ;
     adaptors = NULL ;
 
     EPHYR_LOG ("leave\n") ;
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index 809e309..1cf0f2e 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -40,13 +40,13 @@ fakeCardInit (KdCardInfo *card)
 {
     FakePriv	*priv;
 
-    priv = (FakePriv *) xalloc (sizeof (FakePriv));
+    priv = (FakePriv *) malloc(sizeof (FakePriv));
     if (!priv)
 	return FALSE;
     
     if (!fakeInitialize (card, priv))
     {
-	xfree (priv);
+	free(priv);
 	return FALSE;
     }
     card->driver = priv;
@@ -121,14 +121,14 @@ fakeScreenInit (KdScreenInfo *screen)
 {
     FakeScrPriv *scrpriv;
 
-    scrpriv = xcalloc (1, sizeof (FakeScrPriv));
+    scrpriv = calloc(1, sizeof (FakeScrPriv));
     if (!scrpriv)
 	return FALSE;
     screen->driver = scrpriv;
     if (!fakeScreenInitialize (screen, scrpriv))
     {
 	screen->driver = 0;
-	xfree (scrpriv);
+	free(scrpriv);
 	return FALSE;
     }
     return TRUE;
@@ -455,7 +455,7 @@ fakeCardFini (KdCardInfo *card)
     FakePriv	*priv = card->driver;
 
     free (priv->base);
-    xfree (priv);
+    free(priv);
 }
 
 void
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index d4604ad..2c7fa91 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -84,13 +84,13 @@ fbdevCardInit (KdCardInfo *card)
 {
     FbdevPriv	*priv;
 
-    priv = (FbdevPriv *) xalloc (sizeof (FbdevPriv));
+    priv = (FbdevPriv *) malloc(sizeof (FbdevPriv));
     if (!priv)
 	return FALSE;
 
     if (!fbdevInitialize (card, priv))
     {
-	xfree (priv);
+	free(priv);
 	return FALSE;
     }
     card->driver = priv;
@@ -296,14 +296,14 @@ fbdevScreenInit (KdScreenInfo *screen)
 {
     FbdevScrPriv *scrpriv;
 
-    scrpriv = xcalloc (1, sizeof (FbdevScrPriv));
+    scrpriv = calloc(1, sizeof (FbdevScrPriv));
     if (!scrpriv)
 	return FALSE;
     screen->driver = scrpriv;
     if (!fbdevScreenInitialize (screen, scrpriv))
     {
 	screen->driver = 0;
-	xfree (scrpriv);
+	free(scrpriv);
 	return FALSE;
     }
     return TRUE;
@@ -594,7 +594,7 @@ fbdevCreateColormap (ColormapPtr pmap)
     case FB_VISUAL_STATIC_PSEUDOCOLOR:
 	pVisual = pmap->pVisual;
 	nent = pVisual->ColormapEntries;
-	pdefs = xalloc (nent * sizeof (xColorItem));
+	pdefs = malloc(nent * sizeof (xColorItem));
 	if (!pdefs)
 	    return FALSE;
 	for (i = 0; i < nent; i++)
@@ -606,7 +606,7 @@ fbdevCreateColormap (ColormapPtr pmap)
 	    pmap->red[i].co.local.green = pdefs[i].green;
 	    pmap->red[i].co.local.blue = pdefs[i].blue;
 	}
-	xfree (pdefs);
+	free(pdefs);
 	return TRUE;
     default:
 	return fbInitializeColormap (pmap);
@@ -749,7 +749,7 @@ fbdevCardFini (KdCardInfo *card)
 
     munmap (priv->fb_base, priv->fix.smem_len);
     close (priv->fd);
-    xfree (priv);
+    free(priv);
 }
 
 /*
diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index 0e4c9f7..3797f09 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -252,7 +252,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
         close (fd);
         return BadMatch;
     }
-    ke = xcalloc (1, sizeof (Kevdev));
+    ke = calloc(1, sizeof (Kevdev));
     if (!ke)
     {
         close (fd);
@@ -264,7 +264,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
                    ke->keybits) < 0)
         {
             perror ("EVIOCGBIT EV_KEY");
-            xfree (ke);
+            free(ke);
             close (fd);
             return BadMatch;
         }
@@ -275,7 +275,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
                        ke->relbits) < 0)
         {
             perror ("EVIOCGBIT EV_REL");
-            xfree (ke);
+            free(ke);
             close (fd);
             return BadMatch;
         }
@@ -291,7 +291,7 @@ EvdevPtrEnable (KdPointerInfo *pi)
                    ke->absbits) < 0)
             {
             perror ("EVIOCGBIT EV_ABS");
-            xfree (ke);
+            free(ke);
             close (fd);
             return BadMatch;
         }
@@ -310,13 +310,13 @@ EvdevPtrEnable (KdPointerInfo *pi)
         }
         if (i <= ke->max_abs)
         {
-            xfree (ke);
+            free(ke);
             close (fd);
             return BadValue;
         }
     }
     if (!KdRegisterFd (fd, EvdevPtrRead, pi)) {
-        xfree (ke);
+        free(ke);
         close (fd);
         return BadAlloc;
     }
@@ -341,7 +341,7 @@ EvdevPtrDisable (KdPointerInfo *pi)
     if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
         perror ("Ungrabbing evdev mouse device failed");
 
-    xfree (ke);
+    free(ke);
     pi->driverPrivate = 0;
 }
 
@@ -440,14 +440,14 @@ EvdevKbdEnable (KdKeyboardInfo *ki)
         return BadMatch;
     }
 
-    ke = xcalloc (1, sizeof (Kevdev));
+    ke = calloc(1, sizeof (Kevdev));
     if (!ke) {
         close (fd);
         return BadAlloc;
     }
 
     if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
-        xfree (ke);
+        free(ke);
         close (fd);
         return BadAlloc;
     }
@@ -509,7 +509,7 @@ EvdevKbdDisable (KdKeyboardInfo *ki)
     if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
         perror ("Ungrabbing evdev keyboard device failed");
 
-    xfree (ke);
+    free(ke);
     ki->driverPrivate = 0;
 }
 
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index 6eed7ae..e05c5ab 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -737,9 +737,9 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
     if (!ki)
         return !Success;
 
-    xfree(ki->path);
+    free(ki->path);
     ki->path = strdup("console");
-    xfree(ki->name);
+    free(ki->name);
     ki->name = strdup("Linux console keyboard");
 
     readKernelMapping (ki);
diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
index 007263e..1db5348 100644
--- a/hw/kdrive/linux/mouse.c
+++ b/hw/kdrive/linux/mouse.c
@@ -958,7 +958,7 @@ MouseInit (KdPointerInfo *pi)
 
     close(fd);
 
-    km = (Kmouse *) xalloc (sizeof (Kmouse));
+    km = (Kmouse *) malloc(sizeof (Kmouse));
     if (km) {
         km->iob.avail = km->iob.used = 0;
         MouseFirstProtocol(km, pi->protocol ? pi->protocol : "exps/2");
@@ -1016,7 +1016,7 @@ MouseDisable (KdPointerInfo *pi)
 static void
 MouseFini (KdPointerInfo *pi)
 {
-    xfree (pi->driverPrivate);
+    free(pi->driverPrivate);
     pi->driverPrivate = NULL;
 }
 
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index 322ccc7..48a0842 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -157,7 +157,7 @@ TslibInit (KdPointerInfo *pi)
         return !Success;
 
     pi->driverPrivate = (struct TslibPrivate *)
-                        xcalloc(sizeof(struct TslibPrivate), 1);
+                        calloc(sizeof(struct TslibPrivate), 1);
     if (!pi->driverPrivate)
         return !Success;
 
@@ -175,7 +175,7 @@ TslibInit (KdPointerInfo *pi)
 static void
 TslibFini (KdPointerInfo *pi)
 {
-    xfree(pi->driverPrivate);
+    free(pi->driverPrivate);
     pi->driverPrivate = NULL;
 }
 
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 765bd0e..9d1b383 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -207,7 +207,7 @@ KdDoSwitchCmd (char *reason)
 {
     if (kdSwitchCmd)
     {
-	char    *command = xalloc (strlen (kdSwitchCmd) +
+	char    *command = malloc(strlen (kdSwitchCmd) +
 				   1 +
 				   strlen (reason) +
 				   1);
@@ -217,7 +217,7 @@ KdDoSwitchCmd (char *reason)
 	strcat (command, " ");
 	strcat (command, reason);
 	system (command);
-	xfree (command);
+	free(command);
     }
 }
 
@@ -699,7 +699,7 @@ KdAllocatePrivates (ScreenPtr pScreen)
     if (kdGeneration != serverGeneration)
 	kdGeneration = serverGeneration;
 
-    pScreenPriv = xcalloc(1, sizeof (*pScreenPriv));
+    pScreenPriv = calloc(1, sizeof (*pScreenPriv));
     if (!pScreenPriv)
 	return FALSE;
     KdSetScreenPriv (pScreen, pScreenPriv);
@@ -788,7 +788,7 @@ KdCloseScreen (int index, ScreenPtr pScreen)
 
     pScreenPriv->screen->pScreen = 0;
 
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
     return ret;
 }
 
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 0825ee2..8193215 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -33,7 +33,7 @@ KdCardInfoAdd (KdCardFuncs  *funcs,
 {
     KdCardInfo	*ci, **prev;
 
-    ci = xcalloc (1, sizeof (KdCardInfo));
+    ci = calloc(1, sizeof (KdCardInfo));
     if (!ci)
 	return 0;
     for (prev = &kdCardInfo; *prev; prev = &(*prev)->next);
@@ -66,7 +66,7 @@ KdCardInfoDispose (KdCardInfo *ci)
 	if (*prev == ci)
 	{
 	    *prev = ci->next;
-	    xfree (ci);
+	    free(ci);
 	    break;
 	}
 }
@@ -77,7 +77,7 @@ KdScreenInfoAdd (KdCardInfo *ci)
     KdScreenInfo    *si, **prev;
     int		    n;
 
-    si = xcalloc (1, sizeof (KdScreenInfo));
+    si = calloc(1, sizeof (KdScreenInfo));
     if (!si)
 	return 0;
     for (prev = &ci->screenList, n = 0; *prev; prev = &(*prev)->next, n++);
@@ -98,7 +98,7 @@ KdScreenInfoDispose (KdScreenInfo *si)
 	if (*prev == si)
 	{
 	    *prev = si->next;
-	    xfree (si);
+	    free(si);
 	    if (!ci->screenList)
 		KdCardInfoDispose (ci);
 	    break;
@@ -112,7 +112,7 @@ KdNewPointer (void)
     KdPointerInfo *pi;
     int i;
 
-    pi = (KdPointerInfo *)xcalloc(1, sizeof(KdPointerInfo));
+    pi = (KdPointerInfo *)calloc(1, sizeof(KdPointerInfo));
     if (!pi)
         return NULL;
 
@@ -136,28 +136,28 @@ KdFreePointer(KdPointerInfo *pi)
 {
     InputOption *option, *prev = NULL;
 
-    xfree(pi->name);
-    xfree(pi->path);
+    free(pi->name);
+    free(pi->path);
 
     for (option = pi->options; option; option = option->next) {
-        xfree(prev);
-        xfree(option->key);
-        xfree(option->value);
+        free(prev);
+        free(option->key);
+        free(option->value);
         prev = option;
     }
 
-    xfree(prev);
-    xfree(pi);
+    free(prev);
+    free(pi);
 }
 
 void
 KdFreeKeyboard(KdKeyboardInfo *ki)
 {
-    xfree(ki->name);
-    xfree(ki->path);
-    xfree(ki->xkbRules);
-    xfree(ki->xkbModel);
-    xfree(ki->xkbLayout);
+    free(ki->name);
+    free(ki->path);
+    free(ki->xkbRules);
+    free(ki->xkbModel);
+    free(ki->xkbLayout);
     ki->next = NULL;
-    xfree(ki);
+    free(ki);
 }
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index a88f2dc..4024758 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -420,7 +420,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
                        "(unnamed)");
                 return !Success;
             }
-            xfree(pi->driverPrivate);
+            free(pi->driverPrivate);
             pi->driverPrivate = NULL;
         }
 
@@ -433,12 +433,12 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
             return !Success;
         }
 
-	btn_labels = xcalloc(pi->nButtons, sizeof(Atom));
+	btn_labels = calloc(pi->nButtons, sizeof(Atom));
 	if (!btn_labels)
 	    return BadAlloc;
-	axes_labels = xcalloc(pi->nAxes, sizeof(Atom));
+	axes_labels = calloc(pi->nAxes, sizeof(Atom));
 	if (!axes_labels) {
-	    xfree(btn_labels);
+	    free(btn_labels);
 	    return BadAlloc;
 	}
 
@@ -472,8 +472,8 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
 	    (PtrCtrlProcPtr)NoopDDA,
 	    GetMotionHistorySize(), pi->nAxes, axes_labels);
 
-        xfree(btn_labels);
-        xfree(axes_labels);
+        free(btn_labels);
+        free(axes_labels);
 
         if (pi->inputClass == KD_TOUCHSCREEN) {
             InitAbsoluteClassDeviceStruct(pDevice);
@@ -736,7 +736,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
                        "(unnamed)");
                 return !Success;
             }
-            xfree(ki->driverPrivate);
+            free(ki->driverPrivate);
             ki->driverPrivate = NULL;
         }
 
@@ -887,7 +887,7 @@ KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
 KdKeyboardInfo *
 KdNewKeyboard (void)
 {
-    KdKeyboardInfo *ki = xcalloc(sizeof(KdKeyboardInfo), 1);
+    KdKeyboardInfo *ki = calloc(sizeof(KdKeyboardInfo), 1);
     if (!ki)
         return NULL;
 
@@ -915,7 +915,7 @@ KdAddConfigKeyboard (char *keyboard)
     if (!keyboard)
         return Success;
 
-    new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+    new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1);
     if (!new)
         return BadAlloc;
 
@@ -983,7 +983,7 @@ KdAddConfigPointer (char *pointer)
     if (!pointer)
         return Success;
 
-    new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+    new = (struct KdConfigDevice *) calloc(sizeof(struct KdConfigDevice), 1);
     if (!new)
         return BadAlloc;
 
@@ -1053,7 +1053,7 @@ KdGetOptions (InputOption **options, char *string)
     InputOption     *newopt = NULL, **tmpo = NULL;
     int             tam_key = 0;
 
-    newopt = xcalloc(1, sizeof (InputOption));
+    newopt = calloc(1, sizeof (InputOption));
     if (!newopt)
         return FALSE;
 
@@ -1064,7 +1064,7 @@ KdGetOptions (InputOption **options, char *string)
     if (strchr(string, '='))
     {
         tam_key = (strchr(string, '=') - string);
-        newopt->key = (char *)xalloc(tam_key);
+        newopt->key = (char *)malloc(tam_key);
         strncpy(newopt->key, string, tam_key);
         newopt->key[tam_key] = '\0';
         newopt->value = xstrdup(strchr(string, '=') + 1);
diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c
index cf3391d..6f5a2f3 100644
--- a/hw/kdrive/src/kshadow.c
+++ b/hw/kdrive/src/kshadow.c
@@ -36,11 +36,11 @@ KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate)
 
     /* use fb computation for width */
     paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
-    buf = xalloc (paddedWidth * height);
+    buf = malloc(paddedWidth * height);
     if (!buf)
 	return FALSE;
     if (screen->fb.shadow)
-	xfree (screen->fb.frameBuffer);
+	free(screen->fb.frameBuffer);
     screen->fb.shadow = TRUE;
     screen->fb.frameBuffer = buf;
     screen->fb.byteStride = paddedWidth;
@@ -53,7 +53,7 @@ KdShadowFbFree (KdScreenInfo *screen)
 {
     if (screen->fb.shadow)
     {
-	xfree (screen->fb.frameBuffer);
+	free(screen->fb.frameBuffer);
 	screen->fb.frameBuffer = 0;
 	screen->fb.shadow = FALSE;
     }
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 27ecc5d..56f101f 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -134,7 +134,7 @@ KdXVRegisterGenericAdaptorDriver(
 
 /*   fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
 
-  newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
+  newdrivers = realloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
 			(1 + NumGenDrivers));
   if (!newdrivers)
     return 0;
@@ -159,7 +159,7 @@ KdXVListGenericAdaptors(
 	n = GenDrivers[i](screen,&DrivAdap);
 	if (0 == n)
 	    continue;
-	new = xrealloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
+	new = realloc(*adaptors, sizeof(KdVideoAdaptorPtr) * (num+n));
 	if (NULL == new)
 	    continue;
 	*adaptors = new;
@@ -172,13 +172,13 @@ KdXVListGenericAdaptors(
 KdVideoAdaptorPtr
 KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen)
 {
-    return xcalloc(1, sizeof(KdVideoAdaptorRec));
+    return calloc(1, sizeof(KdVideoAdaptorRec));
 }
 
 void
 KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
 {
-    xfree(ptr);
+    free(ptr);
 }
 
 
@@ -218,7 +218,7 @@ KdXVScreenInit(
      a CloseScreen hook so that we don't have to wrap it.  I'm not
      sure that I appreciate that.  */
 
-  ScreenPriv = xalloc(sizeof(KdXVScreenRec));
+  ScreenPriv = malloc(sizeof(KdXVScreenRec));
   pxvs->devPriv.ptr = (pointer)ScreenPriv;
 
   if(!ScreenPriv) return FALSE;
@@ -247,18 +247,18 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
 {
    int i;
 
-   xfree(pAdaptor->name);
+   free(pAdaptor->name);
 
    if(pAdaptor->pEncodings) {
       XvEncodingPtr pEncode = pAdaptor->pEncodings;
 
       for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
-          xfree(pEncode->name);
+          free(pEncode->name);
       }
-      xfree(pAdaptor->pEncodings);
+      free(pAdaptor->pEncodings);
    }
 
-   xfree(pAdaptor->pFormats);
+   free(pAdaptor->pFormats);
 
    if(pAdaptor->pPorts) {
       XvPortPtr pPort = pAdaptor->pPorts;
@@ -271,25 +271,25 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
              if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
-	     xfree(pPriv);
+	     free(pPriv);
 	  }
       }
-      xfree(pAdaptor->pPorts);
+      free(pAdaptor->pPorts);
    }
 
    if(pAdaptor->nAttributes) {
       XvAttributePtr pAttribute = pAdaptor->pAttributes;
 
       for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
-          xfree(pAttribute->name);
+          free(pAttribute->name);
       }
 
-      xfree(pAdaptor->pAttributes);
+      free(pAdaptor->pAttributes);
    }
 
-   xfree(pAdaptor->pImages);
+   free(pAdaptor->pImages);
 
-   xfree(pAdaptor->devPriv.ptr);
+   free(pAdaptor->devPriv.ptr);
 }
 
 static Bool
@@ -325,7 +325,7 @@ KdXVInitAdaptors(
   pxvs->nAdaptors = 0;
   pxvs->pAdaptors = NULL;
 
-  if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
+  if(!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
       return FALSE;
 
   for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
@@ -375,18 +375,18 @@ KdXVInitAdaptors(
       pa->ddGetPortAttribute = KdXVGetPortAttribute;
       pa->ddQueryBestSize = KdXVQueryBestSize;
       pa->ddQueryImageAttributes = KdXVQueryImageAttributes;
-      if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
+      if((pa->name = malloc(strlen(adaptorPtr->name) + 1)))
           strcpy(pa->name, adaptorPtr->name);
 
       if(adaptorPtr->nEncodings &&
-	(pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+	(pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
 
 	for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
 	    i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
         {
 	    pe->id = encodingPtr->id;
 	    pe->pScreen = pScreen;
-	    if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
+	    if((pe->name = malloc(strlen(encodingPtr->name) + 1)))
                 strcpy(pe->name, encodingPtr->name);
 	    pe->width = encodingPtr->width;
 	    pe->height = encodingPtr->height;
@@ -398,7 +398,7 @@ KdXVInitAdaptors(
       }
 
       if(adaptorPtr->nImages &&
-         (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+         (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
 
           for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
 	      i < adaptorPtr->nImages; i++, pi++, imagePtr++)
@@ -431,7 +431,7 @@ KdXVInitAdaptors(
       }
 
       if(adaptorPtr->nAttributes &&
-	(pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
+	(pAttribute = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
       {
 	for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
 	    i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
@@ -439,7 +439,7 @@ KdXVInitAdaptors(
 	    pat->flags = attributePtr->flags;
 	    pat->min_value = attributePtr->min_value;
 	    pat->max_value = attributePtr->max_value;
-	    if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
+	    if((pat->name = malloc(strlen(attributePtr->name) + 1)))
                 strcpy(pat->name, attributePtr->name);
 	}
 	pa->nAttributes = adaptorPtr->nAttributes;
@@ -449,7 +449,7 @@ KdXVInitAdaptors(
 
       totFormat = adaptorPtr->nFormats;
 
-      if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
+      if(!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
           KdXVFreeAdaptor(pa);
           continue;
       }
@@ -466,7 +466,7 @@ KdXVInitAdaptors(
 		   if(numFormat >= totFormat) {
 			void *moreSpace;
 			totFormat *= 2;
-			moreSpace = xrealloc(pFormat,
+			moreSpace = realloc(pFormat,
 					     totFormat * sizeof(XvFormatRec));
 			if(!moreSpace) break;
 			pFormat = moreSpace;
@@ -489,7 +489,7 @@ KdXVInitAdaptors(
           continue;
       }
 
-      if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
+      if(!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
           KdXVFreeAdaptor(pa);
           continue;
       }
@@ -509,7 +509,7 @@ KdXVInitAdaptors(
 
       pa->devPriv.ptr = (pointer)adaptorPriv;
 
-      if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+      if(!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
           KdXVFreeAdaptor(pa);
           continue;
       }
@@ -519,11 +519,11 @@ KdXVInitAdaptors(
           if(!(pp->id = FakeClientID(0)))
 		continue;
 
-	  if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
+	  if(!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
 		continue;
 
 	  if(!AddResource(pp->id, PortResource, pp)) {
-		xfree(portPriv);
+		free(portPriv);
 		continue;
 	  }
 
@@ -559,7 +559,7 @@ KdXVInitAdaptors(
       pxvs->nAdaptors = numAdaptor;
       pxvs->pAdaptors = pAdaptor;
   } else {
-     xfree(pAdaptor);
+     free(pAdaptor);
      return FALSE;
   }
 
@@ -925,7 +925,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
    }
 
    if(!winPriv) {
-	winPriv = xalloc(sizeof(KdXVWindowRec));
+	winPriv = malloc(sizeof(KdXVWindowRec));
 	if(!winPriv) return BadAlloc;
 	winPriv->PortRec = portPriv;
 	winPriv->next = PrivRoot;
@@ -948,7 +948,7 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 		prevPriv->next = winPriv->next;
 	    else
 		dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
-	    xfree(winPriv);
+	    free(winPriv);
 	    break;
 	}
 	prevPriv = winPriv;
@@ -998,7 +998,7 @@ KdXVDestroyWindow(WindowPtr pWin)
      pPriv->pDraw = NULL;
      tmp = WinPriv;
      WinPriv = WinPriv->next;
-     xfree(tmp);
+     free(tmp);
   }
 
   dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
@@ -1063,7 +1063,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 	       pPrev->next = WinPriv->next;
 	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    xfree(tmp);
+	    free(tmp);
 	    continue;
 	}
 	break;
@@ -1112,7 +1112,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
 	       pPrev->next = WinPriv->next;
 	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    xfree(tmp);
+	    free(tmp);
 	    continue;
 	}
      }
@@ -1153,8 +1153,8 @@ KdXVCloseScreen(int i, ScreenPtr pScreen)
        KdXVFreeAdaptor(pa);
   }
 
-  xfree(pxvs->pAdaptors);
-  xfree(ScreenPriv);
+  free(pxvs->pAdaptors);
+  free(ScreenPriv);
 
   return TRUE;
 }
@@ -1872,7 +1872,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
     BoxPtr	pBox = REGION_RECTS (pRgn);
     int		nBox = REGION_NUM_RECTS (pRgn);
 
-    rects = xalloc (nBox * sizeof (xRectangle));
+    rects = malloc(nBox * sizeof (xRectangle));
     if (!rects)
 	goto bail0;
     r = rects;
@@ -1901,7 +1901,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
 
     FreeScratchGC (pGC);
 bail1:
-    xfree (rects);
+    free(rects);
 bail0:
     ;
 }
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 2985787..7af5f93 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -194,7 +194,7 @@ ddxGiveUp(void)
     case NORMAL_MEMORY_FB:
 	for (i = 0; i < vfbNumScreens; i++)
 	{
-	    Xfree(vfbScreens[i].pXWDHeader);
+	    free(vfbScreens[i].pXWDHeader);
 	}
 	break;
     }
@@ -290,7 +290,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
 
 	if (vfbNumScreens <= screenNum)
 	{
-	    vfbScreens = xrealloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
+	    vfbScreens = realloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
 	    if (!vfbScreens)
 		FatalError("Not enough memory for screen %d\n", screenNum);
 	    for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
@@ -439,9 +439,9 @@ vfbInstallColormap(ColormapPtr pmap)
 	swapcopy32(pXWDHeader->bits_per_rgb, pVisual->bitsPerRGBValue);
 	swapcopy32(pXWDHeader->colormap_entries, pVisual->ColormapEntries);
 
-	ppix = (Pixel *)xalloc(entries * sizeof(Pixel));
-	prgb = (xrgb *)xalloc(entries * sizeof(xrgb));
-	defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
+	ppix = (Pixel *)malloc(entries * sizeof(Pixel));
+	prgb = (xrgb *)malloc(entries * sizeof(xrgb));
+	defs = (xColorItem *)malloc(entries * sizeof(xColorItem));
 
 	for (i = 0; i < entries; i++)  ppix[i] = i;
 	/* XXX truecolor */
@@ -456,9 +456,9 @@ vfbInstallColormap(ColormapPtr pmap)
 	}
 	(*pmap->pScreen->StoreColors)(pmap, entries, defs);
 
-	xfree(ppix);
-	xfree(prgb);
-	xfree(defs);
+	free(ppix);
+	free(prgb);
+	free(defs);
     }
 }
 
@@ -682,7 +682,7 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
 #endif
 
     case NORMAL_MEMORY_FB:
-	pvfb->pXWDHeader = (XWDFileHeader *)Xalloc(pvfb->sizeInBytes);
+	pvfb->pXWDHeader = (XWDFileHeader *)malloc(pvfb->sizeInBytes);
 	break;
     }
 
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 7b836b0..896f695 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -111,7 +111,7 @@ AppendToList(const char *s, const char ***list, int *lines)
 	(*list)[*lines - 1] = newstr;
 	(*list)[*lines] = NULL;
     }
-    xfree(str);
+    free(str);
 }
 
 static void
@@ -121,9 +121,9 @@ FreeList(const char ***list, int *lines)
 
     for (i = 0; i < *lines; i++) {
 	if ((*list)[i])
-	    xfree((*list)[i]);
+	    free((*list)[i]);
     }
-    xfree(*list);
+    free(*list);
     *list = NULL;
     *lines = 0;
 }
@@ -262,7 +262,7 @@ xf86AutoConfig(void)
     AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
 
     for (p = deviceList; *p; p++) {
-	xfree(*p);
+	free(*p);
     }
 
     xf86MsgVerb(X_DEFAULT, 0,
@@ -374,7 +374,7 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
                         while (matches[i]) {
                             i++;
                         }
-                        matches[i] = (char*)xalloc(sizeof(char) * strlen(direntry->d_name) -  3);
+                        matches[i] = (char*)malloc(sizeof(char) * strlen(direntry->d_name) -  3);
                         if (!matches[i]) {
                             xf86Msg(X_ERROR, "Could not allocate space for the module name. Exiting.\n");
                             goto end;
@@ -401,7 +401,7 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
         direntry = readdir(idsdir);
     }
  end:
-    xfree(line);
+    free(line);
     closedir(idsdir);
 }
 #endif /* __linux__ */
@@ -534,7 +534,7 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
         return FALSE;
     memcpy(xf86ConfigLayout.screens[i].screen, oscreen, sizeof(confScreenRec));
 
-    cptr = xcalloc(1, sizeof(GDevRec));
+    cptr = calloc(1, sizeof(GDevRec));
     if (!cptr)
         return FALSE;
     memcpy(cptr, odev, sizeof(GDevRec));
@@ -565,7 +565,7 @@ autoConfigDevice(GDevPtr preconf_device)
     if (preconf_device) {
         ptr = preconf_device;
     } else {
-        ptr = xcalloc(1, sizeof(GDevRec));
+        ptr = calloc(1, sizeof(GDevRec));
         if (!ptr) {
             return NULL;
         }
@@ -620,13 +620,13 @@ autoConfigDevice(GDevPtr preconf_device)
                 xf86ConfigLayout.screens[i+num_matches] = slp[i];
             }
             xf86ConfigLayout.screens[num_screens+num_matches-1].screen = NULL;
-            xfree(slp);
+            free(slp);
         } else {
             /* layout does not have any screens, not much to do */
             ptr->driver = matches[0];
             for (i = 1; matches[i] ; i++) {
                 if (matches[i] != matches[0]) {
-                    xfree(matches[i]);
+                    free(matches[i]);
                 }
             }
         }
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 9d243c1..39e531a 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -98,7 +98,7 @@ StringToBusType(const char* busID, const char **retID)
     s = xstrdup(busID);
     p = strtok(s, ":");
     if (p == NULL || *p == 0) {
-	xfree(s);
+	free(s);
 	return BUS_NONE;
     }
     if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
@@ -108,7 +108,7 @@ StringToBusType(const char* busID, const char **retID)
     if (ret != BUS_NONE)
 	if (retID)
 	    *retID = busID + strlen(p) + 1;
-    xfree(s);
+    free(s);
     return ret;
 }
 
@@ -295,8 +295,8 @@ xf86ClearEntityListForScreen(int scrnIndex)
 	xf86Entities[entityIndex]->inUse = FALSE;
 	/* disable resource: call the disable function */
     }
-    xfree(pScrn->entityList);
-    xfree(pScrn->entityInstanceList);
+    free(pScrn->entityList);
+    free(pScrn->entityInstanceList);
     pScrn->entityList = NULL;
     pScrn->entityInstanceList = NULL;
 }
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9a2837e..a481368 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -184,7 +184,7 @@ xf86ValidateFontPath(char *path)
   int flag;
   int dirlen;
 
-  tmp_path = xcalloc(1,strlen(path)+1);
+  tmp_path = calloc(1,strlen(path)+1);
   out_pnt = tmp_path;
   path_elem = NULL;
   next = path;
@@ -205,7 +205,7 @@ xf86ValidateFontPath(char *path)
       if (flag != 0) {
         xf86Msg(X_WARNING, "The directory \"%s\" does not exist.\n", dir_elem);
 	xf86ErrorF("\tEntry deleted from font path.\n");
-	xfree(dir_elem);
+	free(dir_elem);
 	continue;
       }
       else {
@@ -216,18 +216,18 @@ xf86ValidateFontPath(char *path)
 	if (flag == 0)
 	  if (!S_ISREG(stat_buf.st_mode))
 	    flag = -1;
-	xfree(p1);
+	free(p1);
 	if (flag != 0) {
 	  xf86Msg(X_WARNING,
 		  "`fonts.dir' not found (or not valid) in \"%s\".\n", 
 		  dir_elem);
 	  xf86ErrorF("\tEntry deleted from font path.\n");
 	  xf86ErrorF("\t(Run 'mkfontdir' on \"%s\").\n", dir_elem);
-	  xfree(dir_elem);
+	  free(dir_elem);
 	  continue;
 	}
       }
-      xfree(dir_elem);
+      free(dir_elem);
     }
 
     /*
@@ -363,7 +363,7 @@ xf86ModulelistFromConfig(pointer **optlist)
     if (optlist)
 	    *optlist = optarray;
     else
-	    xfree(optarray);
+	    free(optarray);
     return modulearray;
 }
 
@@ -622,7 +622,7 @@ configFiles(XF86ConfFilesPtr fileconf)
     /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
     temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
     defaultFontPath = xf86ValidateFontPath(temp_path);
-    xfree(temp_path);
+    free(temp_path);
 
     /* make fontpath more readable in the logfiles */
     countDirs = 1;
@@ -647,7 +647,7 @@ configFiles(XF86ConfFilesPtr fileconf)
     *(temp_path++) = '\t';
     strcpy(temp_path, start);
     xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf);
-    xfree(log_buf);
+    free(log_buf);
   
   /* ModulePath */
 
@@ -1199,7 +1199,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 	    for (devs = servlayoutp->inputs; devs && *devs; devs++)
 		if (*devs == corePointer)
                 {
-                    xfree(*devs);
+                    free(*devs);
                     *devs = (IDevPtr)0x1; /* ensure we dont skip next loop*/
 		    break;
                 }
@@ -1341,7 +1341,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
 	    for (devs = servlayoutp->inputs; devs && *devs; devs++)
 		if (*devs == coreKeyboard)
                 {
-                    xfree(*devs);
+                    free(*devs);
                     *devs = (IDevPtr)0x1; /* ensure we dont skip next loop */
 		    break;
                 }
@@ -1503,8 +1503,8 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
 	indp[count] = xnfalloc(sizeof(IDevRec));
 	if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
 	    while(count--)
-		xfree(indp[count]);
-	    xfree(indp);
+		free(indp[count]);
+	    free(indp);
 	    return FALSE;
 	}
 	indp[count]->extraOptions = irp->iref_option_lst;
@@ -1595,7 +1595,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 	    scrnum = adjp->adj_scrnum;
 	if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
 			  X_CONFIG)) {
-	    xfree(slp);
+	    free(slp);
 	    return FALSE;
 	}
 	slp[count].x = adjp->adj_x;
@@ -1640,8 +1640,8 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
         slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
 	if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
                           0, X_CONFIG)) {
-	    xfree(slp[0].screen);
-	    xfree(slp);
+	    free(slp[0].screen);
+	    free(slp);
 	    return FALSE;
 	}
     }
@@ -1700,7 +1700,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
     count = 0;
     while (idp) {
 	if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) {
-	    xfree(gdp);
+	    free(gdp);
 	    return FALSE;
 	}
         count++;
@@ -1760,7 +1760,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
     slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
     slp[1].screen = NULL;
     if (!configScreen(slp[0].screen, conf_screen, 0, from)) {
-	xfree(slp);
+	free(slp);
 	return FALSE;
     }
     servlayoutp->id = "(implicit)";
@@ -2306,7 +2306,7 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
 		enable = !enable;
 	    } else {
 		xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
-		xfree(n);
+		free(n);
 		continue;
 	    }
 
@@ -2317,7 +2317,7 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
 		xf86Msg(X_WARNING, "Ignoring unrecognized extension \"%s\"\n",
                         name);
 	    }
-	    xfree(n);
+	    free(n);
 	}
     }
 }
@@ -2365,7 +2365,7 @@ addDefaultModes(MonPtr monitorp)
 	    monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode);
 	    last = mode;
 	} else {
-	    xfree(mode);
+	    free(mode);
 	}
     }
     monitorp->Last = last;
@@ -2402,7 +2402,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
                 xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
 
                 current = dev;
-                xfree(*dev);
+                free(*dev);
 
                 do {
                     *current = *(current + 1);
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 67bf08b..ef61e46 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -163,7 +163,7 @@ bus_sbus_newdev_configure(void *busData, int i)
 	if (promPath) {
 	    DevToConfig[i].GDev.busID = xnfalloc(strlen(promPath) + 6);
 	    sprintf(DevToConfig[i].GDev.busID, "SBUS:%s", promPath);
-	    xfree(promPath);
+	    free(promPath);
 	} else {
 	    DevToConfig[i].GDev.busID = xnfalloc(12);
 	    sprintf(DevToConfig[i].GDev.busID, "SBUS:fb%d",
@@ -399,7 +399,7 @@ configureDeviceSection (int screennum)
 		int len = strlen(ptr->dev_comment) + strlen(prefix) +
 			  strlen(middle) + strlen(suffix) + 1;
 		
-		optname = xalloc(strlen(p->name) + 2 + 1);
+		optname = malloc(strlen(p->name) + 2 + 1);
 		if (!optname)
 		    break;
 		sprintf(optname, "\"%s\"", p->name);
@@ -407,13 +407,13 @@ configureDeviceSection (int screennum)
 		len += max(20, strlen(optname));
 		len += strlen(opttype);
 
-		ptr->dev_comment = xrealloc(ptr->dev_comment, len);
+		ptr->dev_comment = realloc(ptr->dev_comment, len);
 		if (!ptr->dev_comment)
 		    break;
 		p_e = ptr->dev_comment + strlen(ptr->dev_comment);
 		sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
 			opttype, suffix);
-		xfree(optname);
+		free(optname);
 	    }
     	}
     }
@@ -512,7 +512,7 @@ configureModuleSection (void)
             ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
                                 (glp)ptr->mod_load_lst, (glp)module);
     	}
-	xfree(elist);
+	free(elist);
     }
 
     return ptr;
@@ -658,7 +658,7 @@ DoConfigure(void)
     /* Load all the drivers that were found. */
     xf86LoadModules(vlist, NULL);
 
-    xfree(vlist);
+    free(vlist);
 
     for (i = 0; i < xf86NumDrivers; i++) {
 	xorgHWFlags flags;
@@ -807,7 +807,7 @@ DoConfigure(void)
 		}
 	    }
 	}
-	xfree(driverProbed);
+	free(driverProbed);
     }
     
 
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index 6740faf..9cde059 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -502,7 +502,7 @@ AddEdge(
 	}  
 
 	if(!pEdge) {
-	    if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+	    if(!(pNew = malloc(sizeof(xf86EdgeRec))))
 		break;
 
 	    pNew->screen = screen;
@@ -519,7 +519,7 @@ AddEdge(
 	    
 	    break;
 	} else if (min < pEdge->start) {
-	    if(!(pNew = xalloc(sizeof(xf86EdgeRec))))
+	    if(!(pNew = malloc(sizeof(xf86EdgeRec))))
 		break;
 
 	    pNew->screen = screen;
@@ -850,10 +850,10 @@ xf86ReconfigureLayout(void)
     for (i = 0; i < MAXSCREENS; i++) {
 	xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
 	/* we don't have to zero these, xf86InitOrigins() takes care of that */
-	if (sl->left) xfree(sl->left);
-	if (sl->right) xfree(sl->right);
-	if (sl->up) xfree(sl->up);
-	if (sl->down) xfree(sl->down);
+	if (sl->left) free(sl->left);
+	if (sl->right) free(sl->right);
+	if (sl->up) free(sl->up);
+	if (sl->down) free(sl->down);
     }
 
     xf86InitOrigins();
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 794a131..a51a754 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -124,7 +124,7 @@ DGAInit(
 
     if (!pScreenPriv)
     {
-	if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec))))
+	if(!(pScreenPriv = (DGAScreenPtr)malloc(sizeof(DGAScreenRec))))
 	    return FALSE;
 	dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv);
 	pScreenPriv->CloseScreen = pScreen->CloseScreen;
@@ -235,8 +235,8 @@ FreeMarkedVisuals(ScreenPtr pScreen)
 		prev->next = curr;
 	    else 
 		pScreenPriv->fakedVisuals = curr;
-	    xfree(tmp->pVisual);
-	    xfree(tmp);
+	    free(tmp->pVisual);
+	    free(tmp);
 	} else {
 	    prev = curr;
 	    curr = curr->next;
@@ -263,7 +263,7 @@ DGACloseScreen(int i, ScreenPtr pScreen)
    /* DGAShutdown() should have ensured that no DGA
 	screen were active by here */
 
-   xfree(pScreenPriv);
+   free(pScreenPriv);
 
    return((*pScreen->CloseScreen)(i, pScreen));
 }
@@ -363,7 +363,7 @@ xf86SetDGAMode(
 		else
 		    (*pScreen->DestroyPixmap)(oldPix);
 	    }
-	    xfree(pScreenPriv->current);
+	    free(pScreenPriv->current);
 	    pScreenPriv->current = NULL;
 	    pScrn->vtSema = TRUE;
 	    (*pScreenPriv->funcs->SetMode)(pScrn, NULL);
@@ -391,7 +391,7 @@ xf86SetDGAMode(
    else
 	return BadValue;
 
-   if(!(device = (DGADevicePtr)xalloc(sizeof(DGADeviceRec))))
+   if(!(device = (DGADevicePtr)malloc(sizeof(DGADeviceRec))))
 	return BadAlloc;
 
    if(!pScreenPriv->current) {
@@ -403,7 +403,7 @@ xf86SetDGAMode(
    } 
 
    if(!(*pScreenPriv->funcs->SetMode)(pScrn, pMode)) {
-	xfree(device);
+	free(device);
 	return BadAlloc;
    }
 
@@ -424,7 +424,7 @@ xf86SetDGAMode(
 	    else
 		(*pScreen->DestroyPixmap)(oldPix);
 	}
-	xfree(pScreenPriv->current);
+	free(pScreenPriv->current);
 	pScreenPriv->current = NULL;
    } 
 
@@ -671,7 +671,7 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
 
    pMode = &(pScreenPriv->modes[mode - 1]);
 
-   if(!(pVisual = xalloc(sizeof(VisualRec))))
+   if(!(pVisual = malloc(sizeof(VisualRec))))
 	return BadAlloc;
 
    pVisual->vid = FakeClientID(0);
@@ -705,8 +705,8 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
 	pVisual->offsetBlue  = BitsClear(pVisual->blueMask);
    }
 
-   if(!(fvlp = xalloc(sizeof(FakedVisualList)))) {
-	xfree(pVisual);
+   if(!(fvlp = malloc(sizeof(FakedVisualList)))) {
+	free(pVisual);
 	return BadAlloc;
    }
 
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 22174c7..cd33e75 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -65,7 +65,7 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
     DPMSKey = &DPMSKeyIndex;
 
     if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
-		       xcalloc(sizeof(DPMSRec), 1)))
+		       calloc(sizeof(DPMSRec), 1)))
 	return FALSE;
 
     pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
@@ -127,7 +127,7 @@ DPMSClose(int i, ScreenPtr pScreen)
  	xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0);
     }
     
-    xfree(pDPMS);
+    free(pDPMS);
     dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL);
     if (--DPMSCount == 0)
 	DPMSKey = NULL;
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index ebf03bf..2ff77c6 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -567,7 +567,7 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data)
     if (fd < 0 || !proc)
 	return NULL;
 
-    ih = xcalloc(sizeof(*ih), 1);
+    ih = calloc(sizeof(*ih), 1);
     if (!ih)
 	return NULL;
 
@@ -616,7 +616,7 @@ removeInputHandler(IHPtr ih)
 	if (ih)
 	    p->next = ih->next;
     }
-    xfree(ih);
+    free(ih);
 }
 
 int
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 1cc1526..9ec5941 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -105,7 +105,7 @@ xf86DeleteDriver(int drvIndex)
 	&& (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) {
 	if (xf86DriverList[drvIndex]->module)
 	    UnloadModule(xf86DriverList[drvIndex]->module);
-	xfree(xf86DriverList[drvIndex]);
+	free(xf86DriverList[drvIndex]);
 	xf86DriverList[drvIndex] = NULL;
     }
 }
@@ -137,7 +137,7 @@ xf86DeleteInputDriver(int drvIndex)
 {
     if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module)
 	UnloadModule(xf86InputDriverList[drvIndex]->module);
-    xfree(xf86InputDriverList[drvIndex]);
+    free(xf86InputDriverList[drvIndex]);
     xf86InputDriverList[drvIndex] = NULL;
 }
 
@@ -239,11 +239,11 @@ xf86DeleteScreen(int scrnIndex, int flags)
 	pScrn->drv->refCount--;
 
     if (pScrn->privates)
-	xfree(pScrn->privates);
+	free(pScrn->privates);
 
     xf86ClearEntityListForScreen(scrnIndex);
 
-    xfree(pScrn);
+    free(pScrn);
 
     /* Move the other entries down, updating their scrnIndex fields */
 
@@ -285,7 +285,7 @@ xf86AllocateInput(InputDriverPtr drv, int flags)
 {
     InputInfoPtr new, *prev = NULL;
 
-    if (!(new = xcalloc(sizeof(InputInfoRec), 1)))
+    if (!(new = calloc(sizeof(InputInfoRec), 1)))
 	return NULL;
 
     new->drv = drv;
@@ -332,7 +332,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
      * if the driver forgets about it make sure we free it or at least crash
      * with flying colors */
     if (pInp->private)
-	xfree(pInp->private);
+	free(pInp->private);
 
     /* Remove the entry from the list. */
     if (pInp == xf86InputDevs)
@@ -345,7 +345,7 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
 	    p->next = pInp->next;
 	/* Else the entry wasn't in the xf86InputDevs list (ignore this). */
     }
-    xfree(pInp);
+    free(pInp);
 }
 
 Bool
@@ -1224,7 +1224,7 @@ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
     /* Prefix the scrnIndex name to the format string. */
     if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
 	xf86Screens[scrnIndex]->name) {
-	tmpFormat = xalloc(strlen(format) +
+	tmpFormat = malloc(strlen(format) +
 			   strlen(xf86Screens[scrnIndex]->name) +
 			   PREFIX_SIZE + 1);
 	if (!tmpFormat)
@@ -1235,7 +1235,7 @@ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
 
 	strcat(tmpFormat, format);
 	LogVMessageVerb(type, verb, tmpFormat, args);
-	xfree(tmpFormat);
+	free(tmpFormat);
     } else
 	LogVMessageVerb(type, verb, format, args);
 }
@@ -1502,7 +1502,7 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
     if (sectlist)
 	*sectlist = pgdp;
     else
-	xfree(pgdp);
+	free(pgdp);
     return i;
 }
 
@@ -1697,7 +1697,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
      * allow the config file to override this.
      */
     if (allocatedInstances <= 0) {
-	xfree(instances);
+	free(instances);
 	return 0;
     }
 
@@ -1912,7 +1912,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
 	    }
 	}
     }
-    xfree(instances);
+    free(instances);
     if (numFound > 0) {
 	*foundEntities = retEntities;
     }
@@ -2206,14 +2206,14 @@ xf86LoadOneModule(char *name, pointer opt)
     if (Name == NULL)
 	return NULL;
     if (*Name == '\0') {
-	xfree(Name);
+	free(Name);
 	return NULL;
     }
 
     mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin);
     if (!mod)
 	LoaderErrorMsg(NULL, Name, errmaj, errmin);
-    xfree(Name);
+    free(Name);
     return mod;
 }
 
@@ -2267,7 +2267,7 @@ xf86SetBackingStore(ScreenPtr pScreen)
 	if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS))
 	    from = X_CONFIG;
     }
-    xfree(options);
+    free(options);
     pScreen->backingStoreSupport = useBS ? Always : NotUseful;
     if (serverGeneration == 1)
 	xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n",
@@ -2306,7 +2306,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
 	if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM))
 	    from = X_CONFIG;
     }
-    xfree(options);
+    free(options);
     /*
      * XXX quick hack to report correctly for OSs that can't do SilkenMouse
      * yet.  Should handle this differently so that alternate async methods
@@ -2392,13 +2392,13 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
 
     if (!(pEnt->location.type == BUS_PCI)
 	|| !xf86GetPciInfoForEntity(entityIndex)) {
-	xfree(pEnt);
+	free(pEnt);
 	return pScrn;
     }
     if (!pEnt->active) {
 	xf86ConfigPciEntityInactive(pEnt, p_chip, init,  enter,
 				    leave,  private);
-	xfree(pEnt);
+	free(pEnt);
 	return pScrn;
     }
 
@@ -2411,7 +2411,7 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
     if (xf86IsEntityShared(entityIndex)) {
         return pScrn;
     }
-    xfree(pEnt);
+    free(pEnt);
 
     xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
 
@@ -2427,13 +2427,13 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
     if (!pEnt) return pScrn;
 
     if (!(pEnt->location.type == BUS_NONE)) {
-	xfree(pEnt);
+	free(pEnt);
 	return pScrn;
     }
 
     if (!pEnt->active) {
 	xf86ConfigFbEntityInactive(pEnt, init,  enter, leave,  private);
-	xfree(pEnt);
+	free(pEnt);
 	return pScrn;
     }
 
@@ -2461,12 +2461,12 @@ xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex,
     if (!pEnt) return FALSE;
 
     if (!pEnt->active || !(pEnt->location.type == BUS_PCI)) {
-        xfree(pEnt);
+        free(pEnt);
         return FALSE;
     }
     xf86AddEntityToScreen(pScrn,entityIndex);
 
-    xfree(pEnt);
+    free(pEnt);
     if (!xf86SetEntityFuncs(entityIndex,init,enter,leave,private))
         return FALSE;
 
@@ -2511,7 +2511,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
     }
 
     if (!pNewProp) {
-      if ((pNewProp = (RootWinPropPtr)xalloc(sizeof(RootWinProp))) == NULL) {
+      if ((pNewProp = (RootWinPropPtr)malloc(sizeof(RootWinProp))) == NULL) {
 	return(BadAlloc);
       }
       /*
@@ -2521,7 +2521,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
       pNewProp->next = NULL;
     } else {
       if (pNewProp->name)
-	xfree(pNewProp->name);
+	free(pNewProp->name);
       existing = TRUE;
     }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 55d7a62..39d229b 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -438,7 +438,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
 	    }
 	}
     }
-    xfree(devList);
+    free(devList);
 
     return foundScreen;
 }
@@ -617,8 +617,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     /* Load all modules specified explicitly in the config file */
     if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
       xf86LoadModules(modulelist, optionlist);
-      xfree(modulelist);
-      xfree(optionlist);
+      free(modulelist);
+      free(optionlist);
     }
 
     /* Load all driver modules specified in the config file */
@@ -634,13 +634,13 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
     }
     if ((modulelist = xf86DriverlistFromConfig())) {
       xf86LoadModules(modulelist, NULL);
-      xfree(modulelist);
+      free(modulelist);
     }
 
     /* Load all input driver modules specified in the config file. */
     if ((modulelist = xf86InputDriverlistFromConfig())) {
       xf86LoadModules(modulelist, NULL);
-      xfree(modulelist);
+      free(modulelist);
     }
 
     /*
@@ -940,7 +940,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
       /* This memory needs to stay available until the screen has been
 	 initialized, and we can create the property for real.
       */
-      if ( (VT = xalloc(sizeof(CARD32)))==NULL ) {
+      if ( (VT = malloc(sizeof(CARD32)))==NULL ) {
 	FatalError("Unable to make VT property - out of memory. Exiting...\n");
       }
       *VT = xf86Info.vtno;
@@ -1756,7 +1756,7 @@ xf86LoadModules(char **list, pointer *optlist)
 	    LoaderErrorMsg(NULL, name, errmaj, errmin);
 	    failed = TRUE;
 	}
-	xfree(name);
+	free(name);
     }
     return !failed;
 }
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 5d30a78..7bdf79a 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1918,8 +1918,8 @@ xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode)
 	    mode->next->prev = mode->prev;
     }
 
-    xfree(mode->name);
-    xfree(mode);
+    free(mode->name);
+    free(mode);
 }
 
 /*
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index a2868bf..699204c 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -601,8 +601,8 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	if (strncmp(n, "no", 2) == 0) {
 	    newn = n + 2;
 	} else {
-	    xfree(n);
-	    n = xalloc(strlen(p->name) + 2 + 1);
+	    free(n);
+	    n = malloc(strlen(p->name) + 2 + 1);
 	    if (!n) {
 		p->found = FALSE;
 		return FALSE;
@@ -632,7 +632,7 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	    }
 	    xf86ErrorFVerb(2, "\n");
 	}
-	xfree(n);
+	free(n);
     } else {
 	p->found = FALSE;
     }
@@ -843,7 +843,7 @@ xf86NormalizeName(const char *s)
     if (s == NULL)
 	return NULL;
 
-    ret = xalloc(strlen(s) + 1);
+    ret = malloc(strlen(s) + 1);
     for (p = s, q = ret; *p != 0; p++) {
 	switch (*p) {
 	case '_':
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 86c7bde..455a02c 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -359,7 +359,7 @@ xf86RandRCloseScreen (int index, ScreenPtr pScreen)
     scrp->virtualY = pScreen->height = randrp->virtualY;
     scrp->currentMode = scrp->modes;
     pScreen->CloseScreen = randrp->CloseScreen;
-    xfree (randrp);
+    free(randrp);
     dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
     return (*pScreen->CloseScreen) (index, pScreen);
 }
@@ -426,13 +426,13 @@ xf86RandRInit (ScreenPtr    pScreen)
 
     xf86RandRKey = &xf86RandRKeyIndex;
 
-    randrp = xalloc (sizeof (XF86RandRInfoRec));
+    randrp = malloc(sizeof (XF86RandRInfoRec));
     if (!randrp)
 	return FALSE;
 
     if (!RRScreenInit (pScreen))
     {
-	xfree (randrp);
+	free(randrp);
 	return FALSE;
     }
     rp = rrGetScrPriv(pScreen);
diff --git a/hw/xfree86/common/xf86ShowOpts.c b/hw/xfree86/common/xf86ShowOpts.c
index 04a9a8b..ff4b651 100644
--- a/hw/xfree86/common/xf86ShowOpts.c
+++ b/hw/xfree86/common/xf86ShowOpts.c
@@ -85,7 +85,7 @@ void DoShowOptions (void) {
 		goto bail;
 	}
 	xf86LoadModules (vlist,0);
-	xfree (vlist);
+	free(vlist);
 	for (i = 0; i < xf86NumDrivers; i++) {
 		if (xf86DriverList[i]->AvailableOptions) {
 			OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
@@ -95,7 +95,7 @@ void DoShowOptions (void) {
 				);
 				continue;                                                       
 			}
-			pSymbol = xalloc (
+			pSymbol = malloc(
 				strlen(xf86DriverList[i]->driverName) + strlen("ModuleData") + 1
 			);
 			strcpy (pSymbol, xf86DriverList[i]->driverName);
@@ -109,7 +109,7 @@ void DoShowOptions (void) {
 				);
 				for (p = pOption; p->name != NULL; p++) {
 					const char *opttype = optionTypeToSting(p->type);
-					char *optname = xalloc(strlen(p->name) + 2 + 1);
+					char *optname = malloc(strlen(p->name) + 2 + 1);
 					if (!optname) {
 						continue;                      
 					}
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 52a8b9a..4a736fc 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -178,7 +178,7 @@ xf86VGAarbiterWrapFunctions(void)
         if (!dixRequestPrivate(VGAarbiterGCKey, sizeof(VGAarbiterGCRec)))
             return FALSE;
 
-        if (!(pScreenPriv = xalloc(sizeof(VGAarbiterScreenRec))))
+        if (!(pScreenPriv = malloc(sizeof(VGAarbiterScreenRec))))
             return FALSE;
 
         dixSetPrivate(&pScreen->devPrivates, VGAarbiterScreenKey, pScreenPriv);
@@ -250,7 +250,7 @@ VGAarbiterCloseScreen (int i, ScreenPtr pScreen)
     UNWRAP_SCREEN_INFO(FreeScreen);
     UNWRAP_SPRITE;
 
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
     xf86VGAarbiterLock(xf86Screens[i]);
     val = (*pScreen->CloseScreen) (i, pScreen);
     xf86VGAarbiterUnlock(xf86Screens[i]);
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 49b86e7..e704f5a 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -70,7 +70,7 @@ VidModeExtensionInit(ScreenPtr pScreen)
     VidModeKey = &VidModeKeyIndex;
 
     if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey,
-		       xcalloc(sizeof(VidModeRec), 1))) {
+		       calloc(sizeof(VidModeRec), 1))) {
 	DebugF("xcalloc failed\n");
 	return FALSE;
     }
@@ -103,7 +103,7 @@ VidModeClose(int i, ScreenPtr pScreen)
     pScreen->CloseScreen = pVidMode->CloseScreen;
 
     if (--VidModeCount == 0) {
-	xfree(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
+	free(dixLookupPrivate(&pScreen->devPrivates, VidModeKey));
 	dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL);
 	VidModeKey = NULL;
     }
@@ -527,7 +527,7 @@ VidModeCreateMode(void)
 {
     DisplayModePtr mode;
   
-    mode = xalloc(sizeof(DisplayModeRec));
+    mode = malloc(sizeof(DisplayModeRec));
     if (mode != NULL) {
 	mode->name          = "";
 	mode->VScan         = 1;    /* divides refresh rate. default = 1 */
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index a1a5527..ac287aa 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -235,7 +235,7 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
                     local->name, scheme);
         }
 
-        xfree(schemeStr);
+        free(schemeStr);
 
         /* process special configuration */
         switch (scheme) {
@@ -612,7 +612,7 @@ MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
 
     /* Apply options to device with InputClass settings preferred. */
     if (classdriver) {
-        xfree(idev->driver);
+        free(idev->driver);
         idev->driver = xstrdup(classdriver);
         if (!idev->driver) {
             xf86Msg(X_ERROR, "Failed to allocate memory while merging "
@@ -762,7 +762,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
     int rval = Success;
     int is_auto = 0;
 
-    idev = xcalloc(sizeof(*idev), 1);
+    idev = calloc(sizeof(*idev), 1);
     if (!idev)
         return BadAlloc;
 
@@ -844,11 +844,11 @@ unwind:
     if (is_auto && !xf86Info.autoAddDevices)
         xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
     if(idev->driver)
-        xfree(idev->driver);
+        free(idev->driver);
     if(idev->identifier)
-        xfree(idev->identifier);
+        free(idev->identifier);
     xf86optionListFree(idev->commonOptions);
-    xfree(idev);
+    free(idev);
     return rval;
 }
 
@@ -884,10 +884,10 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
 
         if (!(*it)) /* end of list, not in the layout */
         {
-            xfree(idev->driver);
-            xfree(idev->identifier);
+            free(idev->driver);
+            free(idev->identifier);
             xf86optionListFree(idev->commonOptions);
-            xfree(idev);
+            free(idev);
         }
     }
     OsReleaseSignals();
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index e266ffb..f59ffcb 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -155,17 +155,17 @@ Bool xf86HandleColormaps(
 
     elements = 1 << sigRGBbits;
 
-    if(!(gamma = xalloc(elements * sizeof(LOCO))))
+    if(!(gamma = malloc(elements * sizeof(LOCO))))
     	return FALSE;
 
-    if(!(indices = xalloc(maxColors * sizeof(int)))) {
-	xfree(gamma);
+    if(!(indices = malloc(maxColors * sizeof(int)))) {
+	free(gamma);
 	return FALSE;
     }
       
-    if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) {
-	xfree(gamma);
-	xfree(indices);
+    if(!(pScreenPriv = malloc(sizeof(CMapScreenRec)))) {
+	free(gamma);
+	free(indices);
 	return FALSE;     
     }
 
@@ -261,11 +261,11 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
     else 
 	numColors = 1 << pmap->pVisual->nplanes; 
 
-    if(!(colors = xalloc(numColors * sizeof(LOCO))))
+    if(!(colors = malloc(numColors * sizeof(LOCO))))
 	return FALSE;
 
-    if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) {
-	xfree(colors);
+    if(!(pColPriv = malloc(sizeof(CMapColormapRec)))) {
+	free(colors);
 	return FALSE;
     }	
 
@@ -277,7 +277,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap)
     pColPriv->overscan = -1;
 
     /* add map to list */
-    pLink = xalloc(sizeof(CMapLink));
+    pLink = malloc(sizeof(CMapLink));
     if(pLink) {
 	pLink->cmap = pmap;
 	pLink->next = pScreenPriv->maps;
@@ -316,8 +316,8 @@ CMapDestroyColormap (ColormapPtr cmap)
     CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
 
     if(pColPriv) {
-	if(pColPriv->colors) xfree(pColPriv->colors);
-	xfree(pColPriv);
+	if(pColPriv->colors) free(pColPriv->colors);
+	free(pColPriv);
     }
    
     /* remove map from list */
@@ -327,7 +327,7 @@ CMapDestroyColormap (ColormapPtr cmap)
 		prevLink->next = pLink->next;
 	   else
 		pScreenPriv->maps = pLink->next;
-	   xfree(pLink);
+	   free(pLink);
 	   break;
 	}
 	prevLink = pLink;
@@ -828,9 +828,9 @@ CMapUnwrapScreen(ScreenPtr pScreen)
     pScrn->SetDGAMode = pScreenPriv->SetDGAMode; 
     pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
 
-    xfree(pScreenPriv->gamma);
-    xfree(pScreenPriv->PreAllocIndices);
-    xfree(pScreenPriv);
+    free(pScreenPriv->gamma);
+    free(pScreenPriv->PreAllocIndices);
+    free(pScreenPriv);
 }
 
 
diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c
index 5b88717..a142abe 100644
--- a/hw/xfree86/common/xf86fbman.c
+++ b/hw/xfree86/common/xf86fbman.c
@@ -323,10 +323,10 @@ localRegisterFreeBoxCallback(
 
    offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
 					   xf86FBScreenKey);
-   newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback, 
+   newCallbacks = realloc( offman->FreeBoxesUpdateCallback,
 		sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1));
 
-   newPrivates = xrealloc(offman->devPrivates,
+   newPrivates = realloc(offman->devPrivates,
 			  sizeof(DevUnion) * (offman->NumCallbacks + 1));
 
    if(!newCallbacks || !newPrivates)
@@ -375,7 +375,7 @@ AllocateArea(
 	if(((boxp->y2 - boxp->y1) < h) || ((boxp->x2 - x) < w))
 	   continue;
 
-	link = xalloc(sizeof(FBLink));
+	link = malloc(sizeof(FBLink));
 	if(!link) return NULL;
 
         area = &(link->area);
@@ -485,7 +485,7 @@ localFreeOffscreenArea(FBAreaPtr area)
 	pLinkPrev->next = pLink->next;
    else offman->UsedAreas = pLink->next;
 
-   xfree(pLink); 
+   free(pLink);
    offman->NumUsedAreas--;
 
    SendCallFreeBoxCallbacks(offman);
@@ -583,7 +583,7 @@ localResizeOffscreenArea(
         pLink->next = offman->UsedAreas;
         offman->UsedAreas = pLink;
 
-	xfree(newLink);
+	free(newLink);
 
 	/* AllocateArea added one but we really only exchanged one */
 	offman->NumUsedAreas--;  
@@ -751,7 +751,7 @@ localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen)
 
 	    tmp = pLink;
 	    pLink = pLink->next;
-  	    xfree(tmp); 
+            free(tmp);
 	    offman->NumUsedAreas--;
 	    anyUsed = TRUE;
 	} else {
@@ -799,7 +799,7 @@ LinearRemoveCBWrapper(FBAreaPtr area)
         pLinkPrev->next = pLink->next;
    else offman->LinearAreas = pLink->next;
 
-   xfree(pLink);
+   free(pLink);
 }
 
 static void
@@ -854,7 +854,7 @@ AllocateLinear(
 
    /* break left */
    if (offset > linear->linear.offset) {
-      newlink = xalloc(sizeof(FBLinearLink));
+      newlink = malloc(sizeof(FBLinearLink));
       if (!newlink)
 	 return NULL;
       newlink->area = NULL;
@@ -869,7 +869,7 @@ AllocateLinear(
 
    /* break right */
    if (size < linear->linear.size) {
-      newlink = xalloc(sizeof(FBLinearLink));
+      newlink = malloc(sizeof(FBLinearLink));
       if (!newlink)
 	 return NULL;
       newlink->area = NULL;
@@ -920,7 +920,7 @@ localAllocateOffscreenLinear(
 
    DebugF("NOPE, ALLOCATING AREA\n");
 
-   if(!(link = xalloc(sizeof(FBLinearLink))))
+   if(!(link = malloc(sizeof(FBLinearLink))))
      return NULL;
 
    /* No linear available, so try and pinch some from the XY areas */
@@ -930,7 +930,7 @@ localAllocateOffscreenLinear(
    if (gran > 1) {
         if (gran > pitch) {
             /* we can't match the specified alignment with XY allocations */
-            xfree(link);
+            free(link);
             return NULL;
         }
 
@@ -970,7 +970,7 @@ localAllocateOffscreenLinear(
 	linear->RemoveLinearCallback = removeCB;
 	linear->devPrivate.ptr = privData;
    } else 
-	xfree(link);
+	free(link);
 
    DumpDebug(offman->LinearAreas);
 
@@ -1002,7 +1002,7 @@ localFreeOffscreenLinear(FBLinearPtr linear)
    	if(pLinkPrev)
 	    pLinkPrev->next = pLink->next;
    	else offman->LinearAreas = pLink->next;
-   	xfree(pLink); 
+        free(pLink);
 	DumpDebug(offman->LinearAreas);
 	return;
    }
@@ -1161,22 +1161,22 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen)
    while(pLink) {
 	tmp = pLink;
 	pLink = pLink->next;
-	xfree(tmp);
+	free(tmp);
    }
 
    pLinearLink = offman->LinearAreas;
    while(pLinearLink) {
 	tmp2 = pLinearLink;
 	pLinearLink = pLinearLink->next;
-	xfree(tmp2);
+	free(tmp2);
    }
 
    REGION_DESTROY(pScreen, offman->InitialBoxes);
    REGION_DESTROY(pScreen, offman->FreeBoxes);
 
-   xfree(offman->FreeBoxesUpdateCallback);
-   xfree(offman->devPrivates);
-   xfree(offman);
+   free(offman->FreeBoxesUpdateCallback);
+   free(offman->devPrivates);
+   free(offman);
    dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
 
    return (*pScreen->CloseScreen) (i, pScreen);
@@ -1324,7 +1324,7 @@ xf86InitFBManagerRegion(
    if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs))
 	return FALSE;
 
-   offman = xalloc(sizeof(FBManager));
+   offman = malloc(sizeof(FBManager));
    if(!offman) return FALSE;
 
    dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
@@ -1368,7 +1368,7 @@ xf86InitFBManagerLinear(
 
    offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates,
 					   xf86FBScreenKey);
-   offman->LinearAreas = xalloc(sizeof(FBLinearLink));
+   offman->LinearAreas = malloc(sizeof(FBLinearLink));
    if (!offman->LinearAreas)
 	return FALSE;
 
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index ac018e7..3b30d72 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -212,7 +212,7 @@ xf86PciProbe(void)
 
 	xf86ErrorF("\n");
     }
-    xfree(xf86PciVideoInfo);
+    free(xf86PciVideoInfo);
 }
 
 /*
@@ -293,7 +293,7 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
     s = xstrdup(id);
     p = strtok(s, ":");
     if (p == NULL || *p == 0) {
-	xfree(s);
+	free(s);
 	return FALSE;
     }
     d = strpbrk(p, "@");
@@ -301,14 +301,14 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
 	*(d++) = 0;
 	for (i = 0; d[i] != 0; i++) {
 	    if (!isdigit(d[i])) {
-		xfree(s);
+		free(s);
 		return FALSE;
 	    }
 	}
     }
     for (i = 0; p[i] != 0; i++) {
 	if (!isdigit(p[i])) {
-	    xfree(s);
+	    free(s);
 	    return FALSE;
 	}
     }
@@ -317,12 +317,12 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
 	*bus += atoi(d) << 8;
     p = strtok(NULL, ":");
     if (p == NULL || *p == 0) {
-	xfree(s);
+	free(s);
 	return FALSE;
     }
     for (i = 0; p[i] != 0; i++) {
 	if (!isdigit(p[i])) {
-	    xfree(s);
+	    free(s);
 	    return FALSE;
 	}
     }
@@ -330,17 +330,17 @@ xf86ParsePciBusString(const char *busID, int *bus, int *device, int *func)
     *func = 0;
     p = strtok(NULL, ":");
     if (p == NULL || *p == 0) {
-	xfree(s);
+	free(s);
 	return TRUE;
     }
     for (i = 0; p[i] != 0; i++) {
 	if (!isdigit(p[i])) {
-	    xfree(s);
+	    free(s);
 	    return FALSE;
 	}
     }
     *func = atoi(p);
-    xfree(s);
+    free(s);
     return TRUE;
 }
 
diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index 7b23233..ea8c3e1 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -85,7 +85,7 @@ xf86SbusProbe(void)
     char fbDevName[32];
     sbusDevicePtr psdp, *psdpp;
 
-    xf86SbusInfo = xalloc(sizeof(psdp));
+    xf86SbusInfo = malloc(sizeof(psdp));
     *xf86SbusInfo = NULL;
     for (i = 0; i < 32; i++) {
 	sprintf(fbDevName, "/dev/fb%d", i);
@@ -210,7 +210,7 @@ xf86SbusProbe(void)
 	    promPath = sparcPromNode2Pathname (&psdp->node);
 	    if (promPath) {
 		xf86ErrorF(" at %s", promPath);
-		xfree(promPath);
+		free(promPath);
 	    }
 	} else
 	    xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
@@ -397,7 +397,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
      * allow the config file to override this.
      */
     if (allocatedInstances <= 0) {
-	xfree(instances);
+	free(instances);
 	return 0;
     }
 
@@ -419,7 +419,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
 		pGDev->chipID = pGDev->chipRev = -1;
 	    }
 	}
-	xfree(instances);
+	free(instances);
 	if (useProm)
 	    sparcPromClose();
 	return actualcards;
@@ -479,7 +479,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
 	    instances[i].dev = dev;
 	}
 	if (promPath)
-	    xfree(promPath);
+	    free(promPath);
     }
 
     DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
@@ -506,7 +506,7 @@ xf86MatchSbusInstances(const char *driverName, int sbusDevId,
 	    = xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,instances[i].dev->active ?
 				TRUE : FALSE);
     }
-    xfree(instances);
+    free(instances);
     if (numFound > 0) {
 	*foundEntities = retEntities;
     }
@@ -607,7 +607,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
     int i, index;
     sbusCmapPtr cmap;
     struct fbcmap fbcmap;
-    unsigned char *data = xalloc(numColors*3);
+    unsigned char *data = malloc(numColors*3);
                              
     cmap = SBUSCMAPPTR(pScrn->pScreen);
     if (!cmap) return;
@@ -628,7 +628,7 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
 	fbcmap.blue[fbcmap.count++] = colors[index].blue;
     }
     ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
-    xfree(data);
+    free(data);
 }
 
 static Bool
@@ -647,7 +647,7 @@ xf86SbusCmapCloseScreen(int i, ScreenPtr pScreen)
 	ioctl (cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
     }
     pScreen->CloseScreen = cmap->CloseScreen;
-    xfree (cmap);
+    free(cmap);
     return (*pScreen->CloseScreen) (i, pScreen);
 }    
 
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 2cc2f60..99d1fdf 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -138,7 +138,7 @@ xf86XVRegisterGenericAdaptorDriver(
 ){
   xf86XVInitGenericAdaptorPtr *newdrivers;
 
-  newdrivers = xrealloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
+  newdrivers = realloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
 			(1 + NumGenDrivers));
   if (!newdrivers)
     return 0;
@@ -168,7 +168,7 @@ xf86XVListGenericAdaptors(
 	n = (*GenDrivers[i])(pScrn, &DrivAdap);
 	if (0 == n)
 	    continue;
-	new = xrealloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n));
+	new = realloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n));
 	if (NULL == new)
 	    continue;
 	*adaptors = new;
@@ -225,13 +225,13 @@ xf86XVQueryOffscreenImages(
 XF86VideoAdaptorPtr
 xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn)
 {
-    return xcalloc(1, sizeof(XF86VideoAdaptorRec));
+    return calloc(1, sizeof(XF86VideoAdaptorRec));
 }
 
 void
 xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr)
 {
-    xfree(ptr);
+    free(ptr);
 }
 
 
@@ -267,7 +267,7 @@ xf86XVScreenInit(
      a CloseScreen hook so that we don't have to wrap it.  I'm not
      sure that I appreciate that.  */
 
-  ScreenPriv = xalloc(sizeof(XF86XVScreenRec));
+  ScreenPriv = malloc(sizeof(XF86XVScreenRec));
   pxvs->devPriv.ptr = (pointer)ScreenPriv;
 
   if(!ScreenPriv) return FALSE;
@@ -302,17 +302,17 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
 {
    int i;
 
-   xfree(pAdaptor->name);
+   free(pAdaptor->name);
 
    if(pAdaptor->pEncodings) {
       XvEncodingPtr pEncode = pAdaptor->pEncodings;
 
       for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
-	  xfree(pEncode->name);
-      xfree(pAdaptor->pEncodings);
+	  free(pEncode->name);
+      free(pAdaptor->pEncodings);
    }
 
-   xfree(pAdaptor->pFormats);
+   free(pAdaptor->pFormats);
 
    if(pAdaptor->pPorts) {
       XvPortPtr pPort = pAdaptor->pPorts;
@@ -325,22 +325,22 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
 	     if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 		REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
-	     xfree(pPriv);
+	     free(pPriv);
 	  }
       }
-      xfree(pAdaptor->pPorts);
+      free(pAdaptor->pPorts);
    }
 
    if(pAdaptor->nAttributes) {
       XvAttributePtr pAttribute = pAdaptor->pAttributes;
 
       for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
-	  xfree(pAttribute->name);
-      xfree(pAdaptor->pAttributes);
+	  free(pAttribute->name);
+      free(pAdaptor->pAttributes);
    }
 
-   xfree(pAdaptor->pImages);
-   xfree(pAdaptor->devPriv.ptr);
+   free(pAdaptor->pImages);
+   free(pAdaptor->devPriv.ptr);
 }
 
 static Bool
@@ -374,7 +374,7 @@ xf86XVInitAdaptors(
   pxvs->nAdaptors = 0;
   pxvs->pAdaptors = NULL;
 
-  if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
+  if(!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
       return FALSE;
 
   for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
@@ -424,18 +424,18 @@ xf86XVInitAdaptors(
       pa->ddGetPortAttribute = xf86XVGetPortAttribute;
       pa->ddQueryBestSize = xf86XVQueryBestSize;
       pa->ddQueryImageAttributes = xf86XVQueryImageAttributes;
-      if((pa->name = xalloc(strlen(adaptorPtr->name) + 1)))
+      if((pa->name = malloc(strlen(adaptorPtr->name) + 1)))
 	  strcpy(pa->name, adaptorPtr->name);
 
       if(adaptorPtr->nEncodings &&
-	(pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
+	(pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
 
 	for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
 	    i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
 	{
 	    pe->id = encodingPtr->id;
 	    pe->pScreen = pScreen;
-	    if((pe->name = xalloc(strlen(encodingPtr->name) + 1)))
+	    if((pe->name = malloc(strlen(encodingPtr->name) + 1)))
 		strcpy(pe->name, encodingPtr->name);
 	    pe->width = encodingPtr->width;
 	    pe->height = encodingPtr->height;
@@ -447,7 +447,7 @@ xf86XVInitAdaptors(
       }
 
       if(adaptorPtr->nImages &&
-	 (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
+	 (pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
 
 	  for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
 	      i < adaptorPtr->nImages; i++, pi++, imagePtr++)
@@ -480,7 +480,7 @@ xf86XVInitAdaptors(
       }
 
       if(adaptorPtr->nAttributes &&
-	(pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
+	(pAttribute = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
       {
 	for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
 	    i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
@@ -488,7 +488,7 @@ xf86XVInitAdaptors(
 	    pat->flags = attributePtr->flags;
 	    pat->min_value = attributePtr->min_value;
 	    pat->max_value = attributePtr->max_value;
-	    if((pat->name = xalloc(strlen(attributePtr->name) + 1)))
+	    if((pat->name = malloc(strlen(attributePtr->name) + 1)))
 		strcpy(pat->name, attributePtr->name);
 	}
 	pa->nAttributes = adaptorPtr->nAttributes;
@@ -498,7 +498,7 @@ xf86XVInitAdaptors(
 
       totFormat = adaptorPtr->nFormats;
 
-      if(!(pFormat = xcalloc(totFormat, sizeof(XvFormatRec)))) {
+      if(!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
 	  xf86XVFreeAdaptor(pa);
 	  continue;
       }
@@ -515,7 +515,7 @@ xf86XVInitAdaptors(
 		   if(numFormat >= totFormat) {
 			void *moreSpace;
 			totFormat *= 2;
-			moreSpace = xrealloc(pFormat,
+			moreSpace = realloc(pFormat,
 					     totFormat * sizeof(XvFormatRec));
 			if(!moreSpace) break;
 			pFormat = moreSpace;
@@ -538,7 +538,7 @@ xf86XVInitAdaptors(
 	  continue;
       }
 
-      if(!(adaptorPriv = xcalloc(1, sizeof(XvAdaptorRecPrivate)))) {
+      if(!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
 	  xf86XVFreeAdaptor(pa);
 	  continue;
       }
@@ -558,7 +558,7 @@ xf86XVInitAdaptors(
 
       pa->devPriv.ptr = (pointer)adaptorPriv;
 
-      if(!(pPort = xcalloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
+      if(!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
 	  xf86XVFreeAdaptor(pa);
 	  continue;
       }
@@ -568,11 +568,11 @@ xf86XVInitAdaptors(
 	  if(!(pp->id = FakeClientID(0)))
 		continue;
 
-	  if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
+	  if(!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
 		continue;
 
 	  if(!AddResource(pp->id, PortResource, pp)) {
-		xfree(portPriv);
+		free(portPriv);
 		continue;
 	  }
 
@@ -608,7 +608,7 @@ xf86XVInitAdaptors(
       pxvs->nAdaptors = numAdaptor;
       pxvs->pAdaptors = pAdaptor;
   } else {
-     xfree(pAdaptor);
+     free(pAdaptor);
      return FALSE;
   }
 
@@ -976,7 +976,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
    }
 
    if(!winPriv) {
-	winPriv = xcalloc(1, sizeof(XF86XVWindowRec));
+	winPriv = calloc(1, sizeof(XF86XVWindowRec));
 	if(!winPriv) return BadAlloc;
 	winPriv->PortRec = portPriv;
 	winPriv->next = PrivRoot;
@@ -1003,7 +1003,7 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 	    else
 		dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
 			      winPriv->next);
-	    xfree(winPriv);
+	    free(winPriv);
 	    break;
 	}
 	prevPriv = winPriv;
@@ -1037,7 +1037,7 @@ xf86XVDestroyWindow(WindowPtr pWin)
        FreeGC(WinPriv->pGC, 0);
      }
      WinPriv = WinPriv->next;
-     xfree(tmp);
+     free(tmp);
   }
 
   dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
@@ -1103,7 +1103,7 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 	       pPrev->next = WinPriv->next;
 	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    xfree(tmp);
+	    free(tmp);
 	    continue;
 	}
 	break;
@@ -1159,7 +1159,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 	       pPrev->next = WinPriv->next;
 	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    xfree(tmp);
+	    free(tmp);
 	    continue;
 	}
      }
@@ -1208,8 +1208,8 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
        xf86XVFreeAdaptor(pa);
   }
 
-  xfree(pxvs->pAdaptors);
-  xfree(ScreenPriv);
+  free(pxvs->pAdaptors);
+  free(ScreenPriv);
   return TRUE;
 }
 
@@ -1861,7 +1861,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
 
    REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
 
-   rects = xalloc(nbox * sizeof(xRectangle));
+   rects = malloc(nbox * sizeof(xRectangle));
 
    for(i = 0; i < nbox; i++, pbox++) {
       rects[i].x = pbox->x1;
@@ -1874,7 +1874,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
 
    if (!pPriv) FreeGC(pGC, 0);
 
-   xfree(rects);
+   free(rects);
 }
 
 void
@@ -1895,7 +1895,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
    (void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
    ValidateGC(root, gc);
 
-   rects = xalloc (nbox * sizeof(xRectangle));
+   rects = malloc(nbox * sizeof(xRectangle));
 
    for(i = 0; i < nbox; i++, pbox++) 
    {
@@ -1907,7 +1907,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
    
    (*gc->ops->PolyFillRect)(root, gc, nbox, rects);
    
-   xfree (rects);
+   free(rects);
    FreeScratchGC (gc);
 }
 
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index 39d33da..99d6695 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -149,8 +149,8 @@ xf86XvMCCloseScreen (int i, ScreenPtr pScreen)
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
 
-    xfree(pScreenPriv->dixinfo);
-    xfree(pScreenPriv);
+    free(pScreenPriv->dixinfo);
+    free(pScreenPriv);
 
     return (*pScreen->CloseScreen)(i, pScreen);
 }
@@ -169,11 +169,11 @@ Bool xf86XvMCScreenInit(
 
    if(!XvMCScreenInitProc) return FALSE;
 
-   if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
+   if(!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
 	return FALSE;
 
-   if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) {
-	xfree(pAdapt);
+   if(!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
+	free(pAdapt);
 	return FALSE;
    }
 
@@ -196,7 +196,7 @@ Bool xf86XvMCScreenInit(
 	}
 	if(!pAdapt[i].xv_adaptor) {
 	    /* no adaptor by that name */
-	    xfree(pAdapt);
+	    free(pAdapt);
 	    return FALSE;
 	}
 	pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
@@ -220,10 +220,10 @@ Bool xf86XvMCScreenInit(
 
 XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void)
 {
-   return xcalloc(1, sizeof(XF86MCAdaptorRec));
+   return calloc(1, sizeof(XF86MCAdaptorRec));
 }
 
 void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
 {
-   xfree(adaptor);
+   free(adaptor);
 }
diff --git a/hw/xfree86/common/xisb.c b/hw/xfree86/common/xisb.c
index 1cb9e48..4455efd 100644
--- a/hw/xfree86/common/xisb.c
+++ b/hw/xfree86/common/xisb.c
@@ -67,13 +67,13 @@ XisbNew (int fd, ssize_t size)
 {
 	XISBuffer *b;
 
-	b = xalloc (sizeof (XISBuffer));
+	b = malloc(sizeof (XISBuffer));
 	if (!b)
 		return (NULL);
-	b->buf = xalloc ((sizeof (unsigned char) * size));
+	b->buf = malloc((sizeof (unsigned char) * size));
 	if (!b->buf)
 	{
-		xfree (b);
+		free(b);
 		return (NULL);
 	}
 
@@ -89,8 +89,8 @@ XisbNew (int fd, ssize_t size)
 void
 XisbFree (XISBuffer *b)
 {
-	xfree (b->buf);
-	xfree (b);
+	free(b->buf);
+	free(b);
 }
 
 int
diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c
index 6fad9fb..e64e2f3 100644
--- a/hw/xfree86/ddc/ddc.c
+++ b/hw/xfree86/ddc/ddc.c
@@ -86,7 +86,7 @@ resort(unsigned char *s_block)
     unsigned char tmp;
 
     s_end = s_block + EDID1_LEN;
-    d_new = xalloc(EDID1_LEN);
+    d_new = malloc(EDID1_LEN);
     if (!d_new) return NULL;
     d_end = d_new + EDID1_LEN;
 
@@ -97,7 +97,7 @@ resort(unsigned char *s_block)
 	*d_ptr = tmp; 
 	if (s_ptr == s_end) s_ptr = s_block;
     }
-    xfree(s_block);
+    free(s_block);
     return (d_new);
 }
 
@@ -134,7 +134,7 @@ GetEDID_DDC1(unsigned int *s_ptr)
     if (s_start==-1) return NULL;
     s_end = s_ptr + NUM;
     s_pos = s_ptr + s_start;
-    d_block=xalloc(EDID1_LEN);
+    d_block=malloc(EDID1_LEN);
     if (!d_block) return NULL;
     d_pos = d_block;
     for (i=0;i<EDID1_LEN;i++) {
@@ -148,7 +148,7 @@ GetEDID_DDC1(unsigned int *s_ptr)
 	s_pos++; if (s_pos == s_end) s_pos=s_ptr;
 	d_pos++;
     }
-    xfree(s_ptr);
+    free(s_ptr);
     if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL;
     return (resort(d_block));
 }
@@ -161,7 +161,7 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn,
     int count = NUM;
     unsigned int *ptr, *xp;
 
-    ptr=xp=xalloc(sizeof(int)*NUM); 
+    ptr=xp=malloc(sizeof(int)*NUM);
 
     if (!ptr)  return NULL;
     do {
@@ -251,7 +251,7 @@ xf86DoEDID_DDC1(
 
     xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
     xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
-    xfree(options);
+    free(options);
     
     if (noddc || noddc1)
 	return NULL;
@@ -392,7 +392,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
     Bool noddc = FALSE, noddc2 = FALSE;
     OptionInfoPtr options;
 
-    options = xalloc(sizeof(DDCOptions));
+    options = malloc(sizeof(DDCOptions));
     if (!options)
 	return NULL;
     memcpy(options, DDCOptions, sizeof(DDCOptions));
@@ -400,7 +400,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
 
     xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
     xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
-    xfree(options);
+    free(options);
 
     if (noddc || noddc2)
 	return NULL;
@@ -408,7 +408,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
     if (!(dev = DDC2Init(scrnIndex, pBus)))
 	return NULL;
 
-    EDID_block = xcalloc(1, EDID1_LEN);
+    EDID_block = calloc(1, EDID1_LEN);
     if (!EDID_block)
 	return NULL;
 
@@ -416,7 +416,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
 	int i, n = EDID_block[0x7e];
 
 	if (complete && n) {
-	    EDID_block = xrealloc(EDID_block, EDID1_LEN * (1+n));
+	    EDID_block = realloc(EDID_block, EDID1_LEN * (1+n));
 
 	    for (i = 0; i < n; i++)
 		DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i)));
@@ -477,7 +477,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
     Bool noddc = FALSE, noddc2 = FALSE;
     OptionInfoPtr options;
 
-    options = xalloc(sizeof(DDCOptions));
+    options = malloc(sizeof(DDCOptions));
     if (!options)
 	return NULL;
     memcpy(options, DDCOptions, sizeof(DDCOptions));
@@ -485,7 +485,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
 
     xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
     xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
-    xfree(options);
+    free(options);
 
     if (noddc || noddc2)
 	return NULL;
@@ -494,7 +494,7 @@ xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
 	return NULL;
 
     if ((did = DDC2ReadDisplayID())) {
-	tmp = xcalloc(1, sizeof(*tmp));
+	tmp = calloc(1, sizeof(*tmp));
 	if (!tmp)
 	    return NULL;
 
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 329a639..d2d90ba 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -42,7 +42,7 @@ edidMakeAtom(int i, const char *name, CARD8 *data, int size)
     Atom atom;
     unsigned char *atom_data;
 
-    if (!(atom_data = xalloc(size*sizeof(CARD8))))
+    if (!(atom_data = malloc(size*sizeof(CARD8))))
 	return;
 
     atom = MakeAtom(name, strlen(name), TRUE);
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index f3e593a..d63e25d 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -186,7 +186,7 @@ xf86InterpretEDID(int scrnIndex, Uchar *block)
     return (m);
 
  error:
-    xfree(m);
+    free(m);
     return NULL;
 }
 
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index 7d20868..f4e922c 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -146,13 +146,13 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
     for (i = 0; extensionModules[i].name != NULL; i++) {
 	if (opts) {
 	    char *s;
-	    s = (char *)xalloc(strlen(extensionModules[i].name) + 5);
+	    s = (char *)malloc(strlen(extensionModules[i].name) + 5);
 	    if (s) {
 		pointer o;
 		strcpy(s, "omit");
 		strcat(s, extensionModules[i].name);
 		o = xf86FindOption(opts, s);
-		xfree(s);
+		free(s);
 		if (o) {
 		    xf86MarkOptionUsed(o);
 		    continue;
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 0385514..711a9cb 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -218,7 +218,7 @@ ProcXDGAQueryModes(ClientPtr client)
 	return (client->noClientException);
     }
 
-    if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec))))
+    if(!(mode = (XDGAModePtr)malloc(num * sizeof(XDGAModeRec))))
 	return BadAlloc;
 
     for(i = 0; i < num; i++)
@@ -267,7 +267,7 @@ ProcXDGAQueryModes(ClientPtr client)
 	WriteToClient(client, size, mode[i].name);
     }
 
-    xfree(mode);
+    free(mode);
 
     return (client->noClientException);
 }
@@ -583,7 +583,7 @@ ProcXDGASetClientVersion(ClientPtr client)
 
     REQUEST_SIZE_MATCH(xXDGASetClientVersionReq);
     if ((pPriv = DGA_GETPRIV(client)) == NULL) {
-	pPriv = xalloc(sizeof(DGAPrivRec));
+	pPriv = malloc(sizeof(DGAPrivRec));
 	/* XXX Need to look into freeing this */
 	if (!pPriv)
 	    return BadAlloc;
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index a304a42..5bdd88c 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -150,7 +150,7 @@ static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKeyIndex;
     dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v)
 #define SetupScreen(s)  ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s)
 
-#define New(t)  (xalloc (sizeof (t)))
+#define New(t)  (malloc(sizeof (t)))
 #endif
 
 #ifdef DEBUG
@@ -229,7 +229,7 @@ CheckScreenPrivate (pScreen)
     if (!pPriv)
 	return;
     if (!pPriv->events && !pPriv->hasWindow) {
-	xfree (pPriv);
+	free(pPriv);
 	SetScreenPrivate (pScreen, NULL);
     }
 }
@@ -283,7 +283,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
 	    break;
     if (mask == 0) {
 	*pPrev = pEv->next;
-	xfree (pEv);
+	free(pEv);
 	CheckScreenPrivate (pScreen);
     } else {
 	if (!pEv) {
@@ -319,7 +319,7 @@ XF86VidModeFreeEvents(pointer value, XID id)
     if (!pEv)
 	return TRUE;
     *pPrev = pEv->next;
-    xfree (pEv);
+    free(pEv);
     CheckScreenPrivate (pScreen);
     return TRUE;
 }
@@ -738,20 +738,20 @@ ProcXF86VidModeAddModeLine(ClientPtr client)
 	    break;
 	case MODE_HSYNC:
 	case MODE_H_ILLEGAL:
-	    xfree(mode);
+	    free(mode);
 	    return VidModeErrorBase + XF86VidModeBadHTimings;
 	case MODE_VSYNC:
 	case MODE_V_ILLEGAL:
-	    xfree(mode);
+	    free(mode);
 	    return VidModeErrorBase + XF86VidModeBadVTimings;
 	default:
-	    xfree(mode);
+	    free(mode);
 	    return VidModeErrorBase + XF86VidModeModeUnsuitable;
     }
 
     /* Check that the driver is happy with the mode */
     if (VidModeCheckModeForDriver(stuff->screen, mode) != MODE_OK) {
-	xfree(mode);
+	free(mode);
 	return VidModeErrorBase + XF86VidModeModeUnsuitable;
     }
 
@@ -968,23 +968,23 @@ ProcXF86VidModeModModeLine(ClientPtr client)
 	    break;
 	case MODE_HSYNC:
 	case MODE_H_ILLEGAL:
-	    xfree(modetmp);
+	    free(modetmp);
 	    return VidModeErrorBase + XF86VidModeBadHTimings;
 	case MODE_VSYNC:
 	case MODE_V_ILLEGAL:
-	    xfree(modetmp);
+	    free(modetmp);
 	    return VidModeErrorBase + XF86VidModeBadVTimings;
 	default:
-	    xfree(modetmp);
+	    free(modetmp);
 	    return VidModeErrorBase + XF86VidModeModeUnsuitable;
     }
 
     /* Check that the driver is happy with the mode */
     if (VidModeCheckModeForDriver(stuff->screen, modetmp) != MODE_OK) {
-	xfree(modetmp);
+	free(modetmp);
 	return VidModeErrorBase + XF86VidModeModeUnsuitable;
     }
-    xfree(modetmp);
+    free(modetmp);
 
     VidModeSetModeValue(mode, VIDMODE_H_DISPLAY, stuff->hdisplay);
     VidModeSetModeValue(mode, VIDMODE_H_SYNCSTART, stuff->hsyncstart); 
@@ -1104,7 +1104,7 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
 
 status_reply:
     if(modetmp)
-      xfree(modetmp);
+      free(modetmp);
 
     rep.type = X_Reply;
     rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
@@ -1296,14 +1296,14 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     rep.sequenceNumber = client->sequence;
     rep.nhsync = nHsync;
     rep.nvsync = nVrefresh;
-    hsyncdata = xalloc(nHsync * sizeof(CARD32));
+    hsyncdata = malloc(nHsync * sizeof(CARD32));
     if (!hsyncdata) {
 	return BadAlloc;
     }
 
-    vsyncdata = xalloc(nVrefresh * sizeof(CARD32));
+    vsyncdata = malloc(nVrefresh * sizeof(CARD32));
     if (!vsyncdata) {
-	xfree(hsyncdata);
+	free(hsyncdata);
 	return BadAlloc;
     }
 
@@ -1336,8 +1336,8 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
     if (rep.modelLength)
 	WriteToClient(client, rep.modelLength, (char *)(VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr);
 
-    xfree(hsyncdata);
-    xfree(vsyncdata);
+    free(hsyncdata);
+    free(vsyncdata);
 
     return (client->noClientException);
 }
@@ -1421,11 +1421,11 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
     rep.flags = 0;
 
     if (!ClockProg) {
-	Clocks = xalloc(numClocks * sizeof(int));
+	Clocks = malloc(numClocks * sizeof(int));
 	if (!Clocks)
 	    return BadValue;
 	if (!VidModeGetClocks(stuff->screen, Clocks)) {
-	    xfree(Clocks);
+	    free(Clocks);
 	    return BadValue;
 	}
     }
@@ -1452,7 +1452,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
 	}
     }
 
-    xfree(Clocks);
+    free(Clocks);
     return (client->noClientException);
 }
 
@@ -1557,12 +1557,12 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 
     if(stuff->size) {
 	ramplen = length * 3 * sizeof(CARD16);
-	if (!(ramp = xalloc(ramplen)))
+	if (!(ramp = malloc(ramplen)))
 	    return BadAlloc;
    
         if (!VidModeGetGammaRamp(stuff->screen, stuff->size, 
 		ramp, ramp + length, ramp + (length * 2))) {
-	    xfree(ramp);
+	    free(ramp);
             return BadValue;
 	}
     }
@@ -1581,7 +1581,7 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 
     if(stuff->size) {
 	WriteToClient(client, ramplen, (char*)ramp);
-        xfree(ramp);
+        free(ramp);
     }
 
     return (client->noClientException);
@@ -1657,7 +1657,7 @@ ProcXF86VidModeSetClientVersion(ClientPtr client)
     REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
 
     if ((pPriv = VM_GETPRIV(client)) == NULL) {
-	pPriv = xalloc(sizeof(VidModePrivRec));
+	pPriv = malloc(sizeof(VidModePrivRec));
 	if (!pPriv)
 	    return BadAlloc;
 	VM_SETPRIV(client, pPriv);
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 836967c..77f7fe2 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -357,7 +357,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
     if (DRIGeneration != serverGeneration)
 	DRIGeneration = serverGeneration;
 
-    pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
+    pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
     if (!pDRIPriv) {
 	dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
         return FALSE;
@@ -534,7 +534,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 
 	/* allocate memory for hidden context store */
 	pDRIPriv->hiddenContextStore
-	    = (void *)xcalloc(1, pDRIInfo->contextSize);
+	    = (void *)calloc(1, pDRIInfo->contextSize);
 	if (!pDRIPriv->hiddenContextStore) {
 	    DRIDrvMsg(pScreen->myNum, X_ERROR,
 		      "failed to allocate hidden context\n");
@@ -544,11 +544,11 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 
 	/* allocate memory for partial 3D context store */
 	pDRIPriv->partial3DContextStore
-	    = (void *)xcalloc(1, pDRIInfo->contextSize);
+	    = (void *)calloc(1, pDRIInfo->contextSize);
 	if (!pDRIPriv->partial3DContextStore) {
 	    DRIDrvMsg(pScreen->myNum, X_ERROR,
 		      "[DRI] failed to allocate partial 3D context\n");
-	    xfree(pDRIPriv->hiddenContextStore);
+	    free(pDRIPriv->hiddenContextStore);
 	    DRIDestroyContextPriv(pDRIContextPriv);
 	    return FALSE;
 	}
@@ -574,9 +574,9 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
 	    DRIDrvMsg(pScreen->myNum, X_ERROR,
 		      "[drm] failed to setup DRM signal handler\n");
 	    if (pDRIPriv->hiddenContextStore)
-		xfree(pDRIPriv->hiddenContextStore);
+		free(pDRIPriv->hiddenContextStore);
 	    if (pDRIPriv->partial3DContextStore)
-		xfree(pDRIPriv->partial3DContextStore);
+		free(pDRIPriv->partial3DContextStore);
 	    DRIDestroyContextPriv(pDRIContextPriv);
 	    return FALSE;
 	} else {
@@ -757,7 +757,7 @@ DRICloseScreen(ScreenPtr pScreen)
 	    }
 	}
 
-	xfree(pDRIPriv);
+	free(pDRIPriv);
 	dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
     }
 }
@@ -907,7 +907,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen,
 
     contextPrivSize = sizeof(DRIContextPrivRec) +
 			    pDRIPriv->pDriverInfo->contextSize;
-    if (!(pDRIContextPriv = xcalloc(1, contextPrivSize))) {
+    if (!(pDRIContextPriv = calloc(1, contextPrivSize))) {
 	return NULL;
     }
     pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1);
@@ -965,7 +965,7 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv)
                                    while in this thread, but buffers can be
                                    dispatched asynchronously. */
     drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext);
-    xfree(pDRIContextPriv);
+    free(pDRIContextPriv);
     return TRUE;
 }
 
@@ -1182,7 +1182,7 @@ DRIDriverClipNotify(ScreenPtr pScreen)
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     if (pDRIPriv->pDriverInfo->ClipNotify) {
-	WindowPtr *pDRIWindows = xcalloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
+	WindowPtr *pDRIWindows = calloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
 	DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
 
 	if (pDRIPriv->nrWindows > 0) {
@@ -1193,7 +1193,7 @@ DRIDriverClipNotify(ScreenPtr pScreen)
 
 	pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
 
-	xfree(pDRIWindows);
+	free(pDRIWindows);
     }
 }
 
@@ -1254,14 +1254,14 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
 	}
 	else {
 	    /* allocate a DRI Window Private record */
-	    if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
+	    if (!(pDRIDrawablePriv = malloc(sizeof(DRIDrawablePrivRec)))) {
 		return FALSE;
 	    }
 
 	    /* Only create a drm_drawable_t once */
 	    if (drmCreateDrawable(pDRIPriv->drmFD,
 				  &pDRIDrawablePriv->hwDrawable)) {
-		xfree(pDRIDrawablePriv);
+		free(pDRIDrawablePriv);
 		return FALSE;
 	    }
 
@@ -1330,7 +1330,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin)
 
     drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable);
 
-    xfree(pDRIDrawablePriv);
+    free(pDRIDrawablePriv);
     dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
 }
 
@@ -1587,7 +1587,7 @@ DRIGetDeviceInfo(ScreenPtr pScreen,
 DRIInfoPtr
 DRICreateInfoRec(void)
 {
-    DRIInfoPtr inforec = (DRIInfoPtr)xcalloc(1, sizeof(DRIInfoRec));
+    DRIInfoPtr inforec = (DRIInfoPtr)calloc(1, sizeof(DRIInfoRec));
     if (!inforec) return NULL;
 
     /* Initialize defaults */
@@ -1613,8 +1613,8 @@ DRICreateInfoRec(void)
 void
 DRIDestroyInfoRec(DRIInfoPtr DRIInfo)
 {
-    if (DRIInfo->busIdString) xfree(DRIInfo->busIdString);
-    xfree((char*)DRIInfo);
+    if (DRIInfo->busIdString) free(DRIInfo->busIdString);
+    free((char*)DRIInfo);
 }
 
 
@@ -2425,7 +2425,7 @@ DRICreatePCIBusID(const struct pci_device * dev)
 {
     char *busID;
 
-    busID = xalloc(20);
+    busID = malloc(20);
     if (busID == NULL)
 	return NULL;
 
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 7800399..4e5a15f 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -490,7 +490,7 @@ ProcXF86DRIGetDrawableInfo(
 
     if (rep.numClipRects) {
        /* Clip cliprects to screen dimensions (redirected windows) */
-       pClippedRects = xalloc(rep.numClipRects * sizeof(drm_clip_rect_t));
+       pClippedRects = malloc(rep.numClipRects * sizeof(drm_clip_rect_t));
 
        if (pClippedRects) {
 	    ScreenPtr pScreen = screenInfo.screens[stuff->screen];
@@ -524,7 +524,7 @@ ProcXF86DRIGetDrawableInfo(
 	WriteToClient(client,  
 		      sizeof(drm_clip_rect_t) * rep.numClipRects,
 		      (char *)pClippedRects);
-	xfree(pClippedRects);
+	free(pClippedRects);
     }
 
     if (rep.numBackClipRects) {
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 143163d..21f8118 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -128,7 +128,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     WindowPtr pWin;
     PixmapPtr pPixmap;
 
-    pPriv = xalloc(sizeof *pPriv);
+    pPriv = malloc(sizeof *pPriv);
     if (pPriv == NULL)
 	return NULL;
 
@@ -270,10 +270,10 @@ static int DRI2DrawableGone(pointer p, XID id)
 	for (i = 0; i < pPriv->bufferCount; i++)
 	    (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
 
-	xfree(pPriv->buffers);
+	free(pPriv->buffers);
     }
 
-    xfree(pPriv);
+    free(pPriv);
 
     return Success;
 }
@@ -344,7 +344,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
     dimensions_match = (pDraw->width == pPriv->width)
 	&& (pDraw->height == pPriv->height);
 
-    buffers = xalloc((count + 1) * sizeof(buffers[0]));
+    buffers = malloc((count + 1) * sizeof(buffers[0]));
 
     for (i = 0; i < count; i++) {
 	const unsigned attachment = *(attachments++);
@@ -408,7 +408,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
 	    }
 	}
 
-	xfree(pPriv->buffers);
+	free(pPriv->buffers);
     }
 
     pPriv->buffers = buffers;
@@ -936,7 +936,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
         return FALSE;
     }
 
-    ds = xcalloc(1, sizeof *ds);
+    ds = calloc(1, sizeof *ds);
     if (!ds)
 	return FALSE;
 
@@ -965,17 +965,17 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
     if (info->version == 3 || info->numDrivers == 0) {
 	/* Driver too old: use the old-style driverName field */
 	ds->numDrivers = 1;
-	ds->driverNames = xalloc(sizeof(*ds->driverNames));
+	ds->driverNames = malloc(sizeof(*ds->driverNames));
 	if (!ds->driverNames) {
-	    xfree(ds);
+	    free(ds);
 	    return FALSE;
 	}
 	ds->driverNames[0] = info->driverName;
     } else {
 	ds->numDrivers = info->numDrivers;
-	ds->driverNames = xalloc(info->numDrivers * sizeof(*ds->driverNames));
+	ds->driverNames = malloc(info->numDrivers * sizeof(*ds->driverNames));
 	if (!ds->driverNames) {
-	    xfree(ds);
+	    free(ds);
 	    return FALSE;
 	}
 	memcpy(ds->driverNames, info->driverNames,
@@ -1000,8 +1000,8 @@ DRI2CloseScreen(ScreenPtr pScreen)
 {
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
 
-    xfree(ds->driverNames);
-    xfree(ds);
+    free(ds->driverNames);
+    free(ds);
     dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
 }
 
diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index bcb6a40..315ba4a 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -79,8 +79,8 @@ exaXorgCloseScreen (int i, ScreenPtr pScreen)
 
     pScrn->EnableDisableFBAccess = pScreenPriv->SavedEnableDisableFBAccess;
 
-    xfree (pScreenPriv->options);
-    xfree (pScreenPriv);
+    free(pScreenPriv->options);
+    free(pScreenPriv);
 
     return pScreen->CloseScreen (i, pScreen);
 }
@@ -114,7 +114,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     ExaXorgScreenPrivPtr pScreenPriv;
 
-    pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec));
+    pScreenPriv = calloc(1, sizeof(ExaXorgScreenPrivRec));
     if (pScreenPriv == NULL)
 	return;
 
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 880f0a2..f160908 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -129,7 +129,7 @@ fbdevHWFreeRec(ScrnInfoPtr pScrn)
 		return;
 	if (FBDEVHWPTR(pScrn) == NULL)
 		return;
-	xfree(FBDEVHWPTR(pScrn));
+	free(FBDEVHWPTR(pScrn));
 	FBDEVHWPTRLVAL(pScrn) = NULL;
 }
 
diff --git a/hw/xfree86/i2c/bt829.c b/hw/xfree86/i2c/bt829.c
index 3963ecf..024e76f 100644
--- a/hw/xfree86/i2c/bt829.c
+++ b/hw/xfree86/i2c/bt829.c
@@ -461,7 +461,7 @@ BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
   BT829Ptr bt;
   I2CByte a;
 
-  bt = xcalloc(1, sizeof(BT829Rec));
+  bt = calloc(1, sizeof(BT829Rec));
   if(bt == NULL) return NULL;
   bt->d.DevName = strdup("BT829 video decoder");
   bt->d.SlaveAddr = addr;
@@ -482,7 +482,7 @@ BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr)
   bt->id = btread(bt,IDCODE);
 
   free(bt->d.DevName);
-  bt->d.DevName = xcalloc(200, sizeof(char));
+  bt->d.DevName = calloc(200, sizeof(char));
   switch(BTVERSION){
   	case BT815:
 		sprintf(bt->d.DevName, "bt815a video decoder, revision %d",bt->id & 0xf);
diff --git a/hw/xfree86/i2c/fi1236.c b/hw/xfree86/i2c/fi1236.c
index 61224ea..8337c90 100644
--- a/hw/xfree86/i2c/fi1236.c
+++ b/hw/xfree86/i2c/fi1236.c
@@ -46,7 +46,7 @@ FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr)
    FI1236Ptr f;
    I2CByte a;
 
-   f = xcalloc(1,sizeof(FI1236Rec));
+   f = calloc(1,sizeof(FI1236Rec));
    if(f == NULL) return NULL;
    f->d.DevName = strdup("FI12xx Tuner");
    f->d.SlaveAddr = addr;
diff --git a/hw/xfree86/i2c/msp3430.c b/hw/xfree86/i2c/msp3430.c
index 4bd3a71..2f244e4 100644
--- a/hw/xfree86/i2c/msp3430.c
+++ b/hw/xfree86/i2c/msp3430.c
@@ -136,7 +136,7 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
    CARD8 hardware_version, major_revision, product_code, rom_version;
    Bool supported;
    
-   m = xcalloc(1,sizeof(MSP3430Rec));
+   m = calloc(1,sizeof(MSP3430Rec));
    if(m == NULL)return NULL;
    m->d.DevName = strdup("MSP34xx");
    m->d.SlaveAddr = addr;
@@ -149,8 +149,8 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
    
    if(!I2C_WriteRead(&(m->d), NULL, 0, &a, 1))
    {
-   	xfree(m->d.DevName);
-   	xfree(m);
+       free(m->d.DevName);
+       free(m);
 	return NULL;
     }
 
@@ -235,14 +235,14 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr)
 		MSP_getProductName(m->chip_id), supported?"":" (unsupported)", rom_version, m->chip_id);
 
 	if (!supported) {
-       		xfree(m->d.DevName);
-	   	xfree(m);
-		return NULL;
-	}	
+            free(m->d.DevName);
+            free(m);
+            return NULL;
+	}
    if(!I2CDevInit(&(m->d)))
    {
-       xfree(m->d.DevName);
-       xfree(m);
+       free(m->d.DevName);
+       free(m);
        return NULL;
    }
 
diff --git a/hw/xfree86/i2c/tda8425.c b/hw/xfree86/i2c/tda8425.c
index 7631a08..598f88b 100644
--- a/hw/xfree86/i2c/tda8425.c
+++ b/hw/xfree86/i2c/tda8425.c
@@ -17,7 +17,7 @@ TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
 {
   TDA8425Ptr t;
   
-  t = xcalloc(1, sizeof(TDA8425Rec));
+  t = calloc(1, sizeof(TDA8425Rec));
   if(t == NULL) return NULL;
   t->d.DevName = "TDA8425 BTSC Stereo Audio Processor";
   t->d.SlaveAddr = addr;
@@ -30,14 +30,14 @@ TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force)
   
   if(!force && !I2CProbeAddress(b, addr))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
   
   /* set default parameters */
   if(!I2CDevInit(&(t->d)))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
 
diff --git a/hw/xfree86/i2c/tda9850.c b/hw/xfree86/i2c/tda9850.c
index 5b0c581..24323cb 100644
--- a/hw/xfree86/i2c/tda9850.c
+++ b/hw/xfree86/i2c/tda9850.c
@@ -18,7 +18,7 @@ TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
   TDA9850Ptr t;
   I2CByte a;
   
-  t = xcalloc(1, sizeof(TDA9850Rec));
+  t = calloc(1, sizeof(TDA9850Rec));
   if(t == NULL) return NULL;
   switch(addr)
   {
@@ -39,14 +39,14 @@ TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr)
   
   if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
   
   /* set default parameters */
   if(!I2CDevInit(&(t->d)))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
 
diff --git a/hw/xfree86/i2c/tda9885.c b/hw/xfree86/i2c/tda9885.c
index 4147dfd..9c303b4 100644
--- a/hw/xfree86/i2c/tda9885.c
+++ b/hw/xfree86/i2c/tda9885.c
@@ -13,7 +13,7 @@ TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
   TDA9885Ptr t;
   I2CByte a;
   
-  t = xcalloc(1, sizeof(TDA9885Rec));
+  t = calloc(1, sizeof(TDA9885Rec));
   if(t == NULL) return NULL;
   switch(addr)
   {
@@ -37,14 +37,14 @@ TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr)
   
   if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
   
   /* set default parameters */
   if(!I2CDevInit(&(t->d)))
   {
-     xfree(t);
+     free(t);
      return NULL;
   }
 
diff --git a/hw/xfree86/i2c/uda1380.c b/hw/xfree86/i2c/uda1380.c
index defda3c..c7b1cda 100644
--- a/hw/xfree86/i2c/uda1380.c
+++ b/hw/xfree86/i2c/uda1380.c
@@ -36,7 +36,7 @@ UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
 	UDA1380Ptr t;
 	I2CByte a;
   
-	t = xcalloc(1, sizeof(UDA1380Rec));
+	t = calloc(1, sizeof(UDA1380Rec));
 	if(t == NULL) return NULL;
 	switch(addr)
 	{
@@ -58,14 +58,14 @@ UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr)
   
 	if(!I2C_WriteRead(&(t->d), NULL, 0, &a, 1))
 	{
-		xfree(t);
+		free(t);
 		return NULL;
 	}
   
 	/* set default parameters */
 	if(!I2CDevInit(&(t->d)))
 	{
-		xfree(t);
+		free(t);
 		return NULL;
 	}
   
diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c
index 59832d6..e0223f6 100644
--- a/hw/xfree86/i2c/xf86i2c.c
+++ b/hw/xfree86/i2c/xf86i2c.c
@@ -598,7 +598,7 @@ xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues)
 I2CDevPtr
 xf86CreateI2CDevRec(void) 
 {
-    return xcalloc(1, sizeof(I2CDevRec));
+    return calloc(1, sizeof(I2CDevRec));
 }
 
 /* Unlink an I2C device. If you got the I2CDevRec from xf86CreateI2CDevRec
@@ -623,7 +623,7 @@ xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
 		   "I2C device \"%s:%s\" removed.\n",
 		   d->pI2CBus->BusName, d->DevName);
 
-	if (unalloc) xfree(d);
+	if (unalloc) free(d);
     }
 }
 
@@ -695,7 +695,7 @@ xf86CreateI2CBusRec(void)
 {
     I2CBusPtr b;
 
-    b = (I2CBusPtr) xcalloc(1, sizeof(I2CBusRec));
+    b = (I2CBusPtr) calloc(1, sizeof(I2CBusRec));
 
     if (b != NULL) {
 	b->scrnIndex = -1;
@@ -751,7 +751,7 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too)
 	xf86DrvMsg(b->scrnIndex, X_INFO, "I2C bus \"%s\" removed.\n",
 		   b->BusName);
 
-	if (unalloc) xfree(b);
+	if (unalloc) free(b);
     }
 }
 
diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 9d39e99..fe8bb69 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -137,7 +137,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
     
     if (int10skip(options)) {
-	xfree(options);
+	free(options);
 	return NULL;
     }
     
@@ -285,17 +285,17 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     xf86ExecX86int10(pInt);
     UnlockLegacyVGA(pInt, &vga);
 #endif
-    xfree(options);
+    free(options);
     return pInt;
 
  error1:
-    xfree(base);
+    free(base);
     UnmapVRam(pInt);
-    xfree(INTPriv(pInt)->alloc);
-    xfree(pInt->private);
+    free(INTPriv(pInt)->alloc);
+    free(pInt->private);
  error0:
-    xfree(pInt);
-    xfree(options);
+    free(pInt);
+    free(options);
     
     return NULL;
 }
@@ -339,11 +339,11 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
 #endif
     if (Int10Current == pInt)
 	Int10Current = NULL;
-    xfree(INTPriv(pInt)->base);
+    free(INTPriv(pInt)->base);
     UnmapVRam(pInt);
-    xfree(INTPriv(pInt)->alloc);
-    xfree(pInt->private);
-    xfree(pInt);
+    free(INTPriv(pInt)->alloc);
+    free(pInt->private);
+    free(pInt);
 }
 
 void *
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 6ba647f..8f47afe 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -711,7 +711,7 @@ xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
 	if (pInt->BIOSScratch) {
 	    for (i = 0; i < BIOS_SCRATCH_LEN; i++)
 		*(base + i) = *(pInt->BIOSScratch + i); 
-	    xfree(pInt->BIOSScratch);
+	    free(pInt->BIOSScratch);
 	    pInt->BIOSScratch = NULL;
 	}
     }
diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
index 6f6ecc2..3f206c2 100644
--- a/hw/xfree86/int10/helper_mem.c
+++ b/hw/xfree86/int10/helper_mem.c
@@ -208,14 +208,14 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex)
 	    configOptions = pEnt->device->options;
 
 	if (configOptions) {
-	    if (!(options = (OptionInfoPtr) xalloc(sizeof(INT10Options))))
+	    if (!(options = (OptionInfoPtr) malloc(sizeof(INT10Options))))
 		return NULL;
 	     
 	    (void)memcpy(options, INT10Options, sizeof(INT10Options));
 	    xf86ProcessOptions(pScrn->scrnIndex, configOptions, options);
 	}
     }
-    xfree(pEnt);
+    free(pEnt);
 
     return options;
 }
@@ -276,7 +276,7 @@ xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt)
 
     EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
     location_type = pEnt->location.type;
-    xfree(pEnt);
+    free(pEnt);
 
     return location_type;
 }
diff --git a/hw/xfree86/loader/loadext.c b/hw/xfree86/loader/loadext.c
index 29cdaf1..39a92c8 100644
--- a/hw/xfree86/loader/loadext.c
+++ b/hw/xfree86/loader/loadext.c
@@ -54,7 +54,7 @@ NewExtensionModule(void)
 	numExtensionModules = 0;
 
     n = numExtensionModules + 1;
-    ExtensionModuleList = xrealloc(ExtensionModuleList,
+    ExtensionModuleList = realloc(ExtensionModuleList,
 				   (n + 1) * sizeof(ExtensionModule));
     if (ExtensionModuleList == NULL) {
 	ExtensionModuleList = save;
@@ -268,7 +268,7 @@ free_nodes(NODE * nodelist)
 
     for (n = nodelist; n;) {
 	nextnode = n->n_next;
-	xfree(n);
+	free(n);
 	n = nextnode;
     }
 }
@@ -379,9 +379,9 @@ tsort(void)
 	    ErrorF("tsort: internal error -- could not find cycle");
     }
     if (cycle_buf)
-	xfree(cycle_buf);
+	free(cycle_buf);
     if (longest_cycle)
-	xfree(longest_cycle);
+	free(longest_cycle);
     if (graph)
 	free_nodes(graph);
 }
@@ -433,7 +433,7 @@ LoaderSortExtensions(void)
     if (graph)
 	free_nodes(graph);
     newList[i].name = NULL;
-    xfree(ExtensionModuleList);
+    free(ExtensionModuleList);
     ExtensionModuleList = newList;
 #ifdef DEBUG
     for (i = 0; ExtensionModuleList[i].name; i++)
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 5b175a5..871bfda 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -104,9 +104,9 @@ FreeStringList(char **paths)
 	return;
 
     for (p = paths; *p; p++)
-	xfree(*p);
+	free(*p);
 
-    xfree(paths);
+    free(paths);
 }
 
 static char **defaultPathList = NULL;
@@ -147,19 +147,19 @@ InitPathList(const char *path)
 	    if (addslash)
 		len++;
 	    save = list;
-	    list = xrealloc(list, (n + 2) * sizeof(char *));
+	    list = realloc(list, (n + 2) * sizeof(char *));
 	    if (!list) {
 		if (save) {
 		    save[n] = NULL;
 		    FreeStringList(save);
 		}
-		xfree(fullpath);
+		free(fullpath);
 		return NULL;
 	    }
-	    list[n] = xalloc(len + 1);
+	    list[n] = malloc(len + 1);
 	    if (!list[n]) {
 		FreeStringList(list);
-		xfree(fullpath);
+		free(fullpath);
 		return NULL;
 	    }
 	    strcpy(list[n], elem);
@@ -173,7 +173,7 @@ InitPathList(const char *path)
     }
     if (list)
 	list[n] = NULL;
-    xfree(fullpath);
+    free(fullpath);
     return list;
 }
 
@@ -244,7 +244,7 @@ InitPatterns(const char **patternlist)
 	for (i = 0, s = patternlist; *s; i++, s++)
 	    if (*s == DEFAULT_LIST)
 		i += sizeof(stdPatterns) / sizeof(stdPatterns[0]) - 1 - 1;
-	patterns = xalloc((i + 1) * sizeof(PatternRec));
+	patterns = malloc((i + 1) * sizeof(PatternRec));
 	if (!patterns) {
 	    return NULL;
 	}
@@ -274,7 +274,7 @@ static void
 FreePatterns(PatternPtr patterns)
 {
     if (patterns && patterns != stdPatterns)
-	xfree(patterns);
+	free(patterns);
 }
 
 static const char **
@@ -290,7 +290,7 @@ InitSubdirs(const char **subdirlist)
     Bool indefault;
 
     if (subdirlist == NULL) {
-	subdirlist = tmp_subdirlist = xalloc(2 * sizeof(char *));
+	subdirlist = tmp_subdirlist = malloc(2 * sizeof(char *));
 	if (subdirlist == NULL)
 	    return NULL;
 	subdirlist[0] = DEFAULT_LIST;
@@ -316,15 +316,15 @@ InitSubdirs(const char **subdirlist)
 		    strstr(*s, "..")) {
 		    xf86Msg(X_ERROR, "InitSubdirs: Bad subdir: \"%s\"\n", *s);
 		    if (tmp_subdirlist)
-			xfree(tmp_subdirlist);
+			free(tmp_subdirlist);
 		    return NULL;
 		}
 	    }
 	}
-	subdirs = xalloc((i * 2 + 1) * sizeof(char *));
+	subdirs = malloc((i * 2 + 1) * sizeof(char *));
 	if (!subdirs) {
 	    if (tmp_subdirlist)
-		xfree(tmp_subdirlist);
+		free(tmp_subdirlist);
 	    return NULL;
 	}
 	i = 0;
@@ -344,12 +344,12 @@ InitSubdirs(const char **subdirlist)
 	    } else
 		slash = "";
 	    len += oslen + 2;
-	    if (!(subdirs[i] = xalloc(len))) {
+	    if (!(subdirs[i] = malloc(len))) {
 		while (--i >= 0)
-		    xfree(subdirs[i]);
-		xfree(subdirs);
+		    free(subdirs[i]);
+		free(subdirs);
 		if (tmp_subdirlist)
-		    xfree(tmp_subdirlist);
+		    free(tmp_subdirlist);
 		return NULL;
 	    }
 	    /* tack on the OS name */
@@ -368,7 +368,7 @@ InitSubdirs(const char **subdirlist)
 	subdirs[i] = NULL;
     }
     if (tmp_subdirlist)
-	xfree(tmp_subdirlist);
+	free(tmp_subdirlist);
     return (const char **)subdirs;
 }
 
@@ -379,8 +379,8 @@ FreeSubdirs(const char **subdirs)
 
     if (subdirs) {
 	for (s = subdirs; *s; s++)
-	    xfree(*s);
-	xfree(subdirs);
+	    free(*s);
+	free(subdirs);
     }
 }
 
@@ -465,7 +465,7 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
 
     FreeSubdirs(subdirs);
     if (dirpath != dirname)
-	xfree(dirpath);
+	free(dirpath);
 
     return name;
 }
@@ -527,7 +527,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
 			    match[1].rm_so != -1) {
 			    len = match[1].rm_eo - match[1].rm_so;
 			    save = listing;
-			    listing = xrealloc(listing,
+			    listing = realloc(listing,
 					       (n + 2) * sizeof(char *));
 			    if (!listing) {
 				if (save) {
@@ -539,7 +539,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
 				FreePatterns(patterns);
 				return NULL;
 			    }
-			    listing[n] = xalloc(len + 1);
+			    listing[n] = malloc(len + 1);
 			    if (!listing[n]) {
 				FreeStringList(listing);
 				FreePathList(pathlist);
@@ -780,7 +780,7 @@ LoadSubModule(pointer _parent, const char *module,
 static ModuleDescPtr
 NewModuleDesc(const char *name)
 {
-    ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc));
+    ModuleDescPtr mdp = malloc(sizeof(ModuleDesc));
 
     if (mdp) {
 	mdp->child = NULL;
@@ -944,7 +944,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
      * now check if the special data object <modulename>ModuleData is
      * present.
      */
-    p = xalloc(strlen(name) + strlen("ModuleData") + 1);
+    p = malloc(strlen(name) + strlen("ModuleData") + 1);
     if (!p) {
 	if (errmaj)
 	    *errmaj = LDR_NOMEM;
@@ -1021,9 +1021,9 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
   LoadModule_exit:
     FreePathList(pathlist);
     FreePatterns(patterns);
-    xfree(found);
-    xfree(name);
-    xfree(p);
+    free(found);
+    free(name);
+    free(p);
 
     return ret;
 }
@@ -1099,8 +1099,8 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
 	UnloadModuleOrDriver(mod->child);
     if (mod->sib)
 	UnloadModuleOrDriver(mod->sib);
-    xfree(mod->name);
-    xfree(mod);
+    free(mod->name);
+    free(mod);
 }
 
 void
@@ -1122,8 +1122,8 @@ UnloadSubModule(pointer _mod)
     if (mod->child)
 	UnloadModuleOrDriver(mod->child);
 
-    xfree(mod->name);
-    xfree(mod);
+    free(mod->name);
+    free(mod);
 }
 
 static void
@@ -1241,7 +1241,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
     for (p = patterns; p->pattern; p++)
 	if (regexec(&p->rex, s, 2, match, 0) == 0 && match[1].rm_so != -1) {
 	    len = match[1].rm_eo - match[1].rm_so;
-	    str = xalloc(len + 1);
+	    str = malloc(len + 1);
 	    if (!str)
 		return NULL;
 	    strncpy(str, s + match[1].rm_so, len);
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 1ccaffc..ef7ed58 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -90,7 +90,7 @@ xf86CrtcCreate (ScrnInfoPtr		scrn,
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CrtcPtr		crtc, *crtcs;
 
-    crtc = xcalloc (sizeof (xf86CrtcRec), 1);
+    crtc = calloc(sizeof (xf86CrtcRec), 1);
     if (!crtc)
 	return NULL;
     crtc->version = XF86_CRTC_VERSION;
@@ -118,20 +118,20 @@ xf86CrtcCreate (ScrnInfoPtr		scrn,
     crtc->gamma_size = 256;
     crtc->gamma_red = malloc(3 * crtc->gamma_size * sizeof (CARD16));
     if (!crtc->gamma_red) {
-	xfree (crtc);
+	free(crtc);
 	return NULL;
     }
     crtc->gamma_green = crtc->gamma_red + crtc->gamma_size;
     crtc->gamma_blue = crtc->gamma_green + crtc->gamma_size;
 
     if (xf86_config->crtc)
-	crtcs = xrealloc (xf86_config->crtc,
+	crtcs = realloc(xf86_config->crtc,
 			  (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
     else
-	crtcs = xalloc ((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+	crtcs = malloc((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
     if (!crtcs)
     {
-	xfree (crtc);
+	free(crtc);
 	return NULL;
     }
     xf86_config->crtc = crtcs;
@@ -156,9 +156,9 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
 	    break;
 	}
     if (crtc->params)
-	xfree (crtc->params);
+	free(crtc->params);
     free(crtc->gamma_red);
-    xfree (crtc);
+    free(crtc);
 }
 
 
@@ -381,8 +381,8 @@ done:
     }
 
     if (adjusted_mode->name)
-	    xfree(adjusted_mode->name);
-    xfree(adjusted_mode);
+	    free(adjusted_mode->name);
+    free(adjusted_mode);
 
     if (didLock)
 	crtc->funcs->unlock (crtc);
@@ -479,7 +479,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
 	return;
 
     if (output->options)
-	xfree (output->options);
+	free(output->options);
 
     output->options = xnfalloc (sizeof (xf86OutputOptions));
     memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
@@ -493,7 +493,7 @@ xf86OutputSetMonitor (xf86OutputPtr output)
 	monitor = output->name;
     else
 	xf86MarkOptionUsedByName (output->scrn->options, option_name);
-    xfree (option_name);
+    free(option_name);
     output->conf_monitor = xf86findMonitor (monitor,
 					    xf86configptr->conf_monitor_lst);
     /*
@@ -595,7 +595,7 @@ xf86OutputCreate (ScrnInfoPtr		    scrn,
     else
 	len = 0;
 
-    output = xcalloc (sizeof (xf86OutputRec) + len, 1);
+    output = calloc(sizeof (xf86OutputRec) + len, 1);
     if (!output)
 	return NULL;
     output->scrn = scrn;
@@ -618,20 +618,20 @@ xf86OutputCreate (ScrnInfoPtr		    scrn,
 	xf86OutputSetMonitor (output);
 	if (xf86OutputIgnored (output))
 	{
-	    xfree (output);
+	    free(output);
 	    return FALSE;
 	}
     }
     
     
     if (xf86_config->output)
-	outputs = xrealloc (xf86_config->output,
+	outputs = realloc(xf86_config->output,
 			  (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
     else
-	outputs = xalloc ((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+	outputs = malloc((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
     if (!outputs)
     {
-	xfree (output);
+	free(output);
 	return NULL;
     }
 
@@ -657,14 +657,14 @@ Bool
 xf86OutputRename (xf86OutputPtr output, const char *name)
 {
     int	    len = strlen(name) + 1;
-    char    *newname = xalloc (len);
+    char    *newname = malloc(len);
     
     if (!newname)
 	return FALSE;	/* so sorry... */
     
     strcpy (newname, name);
     if (output->name && output->name != (char *) (output + 1))
-	xfree (output->name);
+	free(output->name);
     output->name = newname;
     xf86OutputSetMonitor (output);
     if (xf86OutputIgnored (output))
@@ -702,8 +702,8 @@ xf86OutputDestroy (xf86OutputPtr output)
 	    break;
 	}
     if (output->name && output->name != (char *) (output + 1))
-	xfree (output->name);
-    xfree (output);
+	free(output->name);
+    free(output);
 }
 
 /*
@@ -950,7 +950,7 @@ xf86PickCrtcs (ScrnInfoPtr	scrn,
     if (modes[n] == NULL)
 	return best_score;
     
-    crtcs = xalloc (config->num_output * sizeof (xf86CrtcPtr));
+    crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
     if (!crtcs)
 	return best_score;
 
@@ -1006,7 +1006,7 @@ xf86PickCrtcs (ScrnInfoPtr	scrn,
 	    memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
 	}
     }
-    xfree (crtcs);
+    free(crtcs);
     return best_score;
 }
 
@@ -1415,8 +1415,8 @@ xf86SortModes (DisplayModePtr input)
 	if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
 	{
 	    o->next = n->next;
-	    xfree (n->name);
-	    xfree (n);
+	    free(n->name);
+	    free(n);
 	    n = o;
 	}
     }
@@ -2101,8 +2101,8 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
 		config->num_output * sizeof(DisplayModePtr));
     }
 
-    xfree(preferred);
-    xfree(preferred_match);
+    free(preferred);
+    free(preferred_match);
     return ret;
 }
 
@@ -2157,7 +2157,7 @@ no_aspect_match:
     ret = TRUE;
 
 out:
-    xfree(aspects);
+    free(aspects);
     return ret;
 }
 
@@ -2391,8 +2391,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
      */
     if (!xf86InitialOutputPositions (scrn, modes))
     {
-	xfree (crtcs);
-	xfree (modes);
+	free(crtcs);
+	free(modes);
 	return FALSE;
     }
 
@@ -2406,8 +2406,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
      */
     if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
     {
-	xfree (crtcs);
-	xfree (modes);
+	free(crtcs);
+	free(modes);
 	return FALSE;
     }
     
@@ -2494,8 +2494,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
     /* Mirror output modes to scrn mode list */
     xf86SetScrnInfoModes (scrn);
     
-    xfree (crtcs);
-    xfree (modes);
+    free(crtcs);
+    free(modes);
     return TRUE;
 }
 
@@ -2934,7 +2934,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
 #endif
     
     if (output->MonInfo != NULL)
-	xfree(output->MonInfo);
+	free(output->MonInfo);
     
     output->MonInfo = edid_mon;
 
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index cfbe778..5842a61 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -551,7 +551,7 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
     if (!cursor_info)
 	return FALSE;
 
-    xf86_config->cursor_image = xalloc (max_width * max_height * 4);
+    xf86_config->cursor_image = malloc(max_width * max_height * 4);
 
     if (!xf86_config->cursor_image)
     {
@@ -661,7 +661,7 @@ xf86_cursors_fini (ScreenPtr screen)
     }
     if (xf86_config->cursor_image)
     {
-	xfree (xf86_config->cursor_image);
+	free(xf86_config->cursor_image);
 	xf86_config->cursor_image = NULL;
     }
     if (xf86_config->cursor)
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
index 60fbdbf..a4cf4f0 100644
--- a/hw/xfree86/modes/xf86DiDGA.c
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -61,7 +61,7 @@ xf86_dga_get_modes (ScreenPtr pScreen)
     if (!num)
 	return FALSE;
     
-    modes = xalloc(num * sizeof(DGAModeRec));
+    modes = malloc(num * sizeof(DGAModeRec));
     if (!modes)
 	return FALSE;
     
@@ -104,7 +104,7 @@ xf86_dga_get_modes (ScreenPtr pScreen)
 	    break;
     }
     if (xf86_config->dga_modes)
-	xfree (xf86_config->dga_modes);
+	free(xf86_config->dga_modes);
     xf86_config->dga_nmode = num;
     xf86_config->dga_modes = modes;
     return TRUE;
diff --git a/hw/xfree86/modes/xf86DisplayIDModes.c b/hw/xfree86/modes/xf86DisplayIDModes.c
index 182d43e..f18f18c 100644
--- a/hw/xfree86/modes/xf86DisplayIDModes.c
+++ b/hw/xfree86/modes/xf86DisplayIDModes.c
@@ -56,7 +56,7 @@ typedef void (*did_proc)(int scrnIndex, unsigned char *data, void *closure);
 static DisplayModePtr
 modeCalloc(void)
 {
-    return xcalloc(1, sizeof(DisplayModeRec));
+    return calloc(1, sizeof(DisplayModeRec));
 }
 
 /*
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index ec65408..8f4d04f 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -608,7 +608,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
 
     /* perform basic check on the detail timing */
     if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) {
-	xfree(Mode);
+	free(Mode);
 	return NULL;
     }
 
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index 75aedaa..05f4319 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -138,7 +138,7 @@ xf86SetModeDefaultName(DisplayModePtr mode)
 {
     Bool interlaced = !!(mode->Flags & V_INTERLACE);
 
-    xfree(mode->name);
+    free(mode->name);
 
     mode->name = XNFprintf("%dx%d%s", mode->HDisplay, mode->VDisplay,
 			   interlaced ? "i" : "");
@@ -324,7 +324,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
 		   mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
 		   mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
 		   mode->VTotal, flags, xf86ModeHSync(mode));
-    xfree(flags);
+    free(flags);
 }
 #endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
 
@@ -607,13 +607,13 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
     
     for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
     {
-        mode = xcalloc(1, sizeof(DisplayModeRec));
+        mode = calloc(1, sizeof(DisplayModeRec));
 	if (!mode)
 	    continue;
         mode->name       = xstrdup(conf_mode->ml_identifier);
 	if (!mode->name)
 	{
-	    xfree (mode);
+	    free(mode);
 	    continue;
 	}
 	mode->type       = 0;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 8898f4d..9dfce3f 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -888,13 +888,13 @@ xf86RandR12Init (ScreenPtr pScreen)
     xf86RandR12Index = AllocateScreenPrivateIndex();
 #endif
 
-    randrp = xalloc (sizeof (XF86RandRInfoRec));
+    randrp = malloc(sizeof (XF86RandRInfoRec));
     if (!randrp)
 	return FALSE;
 
     if (!RRScreenInit(pScreen))
     {
-	xfree (randrp);
+	free(randrp);
 	return FALSE;
     }
     rp = rrGetScrPriv(pScreen);
@@ -1064,7 +1064,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr	randr_crtc)
     DisplayModePtr	mode = &crtc->mode;
     Bool		ret;
 
-    randr_outputs = xalloc(config->num_output * sizeof (RROutputPtr));
+    randr_outputs = malloc(config->num_output * sizeof (RROutputPtr));
     if (!randr_outputs)
 	return FALSE;
     x = crtc->x;
@@ -1101,7 +1101,7 @@ xf86RandR12CrtcNotify (RRCrtcPtr	randr_crtc)
 			rotation, 
 			crtc->transformPresent ? &crtc->transform : NULL,
 			numOutputs, randr_outputs);
-    xfree(randr_outputs);
+    free(randr_outputs);
     return ret;
 }
 
@@ -1158,7 +1158,7 @@ xf86RandR12CrtcSet (ScreenPtr	    pScreen,
     if (!crtc->scrn->vtSema)
 	return FALSE;
 
-    save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
+    save_crtcs = malloc(config->num_output * sizeof (xf86CrtcPtr));
     if ((randr_mode != NULL) != crtc->enabled)
 	changed = TRUE;
     else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
@@ -1222,7 +1222,7 @@ xf86RandR12CrtcSet (ScreenPtr	    pScreen,
 		    xf86OutputPtr	output = config->output[o];
 		    output->crtc = save_crtcs[o];
 		}
-		xfree(save_crtcs);
+		free(save_crtcs);
 		return FALSE;
 	    }
 	    xf86RandR13VerifyPanningArea (crtc, pScreen->width, pScreen->height);
@@ -1243,7 +1243,7 @@ xf86RandR12CrtcSet (ScreenPtr	    pScreen,
 	}
 	xf86DisableUnusedFunctions (pScrn);
     }
-    xfree(save_crtcs);
+    free(save_crtcs);
     return xf86RandR12CrtcNotify (randr_crtc);
 }
 
@@ -1394,7 +1394,7 @@ xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
 	nmode++;
 
     if (nmode) {
-	rrmodes = xalloc (nmode * sizeof (RRModePtr));
+	rrmodes = malloc(nmode * sizeof (RRModePtr));
 	
 	if (!rrmodes)
 	    return FALSE;
@@ -1431,7 +1431,7 @@ xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
     }
     
     ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
-    xfree (rrmodes);
+    free(rrmodes);
     return ret;
 }
 
@@ -1450,8 +1450,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
     RRCrtcPtr		randr_crtc;
     int			nclone;
     
-    clones = xalloc(config->num_output * sizeof (RROutputPtr));
-    crtcs = xalloc (config->num_crtc * sizeof (RRCrtcPtr));
+    clones = malloc(config->num_output * sizeof (RROutputPtr));
+    crtcs = malloc(config->num_crtc * sizeof (RRCrtcPtr));
     for (o = 0; o < config->num_output; o++)
     {
 	xf86OutputPtr	output = config->output[o];
@@ -1468,8 +1468,8 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
 
 	if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
 	{
-	    xfree (crtcs);
-	    xfree (clones);
+	    free(crtcs);
+	    free(clones);
 	    return FALSE;
 	}
 
@@ -1505,13 +1505,13 @@ xf86RandR12SetInfo12 (ScreenPtr pScreen)
 	}
 	if (!RROutputSetClones (output->randr_output, clones, nclone))
 	{
-	    xfree (crtcs);
-	    xfree (clones);
+	    free(crtcs);
+	    free(clones);
 	    return FALSE;
 	}
     }
-    xfree (crtcs);
-    xfree (clones);
+    free(crtcs);
+    free(clones);
     return TRUE;
 }
 
@@ -1729,7 +1729,7 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
     if (!size)
 	return Success;
 
-    points = xcalloc(size, 3 * sizeof(CARD16));
+    points = calloc(size, 3 * sizeof(CARD16));
     if (!points)
 	return BadAlloc;
 
@@ -1742,7 +1742,7 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
     gamma_to_ramp(gamma.blue, blue, size);
     RRCrtcGammaSet(crtc, red, green, blue);
 
-    xfree(points);
+    free(points);
 
     pScrn->gamma = gamma;
 
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 5de6b0c..2714fee 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -406,7 +406,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
 	xf86RotateDestroy (crtc);
 	crtc->transform_in_use = FALSE;
 	if (new_params)
-	    xfree (new_params);
+	    free(new_params);
 	new_params = NULL;
 	new_nparams = 0;
 	new_filter = NULL;
@@ -467,7 +467,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
 	if (transform)
 	{
 	    if (transform->nparams) {
-		new_params = xalloc (transform->nparams * sizeof (xFixed));
+		new_params = malloc(transform->nparams * sizeof (xFixed));
 		if (new_params) {
 		    memcpy (new_params, transform->params,
 			    transform->nparams * sizeof (xFixed));
@@ -507,7 +507,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
     crtc->f_crtc_to_framebuffer = f_crtc_to_fb;
     crtc->f_framebuffer_to_crtc = f_fb_to_crtc;
     if (crtc->params)
-	xfree (crtc->params);
+	free(crtc->params);
     crtc->params = new_params;
     crtc->nparams = new_nparams;
     crtc->filter = new_filter;
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 10db9c7..44abb9d 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -529,7 +529,7 @@ getAllRanges(int *nmr)
 	mro.mo_arg[0] = *nmr;
 	mro.mo_desc = mrd;
 	if (ioctl(devMemFd, MEMRANGE_GET, &mro)) {
-		xfree(mrd);
+		free(mrd);
 		return NULL;
 	}
 	return mrd;
@@ -576,7 +576,7 @@ cleanMTRR()
 #ifdef DEBUG
 	sleep(10);
 #endif
-	xfree(mrd);
+	free(mrd);
 	return TRUE;
 }
 
@@ -594,7 +594,7 @@ freeRangeList(RangePtr range)
 	while (range) {
 		rp = range;
 		range = rp->next;
-		xfree(rp);
+		free(rp);
 	}
 }
 
@@ -679,7 +679,7 @@ findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp)
 			*p = rp;
 		}
 	}
-	xfree(mrd);
+	free(mrd);
 }
 
 /*
@@ -886,7 +886,7 @@ NetBSDsetWC(int screenNum, unsigned long base, unsigned long size, Bool enable,
 	n = 1;
 
 	if (i386_set_mtrr(mtrrp, &n) < 0) {
-		xfree(mtrrp);
+		free(mtrrp);
 		return NULL;
 	}
 	return mtrrp;
@@ -903,6 +903,6 @@ NetBSDundoWC(int screenNum, pointer list)
 	n = 1;
 	mtrrp->flags &= ~MTRR_VALID;
 	i386_set_mtrr(mtrrp, &n);
-	xfree(mtrrp);
+	free(mtrrp);
 }
 #endif
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index 0b6205f..9ccc289 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -192,7 +192,7 @@ sparcPromClose(void)
 	promFd = -1;
     }
     if (promOpio) {
-	xfree(promOpio);
+	free(promOpio);
 	promOpio = NULL;
     }
     promOpenCount = 0;
@@ -208,7 +208,7 @@ sparcPromInit(void)
     promFd = open("/dev/openprom", O_RDONLY, 0);
     if (promFd == -1)
 	return -1;
-    promOpio = (struct openpromio *)xalloc(4096);
+    promOpio = (struct openpromio *)malloc(4096);
     if (!promOpio) {
 	sparcPromClose();
 	return -1;
@@ -515,11 +515,11 @@ sparcPromNode2Pathname(sbusPromNodePtr pnode)
     char *ret;
 
     if (!pnode->node) return NULL;
-    ret = xalloc(4096);
+    ret = malloc(4096);
     if (!ret) return NULL;
     if (promWalkNode2Pathname(ret, promRootNode, promGetChild(promRootNode), pnode->node, 0))
 	return ret;
-    xfree(ret);
+    free(ret);
     return NULL;
 }
 
@@ -585,7 +585,7 @@ sparcPromPathname2Node(const char *pathName)
     char *name, *regstr, *p;
 
     i = strlen(pathName);
-    name = xalloc(i + 2);
+    name = malloc(i + 2);
     if (! name) return 0;
     strcpy (name, pathName);
     name [i + 1] = 0;
@@ -605,7 +605,7 @@ sparcPromPathname2Node(const char *pathName)
 	return 0;
     promGetSibling(0);
     i = promWalkPathname2Node(name + 1, regstr, promRootNode, 0);
-    xfree(name);
+    free(name);
     return i;
 }
 
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 0cf3507..2965b37 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -100,7 +100,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
 
     if (int10skip(options)) {
-	xfree(options);
+	free(options);
 	return NULL;
     }
 
@@ -290,7 +290,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
     dprint(0xc0000, 0x20);
 #endif
 
-    xfree(options);
+    free(options);
     return pInt;
 
 error3:
@@ -308,11 +308,11 @@ error2:
 error1:
     if (vMem)
 	munmap(vMem, SYS_BIOS - V_BIOS);
-    xfree(((linuxInt10Priv*)pInt->private)->alloc);
-    xfree(pInt->private);
+    free(((linuxInt10Priv*)pInt->private)->alloc);
+    free(pInt->private);
 error0:
-    xfree(options);
-    xfree(pInt);
+    free(options);
+    free(pInt);
     return NULL;
 }
 
@@ -399,9 +399,9 @@ xf86FreeInt10(xf86Int10InfoPtr pInt)
     shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
     if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
 	shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
-    xfree(((linuxInt10Priv*)pInt->private)->alloc);
-    xfree(pInt->private);
-    xfree(pInt);
+    free(((linuxInt10Priv*)pInt->private)->alloc);
+    free(pInt->private);
+    free(pInt);
 }
 
 void *
diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c
index 6143740..44db866 100644
--- a/hw/xfree86/os-support/linux/lnx_agp.c
+++ b/hw/xfree86/os-support/linux/lnx_agp.c
@@ -132,7 +132,7 @@ xf86GetAGPInfo(int screenNum)
 		return NULL;
 
 
-	if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+	if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
 		xf86DrvMsg(screenNum, X_ERROR,
 			   "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
 		return NULL;
diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
index 26a1742..bdd2639 100644
--- a/hw/xfree86/os-support/linux/lnx_video.c
+++ b/hw/xfree86/os-support/linux/lnx_video.c
@@ -182,7 +182,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
 
 		/* Found an overlapping region. Delete it. */
 		
-		wcr = xalloc(sizeof(*wcr));
+		wcr = malloc(sizeof(*wcr));
 		if (!wcr)
 			return NULL;
 		wcr->sentry.base = gent.base;
@@ -203,7 +203,7 @@ mtrr_cull_wc_region(int screenNum, unsigned long base, unsigned long size,
 			wcreturn = wcr;
 			gent.regnum--;
 		} else {
-			xfree(wcr);
+			free(wcr);
 			xf86DrvMsgVerb(screenNum, X_WARNING, 0,
 				   "Failed to remove MMIO "
 				   "write-combining range (0x%lx,0x%lx)\n",
@@ -263,7 +263,7 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
 	if (!mtrr_open(from == X_CONFIG ? 0 : 2))
 		return wcreturn;
 
-	*wcr = curwcr = xalloc(sizeof(**wcr));
+	*wcr = curwcr = malloc(sizeof(**wcr));
 	if (!curwcr)
 	    return wcreturn;
 
@@ -313,7 +313,7 @@ mtrr_add_wc_region(int screenNum, unsigned long base, unsigned long size,
 	}
 	else {
 	        *wcr = curwcr->next;
-		xfree(curwcr);
+		free(curwcr);
 		
 		/* Don't complain about the VGA region: MTRR fixed
 		   regions aren't currently supported, but might be in
@@ -339,7 +339,7 @@ mtrr_undo_wc_region(int screenNum, struct mtrr_wc_region *wcr)
 				ioctl(mtrr_fd, MTRRIOC_DEL_ENTRY, &p->sentry);
 			prev = p;
 			p = p->next;
-			xfree(prev);
+			free(prev);
 		}
 	}
 }
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c
index da57939..2e22bc3 100644
--- a/hw/xfree86/os-support/shared/posix_tty.c
+++ b/hw/xfree86/os-support/shared/posix_tty.c
@@ -131,14 +131,14 @@ xf86OpenSerial (pointer options)
 		xf86Msg (X_ERROR,
 			 "xf86OpenSerial: Cannot open device %s\n\t%s.\n",
 			 dev, strerror (errno));
-		xfree(dev);
+		free(dev);
 		return (-1);
 	}
 
 	if (!isatty (fd))
 	{
 		/* Allow non-tty devices to be opened. */
-		xfree(dev);
+		free(dev);
 		return (fd);
 	}
 
@@ -161,7 +161,7 @@ xf86OpenSerial (pointer options)
 	if (xf86SetSerial (fd, options) == -1)
 	{
 		SYSCALL (close (fd));
-		xfree(dev);
+		free(dev);
 		return (-1);
 	}
 
@@ -169,7 +169,7 @@ xf86OpenSerial (pointer options)
 	if (i == -1)
 	{
 		SYSCALL (close (fd));
-		xfree(dev);
+		free(dev);
 		return (-1);
 	}
 	i &= ~O_NONBLOCK;
@@ -177,10 +177,10 @@ xf86OpenSerial (pointer options)
 	if (i == -1)
 	{
 		SYSCALL (close (fd));
-		xfree(dev);
+		free(dev);
 		return (-1);
 	}
-	xfree(dev);
+	free(dev);
 	return (fd);
 }
 
diff --git a/hw/xfree86/os-support/shared/vidmem.c b/hw/xfree86/os-support/shared/vidmem.c
index 803ce09..89db4cc 100644
--- a/hw/xfree86/os-support/shared/vidmem.c
+++ b/hw/xfree86/os-support/shared/vidmem.c
@@ -128,7 +128,7 @@ removeMapping(VidMapPtr vp, MappingPtr mp)
 	for (i = 0; i < vp->numMappings; i++) {
 		if (vp->mappings[i] == mp) {
 			found = 1;
-			xfree(vp->mappings[i]);
+			free(vp->mappings[i]);
 		} else if (found) {
 			vp->mappings[i - 1] = vp->mappings[i];
 		}
@@ -156,7 +156,7 @@ checkMtrrOption(VidMapPtr vp)
 					options);
 		if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled))
 			vp->mtrrFrom = X_CONFIG;
-		xfree(options);
+		free(options);
 		vp->mtrrOptChecked = TRUE;
 	}
 }
diff --git a/hw/xfree86/os-support/solaris/sun_agp.c b/hw/xfree86/os-support/solaris/sun_agp.c
index e6a55a4..ccecd11 100644
--- a/hw/xfree86/os-support/solaris/sun_agp.c
+++ b/hw/xfree86/os-support/solaris/sun_agp.c
@@ -115,7 +115,7 @@ xf86GetAGPInfo(int screenNum)
 	if (!GARTInit(screenNum))
 		return NULL;
 
-	if ((info = xcalloc(sizeof(AgpInfo), 1)) == NULL) {
+	if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) {
 		xf86DrvMsg(screenNum, X_ERROR,
 		    "xf86GetAGPInfo: Failed to allocate AgpInfo\n");
 		return NULL;
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 346e994..2bbcb9c 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -65,7 +65,7 @@ xf86InitCursor(
     if (!xf86InitHardwareCursor(pScreen, infoPtr))
 	return FALSE;
 
-    ScreenPriv = xcalloc(1, sizeof(xf86CursorScreenRec));
+    ScreenPriv = calloc(1, sizeof(xf86CursorScreenRec));
     if (!ScreenPriv)
 	return FALSE;
 
@@ -144,8 +144,8 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen)
     pScrn->EnableDisableFBAccess = ScreenPriv->EnableDisableFBAccess;
     pScrn->SwitchMode = ScreenPriv->SwitchMode;
 
-    xfree(ScreenPriv->transparentData);
-    xfree(ScreenPriv);
+    free(ScreenPriv->transparentData);
+    free(ScreenPriv);
 
     return (*pScreen->CloseScreen)(i, pScreen);
 }
@@ -286,7 +286,7 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
 	&pScreen->devPrivates, xf86CursorScreenKey);
 
     if (pCurs->refcnt <= 1) {
-	xfree(dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen)));
+	free(dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen)));
 	dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL);
     }
 
@@ -439,13 +439,13 @@ xf86ForceHWCursor (ScreenPtr pScreen, Bool on)
 xf86CursorInfoPtr
 xf86CreateCursorInfoRec(void)
 {
-    return xcalloc(1, sizeof(xf86CursorInfoRec));
+    return calloc(1, sizeof(xf86CursorInfoRec));
 }
 
 void
 xf86DestroyCursorInfoRec(xf86CursorInfoPtr infoPtr)
 {
-    xfree(infoPtr);
+    free(infoPtr);
 }
 
 /**
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 4374e51..dd2b78f 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -247,7 +247,7 @@ RealizeCursorInterleave0(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     int words = size / (CUR_BITMAP_SCANLINE_PAD / 4);
 
 
-    if (!(mem = xcalloc(1, size)))
+    if (!(mem = calloc(1, size)))
 	return NULL;
 
     if (pCurs == NullCursor) {
@@ -354,8 +354,8 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
 	return NULL;
 
-    if (!(mem = xcalloc(1, size))) {
-	xfree(mem2);
+    if (!(mem = calloc(1, size))) {
+	free(mem2);
 	return NULL;
     }
 
@@ -379,7 +379,7 @@ RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* Free the uninterleaved cursor */
-    xfree(mem2);
+    free(mem2);
 
     return mem;
 }
@@ -397,8 +397,8 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
 	return NULL;
 
-    if (!(mem = xcalloc(1, size))) {
-	xfree(mem2);
+    if (!(mem = calloc(1, size))) {
+	free(mem2);
 	return NULL;
     }
 
@@ -414,7 +414,7 @@ RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* Free the uninterleaved cursor */
-    xfree(mem2);
+    free(mem2);
 
     return mem;
 }
@@ -432,8 +432,8 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
 	return NULL;
 
-    if (!(mem = xcalloc(1, size))) {
-	xfree(mem2);
+    if (!(mem = calloc(1, size))) {
+	free(mem2);
 	return NULL;
     }
 
@@ -449,7 +449,7 @@ RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* Free the uninterleaved cursor */
-    xfree(mem2);
+    free(mem2);
 
     return mem;
 }
@@ -467,8 +467,8 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
 	return NULL;
 
-    if (!(mem = xcalloc(1, size))) {
-	xfree(mem2);
+    if (!(mem = calloc(1, size))) {
+	free(mem2);
 	return NULL;
     }
 
@@ -484,7 +484,7 @@ RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* Free the uninterleaved cursor */
-    xfree(mem2);
+    free(mem2);
 
     return mem;
 }
@@ -502,8 +502,8 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     if (!(mem2 = RealizeCursorInterleave0(infoPtr, pCurs)))
 	return NULL;
 
-    if (!(mem = xcalloc(1, size))) {
-	xfree(mem2);
+    if (!(mem = calloc(1, size))) {
+	free(mem2);
 	return NULL;
     }
 
@@ -521,7 +521,7 @@ RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
     }
 
     /* Free the uninterleaved cursor */
-    xfree(mem2);
+    free(mem2);
 
     return mem;
 }
diff --git a/hw/xfree86/ramdac/xf86RamDac.c b/hw/xfree86/ramdac/xf86RamDac.c
index bd4f346..0015b76 100644
--- a/hw/xfree86/ramdac/xf86RamDac.c
+++ b/hw/xfree86/ramdac/xf86RamDac.c
@@ -41,7 +41,7 @@ RamDacCreateInfoRec(void)
 {
     RamDacRecPtr infoRec;
 
-    infoRec = xcalloc(1, sizeof(RamDacRec));
+    infoRec = calloc(1, sizeof(RamDacRec));
 
     return infoRec;
 }
@@ -51,7 +51,7 @@ RamDacHelperCreateInfoRec(void)
 {
     RamDacHelperRecPtr infoRec;
 
-    infoRec = xcalloc(1, sizeof(RamDacHelperRec));
+    infoRec = calloc(1, sizeof(RamDacHelperRec));
 
     return infoRec;
 }
@@ -59,13 +59,13 @@ RamDacHelperCreateInfoRec(void)
 void
 RamDacDestroyInfoRec(RamDacRecPtr infoRec)
 {
-    xfree(infoRec);
+    free(infoRec);
 }
 
 void
 RamDacHelperDestroyInfoRec(RamDacHelperRecPtr infoRec)
 {
-    xfree(infoRec);
+    free(infoRec);
 }
 
 Bool
@@ -133,11 +133,11 @@ RamDacFreeRec(ScrnInfoPtr pScrn)
 				(pScrn)->privates[RamDacGetScreenIndex()].ptr);
     
     if (ramdacHWPtr)
-	xfree(ramdacHWPtr);
+	free(ramdacHWPtr);
     ramdacHWPtr = NULL;
 
     if (ramdacScrPtr)
-	xfree(ramdacScrPtr);
+	free(ramdacScrPtr);
     ramdacScrPtr = NULL;
 }
 
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 1c81701..fd5f26c 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -165,7 +165,7 @@ ShadowFBInit2 (
     if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec)))
 	return FALSE;
 
-    if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec))))
+    if(!(pPriv = (ShadowScreenPtr)malloc(sizeof(ShadowScreenRec))))
 	return FALSE;
 
     dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv);
@@ -255,7 +255,7 @@ ShadowCloseScreen (int i, ScreenPtr pScreen)
         ps->Composite = pPriv->Composite;
     }
 
-    xfree((pointer)pPriv);
+    free((pointer)pPriv);
 
     return (*pScreen->CloseScreen) (i, pScreen);
 }
@@ -1010,7 +1010,7 @@ ShadowPolyRectangle(
 	    offset1 = offset2 >> 1;
 	    offset3 = offset2 - offset1;
 
-	    pBoxInit = (BoxPtr)xalloc(nRects * 4 * sizeof(BoxRec));
+	    pBoxInit = (BoxPtr)malloc(nRects * 4 * sizeof(BoxRec));
 	    pbox = pBoxInit;
 
 	    while(nRects--) {
@@ -1061,7 +1061,7 @@ ShadowPolyRectangle(
                 if(pPriv->preRefresh)
                     (*pPriv->preRefresh)(pPriv->pScrn, num, pBoxInit);
             } else {
-                xfree(pBoxInit);
+                free(pBoxInit);
             }                
 	}
     }
@@ -1073,7 +1073,7 @@ ShadowPolyRectangle(
     } else if(num) {
        if(pPriv->postRefresh)
           (*pPriv->postRefresh)(pPriv->pScrn, num, pBoxInit);
-       xfree(pBoxInit);
+       free(pBoxInit);
     }
     
     SHADOW_GC_OP_EPILOGUE(pGC);
diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 26f5911..9f9b743 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -164,7 +164,7 @@ vbeFree(vbeInfoPtr pVbe)
     /* If we have initalized int10 we ought to free it, too */
     if (pVbe->init_int10) 
 	xf86FreeInt10(pVbe->pInt10);
-    xfree(pVbe);
+    free(pVbe);
     return;
 }
 
@@ -264,7 +264,7 @@ vbeReadEDID(vbeInfoPtr pVbe)
     xf86ProcessOptions(screen, xf86Screens[screen]->options, options);
     xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe);
     xf86GetOptValBool(options, VBEOPT_NODDC, &noddc);
-    xfree(options);
+    free(options);
     if (novbe || noddc) return NULL;
     
     if (!vbeProbeDDC(pVbe)) goto error;
@@ -373,7 +373,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
     if (R16(pVbe->pInt10->ax) != 0x4f)
 	return (NULL);
 
-    block = xcalloc(sizeof(VbeInfoBlock), 1);
+    block = calloc(sizeof(VbeInfoBlock), 1);
     block->VESASignature[0] = ((char*)pVbe->memory)[0];
     block->VESASignature[1] = ((char*)pVbe->memory)[1];
     block->VESASignature[2] = ((char*)pVbe->memory)[2];
@@ -396,7 +396,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
     i = 0;
     while (modes[i] != 0xffff)
 	i++;
-    block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1);
+    block->VideoModePtr = malloc(sizeof(CARD16) * i + 1);
     memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i);
     block->VideoModePtr[i] = 0xffff;
 
@@ -425,14 +425,14 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
 void
 VBEFreeVBEInfo(VbeInfoBlock *block)
 {
-    xfree(block->OEMStringPtr);
-    xfree(block->VideoModePtr);
+    free(block->OEMStringPtr);
+    free(block->VideoModePtr);
     if (((unsigned)block->VESAVersion >> 8) >= 2) {
-	xfree(block->OemVendorNamePtr);
-	xfree(block->OemProductNamePtr);
-	xfree(block->OemProductRevPtr);
+	free(block->OemVendorNamePtr);
+	free(block->OemProductNamePtr);
+	free(block->OemProductRevPtr);
     }
-    xfree(block);
+    free(block);
 }
 
 Bool
@@ -528,7 +528,7 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
     if (R16(pVbe->pInt10->ax) != 0x4f)
 	return (NULL);
 
-    block = xcalloc(sizeof(VbeModeInfoBlock), 1);
+    block = calloc(sizeof(VbeModeInfoBlock), 1);
 
     block->ModeAttributes = *(CARD16*)pVbe->memory;
     block->WinAAttributes = ((char*)pVbe->memory)[2];
@@ -598,7 +598,7 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
 void
 VBEFreeModeInfo(VbeModeInfoBlock *block)
 {
-    xfree(block);
+    free(block);
 }
 
 Bool
@@ -884,7 +884,7 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
     if (set)
 	return (data);
 
-    data = xalloc(num * sizeof(CARD32));
+    data = malloc(num * sizeof(CARD32));
     memcpy(data, pVbe->memory, num * sizeof(CARD32));
 
     return (data);
@@ -918,7 +918,7 @@ VBEGetVBEpmi(vbeInfoPtr pVbe)
     if (R16(pVbe->pInt10->ax) != 0x4f)
 	return (NULL);
 
-    pmi = xalloc(sizeof(VBEpmi));
+    pmi = malloc(sizeof(VBEpmi));
     pmi->seg_tbl = R16(pVbe->pInt10->es);
     pmi->tbl_off = R16(pVbe->pInt10->di);
     pmi->tbl_len = R16(pVbe->pInt10->cx);
@@ -995,7 +995,7 @@ VBEVesaSaveRestore(vbeInfoPtr pVbe, vbeSaveRestorePtr vbe_sr,
 		vbe_sr->stateMode = -1; /* invalidate */
 		/* don't rely on the memory not being touched */
 		if (vbe_sr->pstate == NULL)
-		    vbe_sr->pstate = xalloc(vbe_sr->stateSize);
+		    vbe_sr->pstate = malloc(vbe_sr->stateSize);
 		memcpy(vbe_sr->pstate, vbe_sr->state, vbe_sr->stateSize);
 	    }
 	    ErrorF("VBESaveRestore done with success\n");
@@ -1099,7 +1099,7 @@ VBEInterpretPanelID(int scrnIndex, struct vbePanelID *data)
     pScrn->monitor->vrefresh[0].hi =
 	(float)mode->Clock*1000.0 / (float)mode->HTotal / (float)mode->VTotal;
 
-    xfree(mode);
+    free(mode);
 }
 
 struct vbePanelID *
diff --git a/hw/xfree86/vbe/vbe.h b/hw/xfree86/vbe/vbe.h
index b1ec5a9..3ebd440 100644
--- a/hw/xfree86/vbe/vbe.h
+++ b/hw/xfree86/vbe/vbe.h
@@ -282,7 +282,7 @@ extern _X_EXPORT int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits);
  */
 extern _X_EXPORT CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num,
 			     CARD32 *data, Bool secondary, Bool wait_retrace);
-#define VBEFreePaletteData(data)	xfree(data)
+#define VBEFreePaletteData(data)	free(data)
 
 /*
  * INT A
@@ -295,7 +295,7 @@ typedef struct _VBEpmi {
 } VBEpmi;
 
 extern _X_EXPORT VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe);
-#define VESAFreeVBEpmi(pmi)	xfree(pmi)
+#define VESAFreeVBEpmi(pmi)	free(pmi)
 
 /* high level helper functions */
 
diff --git a/hw/xfree86/vbe/vbeModes.c b/hw/xfree86/vbe/vbeModes.c
index 1a4d240..3f2cae5 100644
--- a/hw/xfree86/vbe/vbeModes.c
+++ b/hw/xfree86/vbe/vbeModes.c
@@ -402,7 +402,7 @@ VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe)
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		       "Attempting to use %dHz refresh for mode \"%s\" (%x)\n",
 		       (int)pMode->VRefresh, pMode->name, data->mode);
-	    data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1);
+	    data->block = calloc(sizeof(VbeCRTCInfoBlock), 1);
 	    data->block->HorizontalTotal = best->HTotal;
 	    data->block->HorizontalSyncStart = best->HSyncStart;
 	    data->block->HorizontalSyncEnd = best->HSyncEnd;
diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c
index 06eeb4c..dad71b9 100644
--- a/hw/xfree86/vgahw/vgaCmap.c
+++ b/hw/xfree86/vgahw/vgaCmap.c
@@ -235,9 +235,9 @@ vgaInstallColormap(pmap)
   else
     entries = pmap->pVisual->ColormapEntries;
 
-  ppix = (Pixel *)xalloc( entries * sizeof(Pixel));
-  prgb = (xrgb *)xalloc( entries * sizeof(xrgb));
-  defs = (xColorItem *)xalloc(entries * sizeof(xColorItem));
+  ppix = (Pixel *)malloc( entries * sizeof(Pixel));
+  prgb = (xrgb *)malloc( entries * sizeof(xrgb));
+  defs = (xColorItem *)malloc(entries * sizeof(xColorItem));
 
   if ( oldmap != NOMAPYET)
     WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
@@ -260,9 +260,9 @@ vgaInstallColormap(pmap)
 
   WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid);
   
-  xfree(ppix);
-  xfree(prgb);
-  xfree(defs);
+  free(ppix);
+  free(prgb);
+  free(defs);
 }
 
 
diff --git a/hw/xfree86/vgahw/vgaHW.c b/hw/xfree86/vgahw/vgaHW.c
index 004376b..3ae2dfa 100644
--- a/hw/xfree86/vgahw/vgaHW.c
+++ b/hw/xfree86/vgahw/vgaHW.c
@@ -968,21 +968,21 @@ vgaHWSaveFonts(ScrnInfoPtr scrninfp, vgaRegPtr save)
     hwp->writeGr(hwp, 0x06, 0x05);	/* set graphics */
 
 #if SAVE_FONT1
-    if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) {
+    if (hwp->FontInfo1 || (hwp->FontInfo1 = malloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x04);	/* write to plane 2 */
 	hwp->writeGr(hwp, 0x04, 0x02);	/* read plane 2 */
 	slowbcopy_frombus(hwp->Base, hwp->FontInfo1, FONT_AMOUNT);
     }
 #endif /* SAVE_FONT1 */
 #if SAVE_FONT2
-    if (hwp->FontInfo2 || (hwp->FontInfo2 = xalloc(FONT_AMOUNT))) {
+    if (hwp->FontInfo2 || (hwp->FontInfo2 = malloc(FONT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x08);	/* write to plane 3 */
 	hwp->writeGr(hwp, 0x04, 0x03);	/* read plane 3 */
 	slowbcopy_frombus(hwp->Base, hwp->FontInfo2, FONT_AMOUNT);
     }
 #endif /* SAVE_FONT2 */
 #if SAVE_TEXT
-    if (hwp->TextInfo || (hwp->TextInfo = xalloc(2 * TEXT_AMOUNT))) {
+    if (hwp->TextInfo || (hwp->TextInfo = malloc(2 * TEXT_AMOUNT))) {
 	hwp->writeSeq(hwp, 0x02, 0x01);	/* write to plane 0 */
 	hwp->writeGr(hwp, 0x04, 0x00);	/* read plane 0 */
 	slowbcopy_frombus(hwp->Base, hwp->TextInfo, TEXT_AMOUNT);
@@ -1480,7 +1480,7 @@ static void
 vgaHWFreeRegs(vgaRegPtr regp)
 {
     if (regp->CRTC)
-    	xfree (regp->CRTC);
+        free(regp->CRTC);
 
     regp->CRTC =
     regp->Sequencer =
@@ -1504,7 +1504,7 @@ vgaHWAllocRegs(vgaRegPtr regp)
          regp->numAttribute) == 0)
         return FALSE;
 
-    buf = xcalloc(regp->numCRTC +
+    buf = calloc(regp->numCRTC +
     		  regp->numSequencer +
 		  regp->numGraphics +
 		  regp->numAttribute, 1);
@@ -1643,7 +1643,7 @@ vgaHWGetHWRec(ScrnInfoPtr scrp)
 
     if ((!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->SavedReg)) ||
     	(!vgaHWAllocDefaultRegs(&VGAHWPTR(scrp)->ModeReg))) {
-        xfree(hwp);
+        free(hwp);
 	return FALSE;
     }
 
@@ -1726,14 +1726,14 @@ vgaHWFreeHWRec(ScrnInfoPtr scrp)
 	if (!hwp)
 	    return;
 
-	xfree(hwp->FontInfo1);
-	xfree(hwp->FontInfo2);
-	xfree(hwp->TextInfo);
+	free(hwp->FontInfo1);
+	free(hwp->FontInfo2);
+	free(hwp->TextInfo);
 
 	vgaHWFreeRegs (&hwp->ModeReg);
 	vgaHWFreeRegs (&hwp->SavedReg);
 
-	xfree(hwp);
+	free(hwp);
 	VGAHWPTRLVAL(scrp) = NULL;
     }
 }
@@ -1975,7 +1975,7 @@ vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
 	hwp->writeCrtc(hwp,0x15,save->cr15);
 	hwp->writeCrtc(hwp,0x12,save->cr12);
 	hwp->writeCrtc(hwp,0x03,save->cr03);
-	xfree(save);
+	free(save);
 	hwp->ddc = NULL;
 	break;
     default:
diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c
index ebba74e..75033bc 100644
--- a/hw/xfree86/xaa/xaaBitBlt.c
+++ b/hw/xfree86/xaa/xaaBitBlt.c
@@ -186,7 +186,7 @@ XAABitBlt(
     /* Do bit blitting */
     numRects = REGION_NUM_RECTS(&rgnDst);
     if (numRects && width && height) {
-	if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
+	if(!(pptSrc = (DDXPointPtr)malloc(numRects *
 						  sizeof(DDXPointRec)))) {
 	    REGION_UNINIT(pGC->pScreen, &rgnDst);
 	    if (freeSrcClip)
@@ -201,7 +201,7 @@ XAABitBlt(
 	}
 
 	(*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
-	xfree(pptSrc);
+	free(pptSrc);
     }
 
     prgnExposed = NULL;
diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c
index 6a898cd..1a03bfd 100644
--- a/hw/xfree86/xaa/xaaCpyArea.c
+++ b/hw/xfree86/xaa/xaaCpyArea.c
@@ -108,12 +108,12 @@ XAADoBitBlt(
 
 	if (nbox > 1) {
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
-	    pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+	    pptNew1 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
 	    if(!pptNew1) {
-	        xfree(pboxNew1);
+	        free(pboxNew1);
 	        return;
 	    }
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -145,14 +145,14 @@ XAADoBitBlt(
 
 	if (nbox > 1) {
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
-	    pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
+	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
+	    pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
 	    if(!pboxNew2 || !pptNew2) {
-		if (pptNew2) xfree(pptNew2);
-		if (pboxNew2) xfree(pboxNew2);
+		if (pptNew2) free(pptNew2);
+		if (pboxNew2) free(pboxNew2);
 		if (pboxNew1) {
-		    xfree(pptNew1);
-		    xfree(pboxNew1);
+		    free(pptNew1);
+		    free(pboxNew1);
 		}
 	        return;
 	    }
@@ -183,12 +183,12 @@ XAADoBitBlt(
 	xdir, ydir, pGC->alu, pGC->planemask);
  
     if (pboxNew2) {
-	xfree(pptNew2);
-	xfree(pboxNew2);
+	free(pptNew2);
+	free(pboxNew2);
     }
     if (pboxNew1) {
-	xfree(pptNew1);
-	xfree(pboxNew1);
+	free(pptNew1);
+	free(pboxNew1);
     }
 
 }
diff --git a/hw/xfree86/xaa/xaaCpyPlane.c b/hw/xfree86/xaa/xaaCpyPlane.c
index aa4c040..e3010ea 100644
--- a/hw/xfree86/xaa/xaaCpyPlane.c
+++ b/hw/xfree86/xaa/xaaCpyPlane.c
@@ -131,7 +131,7 @@ XAACopyPlaneNtoNColorExpand(
 	h = height = pbox->y2 - pbox->y1;
 	pitch = BitmapBytePad(width);
 
-	if(!(data = xcalloc(height, pitch)))
+	if(!(data = calloc(height, pitch)))
 	   goto ALLOC_FAILED;
 
 	dataPtr = data;
@@ -151,7 +151,7 @@ XAACopyPlaneNtoNColorExpand(
 		pbox->x1, pbox->y1, width, height, data, pitch, 0, 
 		pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
 	
-	xfree(data);
+	free(data);
 
 ALLOC_FAILED:
 
@@ -184,7 +184,7 @@ XAAPushPixelsSolidColorExpansion(
    TheRect.height = dy; 
 
    if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
-	pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
+	pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
 	if(!pClipBoxes) return;	
    } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
 
@@ -203,6 +203,6 @@ XAAPushPixelsSolidColorExpansion(
    }
 
     if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
-	xfree(pClipBoxes);
+	free(pClipBoxes);
 }
 
diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c
index 31c421e..d37c8ec 100644
--- a/hw/xfree86/xaa/xaaCpyWin.c
+++ b/hw/xfree86/xaa/xaaCpyWin.c
@@ -59,7 +59,7 @@ XAACopyWindow(
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(!nbox || 
-      !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+      !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
 	REGION_UNINIT(pScreen, &rgnDst);
 	return;
     }
@@ -77,6 +77,6 @@ XAACopyWindow(
     XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 
-    xfree(pptSrc);
+    free(pptSrc);
     REGION_UNINIT(pScreen, &rgnDst);
 }
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index e6083d5..8c9d0ed 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -158,7 +158,7 @@ XAAValidateGC(
 
     /* If our Ops are still the default ones we need to allocate new ones */
     if(pGC->ops == &XAAFallbackOps) {
-	if(!(pGCPriv->XAAOps = xalloc(sizeof(GCOps)))) {	
+	if(!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
 	    pGCPriv->XAAOps = &XAAFallbackOps;
 	    return;
 	}
@@ -241,10 +241,10 @@ XAADestroyGC(GCPtr pGC)
     XAA_GC_FUNC_PROLOGUE (pGC);
      
     if(pGCPriv->XAAOps != &XAAFallbackOps)
-	xfree(pGCPriv->XAAOps);
+	free(pGCPriv->XAAOps);
 
     if(pGCPriv->DashPattern)
-	xfree(pGCPriv->DashPattern);    
+	free(pGCPriv->DashPattern);
 
     (*pGC->funcs->DestroyGC)(pGC);
     XAA_GC_FUNC_EPILOGUE (pGC);
diff --git a/hw/xfree86/xaa/xaaImage.c b/hw/xfree86/xaa/xaaImage.c
index 4933bee..30caa2a 100644
--- a/hw/xfree86/xaa/xaaImage.c
+++ b/hw/xfree86/xaa/xaaImage.c
@@ -442,7 +442,7 @@ XAAPutImage(
 	TheRect.height = h; 
 
 	if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
-	    pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
+	    pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
 	    if(!pClipBoxes) return;	
 	} else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
 
@@ -514,7 +514,7 @@ XAAPutImage(
 	}
 
 	if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
-	    xfree(pClipBoxes);
+	    free(pClipBoxes);
     } else 
 	XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad, 
 				format, pImage);
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 7d4583d..0ccdae5 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -69,7 +69,7 @@ XAACreateInfoRec(void)
 {
     XAAInfoRecPtr infoRec;
 
-    infoRec = xcalloc(1, sizeof(XAAInfoRec));
+    infoRec = calloc(1, sizeof(XAAInfoRec));
     if(infoRec)
 	infoRec->CachePixelGranularity = -1;
 
@@ -85,12 +85,12 @@ XAADestroyInfoRec(XAAInfoRecPtr infoRec)
 	(*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
    
     if(infoRec->PreAllocMem)
-	xfree(infoRec->PreAllocMem);
+	free(infoRec->PreAllocMem);
 
     if(infoRec->PixmapCachePrivate)
-	xfree(infoRec->PixmapCachePrivate);
+	free(infoRec->PixmapCachePrivate);
 
-    xfree(infoRec);
+    free(infoRec);
 }
 
 
@@ -112,7 +112,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
 	return FALSE;
 
-    if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec))))
+    if (!(pScreenPriv = malloc(sizeof(XAAScreenRec))))
 	return FALSE;
 
     dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
@@ -181,7 +181,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
         XAASetupOverlay8_32Planar(pScreen);
 
-    infoRec->PreAllocMem = xalloc(MAX_PREALLOC_MEM);
+    infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM);
     if(infoRec->PreAllocMem)
     	infoRec->PreAllocSize = MAX_PREALLOC_MEM;
 
@@ -228,7 +228,7 @@ XAACloseScreen (int i, ScreenPtr pScreen)
 
     /* We leave it up to the client to free the XAAInfoRec */
 
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
 
     return (*pScreen->CloseScreen) (i, pScreen);
 }
@@ -372,7 +372,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
 	    goto BAILOUT;
 	}
 
-        if(!(pLink = xalloc(sizeof(PixmapLink)))) {
+        if(!(pLink = malloc(sizeof(PixmapLink)))) {
             xf86FreeOffscreenArea(area);
 	    goto BAILOUT;
 	}
@@ -382,7 +382,7 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
 	XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
 
 	if (!pPix) {
-	    xfree (pLink);
+	    free(pLink);
             xf86FreeOffscreenArea(area);
 	    goto BAILOUT;
 	}
@@ -436,7 +436,7 @@ XAADestroyPixmap(PixmapPtr pPix)
     if(pPix->refcnt == 1) {
         if(pPriv->flags & OFFSCREEN) {
 	    if(pPriv->flags & DGA_PIXMAP)
-	        xfree(pPriv->offscreenArea);
+	        free(pPriv->offscreenArea);
             else {
 	        FBAreaPtr area = pPriv->offscreenArea;
 		PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
@@ -454,12 +454,12 @@ XAADestroyPixmap(PixmapPtr pPix)
 
 	        xf86FreeOffscreenArea(area);
 	        pPriv->offscreenArea = NULL;
-	        xfree(pLink);
+	        free(pLink);
 	    } 
         }
 
         if(pPriv->freeData) { /* pixmaps that were once in video ram */
-	    xfree(pPix->devPrivate.ptr);
+	    free(pPix->devPrivate.ptr);
 	    pPix->devPrivate.ptr = NULL;
 	}
     }
@@ -551,7 +551,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
 	infoRec->UsingPixmapCache = state->UsingPixmapCache;	
 	infoRec->CanDoColor8x8 = state->CanDoColor8x8;	
 	infoRec->CanDoMono8x8 = state->CanDoMono8x8;
-	xfree(infoRec->dgaSaves);
+	free(infoRec->dgaSaves);
 	infoRec->dgaSaves = NULL;
     }
 
@@ -562,7 +562,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
 	XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
 	FBAreaPtr area;
 
-	if((area = xalloc(sizeof(FBArea)))) {
+	if((area = malloc(sizeof(FBArea)))) {
 	    area->pScreen = pScreen;
 	    area->box.x1 = 0;
 	    area->box.x2 = 0;
@@ -577,7 +577,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet)
 	    pixPriv->offscreenArea = area;
 
 	    if(!infoRec->dgaSaves) { /* save pixmap cache state */
-		SavedCacheStatePtr state = xalloc(sizeof(SavedCacheState));
+		SavedCacheStatePtr state = malloc(sizeof(SavedCacheState));
 	
 		state->UsingPixmapCache = infoRec->UsingPixmapCache;	
 		state->CanDoColor8x8 = infoRec->CanDoColor8x8;	
diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c
index 6f3d622..2f40c81 100644
--- a/hw/xfree86/xaa/xaaInitAccel.c
+++ b/hw/xfree86/xaa/xaaInitAccel.c
@@ -1476,7 +1476,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 	    infoRec->CachePixelGranularity *= 2;
     }
 
-    xfree(options);
+    free(options);
 
     if(!infoRec->CacheTile && infoRec->WritePixmapToCache)
 	infoRec->CacheTile = XAACacheTile;
diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c
index 6cef4bc..e017c22 100644
--- a/hw/xfree86/xaa/xaaLineMisc.c
+++ b/hw/xfree86/xaa/xaaLineMisc.c
@@ -75,7 +75,7 @@ XAAComputeDash(GCPtr pGC)
     Bool set;
 
     if(pGCPriv->DashPattern)
-	xfree(pGCPriv->DashPattern);
+	free(pGCPriv->DashPattern);
 
     pGCPriv->DashPattern = NULL;
     pGCPriv->DashLength = 0; 
@@ -93,7 +93,7 @@ XAAComputeDash(GCPtr pGC)
 				(PatternLength & (PatternLength - 1)))
 	return;
 
-    pGCPriv->DashPattern = xcalloc((PatternLength + 31) >> 5, 4);
+    pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
     if(!pGCPriv->DashPattern) return;
     pGCPriv->DashLength = PatternLength;
 
diff --git a/hw/xfree86/xaa/xaaNonTEText.c b/hw/xfree86/xaa/xaaNonTEText.c
index d32c0bb..072fe19 100644
--- a/hw/xfree86/xaa/xaaNonTEText.c
+++ b/hw/xfree86/xaa/xaaNonTEText.c
@@ -291,7 +291,7 @@ PolyGlyphBltAsSingleBitmap (
 
     pitch = (Right - Left + 31) >> 5;
     size = (pitch << 2) * (Bottom - Top);
-    block = xcalloc(1, size);
+    block = calloc(1, size);
 
     topLine = 10000; botLine = -10000;
 
@@ -349,7 +349,7 @@ PolyGlyphBltAsSingleBitmap (
 	nbox--; pbox++;
     }
 
-    xfree(block);
+    free(block);
 }
 
 static void
diff --git a/hw/xfree86/xaa/xaaOffscreen.c b/hw/xfree86/xaa/xaaOffscreen.c
index 7c9d532..cd0d9a9 100644
--- a/hw/xfree86/xaa/xaaOffscreen.c
+++ b/hw/xfree86/xaa/xaaOffscreen.c
@@ -79,7 +79,7 @@ XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
 
 	if(!tmpPix) {
 	    pPriv->offscreenArea = area;
-	    xfree(data);
+	    free(data);
 	    pLink = pLink->next;
 	    continue;
 	}
@@ -90,7 +90,7 @@ XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
 	(*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC, 
 		0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);	
 
-	xfree(data);
+	free(data);
 	tmpPix->devPrivate.ptr = NULL;
 
 	FreeScratchGC(pGC);
@@ -132,13 +132,13 @@ XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
     bitsPerPixel = pPix->drawable.bitsPerPixel;
 
     devKind = BitmapBytePad(width * bitsPerPixel);
-    if(!(data = xalloc(devKind * height)))
+    if(!(data = malloc(devKind * height)))
 	FatalError("Out of memory\n");
 
     tmpPix = GetScratchPixmapHeader(pScreen, width, height, 
 		pPix->drawable.depth, bitsPerPixel, devKind, data);
     if(!tmpPix) {
-	xfree(data);
+	free(data);
 	FatalError("Out of memory\n");
     }
 
diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c
index 2956a3d..2af8083 100644
--- a/hw/xfree86/xaa/xaaOverlay.c
+++ b/hw/xfree86/xaa/xaaOverlay.c
@@ -69,7 +69,7 @@ XAACopyWindow8_32(
     pbox = REGION_RECTS(&rgnDst);
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(!nbox || 
-      !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+      !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
 	REGION_UNINIT(pScreen, &rgnDst);
 	return;
     }
@@ -87,7 +87,7 @@ XAACopyWindow8_32(
     XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 
-    xfree(pptSrc);
+    free(pptSrc);
     REGION_UNINIT(pScreen, &rgnDst);
     if(freeReg) 
 	REGION_DESTROY(pScreen, borderClip);
diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c
index 8db816e..3b848ac 100644
--- a/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/hw/xfree86/xaa/xaaOverlayDF.c
@@ -173,7 +173,7 @@ XAAInitDualFramebufferOverlay(
     XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
     XAAOverlayPtr pOverPriv;
 
-    if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
+    if(!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
 	return FALSE;
 
     dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
@@ -350,7 +350,7 @@ XAAOverCopyWindow(
 
     nbox = REGION_NUM_RECTS(&rgnDst);
     if(nbox &&
-	(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
+	(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
 
 	pbox = REGION_RECTS(&rgnDst);
 	for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
@@ -368,7 +368,7 @@ XAAOverCopyWindow(
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
 	}
 
-	xfree(pptSrc);
+	free(pptSrc);
     }
 
     REGION_UNINIT(pScreen, &rgnDst);
@@ -380,7 +380,7 @@ XAAOverCopyWindow(
 	REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
 	nbox = REGION_NUM_RECTS(&rgnDst);
 	if(nbox &&
-	  (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))){
+	  (pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))){
 
 	    pbox = REGION_RECTS(&rgnDst);
 	    for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
@@ -391,7 +391,7 @@ XAAOverCopyWindow(
 	    SWITCH_DEPTH(pScrn->depth);
 	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
         		&(infoRec->ScratchGC), &rgnDst, pptSrc);
-	    xfree(pptSrc);
+	    free(pptSrc);
 	}
       }
       REGION_UNINIT(pScreen, &rgnDst);
diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c
index 7e3011b..e78a6f8 100644
--- a/hw/xfree86/xaa/xaaPCache.c
+++ b/hw/xfree86/xaa/xaaPCache.c
@@ -65,7 +65,7 @@ Enlist(CacheLinkPtr link, int x, int y, int w, int h)
 {
     CacheLinkPtr newLink;
 
-    newLink = xalloc(sizeof(CacheLink));
+    newLink = malloc(sizeof(CacheLink));
     newLink->next = link;
     newLink->x = x; newLink->y = y;
     newLink->w = w; newLink->h = h;	
@@ -80,7 +80,7 @@ Delist(CacheLinkPtr link) {
 
     if(link) {
 	ret = link->next;
-	xfree(link);
+	free(link);
     }    
     return ret;
 }
@@ -94,7 +94,7 @@ FreeList(CacheLinkPtr link) {
     while(link) {
 	tmp = link;
 	link = link->next;
-	xfree(tmp);
+	free(tmp);
     }
 }
 
@@ -145,19 +145,19 @@ FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
     if(!pPriv) return;
 
     if(pPriv->Info512)
-	xfree(pPriv->Info512);
+	free(pPriv->Info512);
     if(pPriv->Info256)
-	xfree(pPriv->Info256);
+	free(pPriv->Info256);
     if(pPriv->Info128)
-	xfree(pPriv->Info128);
+	free(pPriv->Info128);
     if(pPriv->InfoColor)
-	xfree(pPriv->InfoColor);
+	free(pPriv->InfoColor);
     if(pPriv->InfoMono)
-	xfree(pPriv->InfoMono);
+	free(pPriv->InfoMono);
     if(pPriv->InfoPartial)
-	xfree(pPriv->InfoPartial);
+	free(pPriv->InfoPartial);
      
-    xfree(pPriv);
+    free(pPriv);
 }
 
 void
@@ -212,7 +212,7 @@ ThinOutPartials(
 	    pCur->next = List8; List8 = pCur;
 	    Num8++;
 	} else {
-	   xfree(pCur);
+	   free(pCur);
 	}
 
 	pCur = next;
@@ -477,7 +477,7 @@ ConvertSomePartialsTo8x8(
 		    }	
 		}
 	   }	
-	   xfree(pCur);
+	   free(pCur);
 	}
 
 	pCur = next;
@@ -955,7 +955,7 @@ XAAInitPixmapCache(
     }
 
 
-    pCachePriv = xcalloc(1,sizeof(XAAPixmapCachePrivate));
+    pCachePriv = calloc(1,sizeof(XAAPixmapCachePrivate));
     if(!pCachePriv) {
 	if(Num512) FreeList(List512);
 	if(Num256) FreeList(List256);
@@ -969,21 +969,21 @@ XAAInitPixmapCache(
     infoRec->PixmapCachePrivate = (char*)pCachePriv;
 
     if(Num512) {
-	pCachePriv->Info512 = xcalloc(Num512,sizeof(XAACacheInfoRec));
+	pCachePriv->Info512 = calloc(Num512,sizeof(XAACacheInfoRec));
 	if(!pCachePriv->Info512) Num512 = 0;
 	if(Num512) TransferList(List512, pCachePriv->Info512, Num512);
 	FreeList(List512);
     	pCachePriv->Num512x512 = Num512;
     }
     if(Num256) {
-	pCachePriv->Info256 = xcalloc(Num256, sizeof(XAACacheInfoRec));
+	pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec));
 	if(!pCachePriv->Info256) Num256 = 0;
 	if(Num256) TransferList(List256, pCachePriv->Info256, Num256);
 	FreeList(List256);
     	pCachePriv->Num256x256 = Num256;
     }
     if(Num128) {
-	pCachePriv->Info128 = xcalloc(Num128, sizeof(XAACacheInfoRec));
+	pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec));
 	if(!pCachePriv->Info128) Num128 = 0;
 	if(Num128) TransferList(List128, pCachePriv->Info128, Num128);
 	FreeList(List128);
@@ -991,7 +991,7 @@ XAAInitPixmapCache(
     }
 
     if(NumPartial) {
-	pCachePriv->InfoPartial = xcalloc(NumPartial, sizeof(XAACacheInfoRec));
+	pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec));
 	if(!pCachePriv->InfoPartial) NumPartial = 0;
 	if(NumPartial) 
 	    TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
@@ -1000,7 +1000,7 @@ XAAInitPixmapCache(
     }
 
     if(NumColor) {
-	pCachePriv->InfoColor = xcalloc(NumColor, sizeof(XAACacheInfoRec));
+	pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec));
 	if(!pCachePriv->InfoColor) NumColor = 0;
 	if(NumColor) TransferList(ListColor, pCachePriv->InfoColor, NumColor);
 	FreeList(ListColor);
@@ -1008,7 +1008,7 @@ XAAInitPixmapCache(
     }
 
     if(NumMono) {
-	pCachePriv->InfoMono = xcalloc(NumMono, sizeof(XAACacheInfoRec));
+	pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec));
 	if(!pCachePriv->InfoMono) NumMono = 0;
 	if(NumMono) TransferList(ListMono, pCachePriv->InfoMono, NumMono);
 	FreeList(ListMono);
@@ -1557,7 +1557,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
 
    pad = BitmapBytePad(pCache->w * bpp);
    dwords = bytes_to_int32(pad);
-   dstPtr = data = (unsigned char*)xalloc(pad * pCache->h);
+   dstPtr = data = (unsigned char*)malloc(pad * pCache->h);
    srcPtr = (unsigned char*)pPix->devPrivate.ptr;
 
    if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
@@ -1588,7 +1588,7 @@ XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
 	pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
 	pad, bpp, pScrn->depth);
 
-   xfree(data);
+   free(data);
 
    return pCache;
 }
@@ -1970,7 +1970,7 @@ XAAWriteMono8x8PatternToCache(
 
    pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
 
-   data = (unsigned char*)xalloc(pad * pCache->h);
+   data = (unsigned char*)malloc(pad * pCache->h);
    if(!data) return;
 
    if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
@@ -1994,7 +1994,7 @@ XAAWriteMono8x8PatternToCache(
    (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, 
 	pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
 
-   xfree(data);
+   free(data);
 }
 
 void
@@ -2015,7 +2015,7 @@ XAAWriteColor8x8PatternToCache(
    if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
 	CARD32* ptr;
 	pad = BitmapBytePad(pCache->w);
-	data = (unsigned char*)xalloc(pad * pCache->h);
+	data = (unsigned char*)malloc(pad * pCache->h);
 	if(!data) return;
 
 	if(infoRec->Color8x8PatternFillFlags & 
@@ -2040,7 +2040,7 @@ XAAWriteColor8x8PatternToCache(
 	(*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y, 
 		pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
 
-   	xfree(data);
+        free(data);
 	return;
    } 
 
@@ -2049,7 +2049,7 @@ XAAWriteColor8x8PatternToCache(
    w = min(8,pPix->drawable.width);
    pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
 
-   data = (unsigned char*)xalloc(pad * pCache->h);
+   data = (unsigned char*)malloc(pad * pCache->h);
    if(!data) return;
 
    /* Write and expand horizontally. */
@@ -2088,7 +2088,7 @@ XAAWriteColor8x8PatternToCache(
    (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y, 
 	pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
 
-   xfree(data);   
+   free(data);
 }
 
 
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
index e059d3d..38ef21e 100644
--- a/hw/xfree86/xaa/xaaPict.c
+++ b/hw/xfree86/xaa/xaaPict.c
@@ -483,7 +483,7 @@ XAACompositeSrcCopy (PicturePtr pSrc,
 	REGION_UNINIT(pScreen, &region);
 	return;
     }
-    pptSrc = xalloc(sizeof(DDXPointRec) * nbox);
+    pptSrc = malloc(sizeof(DDXPointRec) * nbox);
     if (!pptSrc) {
 	REGION_UNINIT(pScreen, &region);
 	return;
@@ -501,7 +501,7 @@ XAACompositeSrcCopy (PicturePtr pSrc,
     XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
 		pptSrc);
 
-    xfree(pptSrc);
+    free(pptSrc);
     REGION_UNINIT(pScreen, &region);
     return;
 }
diff --git a/hw/xfree86/xaa/xaaStateChange.c b/hw/xfree86/xaa/xaaStateChange.c
index f332614..0e86e67 100644
--- a/hw/xfree86/xaa/xaaStateChange.c
+++ b/hw/xfree86/xaa/xaaStateChange.c
@@ -1500,7 +1500,7 @@ XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
    XAAStateWrapPtr pStatePriv;
    int i = 0;
    
-   if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE;
+   if(!(pStatePriv = malloc(sizeof(XAAStateWrapRec)))) return FALSE;
    dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
    pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
    pStatePriv->pScrn = pScrn;
diff --git a/hw/xfree86/xaa/xaaTEGlyph.c b/hw/xfree86/xaa/xaaTEGlyph.c
index 41e638e..510c387 100644
--- a/hw/xfree86/xaa/xaaTEGlyph.c
+++ b/hw/xfree86/xaa/xaaTEGlyph.c
@@ -301,7 +301,7 @@ EXPNAME(XAATEGlyphRenderer3)(
     } 
 
     dwords = ((3 * w + 31) >> 5) * h;
-    mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
+    mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
     if (!mem) return;
 
     (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
@@ -321,7 +321,7 @@ EXPNAME(XAATEGlyphRenderer3)(
 	    DrawTextScanline3(base, mem, w);
 	}
 
-    xfree(mem);
+    free(mem);
 
     if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
 			(dwords & 1)) {
@@ -478,7 +478,7 @@ EXPNAME(XAATEGlyphRendererScanline3)(
 
     w += skipleft;
     x -= skipleft;
-    mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
+    mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
     if (!mem) return;
 
    (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(	
@@ -495,7 +495,7 @@ EXPNAME(XAATEGlyphRendererScanline3)(
 	    bufferNo = 0;
     }
 
-    xfree(mem);
+    free(mem);
     
 THE_END:
 
diff --git a/hw/xfree86/xaa/xaaTEText.c b/hw/xfree86/xaa/xaaTEText.c
index fc44572..b182283 100644
--- a/hw/xfree86/xaa/xaaTEText.c
+++ b/hw/xfree86/xaa/xaaTEText.c
@@ -273,7 +273,7 @@ XAAGlyphBltTEColorExpansion(
 			    
 			    if (!fallbackBits) {
 				int fontHeight = Bottom - Top + 1;
-				fallbackBits = xcalloc (glyphWidth * fontHeight, 1);
+				fallbackBits = calloc(glyphWidth * fontHeight, 1);
 				if (!fallbackBits)
 				    return;
 			    }
@@ -300,7 +300,7 @@ XAAGlyphBltTEColorExpansion(
 		fg, bg, rop, planemask);
 
 	    if (fallbackBits)
-		xfree (fallbackBits);
+		free(fallbackBits);
 	}
 
 	nbox--; pbox++;
diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c
index d640988..2491492 100644
--- a/hw/xfree86/xaa/xaaWrapper.c
+++ b/hw/xfree86/xaa/xaaWrapper.c
@@ -271,7 +271,7 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f
     if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
 	return FALSE;
 
-    pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec));
+    pScrPriv = (xaaWrapperScrPrivPtr) malloc(sizeof (xaaWrapperScrPrivRec));
     if (!pScrPriv)
 	return FALSE;
 
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index 129c1d6..a9a70da 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -1709,7 +1709,7 @@ extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
 	    if(_pLink->pPix == pPix) { \
 		if(_prev) _prev->next = _pLink->next; \
 		else infoRec->OffscreenPixmaps = _pLink->next; \
-		xfree(_pLink); \
+		free(_pLink); \
 		break; \
 	    } \
 	    _prev = _pLink; \
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c
index 2e6de15..b3f0fc4 100644
--- a/hw/xnest/Color.c
+++ b/hw/xnest/Color.c
@@ -52,7 +52,7 @@ xnestCreateColormap(ColormapPtr pCmap)
   pVisual = pCmap->pVisual;
   ncolors = pVisual->ColormapEntries;
 
-  pCmap->devPriv = (pointer)xalloc(sizeof(xnestPrivColormap));
+  pCmap->devPriv = (pointer)malloc(sizeof(xnestPrivColormap));
   
   xnestColormapPriv(pCmap)->colormap = 
     XCreateColormap(xnestDisplay,
@@ -64,7 +64,7 @@ xnestCreateColormap(ColormapPtr pCmap)
   
   switch (pVisual->class) {
   case StaticGray: /* read only */
-    colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+    colors = (XColor *)malloc(ncolors * sizeof(XColor));
     for (i = 0; i < ncolors; i++)
       colors[i].pixel = i;
     XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
@@ -73,11 +73,11 @@ xnestCreateColormap(ColormapPtr pCmap)
       pCmap->red[i].co.local.green = colors[i].red;
       pCmap->red[i].co.local.blue = colors[i].red;
     }
-    xfree(colors);
+    free(colors);
     break;
 
   case StaticColor: /* read only */
-    colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+    colors = (XColor *)malloc(ncolors * sizeof(XColor));
     for (i = 0; i < ncolors; i++)
       colors[i].pixel = i;
     XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
@@ -86,11 +86,11 @@ xnestCreateColormap(ColormapPtr pCmap)
       pCmap->red[i].co.local.green = colors[i].green;
       pCmap->red[i].co.local.blue = colors[i].blue;
     }
-    xfree(colors);
+    free(colors);
     break;
     
   case TrueColor: /* read only */
-    colors = (XColor *)xalloc(ncolors * sizeof(XColor));
+    colors = (XColor *)malloc(ncolors * sizeof(XColor));
     red = green = blue = 0L;
     redInc = lowbit(pVisual->redMask);
     greenInc = lowbit(pVisual->greenMask);
@@ -110,7 +110,7 @@ xnestCreateColormap(ColormapPtr pCmap)
       pCmap->green[i].co.local.green = colors[i].green;
       pCmap->blue[i].co.local.blue = colors[i].blue;
     }
-    xfree(colors);
+    free(colors);
     break;
     
   case GrayScale: /* read and write */
@@ -130,7 +130,7 @@ void
 xnestDestroyColormap(ColormapPtr pCmap)
 {
   XFreeColormap(xnestDisplay, xnestColormap(pCmap));
-  xfree(pCmap->devPriv);
+  free(pCmap->devPriv);
 }
 
 #define SEARCH_PREDICATE \
@@ -194,13 +194,13 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
   xnestInstalledColormapWindows icws;
   int numWindows;
   
-  icws.cmapIDs = (Colormap *)xalloc(pScreen->maxInstalledCmaps *
+  icws.cmapIDs = (Colormap *)malloc(pScreen->maxInstalledCmaps *
 				    sizeof(Colormap));
   icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
   icws.numWindows = 0;
   WalkTree(pScreen, xnestCountInstalledColormapWindows, (pointer)&icws);
   if (icws.numWindows) {
-    icws.windows = (Window *)xalloc((icws.numWindows + 1) * sizeof(Window));
+    icws.windows = (Window *)malloc((icws.numWindows + 1) * sizeof(Window));
     icws.index = 0;
     WalkTree(pScreen, xnestGetInstalledColormapWindows, (pointer)&icws);
     icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
@@ -211,22 +211,22 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
     numWindows = 0;
   }
   
-  xfree(icws.cmapIDs);
+  free(icws.cmapIDs);
   
   if (!xnestSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
     if (xnestOldInstalledColormapWindows)
-      xfree(xnestOldInstalledColormapWindows);
+      free(xnestOldInstalledColormapWindows);
 
 #ifdef _XSERVER64
     {
       int i;
-      Window64 *windows = (Window64 *)xalloc(numWindows * sizeof(Window64));
+      Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64));
 
       for(i = 0; i < numWindows; ++i)
 	  windows[i] = icws.windows[i];
       XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
 			    windows, numWindows);
-      xfree(windows);
+      free(windows);
     }
 #else
     XSetWMColormapWindows(xnestDisplay, xnestDefaultWindows[pScreen->myNum],
@@ -264,14 +264,14 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
 #endif /* DUMB_WINDOW_MANAGERS */
   }
   else
-    if (icws.windows) xfree(icws.windows);
+    if (icws.windows) free(icws.windows);
 }
 
 void
 xnestSetScreenSaverColormapWindow(ScreenPtr pScreen)
 {
   if (xnestOldInstalledColormapWindows)
-    xfree(xnestOldInstalledColormapWindows);
+    free(xnestOldInstalledColormapWindows);
   
 #ifdef _XSERVER64
   {
@@ -392,7 +392,7 @@ xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
 #ifdef _XSERVER64
   {
     int i;
-    XColor *pColors64 = (XColor *)xalloc(nColors * sizeof(XColor) );
+    XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) );
 
     for(i = 0; i < nColors; ++i)
     {
@@ -403,7 +403,7 @@ xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
       pColors64[i].flags = pColors[i].flags;
     }
     XStoreColors(xnestDisplay, xnestColormap(pCmap), pColors64, nColors);
-    xfree(pColors64);
+    free(pColors64);
   }
 #else
     XStoreColors(xnestDisplay, xnestColormap(pCmap),
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c
index 12f47e7..9ae2102 100644
--- a/hw/xnest/Cursor.c
+++ b/hw/xnest/Cursor.c
@@ -107,7 +107,7 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
   bg_color.green = pCursor->backGreen;
   bg_color.blue = pCursor->backBlue;
 
-  xnestSetCursorPriv(pCursor, pScreen, xalloc(sizeof(xnestPrivCursor)));
+  xnestSetCursorPriv(pCursor, pScreen, malloc(sizeof(xnestPrivCursor)));
   xnestCursor(pCursor, pScreen) = 
     XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color,
 			pCursor->bits->xhot, pCursor->bits->yhot);
@@ -122,7 +122,7 @@ Bool
 xnestUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
 {
   XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen));
-  xfree(xnestGetCursorPriv(pCursor, pScreen));
+  free(xnestGetCursorPriv(pCursor, pScreen));
   return True;
 }
 
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index 0129041..b78aff5 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -101,7 +101,7 @@ xnestOpenDisplay(int argc, char *argv[])
   }
   
   xnestNumDefaultColormaps = xnestNumVisuals;
-  xnestDefaultColormaps = (Colormap *)xalloc(xnestNumDefaultColormaps *
+  xnestDefaultColormaps = (Colormap *)malloc(xnestNumDefaultColormaps *
 					     sizeof(Colormap));
   for (i = 0; i < xnestNumDefaultColormaps; i++)
     xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
@@ -185,7 +185,7 @@ xnestCloseDisplay(void)
     the display connection.  There is no need to generate extra protocol.
     */
 
-  xfree(xnestDefaultColormaps);
+  free(xnestDefaultColormaps);
   XFree(xnestVisuals);
   XFree(xnestDepths);
   XFree(xnestPixmapFormats);
diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c
index 7b388f0..f1ccd7e 100644
--- a/hw/xnest/Font.c
+++ b/hw/xnest/Font.c
@@ -62,7 +62,7 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont)
 
   if (!name) return False;
 
-  priv = (pointer)xalloc(sizeof(xnestPrivFont));  
+  priv = (pointer)malloc(sizeof(xnestPrivFont));
   FontSetPrivate(pFont, xnestFontPrivateIndex, priv);
   
   xnestFontPriv(pFont)->font_struct = XLoadQueryFont(xnestDisplay, name);
@@ -79,7 +79,7 @@ xnestUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
   if (xnestFontPriv(pFont)) {
     if (xnestFontStruct(pFont)) 
       XFreeFont(xnestDisplay, xnestFontStruct(pFont));
-    xfree(xnestFontPriv(pFont));
+    free(xnestFontPriv(pFont));
     FontSetPrivate(pFont, xnestFontPrivateIndex, NULL);
   }
   return True;
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 65425e9..4082bfc 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -212,7 +212,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
     case CT_REGION:
       nRects = REGION_NUM_RECTS((RegionPtr)pValue);
       size = nRects * sizeof(*pRects);
-      pRects = (XRectangle *) xalloc(size);
+      pRects = (XRectangle *) malloc(size);
       pBox = REGION_RECTS((RegionPtr)pValue);
       for (i = nRects; i-- > 0; ) {
 	pRects[i].x = pBox[i].x1;
@@ -222,7 +222,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
       }
       XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
 			 pRects, nRects, Unsorted);
-      xfree((char *) pRects);
+      free((char *) pRects);
       break;
 
     case CT_PIXMAP:
@@ -279,7 +279,7 @@ xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
        */
       pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nRects,
 						  (xRectangle *)pValue, type);
-      xfree(pValue);
+      free(pValue);
       pValue = pGC->clientClip;
       type = CT_REGION;
 
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 1835c70..570866b 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -136,7 +136,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
 				     max_keycode - min_keycode + 1,
 				     &mapWidth);
 	len = (max_keycode - min_keycode + 1) * mapWidth;
-	keymap = (KeySym *)xalloc(len * sizeof(KeySym));
+	keymap = (KeySym *)malloc(len * sizeof(KeySym));
 	for(i = 0; i < len; ++i)
 	  keymap[i] = keymap64[i];
 	XFree(keymap64);
@@ -168,7 +168,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
 			       xnestBell, xnestChangeKeyboardControl);
       XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
       XkbFreeKeyboard(xkb, 0, False);
-      xfree(keymap);
+      free(keymap);
       break;
     case DEVICE_ON: 
       xnestEventMask |= XNEST_KEYBOARD_EVENT_MASK;
@@ -193,7 +193,7 @@ XkbError:
 
   InitKeyboardDeviceStruct(pDev, NULL,
                            xnestBell, xnestChangeKeyboardControl);
-  xfree(keymap);
+  free(keymap);
   return Success;
 }
 
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 676a2ba..583f877 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -79,7 +79,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
     return TRUE;
   XFreePixmap(xnestDisplay, xnestPixmap(pPixmap));
   dixFreePrivates(pPixmap->devPrivates);
-  xfree(pPixmap);
+  free(pPixmap);
   return TRUE;
 }
 
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index ca903d7..8c1c244 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -151,13 +151,13 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
   if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC)))
     return False;
 
-  visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
+  visuals = (VisualPtr)malloc(xnestNumVisuals * sizeof(VisualRec));
   numVisuals = 0;
 
-  depths = (DepthPtr)xalloc(MAXDEPTH * sizeof(DepthRec));
+  depths = (DepthPtr)malloc(MAXDEPTH * sizeof(DepthRec));
   depths[0].depth = 1;
   depths[0].numVids = 0;
-  depths[0].vids = (VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+  depths[0].vids = (VisualID *)malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
   numDepths = 1;
 
   for (i = 0; i < xnestNumVisuals; i++) {
@@ -203,7 +203,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
       depths[depthIndex].depth = xnestVisuals[i].depth;
       depths[depthIndex].numVids = 0;
       depths[depthIndex].vids = 
-	(VisualID *)xalloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
+	(VisualID *)malloc(MAXVISUALSPERDEPTH * sizeof(VisualID));
       numDepths++;
     }
     if (depths[depthIndex].numVids >= MAXVISUALSPERDEPTH) {
@@ -215,7 +215,7 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
     
     numVisuals++;
   }
-  visuals = (VisualPtr)xrealloc(visuals, numVisuals * sizeof(VisualRec));
+  visuals = (VisualPtr)realloc(visuals, numVisuals * sizeof(VisualRec));
 
   defaultVisual = visuals[xnestDefaultVisualIndex].vid;
   rootDepth = visuals[xnestDefaultVisualIndex].nplanes;
@@ -407,10 +407,10 @@ xnestCloseScreen(int index, ScreenPtr pScreen)
   int i;
   
   for (i = 0; i < pScreen->numDepths; i++)
-    xfree(pScreen->allowedDepths[i].vids);
-  xfree(pScreen->allowedDepths);
-  xfree(pScreen->visuals);
-  xfree(pScreen->devPrivate);
+    free(pScreen->allowedDepths[i].vids);
+  free(pScreen->allowedDepths);
+  free(pScreen->visuals);
+  free(pScreen->devPrivate);
 
   /*
     If xnestDoFullGeneration all x resources will be destroyed upon closing
diff --git a/hw/xquartz/GL/glcontextmodes.c b/hw/xquartz/GL/glcontextmodes.c
index 326c8b2..eee7103 100644
--- a/hw/xquartz/GL/glcontextmodes.c
+++ b/hw/xquartz/GL/glcontextmodes.c
@@ -53,14 +53,14 @@
 # ifdef XFree86Server
 # include <os.h>
 # include <string.h>
-#  define _mesa_malloc(b) xalloc(b)
-#  define _mesa_free(m)   xfree(m)
+#  define _mesa_malloc(b) malloc(b)
+#  define _mesa_free(m)   free(m)
 #  define _mesa_memset   memset
 # else
 #  include <X11/Xlibint.h>
 #  define _mesa_memset memset
 #  define _mesa_malloc(b) Xmalloc(b)
-#  define _mesa_free(m) Xfree(m)
+#  define _mesa_free(m) free(m)
 # endif /* XFree86Server */
 #endif /* !defined(IN_MINI_GLX) */
 
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 8092cfa..f769ff2 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -222,7 +222,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
   
     GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
     
-    context = xcalloc(1, sizeof (__GLXAquaContext));
+    context = calloc(1, sizeof (__GLXAquaContext));
     
     if (context == NULL)
 	return NULL;
@@ -241,7 +241,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
     context->pixelFormat = makeFormat(conf);
     
     if (!context->pixelFormat) {
-        xfree(context);
+        free(context);
         return NULL;
     }
 
@@ -253,7 +253,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
     if (gl_err != 0) {
 	ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
 	CGLDestroyPixelFormat(context->pixelFormat);
-	xfree(context);
+	free(context);
 	return NULL;
     }
     
@@ -286,7 +286,7 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
       if (context->pixelFormat != NULL)
 	  CGLDestroyPixelFormat(context->pixelFormat);
       
-      xfree(context);
+      free(context);
     }
 }
 
@@ -566,7 +566,7 @@ static void __glXAquaScreenDestroy(__GLXscreen *screen) {
     GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
     __glXScreenDestroy(screen);
 
-    xfree(screen);
+    free(screen);
 }
 
 /* This is called by __glXInitScreens(). */
@@ -578,7 +578,7 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
     if (pScreen == NULL) 
 	return NULL;
 
-    screen = xcalloc(1, sizeof *screen);
+    screen = calloc(1, sizeof *screen);
 
     if(NULL == screen)
 	return NULL;
@@ -635,7 +635,7 @@ static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
      *to validate the test, beyond using gdb with print.
      */
 
-    xfree(glxPriv);
+    free(glxPriv);
 }
 
 static __GLXdrawable *
@@ -648,7 +648,7 @@ __glXAquaScreenCreateDrawable(ClientPtr client,
 			      __GLXconfig *conf) {
   __GLXAquaDrawable *glxPriv;
 
-  glxPriv = xalloc(sizeof *glxPriv);
+  glxPriv = malloc(sizeof *glxPriv);
 
   if(glxPriv == NULL)
       return NULL;
@@ -656,7 +656,7 @@ __glXAquaScreenCreateDrawable(ClientPtr client,
   memset(glxPriv, 0, sizeof *glxPriv);
 
   if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
-    xfree(glxPriv);
+    free(glxPriv);
     return NULL;
   }
 
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index cecc902..b209b76 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -115,7 +115,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
     if(numConfigsPtr)
         *numConfigsPtr = numConfigs; 
     
-    visualConfigs = xcalloc(sizeof(*visualConfigs), numConfigs);
+    visualConfigs = calloc(sizeof(*visualConfigs), numConfigs);
     
     if(NULL == visualConfigs) {
         ErrorF("xcalloc failure when allocating visualConfigs\n");
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 15c86de..8750f5d 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -229,7 +229,7 @@ WMFreeClient (pointer data, XID id) {
         }
         updateEventMask (pHead);
     }
-    xfree ((pointer) pEvent);
+    free((pointer) pEvent);
     return 1;
 }
 
@@ -242,9 +242,9 @@ WMFreeEvents (pointer data, XID id) {
     for (pCur = *pHead; pCur; pCur = pNext) {
         pNext = pCur->next;
         FreeResource (pCur->clientResource, ClientType);
-        xfree ((pointer) pCur);
+        free((pointer) pCur);
     }
-    xfree ((pointer) pHead);
+    free((pointer) pHead);
     eventMask = 0;
     return 1;
 }
@@ -274,7 +274,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
         }
 
         /* build the entry */
-        pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
+        pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
         if (!pNewEvent)
             return BadAlloc;
         pNewEvent->next = 0;
@@ -296,7 +296,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
          */
         if (i != Success || !pHead)
         {
-            pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
+            pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
             if (!pHead ||
                 !AddResource (eventResource, EventType, (pointer)pHead))
             {
@@ -323,7 +323,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
                     pNewEvent->next = pEvent->next;
                 else
                     *pHead = pEvent->next;
-                xfree (pEvent);
+                free(pEvent);
                 updateEventMask (pHead);
             }
         }
@@ -414,8 +414,8 @@ ProcAppleWMSetWindowMenu(
     REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq);
 
     nitems = stuff->nitems;
-    items = xalloc (sizeof (char *) * nitems);
-    shortcuts = xalloc (sizeof (char) * nitems);
+    items = malloc(sizeof (char *) * nitems);
+    shortcuts = malloc(sizeof (char) * nitems);
 
     max_len = (stuff->length << 2) - sizeof(xAppleWMSetWindowMenuReq);
     bytes = (char *) &stuff[1];
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 1fb158b..580fe4a 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -194,7 +194,7 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
     }
 
     // allocate space for private per screen storage
-    dfb = xalloc(sizeof(DarwinFramebufferRec));
+    dfb = malloc(sizeof(DarwinFramebufferRec));
 
     // SCREEN_PRIV(pScreen) = dfb;
     dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 1de7af6..c3154b9 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -94,7 +94,7 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
 
     if (pseudoramiXNumScreens == pseudoramiXScreensAllocated) {
         pseudoramiXScreensAllocated += pseudoramiXScreensAllocated + 1;
-        pseudoramiXScreens = xrealloc(pseudoramiXScreens,
+        pseudoramiXScreens = realloc(pseudoramiXScreens,
                                       pseudoramiXScreensAllocated *
                                       sizeof(PseudoramiXScreenRec));
     }
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index a8c0d4b..462be87 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -122,7 +122,7 @@ Bool QuartzAddScreen(
     ScreenPtr pScreen)
 {
     // allocate space for private per screen Quartz specific storage
-    QuartzScreenPtr displayInfo = xcalloc(sizeof(QuartzScreenRec), 1);
+    QuartzScreenPtr displayInfo = calloc(sizeof(QuartzScreenRec), 1);
 
     // QUARTZ_PRIV(pScreen) = displayInfo;
     dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo);
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 0a58b29..3b14581 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -205,7 +205,7 @@ DRIScreenInit(ScreenPtr pScreen)
     DRIScreenPrivPtr    pDRIPriv;
     int                 i;
 
-    pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec));
+    pDRIPriv = (DRIScreenPrivPtr) calloc(1, sizeof(DRIScreenPrivRec));
     if (!pDRIPriv) {
 	dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
         return FALSE;
@@ -269,7 +269,7 @@ DRICloseScreen(ScreenPtr pScreen)
     DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
 
     if (pDRIPriv && pDRIPriv->directRenderingSupport) {
-        xfree(pDRIPriv);
+        free(pDRIPriv);
 	dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL);
     }
 }
@@ -381,7 +381,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
 	xp_window_changes wc;
 	
 	/* allocate a DRI Window Private record */
-	if (!(pDRIDrawablePriv = xalloc(sizeof(*pDRIDrawablePriv)))) {
+	if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) {
 	    return NULL;
 	}
 	
@@ -395,7 +395,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
 	wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
 
 	if (wid == 0) {
-	    xfree(pDRIDrawablePriv);
+	    free(pDRIDrawablePriv);
 	    return NULL;
 	}
 	
@@ -403,7 +403,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
 	err = xp_create_surface(wid, &pDRIDrawablePriv->sid);
 
 	if (err != Success) {
-	    xfree(pDRIDrawablePriv);
+	    free(pDRIDrawablePriv);
 	    return NULL;
 	}
 
@@ -414,7 +414,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin, xp_window_id *widPtr)
 
 	if (err != Success) {
 	    xp_destroy_surface(pDRIDrawablePriv->sid);
-	    xfree(pDRIDrawablePriv);
+	    free(pDRIDrawablePriv);
 	    return NULL;
 	}
 
@@ -439,7 +439,7 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
 	xp_error err;
 
 	/* allocate a DRI Window Private record */
-	if (!(pDRIDrawablePriv = xcalloc(1, sizeof(*pDRIDrawablePriv)))) {
+	if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) {
 	    return NULL;
 	}
 	
@@ -454,7 +454,7 @@ CreateSurfaceForPixmap(ScreenPtr pScreen, PixmapPtr pPix) {
 	
 	err = xp_create_surface(0, &pDRIDrawablePriv->sid);
 	if (err != Success) {
-	    xfree(pDRIDrawablePriv);
+	    free(pDRIDrawablePriv);
 	    return NULL;
 	}
 
@@ -519,7 +519,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
                                     client_id, key);
             if (err != Success) {
                 xp_destroy_surface(pDRIDrawablePriv->sid);
-                xfree(pDRIDrawablePriv);
+                free(pDRIDrawablePriv);
 		
 		/* 
 		 * Now set the dix privates to NULL that were previously set.
@@ -637,7 +637,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
     if (pDRIDrawablePriv->notifiers != NULL)
         x_hook_free(pDRIDrawablePriv->notifiers);
 
-    xfree(pDRIDrawablePriv);
+    free(pDRIDrawablePriv);
 
     if (pDrawable->type == DRAWABLE_WINDOW) {
 	dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL);
@@ -828,7 +828,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
 
     pPix = (PixmapPtr)pDrawable;
 
-    shared = xalloc(sizeof(*shared));
+    shared = malloc(sizeof(*shared));
     if(NULL == shared) {
         FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
     }
@@ -856,7 +856,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
                           S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
     
     if(-1 == shared->fd) {
-	xfree(shared);
+	free(shared);
         return FALSE;
     }   
     
@@ -866,7 +866,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
 	ErrorF("failed to ftruncate (extend) file.");
 	shm_unlink(shared->shmPath);
 	close(shared->fd);
-	xfree(shared);
+	free(shared);
 	return FALSE;
     }
 
@@ -878,7 +878,7 @@ Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
 	ErrorF("failed to mmap shared memory.");
 	shm_unlink(shared->shmPath);
 	close(shared->fd);
-	xfree(shared);
+	free(shared);
 	return FALSE;
     }
     
@@ -938,7 +938,7 @@ DRIFreePixmapImp(DrawablePtr pDrawable) {
     close(shared->fd);
     munmap(shared->buffer, shared->length);
     shm_unlink(shared->shmPath);
-    xfree(shared);
+    free(shared);
 
     dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, (pointer)NULL);
 
diff --git a/hw/xquartz/xpr/driWrap.c b/hw/xquartz/xpr/driWrap.c
index 8c57fd4..f1a5c83 100644
--- a/hw/xquartz/xpr/driWrap.c
+++ b/hw/xquartz/xpr/driWrap.c
@@ -533,7 +533,7 @@ DRIWrapInit(ScreenPtr pScreen) {
     if(!dixRequestPrivate(driWrapScreenKey, sizeof(DRIWrapScreenRec)))
 	return FALSE;
     
-    pScreenPriv = xalloc(sizeof(*pScreenPriv));
+    pScreenPriv = malloc(sizeof(*pScreenPriv));
 
     if(NULL == pScreenPriv)
 	return FALSE;
diff --git a/hw/xquartz/xpr/x-hook.c b/hw/xquartz/xpr/x-hook.c
index 5b850fe..d9f0115 100644
--- a/hw/xquartz/xpr/x-hook.c
+++ b/hw/xquartz/xpr/x-hook.c
@@ -83,8 +83,8 @@ X_PFX (hook_run) (x_list *lst, void *arg)
         return;
 
     length = X_PFX (list_length) (lst);
-    fun = xalloc (sizeof (x_hook_function *) * length);
-    data = xalloc (sizeof (void *) * length);
+    fun = malloc(sizeof (x_hook_function *) * length);
+    data = malloc(sizeof (void *) * length);
 
     if(!fun || !data) {
         FatalError("Failed to allocate memory in %s\n", __func__);
@@ -102,8 +102,8 @@ X_PFX (hook_run) (x_list *lst, void *arg)
 	(*fun[i]) (arg, data[i]);
     }
     
-    xfree(fun);
-    xfree(data);
+    free(fun);
+    free(data);
 }
 
 X_EXTERN void
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index fbaf825..c1c8b20 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -95,7 +95,7 @@ load_cursor(CursorPtr src, int screen)
         const uint32_t *be_data=(uint32_t *) src->bits->argb;
         unsigned i;
         rowbytes = src->bits->width * sizeof (CARD32);
-        data = xalloc(rowbytes * src->bits->height);
+        data = malloc(rowbytes * src->bits->height);
         if(!data) {
             FatalError("Failed to allocate memory in %s\n", __func__);
         }
@@ -121,7 +121,7 @@ load_cursor(CursorPtr src, int screen)
 
         /* round up to 8 pixel boundary so we can convert whole bytes */
         rowbytes = ((src->bits->width * 4) + 31) & ~31;
-        data = xalloc(rowbytes * src->bits->height);
+        data = malloc(rowbytes * src->bits->height);
         if(!data) {
             FatalError("Failed to allocate memory in %s\n", __func__);
         }
@@ -174,7 +174,7 @@ load_cursor(CursorPtr src, int screen)
     }
 
     err = xp_set_cursor(width, height, hot_x, hot_y, data, rowbytes);
-    xfree(data);
+    free(data);
     return err == Success;
 }
 
@@ -360,7 +360,7 @@ QuartzInitCursor(ScreenPtr pScreen)
     if (!miDCInitialize(pScreen, &quartzScreenFuncsRec))
         return FALSE;
 
-    ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec));
+    ScreenPriv = calloc(1, sizeof(QuartzCursorScreenRec));
     if (ScreenPriv == NULL)
         return FALSE;
 
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index 735b2ba..d574721 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -195,7 +195,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
         return;
     }
 
-    displayList = xalloc(displayCount * sizeof(CGDirectDisplayID));
+    displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
     if(!displayList)
         FatalError("Unable to allocate memory for list of displays.\n");
     CGGetActiveDisplayList(displayCount, displayList, &displayCount);
@@ -232,7 +232,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
                              frame.size.width, frame.size.height);
     }
 
-    xfree(displayList);
+    free(displayList);
 }
 
 /*
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index c12cd1f..5e0e917 100755
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -420,7 +420,7 @@ glxWinScreenDestroy(__GLXscreen *screen)
 {
     GLWIN_DEBUG_MSG("glxWinScreenDestroy(%p)", screen);
     __glXScreenDestroy(screen);
-    xfree(screen);
+    free(screen);
 }
 
 static int
@@ -442,7 +442,7 @@ glxLogExtensions(const char *prefix, const char *extensions)
 {
   int length = 0;
   char *strl;
-  char *str = xalloc(strlen(extensions) + 1);
+  char *str = malloc(strlen(extensions) + 1);
 
   if (str == NULL)
     {
@@ -480,7 +480,7 @@ glxLogExtensions(const char *prefix, const char *extensions)
 
   ErrorF("\n");
 
-  xfree(str);
+  free(str);
 }
 
 /* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */
@@ -507,7 +507,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
         return NULL;
       }
 
-    screen = xcalloc(1, sizeof(glxWinScreen));
+    screen = calloc(1, sizeof(glxWinScreen));
 
     if (NULL == screen)
 	return NULL;
@@ -685,7 +685,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
           {
             if (screen->base.GLXextensions != NULL)
               {
-                xfree(screen->base.GLXextensions);
+                free(screen->base.GLXextensions);
               }
 
             screen->base.GLXextensions = xnfalloc(buffer_size);
@@ -702,7 +702,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
       //
       if (screen->has_WGL_ARB_pbuffer && glx_sgi_make_current_read)
         {
-          xfree(screen->base.GLXversion);
+          free(screen->base.GLXversion);
 
           if (screen->has_WGL_ARB_multisample)
             {
@@ -897,7 +897,7 @@ glxWinDrawableDestroy(__GLXdrawable *base)
     }
 
   GLWIN_DEBUG_MSG("glxWinDestroyDrawable");
-  xfree(glxPriv);
+  free(glxPriv);
 }
 
 static __GLXdrawable *
@@ -909,7 +909,7 @@ glxWinCreateDrawable(__GLXscreen *screen,
 {
   __GLXWinDrawable *glxPriv;
 
-  glxPriv = xalloc(sizeof *glxPriv);
+  glxPriv = malloc(sizeof *glxPriv);
 
   if (glxPriv == NULL)
       return NULL;
@@ -917,7 +917,7 @@ glxWinCreateDrawable(__GLXscreen *screen,
   memset(glxPriv, 0, sizeof *glxPriv);
 
   if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, drawId, conf)) {
-    xfree(glxPriv);
+    free(glxPriv);
     return NULL;
   }
 
@@ -1517,7 +1517,7 @@ glxWinContextDestroy(__GLXcontext *base)
           gc->ctx = NULL;
         }
 
-      xfree(gc);
+      free(gc);
     }
 }
 
@@ -1535,7 +1535,7 @@ glxWinCreateContext(__GLXscreen *screen,
         glxWinReleaseTexImage
       };
 
-    context = (__GLXWinContext *)xcalloc(1, sizeof(__GLXWinContext));
+    context = (__GLXWinContext *)calloc(1, sizeof(__GLXWinContext));
 
     if (!context)
         return NULL;
@@ -1749,7 +1749,7 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen *screen)
   GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats", numConfigs);
 
   /* alloc */
-  result = xalloc(sizeof(GLXWinConfig) * numConfigs);
+  result = malloc(sizeof(GLXWinConfig) * numConfigs);
 
   if (NULL == result)
     {
@@ -1992,7 +1992,7 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen *screen)
   GLWIN_DEBUG_MSG("wglGetPixelFormatAttribivARB says %d possible pixel formats", numConfigs);
 
   /* alloc */
-  result = xalloc(sizeof(GLXWinConfig) * numConfigs);
+  result = malloc(sizeof(GLXWinConfig) * numConfigs);
 
   if (NULL == result)
     {
diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 5abaa03..26bb856 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -223,7 +223,7 @@ if (fDebugProcMsg) \
   int iLength; \
   pszTemp = Xprintf (str, ##__VA_ARGS__); \
   MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \
-  xfree (pszTemp); \
+  free(pszTemp); \
 }
 #else
 #define DEBUG_MSG(str,...)
diff --git a/hw/xwin/winauth.c b/hw/xwin/winauth.c
index f4c4005..f0eec04 100644
--- a/hw/xwin/winauth.c
+++ b/hw/xwin/winauth.c
@@ -150,7 +150,7 @@ winGenerateAuthorization (void)
 #ifdef XCSECURITY
   /* Allocate structure for additional auth information */
   pAuth = (SecurityAuthorizationPtr) 
-    xalloc (sizeof (SecurityAuthorizationRec));
+    malloc(sizeof (SecurityAuthorizationRec));
   if (!(pAuth))
     {
       ErrorF ("winGenerateAuthorization - Failed allocating "
@@ -186,7 +186,7 @@ winGenerateAuthorization (void)
 
  auth_bailout:
   if (fFreeAuth)
-    xfree (pAuth);
+    free(pAuth);
   
   return FALSE;
 }
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index b05867b..971d381 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -393,10 +393,10 @@ winConfigKeyboard (DeviceIntPtr pDevice)
                   (1000 / g_winInfo.keyboard.rate) < 1) 
             {
               winErrorFVerb (2, "\"%s\" is not a valid AutoRepeat value", s);
-              xfree(s);
+              free(s);
               return FALSE;
             }
-          xfree(s);
+          free(s);
           winMsg (X_CONFIG, "AutoRepeat: %ld %ld\n", 
                   g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
         }
diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c
index a815353..3ec9b78 100755
--- a/hw/xwin/windialogs.c
+++ b/hw/xwin/windialogs.c
@@ -365,7 +365,7 @@ winExitDlgProc (HWND hDialog, UINT message,
 	/* Set the number of connected clients */
 	SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED),
 		       pszConnectedClients);
-	xfree (pszConnectedClients);
+	free(pszConnectedClients);
       }
       return TRUE;
 
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 191b9a9..2ff65bc 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -145,8 +145,8 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
 
  winMessageBoxF_Cleanup:
   if (pszErrorF)
-    xfree (pszErrorF);
+    free(pszErrorF);
   if (pszMsgBox)
-    xfree (pszMsgBox);
+    free(pszMsgBox);
 #undef MESSAGEBOXF
 }
diff --git a/hw/xwin/winvideo.c b/hw/xwin/winvideo.c
index 529ca76..4cdb3c4 100755
--- a/hw/xwin/winvideo.c
+++ b/hw/xwin/winvideo.c
@@ -143,7 +143,7 @@ winSetupImageVideo (ScreenPtr pScreen)
 #endif
     XF86VideoAdaptorPtr adapt;
 
-    if (!(adapt = xcalloc (1, sizeof(XF86VideoAdaptorRec))))
+    if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec))))
       return NULL;
 
     adapt->type = XvWindowMask | XvInputMask | XvImageMask;
diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c
index 0e75a2c..30b6729 100644
--- a/hw/xwin/winwindow.c
+++ b/hw/xwin/winwindow.c
@@ -165,7 +165,7 @@ winCopyWindowNativeGDI (WindowPtr pWin,
   nbox = REGION_NUM_RECTS(prgnDst);
 
   /* Allocate source points for each box */
-  if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec))))
+  if(!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec))))
     return;
 
   /* Set an iterator pointer */
@@ -204,7 +204,7 @@ winCopyWindowNativeGDI (WindowPtr pWin,
     }
 
   /* Cleanup the regions, etc. */
-  xfree(pptSrc);
+  free(pptSrc);
   REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
 }
 
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index 7dce7e3..a996bc4 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -164,7 +164,7 @@ WMFreeClient (pointer data, XID id)
 	}
       updateEventMask (pHead);
     }
-  xfree ((pointer) pEvent);
+  free((pointer) pEvent);
   return 1;
 }
 
@@ -179,9 +179,9 @@ WMFreeEvents (pointer data, XID id)
     {
       pNext = pCur->next;
       FreeResource (pCur->clientResource, ClientType);
-      xfree ((pointer) pCur);
+      free((pointer) pCur);
     }
-  xfree ((pointer) pHead);
+  free((pointer) pHead);
   eventMask = 0;
   return 1;
 }
@@ -212,7 +212,7 @@ ProcWindowsWMSelectInput (register ClientPtr client)
 	}
       
       /* build the entry */
-      pNewEvent = (WMEventPtr) xalloc (sizeof (WMEventRec));
+      pNewEvent = (WMEventPtr) malloc(sizeof (WMEventRec));
       if (!pNewEvent)
 	return BadAlloc;
       pNewEvent->next = 0;
@@ -234,7 +234,7 @@ ProcWindowsWMSelectInput (register ClientPtr client)
        */
       if (!pHead)
 	{
-	  pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
+	  pHead = (WMEventPtr *) malloc(sizeof (WMEventPtr));
 	  if (!pHead ||
 	      !AddResource (eventResource, eventResourceType, (pointer)pHead))
 	    {
@@ -266,7 +266,7 @@ ProcWindowsWMSelectInput (register ClientPtr client)
 		pNewEvent->next = pEvent->next;
 	      else
 		*pHead = pEvent->next;
-	      xfree (pEvent);
+	      free(pEvent);
 	      updateEventMask (pHead);
 	    }
 	}
diff --git a/include/regionstr.h b/include/regionstr.h
index eead1a1..6a5c98c 100644
--- a/include/regionstr.h
+++ b/include/regionstr.h
@@ -142,7 +142,7 @@ extern _X_EXPORT RegDataRec miBrokenData;
     { \
         (_pReg)->extents = miEmptyBox; \
         if (((_size) > 1) && ((_pReg)->data = \
-                             (RegDataPtr)xalloc(REGION_SZOF(_size)))) \
+                             (RegDataPtr)malloc(REGION_SZOF(_size)))) \
         { \
             (_pReg)->data->size = (_size); \
             (_pReg)->data->numRects = 0; \
@@ -156,7 +156,7 @@ extern _X_EXPORT RegDataRec miBrokenData;
 #define REGION_UNINIT(_pScreen, _pReg) \
 { \
     if ((_pReg)->data && (_pReg)->data->size) { \
-	xfree((_pReg)->data); \
+	free((_pReg)->data); \
 	(_pReg)->data = NULL; \
     } \
 }
diff --git a/mi/miarc.c b/mi/miarc.c
index 1061436..36b71bf 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -800,7 +800,7 @@ miComputeWideEllipse(int lw, xArc *parc)
     if (!lw)
 	lw = 1;
     k = (parc->height >> 1) + ((lw - 1) >> 1);
-    spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
+    spdata = malloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
     if (!spdata)
 	return NULL;
     spdata->spans = (miArcSpan *)(spdata + 1);
@@ -831,14 +831,14 @@ miFillWideEllipse(
 
     yorgu = parc->height + pGC->lineWidth;
     n = (sizeof(int) * 2) * yorgu;
-    widths = xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
+    widths = malloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
     if (!widths)
 	return;
     points = (DDXPointPtr)((char *)widths + n);
     spdata = miComputeWideEllipse((int)pGC->lineWidth, parc);
     if (!spdata)
     {
-	xfree(widths);
+	free(widths);
 	return;
     }
     pts = points;
@@ -927,10 +927,10 @@ miFillWideEllipse(
 	    wids += 2;
 	}
     }
-    xfree(spdata);
+    free(spdata);
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
 
-    xfree(widths);
+    free(widths);
 }
 
 /*
@@ -1266,7 +1266,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
 		arc.height = width;
 		arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x);
 		arc.angle2 = a;
-		pArcPts = xalloc (3 * sizeof (SppPointRec));
+		pArcPts = malloc(3 * sizeof (SppPointRec));
 		if (!pArcPts)
 		    return;
 		pArcPts[0].x = otherCorner.x;
@@ -1282,7 +1282,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
 			 * rest of the line */
 			miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans);
 		}
-		xfree(pArcPts);
+		free(pArcPts);
 		return;
 	case JoinMiter:
 		/*
@@ -1413,7 +1413,7 @@ miRoundCap(
 	 * rest of the line */
 	miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans);
     }
-    xfree(pArcPts);
+    free(pArcPts);
 }
 
 /*
@@ -1511,10 +1511,10 @@ miDatan2 (double dy, double dx)
  * This procedure allocates the space necessary to fit the arc points.
  * Sometimes it's convenient for those points to be at the end of an existing
  * array. (For example, if we want to leave a spare point to make sectors
- * instead of segments.)  So we pass in the xalloc()ed chunk that contains the
+ * instead of segments.)  So we pass in the malloc()ed chunk that contains the
  * array and an index saying where we should start stashing the points.
  * If there isn't an array already, we just pass in a null pointer and 
- * count on xrealloc() to handle the null pointer correctly.
+ * count on realloc() to handle the null pointer correctly.
  */
 static int
 miGetArcPts(
@@ -1561,7 +1561,7 @@ miGetArcPts(
     count++;
 
     cdt = 2 * miDcos(dt);
-    if (!(poly = (SppPointPtr) xrealloc((pointer)*ppPts,
+    if (!(poly = (SppPointPtr) realloc((pointer)*ppPts,
 					(cpt + count) * sizeof(SppPointRec))))
 	return(0);
     *ppPts = poly;
@@ -1624,7 +1624,7 @@ addCap (
 	if (*ncapsp == *sizep)
 	{
 	    newsize = *sizep + ADD_REALLOC_STEP;
-	    cap = (miArcCapPtr) xrealloc (*capsp,
+	    cap = (miArcCapPtr) realloc(*capsp,
 					  newsize * sizeof (**capsp));
 	    if (!cap)
 		return;
@@ -1655,7 +1655,7 @@ addJoin (
 	if (*njoinsp == *sizep)
 	{
 	    newsize = *sizep + ADD_REALLOC_STEP;
-	    join = (miArcJoinPtr) xrealloc (*joinsp,
+	    join = (miArcJoinPtr) realloc(*joinsp,
 					    newsize * sizeof (**joinsp));
 	    if (!join)
 		return;
@@ -1685,7 +1685,7 @@ addArc (
 	if (*narcsp == *sizep)
 	{
 	    newsize = *sizep + ADD_REALLOC_STEP;
-	    arc = (miArcDataPtr) xrealloc (*arcsp,
+	    arc = (miArcDataPtr) realloc(*arcsp,
 					   newsize * sizeof (**arcsp));
 	    if (!arc)
 		return NULL;
@@ -1710,13 +1710,13 @@ miFreeArcs(
 	     iphase--)
 	{
 	    if (arcs[iphase].narcs > 0)
-		xfree(arcs[iphase].arcs);
+		free(arcs[iphase].arcs);
 	    if (arcs[iphase].njoins > 0)
-		xfree(arcs[iphase].joins);
+		free(arcs[iphase].joins);
 	    if (arcs[iphase].ncaps > 0)
-		xfree(arcs[iphase].caps);
+		free(arcs[iphase].caps);
 	}
-	xfree(arcs);
+	free(arcs);
 }
 
 /*
@@ -1800,13 +1800,13 @@ miComputeArcs (
 	isDoubleDash = (pGC->lineStyle == LineDoubleDash);
 	dashOffset = pGC->dashOffset;
 
-	data = xalloc (narcs * sizeof (struct arcData));
+	data = malloc(narcs * sizeof (struct arcData));
 	if (!data)
 	    return NULL;
-	arcs = xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
+	arcs = malloc(sizeof (*arcs) * (isDoubleDash ? 2 : 1));
 	if (!arcs)
 	{
-	    xfree(data);
+	    free(data);
 	    return NULL;
 	}
 	for (i = 0; i < narcs; i++) {
@@ -2155,11 +2155,11 @@ miComputeArcs (
 			arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
 			         arcs[iphase].ncaps;
 		}
-	xfree(data);
+	free(data);
 	return arcs;
 arcfail:
 	miFreeArcs(arcs, pGC);
-	xfree(data);
+	free(data);
 	return NULL;
 }
 
@@ -3016,7 +3016,7 @@ realAllocSpan (void)
 	struct finalSpan	*span;
 	int			i;
 
-	newChunk = xalloc (sizeof (struct finalSpanChunk));
+	newChunk = malloc(sizeof (struct finalSpanChunk));
 	if (!newChunk)
 		return (struct finalSpan *) NULL;
 	newChunk->next = chunks;
@@ -3039,11 +3039,11 @@ disposeFinalSpans (void)
 
 	for (chunk = chunks; chunk; chunk = next) {
 		next = chunk->next;
-		xfree (chunk);
+		free(chunk);
 	}
 	chunks = 0;
 	freeFinalSpans = 0;
-	xfree(finalSpans);
+	free(finalSpans);
 	finalSpans = 0;
 }
 
@@ -3063,8 +3063,8 @@ fillSpans (
 
 	if (nspans == 0)
 		return;
-	xSpan = xSpans = xalloc (nspans * sizeof (DDXPointRec));
-	xWidth = xWidths = xalloc (nspans * sizeof (int));
+	xSpan = xSpans = malloc(nspans * sizeof (DDXPointRec));
+	xWidth = xWidths = malloc(nspans * sizeof (int));
 	if (xSpans && xWidths)
 	{
 	    i = 0;
@@ -3084,9 +3084,9 @@ fillSpans (
 	}
 	disposeFinalSpans ();
 	if (xSpans)
-	    xfree (xSpans);
+	    free(xSpans);
 	if (xWidths)
-	    xfree (xWidths);
+	    free(xWidths);
 	finalMiny = 0;
 	finalMaxy = -1;
 	finalSize = 0;
@@ -3121,7 +3121,7 @@ realFindSpan (int y)
 		else
 			change = SPAN_REALLOC;
 		newSize = finalSize + change;
-		newSpans = xalloc(newSize * sizeof (struct finalSpan *));
+		newSpans = malloc(newSize * sizeof (struct finalSpan *));
 		if (!newSpans)
 		    return NULL;
 		newMiny = finalMiny;
@@ -3134,7 +3134,7 @@ realFindSpan (int y)
 			memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *),
 				(char *) finalSpans,
 			       finalSize * sizeof (struct finalSpan *));
-			xfree (finalSpans);
+			free(finalSpans);
 		}
 		if ((i = finalMiny - newMiny) > 0)
 			bzero ((char *)newSpans, i * sizeof (struct finalSpan *));
@@ -3477,7 +3477,7 @@ drawArc (
 			left->counterClock = temp;
 		}
 	}
-	xfree(spdata);
+	free(spdata);
 }
 
 static void
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index cc8b11d..2ac6ce0 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -143,19 +143,19 @@ miCopyArea(DrawablePtr  pSrcDrawable,
 	dsty += pDstDrawable->y;
     }
 
-    pptFirst = ppt = xalloc(heightSrc * sizeof(DDXPointRec));
-    pwidthFirst = pwidth = xalloc(heightSrc * sizeof(unsigned int));
+    pptFirst = ppt = malloc(heightSrc * sizeof(DDXPointRec));
+    pwidthFirst = pwidth = malloc(heightSrc * sizeof(unsigned int));
     numRects = REGION_NUM_RECTS(prgnSrcClip);
     boxes = REGION_RECTS(prgnSrcClip);
-    ordering = xalloc(numRects * sizeof(unsigned int));
+    ordering = malloc(numRects * sizeof(unsigned int));
     if(!pptFirst || !pwidthFirst || !ordering)
     {
        if (ordering)
-	   xfree(ordering);
+	   free(ordering);
        if (pwidthFirst)
-           xfree(pwidthFirst);
+           free(pwidthFirst);
        if (pptFirst)
-           xfree(pptFirst);
+           free(pptFirst);
        return NULL;
     }
 
@@ -235,7 +235,7 @@ miCopyArea(DrawablePtr  pSrcDrawable,
 	    ppt++->y = y++;
 	    *pwidth++ = width;
 	}
-	pbits = xalloc(height * PixmapBytePad(width, pSrcDrawable->depth));
+	pbits = malloc(height * PixmapBytePad(width, pSrcDrawable->depth));
 	if (pbits)
 	{
 	    (*pSrcDrawable->pScreen->GetSpans)(pSrcDrawable, width, pptFirst,
@@ -253,7 +253,7 @@ miCopyArea(DrawablePtr  pSrcDrawable,
 
 	    (*pGC->ops->SetSpans)(pDstDrawable, pGC, (char *)pbits, pptFirst,
 				  (int *)pwidthFirst, height, TRUE);
-	    xfree(pbits);
+	    free(pbits);
 	}
     }
     prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
@@ -261,9 +261,9 @@ miCopyArea(DrawablePtr  pSrcDrawable,
     if(realSrcClip)
 	REGION_DESTROY(pGC->pScreen, prgnSrcClip);
 		
-    xfree(ordering);
-    xfree(pwidthFirst);
-    xfree(pptFirst);
+    free(ordering);
+    free(pwidthFirst);
+    free(pptFirst);
     return prgnExposed;
 }
 
@@ -313,7 +313,7 @@ miGetPlane(
     sy += pDraw->y;
     widthInBytes = BitmapBytePad(w);
     if(!result)
-        result = xcalloc(h, widthInBytes);
+        result = calloc(h, widthInBytes);
     if (!result)
 	return NULL;
     bitsPerPixel = pDraw->bitsPerPixel;
@@ -429,12 +429,12 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
     dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv);
     ValidateGC((DrawablePtr)pPixmap, pGCT);
     miClearDrawable((DrawablePtr)pPixmap, pGCT);
-    ppt = pptFirst = xalloc(h * sizeof(DDXPointRec));
-    pwidth = pwidthFirst = xalloc(h * sizeof(int));
+    ppt = pptFirst = malloc(h * sizeof(DDXPointRec));
+    pwidth = pwidthFirst = malloc(h * sizeof(int));
     if(!pptFirst || !pwidthFirst)
     {
-	if (pwidthFirst) xfree(pwidthFirst);
-	if (pptFirst) xfree(pptFirst);
+	if (pwidthFirst) free(pwidthFirst);
+	if (pptFirst) free(pptFirst);
 	FreeScratchGC(pGCT);
 	return;
     }
@@ -460,8 +460,8 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
 
     (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits,
 			   pptFirst, pwidthFirst, h, TRUE);
-    xfree(pwidthFirst);
-    xfree(pptFirst);
+    free(pwidthFirst);
+    free(pptFirst);
 
 
     /* Save current values from the client GC */
@@ -614,7 +614,7 @@ miCopyPlane( DrawablePtr pSrcDrawable,
 	    miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
 			      box.x2 - box.x1, box.y2 - box.y1,
 			      dstx + box.x1 - srcx, dsty + box.y1 - srcy);
-	    xfree(ptile);
+	    free(ptile);
 	}
     }
     prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
@@ -798,14 +798,14 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
 	break;
 
       case ZPixmap:
-    	ppt = pptFirst = xalloc(h * sizeof(DDXPointRec));
-    	pwidth = pwidthFirst = xalloc(h * sizeof(int));
+        ppt = pptFirst = malloc(h * sizeof(DDXPointRec));
+        pwidth = pwidthFirst = malloc(h * sizeof(int));
 	if(!pptFirst || !pwidthFirst)
         {
 	   if (pwidthFirst)
-               xfree(pwidthFirst);
+               free(pwidthFirst);
            if (pptFirst)
-               xfree(pptFirst);
+               free(pptFirst);
            return;
         }
 	if (pGC->miTranslate)
@@ -824,8 +824,8 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
 
 	(*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst,
 			      pwidthFirst, h, TRUE);
-	xfree(pwidthFirst);
-	xfree(pptFirst);
+	free(pwidthFirst);
+	free(pptFirst);
 	break;
     }
 }
diff --git a/mi/micmap.c b/mi/micmap.c
index cc829fc..dac700d 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -380,7 +380,7 @@ miClearVisualTypes(void)
 
     while ((v = miVisuals)) {
 	miVisuals = v->next;
-	xfree(v);
+	free(v);
     }
 }
 
@@ -393,7 +393,7 @@ miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
     miVisualsPtr   new, *prev, v;
     int		    count;
 
-    new = xalloc (sizeof *new);
+    new = malloc(sizeof *new);
     if (!new)
 	return FALSE;
     if (!redMask || !greenMask || !blueMask)
@@ -534,14 +534,14 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
 	ndepth++;
 	nvisual += visuals->count;
     }
-    depth = xalloc (ndepth * sizeof (DepthRec));
-    visual = xalloc (nvisual * sizeof (VisualRec));
-    preferredCVCs = xalloc(ndepth * sizeof(int));
+    depth = malloc(ndepth * sizeof (DepthRec));
+    visual = malloc(nvisual * sizeof (VisualRec));
+    preferredCVCs = malloc(ndepth * sizeof(int));
     if (!depth || !visual || !preferredCVCs)
     {
-	xfree (depth);
-	xfree (visual);
-	xfree (preferredCVCs);
+	free(depth);
+	free(visual);
+	free(preferredCVCs);
 	return FALSE;
     }
     *depthp = depth;
@@ -560,9 +560,9 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
 	vid = NULL;
 	if (nvtype)
 	{
-	    vid = xalloc (nvtype * sizeof (VisualID));
+	    vid = malloc(nvtype * sizeof (VisualID));
 	    if (!vid) {
-		xfree(preferredCVCs);
+		free(preferredCVCs);
 		return FALSE;
 	    }
 	}
@@ -604,7 +604,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
 	    vid++;
 	    visual++;
 	}
-	xfree (visuals);
+	free(visuals);
     }
     miVisuals = NULL;
     visual = *visualp;
@@ -660,7 +660,7 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
     }
     *rootDepthp = depth[i].depth;
     *defaultVisp = depth[i].vids[j];
-    xfree(preferredCVCs);
+    free(preferredCVCs);
 
     return TRUE;
 }
diff --git a/mi/micopy.c b/mi/micopy.c
index 3719f46..6df9d88 100644
--- a/mi/micopy.c
+++ b/mi/micopy.c
@@ -68,7 +68,7 @@ miCopyRegion (DrawablePtr   pSrcDrawable,
 	if (nbox > 1)
 	{
 	    /* keep ordering in each band, reverse order of bands */
-	    pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew1)
 		return;
 	    pboxBase = pboxNext = pbox+nbox-1;
@@ -105,11 +105,11 @@ miCopyRegion (DrawablePtr   pSrcDrawable,
 	if (nbox > 1)
 	{
 	    /* reverse order of rects in each band */
-	    pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
+	    pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
 	    if(!pboxNew2)
 	    {
 		if (pboxNew1)
-		    xfree(pboxNew1);
+		    free(pboxNew1);
 		return;
 	    }
 	    pboxBase = pboxNext = pbox;
@@ -144,9 +144,9 @@ miCopyRegion (DrawablePtr   pSrcDrawable,
 		 reverse, upsidedown, bitPlane, closure);
     
     if (pboxNew1)
-	xfree (pboxNew1);
+	free(pboxNew1);
     if (pboxNew2)
-	xfree (pboxNew2);
+	free(pboxNew2);
 }
 
 RegionPtr
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 9041630..06bddec 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -140,7 +140,7 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
 {
     miDCScreenPtr   pScreenPriv;
 
-    pScreenPriv = xalloc (sizeof (miDCScreenRec));
+    pScreenPriv = malloc(sizeof (miDCScreenRec));
     if (!pScreenPriv)
 	return FALSE;
 
@@ -152,7 +152,7 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
 
     if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs))
     {
-	xfree ((pointer) pScreenPriv);
+	free((pointer) pScreenPriv);
 	return FALSE;
     }
     return TRUE;
@@ -166,7 +166,7 @@ miDCCloseScreen (int index, ScreenPtr pScreen)
     pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
 						  miDCScreenKey);
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
     return (*pScreen->CloseScreen) (index, pScreen);
 }
 
@@ -224,7 +224,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
     GCPtr	    pGC;
     XID		    gcvals[3];
 
-    pPriv = xalloc (sizeof (miDCCursorRec));
+    pPriv = malloc(sizeof (miDCCursorRec));
     if (!pPriv)
 	return NULL;
 #ifdef ARGB_CURSOR
@@ -237,7 +237,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 	pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
 	if (!pFormat)
 	{
-	    xfree ((pointer) pPriv);
+	    free((pointer) pPriv);
 	    return NULL;
 	}
 	
@@ -248,14 +248,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
 					    CREATE_PIXMAP_USAGE_SCRATCH);
 	if (!pPixmap)
 	{
-	    xfree ((pointer) pPriv);
+	    free((pointer) pPriv);
 	    return NULL;
 	}
 	pGC = GetScratchGC (32, pScreen);
 	if (!pGC)
 	{
 	    (*pScreen->DestroyPixmap) (pPixmap);
-	    xfree ((pointer) pPriv);
+	    free((pointer) pPriv);
 	    return NULL;
 	}
 	ValidateGC (&pPixmap->drawable, pGC);
@@ -269,7 +269,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
         (*pScreen->DestroyPixmap) (pPixmap);
 	if (!pPriv->pPicture)
 	{
-	    xfree ((pointer) pPriv);
+	    free((pointer) pPriv);
 	    return NULL;
 	}
 	dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
@@ -280,14 +280,14 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
     pPriv->sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
     if (!pPriv->sourceBits)
     {
-	xfree ((pointer) pPriv);
+	free((pointer) pPriv);
 	return NULL;
     }
     pPriv->maskBits =  (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 1, 0);
     if (!pPriv->maskBits)
     {
 	(*pScreen->DestroyPixmap) (pPriv->sourceBits);
-	xfree ((pointer) pPriv);
+	free((pointer) pPriv);
 	return NULL;
     }
     dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
@@ -346,7 +346,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
 	if (pPriv->pPicture)
 	    FreePicture (pPriv->pPicture, 0);
 #endif
-	xfree ((pointer) pPriv);
+	free((pointer) pPriv);
 	dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
     }
     return TRUE;
@@ -780,7 +780,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
     {
         pScreen = screenInfo.screens[i];
 
-        pBuffer = xalloc(sizeof(miDCBufferRec));
+        pBuffer = malloc(sizeof(miDCBufferRec));
         if (!pBuffer)
             goto failure;
 
@@ -866,7 +866,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
                 if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
                 if (pBuffer->pTemp) (*pScreen->DestroyPixmap)(pBuffer->pTemp);
 
-                xfree(pBuffer);
+                free(pBuffer);
                 dixSetPrivate(&pDev->devPrivates, miDCSpriteKey + pScreen->myNum, NULL);
             }
         }
diff --git a/mi/mieq.c b/mi/mieq.c
index 9b6d0c9..fa60b40 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -191,7 +191,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e)
     if (evt->evlen < evlen)
     {
         evt->evlen = evlen;
-        evt->event = xrealloc(evt->event, evt->evlen);
+        evt->event = realloc(evt->event, evt->evlen);
         if (!evt->event)
         {
             ErrorF("[mi] Running out of memory. Tossing event.\n");
@@ -439,7 +439,7 @@ mieqProcessInputEvents(void)
 
         evlen   = e->events->evlen;
         if(evlen > event_size)
-            event = xrealloc(event, evlen);
+            event = realloc(event, evlen);
 
         if (!event)
             FatalError("[mi] No memory left for event processing.\n");
diff --git a/mi/miexpose.c b/mi/miexpose.c
index f52b492..2072e6a 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -358,7 +358,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
 
 	numRects = REGION_NUM_RECTS(pRgn);
 	pBox = REGION_RECTS(pRgn);
-	if(!(pEvent = xalloc(numRects * sizeof(xEvent))))
+	if(!(pEvent = malloc(numRects * sizeof(xEvent))))
 		return;
 	pe = pEvent;
 
@@ -376,7 +376,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
 	}
 	TryClientEvents(client, NULL, pEvent, numRects,
 			    (Mask)0, NoEventMask, NullGrab);
-	xfree(pEvent);
+	free(pEvent);
     }
     else
     {
@@ -402,7 +402,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
 
     pBox = REGION_RECTS(pRgn);
     numRects = REGION_NUM_RECTS(pRgn);
-    if(!(pEvent = xcalloc(1, numRects * sizeof(xEvent))))
+    if(!(pEvent = calloc(1, numRects * sizeof(xEvent))))
 	return;
 
     for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++)
@@ -432,7 +432,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
 	    win = PanoramiXFindIDByScrnum(XRT_WINDOW, 
 			pWin->drawable.id, scrnum);
 	    if(!win) {
-		xfree(pEvent);
+		free(pEvent);
 		return;
 	    }
 	    realWin = win->info[0].id;
@@ -449,7 +449,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
 
     DeliverEvents(pWin, pEvent, numRects, NullWindow);
 
-    xfree(pEvent);
+    free(pEvent);
 }
 
 void
@@ -646,14 +646,14 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin;
     }
 
-    prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
+    prect = malloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle));
     if (!prect)
 	return;
 
     pGC = GetScratchGC(drawable->depth, drawable->pScreen);
     if (!pGC)
     {
-	xfree(prect);
+	free(prect);
 	return;
     }
     
@@ -671,7 +671,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     }
     prect -= numRects;
     (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
-    xfree(prect);
+    free(prect);
 
     FreeScratchGC(pGC);
 }
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index c22baf5..6e13e68 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -546,13 +546,13 @@ miFillEllipseI(
     int *widths;
     int *wids;
 
-    points = xalloc(sizeof(DDXPointRec) * arc->height);
+    points = malloc(sizeof(DDXPointRec) * arc->height);
     if (!points)
 	return;
-    widths = xalloc(sizeof(int) * arc->height);
+    widths = malloc(sizeof(int) * arc->height);
     if (!widths)
     {
-	xfree(points);
+	free(points);
 	return;
     }
     miFillArcSetup(arc, &info);
@@ -570,8 +570,8 @@ miFillEllipseI(
 	ADDSPANS();
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    xfree(widths);
-    xfree(points);
+    free(widths);
+    free(points);
 }
 
 static void
@@ -589,13 +589,13 @@ miFillEllipseD(
     int *widths;
     int *wids;
 
-    points = xalloc(sizeof(DDXPointRec) * arc->height);
+    points = malloc(sizeof(DDXPointRec) * arc->height);
     if (!points)
 	return;
-    widths = xalloc(sizeof(int) * arc->height);
+    widths = malloc(sizeof(int) * arc->height);
     if (!widths)
     {
-	xfree(points);
+	free(points);
 	return;
     }
     miFillArcDSetup(arc, &info);
@@ -613,8 +613,8 @@ miFillEllipseD(
 	ADDSPANS();
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    xfree(widths);
-    xfree(points);
+    free(widths);
+    free(points);
 }
 
 #define ADDSPAN(l,r) \
@@ -661,13 +661,13 @@ miFillArcSliceI(
     slw = arc->height;
     if (slice.flip_top || slice.flip_bot)
 	slw += (arc->height >> 1) + 1;
-    points = xalloc(sizeof(DDXPointRec) * slw);
+    points = malloc(sizeof(DDXPointRec) * slw);
     if (!points)
 	return;
-    widths = xalloc(sizeof(int) * slw);
+    widths = malloc(sizeof(int) * slw);
     if (!widths)
     {
-	xfree(points);
+	free(points);
 	return;
     }
     if (pGC->miTranslate)
@@ -698,8 +698,8 @@ miFillArcSliceI(
 	}
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    xfree(widths);
-    xfree(points);
+    free(widths);
+    free(points);
 }
 
 static void
@@ -725,13 +725,13 @@ miFillArcSliceD(
     slw = arc->height;
     if (slice.flip_top || slice.flip_bot)
 	slw += (arc->height >> 1) + 1;
-    points = xalloc(sizeof(DDXPointRec) * slw);
+    points = malloc(sizeof(DDXPointRec) * slw);
     if (!points)
 	return;
-    widths = xalloc(sizeof(int) * slw);
+    widths = malloc(sizeof(int) * slw);
     if (!widths)
     {
-	xfree(points);
+	free(points);
 	return;
     }
     if (pGC->miTranslate)
@@ -762,8 +762,8 @@ miFillArcSliceD(
 	}
     }
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
-    xfree(widths);
-    xfree(points);
+    free(widths);
+    free(points);
 }
 
 /* MIPOLYFILLARC -- The public entry for the PolyFillArc request.
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index 6e99790..e2bd7c9 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -107,12 +107,12 @@ miPolyFillRect(
 	    maxheight = max(maxheight, prect->height);
     }
 
-    pptFirst = xalloc(maxheight * sizeof(DDXPointRec));
-    pwFirst = xalloc(maxheight * sizeof(int));
+    pptFirst = malloc(maxheight * sizeof(DDXPointRec));
+    pwFirst = malloc(maxheight * sizeof(int));
     if(!pptFirst || !pwFirst)
     {
-	if (pwFirst) xfree(pwFirst);
-	if (pptFirst) xfree(pptFirst);
+	if (pwFirst) free(pwFirst);
+	if (pptFirst) free(pptFirst);
 	return;
     }
 
@@ -138,6 +138,6 @@ miPolyFillRect(
 			   1);
 	prect++;
     }
-    xfree(pwFirst);
-    xfree(pptFirst);
+    free(pwFirst);
+    free(pptFirst);
 }
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index 383502f..13b5a48 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -116,15 +116,15 @@ miFillSppPoly(
     y = ymax - ymin + 1;
     if ((count < 3) || (y <= 0))
 	return;
-    ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec) * y);
-    width = FirstWidth = xalloc(sizeof(int) * y);
-    Marked = xalloc(sizeof(int) * count);
+    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * y);
+    width = FirstWidth = malloc(sizeof(int) * y);
+    Marked = malloc(sizeof(int) * count);
 
     if(!ptsOut || !width || !Marked)
     {
-	if (Marked) xfree(Marked);
-	if (width) xfree(width);
-	if (ptsOut) xfree(ptsOut);
+	if (Marked) free(Marked);
+	if (width) free(width);
+	if (ptsOut) free(ptsOut);
 	return;
     }
 
@@ -238,9 +238,9 @@ miFillSppPoly(
     /* Finally, fill the spans we've collected */
     (*pgc->ops->FillSpans)(dst, pgc, 
 		      ptsOut-FirstPoint, FirstPoint, FirstWidth, 1);
-    xfree(Marked);
-    xfree(FirstWidth);
-    xfree(FirstPoint);
+    free(Marked);
+    free(FirstWidth);
+    free(FirstPoint);
 }
 
 
diff --git a/mi/migc.c b/mi/migc.c
index a797099..7b2b1c3 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -95,7 +95,7 @@ miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
 	pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
 						      (xRectangle *) pvalue,
 								    type);
-	xfree(pvalue);
+	free(pvalue);
     }
     pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE;
     pGC->stateChanges |= GCClipMask;
diff --git a/mi/miglblt.c b/mi/miglblt.c
index bc715ae..ea199dc 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -141,7 +141,7 @@ miPolyGlyphBlt(
     DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
 
     nbyLine = BitmapBytePad(width);
-    pbits = xalloc(height*nbyLine);
+    pbits = malloc(height*nbyLine);
     if (!pbits)
     {
 	(*pDrawable->pScreen->DestroyPixmap)(pPixmap);
@@ -192,7 +192,7 @@ miPolyGlyphBlt(
 	x += pci->metrics.characterWidth;
     }
     (*pDrawable->pScreen->DestroyPixmap)(pPixmap);
-    xfree(pbits);
+    free(pbits);
     FreeScratchGC(pGCtmp);
 }
 
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index e0aa880..2de7682 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -115,7 +115,7 @@ miInitOverlay(
     if(!dixRequestPrivate(miOverlayWindowKey, sizeof(miOverlayWindowRec)))
 	return FALSE;
 
-    if(!(pScreenPriv = xalloc(sizeof(miOverlayScreenRec))))
+    if(!(pScreenPriv = malloc(sizeof(miOverlayScreenRec))))
 	return FALSE;
 
     dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
@@ -166,7 +166,7 @@ miOverlayCloseScreen(int i, ScreenPtr pScreen)
    pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
    pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
 
-   xfree(pScreenPriv);
+   free(pScreenPriv);
 
    return (*pScreen->CloseScreen)(i, pScreen);
 }
@@ -184,7 +184,7 @@ miOverlayCreateWindow(WindowPtr pWin)
     pWinPriv->tree = NULL;
 
     if(!pWin->parent || !((*pScreenPriv->InOverlay)(pWin))) {
-	if(!(pTree = (miOverlayTreePtr)xcalloc(1, sizeof(miOverlayTreeRec))))
+	if(!(pTree = (miOverlayTreePtr)calloc(1, sizeof(miOverlayTreeRec))))
 	   return FALSE;
     }
 
@@ -212,7 +212,7 @@ miOverlayCreateWindow(WindowPtr pWin)
 		REGION_INIT(pScreen, &(pTree->borderClip), &fullBox, 1);
 		REGION_INIT(pScreen, &(pTree->clipList), &fullBox, 1);
 	    }
-	} else xfree(pTree);
+	} else free(pTree);
     }
 
     return TRUE;
@@ -240,7 +240,7 @@ miOverlayDestroyWindow(WindowPtr pWin)
 
 	REGION_UNINIT(pScreen, &(pTree->borderClip));
 	REGION_UNINIT(pScreen, &(pTree->clipList));
-	xfree(pTree);
+	free(pTree);
     }
 
     if(pScreenPriv->DestroyWindow) {
@@ -861,7 +861,7 @@ miOverlayHandleExposures(WindowPtr pWin)
 		    (*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
 		    REGION_UNINIT(pScreen, &mival->exposed);
 		}
-		xfree(mival);
+		free(mival);
 		pTree->valdata = NULL;
 		if (pTree->firstChild) {
 		    pTree = pTree->firstChild;
@@ -899,7 +899,7 @@ miOverlayHandleExposures(WindowPtr pWin)
 	    }
 	    REGION_UNINIT(pScreen, &val->after.borderExposed);
 	    REGION_UNINIT(pScreen, &val->after.exposed);
-	    xfree(val);
+	    free(val);
 	    pChild->valdata = NULL;
 	    if (pChild->firstChild)
 	    {
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 1b33f82..ad7b3db 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -88,7 +88,7 @@ miPointerInitialize (ScreenPtr                  pScreen,
 {
     miPointerScreenPtr	pScreenPriv;
 
-    pScreenPriv = xalloc (sizeof (miPointerScreenRec));
+    pScreenPriv = malloc(sizeof (miPointerScreenRec));
     if (!pScreenPriv)
 	return FALSE;
     pScreenPriv->spriteFuncs = spriteFuncs;
@@ -154,7 +154,7 @@ miPointerCloseScreen (int index, ScreenPtr pScreen)
 #endif
 
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
-    xfree ((pointer) pScreenPriv);
+    free((pointer) pScreenPriv);
     FreeEventList(events, GetMaximumEventsNum());
     events = NULL;
     return (*pScreen->CloseScreen) (index, pScreen);
@@ -252,7 +252,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
     miPointerPtr pPointer;
     SetupScreen (pScreen);
 
-    pPointer = xalloc(sizeof(miPointerRec));
+    pPointer = malloc(sizeof(miPointerRec));
     if (!pPointer)
         return FALSE;
 
@@ -270,7 +270,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
 
     if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
     {
-        xfree(pPointer);
+        free(pPointer);
         return FALSE;
     }
 
@@ -290,7 +290,7 @@ miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
         return;
 
     (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
-    xfree(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey));
+    free(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey));
     dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL);
 }
 
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index 7938488..40671df 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -105,12 +105,12 @@ miFillConvexPoly(
     dy = ymax - ymin + 1;
     if ((count < 3) || (dy < 0))
 	return(TRUE);
-    ptsOut = FirstPoint = xalloc(sizeof(DDXPointRec)*dy);
-    width = FirstWidth = xalloc(sizeof(int) * dy);
+    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec)*dy);
+    width = FirstWidth = malloc(sizeof(int) * dy);
     if(!FirstPoint || !FirstWidth)
     {
-	if (FirstWidth) xfree(FirstWidth);
-	if (FirstPoint) xfree(FirstPoint);
+	if (FirstWidth) free(FirstWidth);
+	if (FirstPoint) free(FirstPoint);
 	return(FALSE);
     }
 
@@ -175,8 +175,8 @@ miFillConvexPoly(
 	/* in case we're called with non-convex polygon */
 	if(i < 0)
         {
-	    xfree(FirstWidth);
-	    xfree(FirstPoint);
+	    free(FirstWidth);
+	    free(FirstPoint);
 	    return(TRUE);
 	}
         while (i-- > 0) 
@@ -210,8 +210,8 @@ miFillConvexPoly(
     (*pgc->ops->FillSpans)(dst, pgc, 
 		      ptsOut-FirstPoint,FirstPoint,FirstWidth,
 		      1);
-    xfree(FirstWidth);
-    xfree(FirstPoint);
+    free(FirstWidth);
+    free(FirstPoint);
     return(TRUE);
 }
 
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
index 4744583..d975165 100644
--- a/mi/mipolygen.c
+++ b/mi/mipolygen.c
@@ -92,13 +92,13 @@ miFillGeneralPoly(
     if (count < 3)
 	return(TRUE);
 
-    if(!(pETEs = xalloc(sizeof(EdgeTableEntry) * count)))
+    if(!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
 	return(FALSE);
     ptsOut = FirstPoint;
     width = FirstWidth;
     if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock))
     {
-	xfree(pETEs);
+	free(pETEs);
 	return(FALSE);
     }
     pSLL = ET.scanlines.next;
@@ -224,7 +224,7 @@ miFillGeneralPoly(
      *     Get any spans that we missed by buffering
      */
     (*pgc->ops->FillSpans)(dst, pgc, nPts, FirstPoint, FirstWidth, 1);
-    xfree(pETEs);
+    free(pETEs);
     miFreeStorage(SLLBlock.next);
     return(TRUE);
 }
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 12771ee..3c6ed4e 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -120,6 +120,6 @@ miPolyPoint(
 	DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
 	ValidateGC(pDrawable, pGC);
     }
-    xfree(pwidthInit);
+    free(pwidthInit);
 }
 
diff --git a/mi/mipolyrect.c b/mi/mipolyrect.c
index 033c7a7..9b0edc1 100644
--- a/mi/mipolyrect.c
+++ b/mi/mipolyrect.c
@@ -90,7 +90,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
 	offset2 = pGC->lineWidth;
 	offset1 = offset2 >> 1;
 	offset3 = offset2 - offset1;
-	tmp = xalloc(ntmp * sizeof (xRectangle));
+	tmp = malloc(ntmp * sizeof (xRectangle));
 	if (!tmp)
 	    return;
 	t = tmp;
@@ -158,7 +158,7 @@ miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
 	    }
 	}
 	(*pGC->ops->PolyFillRect) (pDraw, pGC, t - tmp, tmp);
-	xfree ((pointer) tmp);
+	free((pointer) tmp);
     }
     else
     {
diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c
index 15561b7..c4ce882 100644
--- a/mi/mipolyutil.c
+++ b/mi/mipolyutil.c
@@ -99,7 +99,7 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE,  int scanline,
     {
         if (*iSLLBlock > SLLSPERBLOCK-1) 
         {
-            tmpSLLBlock = xalloc(sizeof(ScanLineListBlock));
+            tmpSLLBlock = malloc(sizeof(ScanLineListBlock));
 	    if (!tmpSLLBlock)
 		return FALSE;
             (*SLLBlock)->next = tmpSLLBlock;
@@ -379,7 +379,7 @@ miFreeStorage(ScanLineListBlock *pSLLBlock)
     while (pSLLBlock) 
     {
         tmpSLLBlock = pSLLBlock->next;
-        xfree(pSLLBlock);
+        free(pSLLBlock);
         pSLLBlock = tmpSLLBlock;
     }
 }
diff --git a/mi/mipushpxl.c b/mi/mipushpxl.c
index 3844519..9f04298 100644
--- a/mi/mipushpxl.c
+++ b/mi/mipushpxl.c
@@ -123,7 +123,7 @@ miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
             LONG2CHARSDIFFORDER((MiBits)(-1) >> 1);
 #endif
 
-    pwLineStart = xalloc(BitmapBytePad(dx));
+    pwLineStart = malloc(BitmapBytePad(dx));
     if (!pwLineStart)
 	return;
     ipt = 0;
@@ -262,7 +262,7 @@ miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
 	    }
 	}
     }
-    xfree(pwLineStart);
+    free(pwLineStart);
     /* Flush any remaining spans */
     if (ipt)
     {
diff --git a/mi/miregion.c b/mi/miregion.c
index c48befc..59aaa85 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -171,8 +171,8 @@ Equipment Corporation.
         ((r1)->y1 <= (r2)->y1) && \
         ((r1)->y2 >= (r2)->y2) )
 
-#define xallocData(n) xalloc(REGION_SZOF(n))
-#define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data)
+#define xallocData(n) malloc(REGION_SZOF(n))
+#define xfreeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data)
 
 #define RECTALLOC_BAIL(pReg,n,bail) \
 if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
@@ -209,7 +209,7 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
 if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
 {									 \
     RegDataPtr NewData;							 \
-    NewData = (RegDataPtr)xrealloc((reg)->data, REGION_SZOF(numRects));	 \
+    NewData = (RegDataPtr)realloc((reg)->data, REGION_SZOF(numRects));	 \
     if (NewData)							 \
     {									 \
 	NewData->size = (numRects);					 \
@@ -241,7 +241,7 @@ miRegionCreate(BoxPtr rect, int size)
 {
     RegionPtr pReg;
    
-    pReg = (RegionPtr)xalloc(sizeof(RegionRec));
+    pReg = (RegionPtr)malloc(sizeof(RegionRec));
     if (!pReg)
 	return &miBrokenRegion;
 
@@ -255,7 +255,7 @@ miRegionDestroy(RegionPtr pReg)
 {
     pixman_region_fini (pReg);
     if (pReg != &miBrokenRegion)
-	xfree(pReg);
+	free(pReg);
 }
 
 void
@@ -389,7 +389,7 @@ miRectAlloc(RegionPtr pRgn, int n)
 		n = 250;
 	}
 	n += pRgn->data->numRects;
-	data = (RegDataPtr)xrealloc(pRgn->data, REGION_SZOF(n));
+	data = (RegDataPtr)realloc(pRgn->data, REGION_SZOF(n));
 	if (!data)
 	    return miRegionBreak (pRgn);
 	pRgn->data = data;
@@ -797,7 +797,7 @@ miRegionOp(
     }
 
     if (oldData)
-	xfree(oldData);
+	free(oldData);
 
     if (!(numRects = newReg->data->numRects))
     {
@@ -1269,7 +1269,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
 
     /* Set up the first region to be the first rectangle in badreg */
     /* Note that step 2 code will never overflow the ri[0].reg rects array */
-    ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo));
+    ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
     if (!ri)
 	return miRegionBreak (badreg);
     sizeRI = 4;
@@ -1333,7 +1333,7 @@ miRegionValidate(RegionPtr badreg, Bool *pOverlap)
 	{
 	    /* Oops, allocate space for new region information */
 	    sizeRI <<= 1;
-	    rit = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
+	    rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo));
 	    if (!rit)
 		goto bail;
 	    ri = rit;
@@ -1389,13 +1389,13 @@ NextRect: ;
 	numRI -= half;
     }
     *badreg = ri[0].reg;
-    xfree(ri);
+    free(ri);
     good(badreg);
     return ret;
 bail:
     for (i = 0; i < numRI; i++)
 	xfreeData(&ri[i].reg);
-    xfree (ri);
+    free(ri);
     return miRegionBreak (badreg);
 }
 
@@ -1473,7 +1473,7 @@ miRectsToRegion(int nrects, xRectangle *prect, int ctype)
     }
     else
     {
-	xfree (pData);
+	free(pData);
     }
     return pRgn;
 }
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 96113d6..d46b9f5 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -166,7 +166,7 @@ miCreateScreenResources(ScreenPtr pScreen)
     {
 	value = pScrInitParms->pbits;
     }
-    xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
+    free(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
     pScreen->devPrivate = value; /* pPixmap or pbits */
     return TRUE;
 }
@@ -180,7 +180,7 @@ miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
      * to the screen, until CreateScreenResources can put them in the
      * screen pixmap.
      */
-    pScrInitParms = xalloc(sizeof(miScreenInitParmsRec));
+    pScrInitParms = malloc(sizeof(miScreenInitParmsRec));
     if (!pScrInitParms)
 	return FALSE;
     pScrInitParms->pbits = pbits;
diff --git a/mi/mispans.c b/mi/mispans.c
index 5504341..8ac66cc 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -150,12 +150,12 @@ static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub)
 				int	    *newwid;
 
 #define EXTRA 8
-				newPt = (DDXPointPtr) xrealloc (spans->points, (spans->count + EXTRA) * sizeof (DDXPointRec));
+				newPt = (DDXPointPtr) realloc(spans->points, (spans->count + EXTRA) * sizeof (DDXPointRec));
 				if (!newPt)
 				    break;
 				spansPt = newPt + (spansPt - spans->points);
 				spans->points = newPt;
-				newwid = (int *) xrealloc (spans->widths, (spans->count + EXTRA) * sizeof (int));
+				newwid = (int *) realloc(spans->widths, (spans->count + EXTRA) * sizeof (int));
 				if (!newwid)
 				    break;
 				spansWid = newwid + (spansWid - spans->widths);
@@ -190,7 +190,7 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
 	if (spanGroup->size == spanGroup->count) {
 	    spanGroup->size = (spanGroup->size + 8) * 2;
 	    spanGroup->group = (Spans *)
-		xrealloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
+		realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
 	 }
 
 	spanGroup->group[spanGroup->count] = *spans;
@@ -208,14 +208,14 @@ void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
     }
     else
     {
-	xfree (spans->points);
-	xfree (spans->widths);
+	free(spans->points);
+	free(spans->widths);
     }
 } /* AppendSpans */
 
 void miFreeSpanGroup(SpanGroup *spanGroup)
 {
-    if (spanGroup->group != NULL) xfree(spanGroup->group);
+    if (spanGroup->group != NULL) free(spanGroup->group);
 }
 
 static void QuickSortSpansX(
@@ -366,8 +366,8 @@ miDisposeSpanGroup (SpanGroup *spanGroup)
     for (i = 0; i < spanGroup->count; i++)
     {
 	spans = spanGroup->group + i;
-	xfree (spans->points);
-	xfree (spans->widths);
+	free(spans->points);
+	free(spans->widths);
     }
 }
 
@@ -391,8 +391,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 	spans = spanGroup->group;
 	(*pGC->ops->FillSpans)
 	    (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
-	xfree(spans->points);
-	xfree(spans->widths);
+	free(spans->points);
+	free(spans->widths);
     }
     else
     {
@@ -405,15 +405,15 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 	ylength = spanGroup->ymax - ymin + 1;
 
 	/* Allocate Spans for y buckets */
-	yspans = xalloc(ylength * sizeof(Spans));
-	ysizes = xalloc(ylength * sizeof (int));
+	yspans = malloc(ylength * sizeof(Spans));
+	ysizes = malloc(ylength * sizeof (int));
 
 	if (!yspans || !ysizes)
 	{
 	    if (yspans)
-		xfree (yspans);
+		free(yspans);
 	    if (ysizes)
-		xfree (ysizes);
+		free(ysizes);
 	    miDisposeSpanGroup (spanGroup);
 	    return;
 	}
@@ -443,10 +443,10 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 			DDXPointPtr newpoints;
 			int	    *newwidths;
 			ysizes[index] = (ysizes[index] + 8) * 2;
-			newpoints = (DDXPointPtr) xrealloc(
+			newpoints = (DDXPointPtr) realloc(
 			    newspans->points,
 			    ysizes[index] * sizeof(DDXPointRec));
-			newwidths = (int *) xrealloc(
+			newwidths = (int *) realloc(
 			    newspans->widths,
 			    ysizes[index] * sizeof(int));
 			if (!newpoints || !newwidths)
@@ -455,11 +455,11 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 
 			    for (i = 0; i < ylength; i++)
 			    {
-				xfree (yspans[i].points);
-				xfree (yspans[i].widths);
+				free(yspans[i].points);
+				free(yspans[i].widths);
 			    }
-			    xfree (yspans);
-			    xfree (ysizes);
+			    free(yspans);
+			    free(ysizes);
 			    miDisposeSpanGroup (spanGroup);
 			    return;
 			}
@@ -472,30 +472,30 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 		} /* if y value of span in range */
 	    } /* for j through spans */
 	    count += spans->count;
-	    xfree(spans->points);
+	    free(spans->points);
 	    spans->points = NULL;
-	    xfree(spans->widths);
+	    free(spans->widths);
 	    spans->widths = NULL;
 	} /* for i thorough Spans */
 
 	/* Now sort by x and uniquify each bucket into the final array */
-	points = xalloc(count * sizeof(DDXPointRec));
-	widths = xalloc(count * sizeof(int));
+	points = malloc(count * sizeof(DDXPointRec));
+	widths = malloc(count * sizeof(int));
 	if (!points || !widths)
 	{
 	    int	i;
 
 	    for (i = 0; i < ylength; i++)
 	    {
-		xfree (yspans[i].points);
-		xfree (yspans[i].widths);
+		free(yspans[i].points);
+		free(yspans[i].widths);
 	    }
-	    xfree (yspans);
-	    xfree (ysizes);
+	    free(yspans);
+	    free(ysizes);
 	    if (points)
-		xfree (points);
+		free(points);
 	    if (widths)
-		xfree (widths);
+		free(widths);
 	    return;
 	}
 	count = 0;
@@ -511,16 +511,16 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 		    widths[count] = yspans[i].widths[0];
 		    count++;
 		}
-		xfree(yspans[i].points);
-		xfree(yspans[i].widths);
+		free(yspans[i].points);
+		free(yspans[i].widths);
 	    }
 	}
 
 	(*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE);
-	xfree(points);
-	xfree(widths);
-	xfree(yspans);
-	xfree(ysizes);		/* use (DE)xalloc for these? */
+	free(points);
+	free(widths);
+	free(yspans);
+	free(ysizes);		/* use (DE)xalloc for these? */
     }
 
     spanGroup->count = 0;
diff --git a/mi/misprite.c b/mi/misprite.c
index ac025e1..9f10a2b 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -298,7 +298,7 @@ miSpriteInitialize (ScreenPtr               pScreen,
     if (!DamageSetup (pScreen))
 	return FALSE;
 
-    pScreenPriv = xalloc (sizeof (miSpriteScreenRec));
+    pScreenPriv = malloc(sizeof (miSpriteScreenRec));
     if (!pScreenPriv)
 	return FALSE;
 
@@ -311,7 +311,7 @@ miSpriteInitialize (ScreenPtr               pScreen,
 
     if (!miPointerInitialize (pScreen, &miSpritePointerFuncs, screenFuncs,TRUE))
     {
-	xfree (pScreenPriv);
+	free(pScreenPriv);
 	return FALSE;
     }
     for (pVisual = pScreen->visuals;
@@ -386,7 +386,7 @@ miSpriteCloseScreen (int i, ScreenPtr pScreen)
 
     DamageDestroy (pScreenPriv->pDamage);
 
-    xfree (pScreenPriv);
+    free(pScreenPriv);
 
     return (*pScreen->CloseScreen) (i, pScreen);
 }
@@ -926,7 +926,7 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
 
     pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
 
-    pCursorInfo = xalloc(sizeof(miCursorInfoRec));
+    pCursorInfo = malloc(sizeof(miCursorInfoRec));
     if (!pCursorInfo)
         return FALSE;
 
@@ -943,7 +943,7 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
     ret = (*pScreenPriv->funcs->DeviceCursorInitialize)(pDev, pScreen);
     if (!ret)
     {
-        xfree(pCursorInfo);
+        free(pCursorInfo);
         pCursorInfo = NULL;
     }
     dixSetPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey, pCursorInfo);
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 181b12e..57dda22 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -122,13 +122,13 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     
     if (!spanData)
     {
-    	pptInit = xalloc (overall_height * sizeof(*ppt));
+        pptInit = malloc(overall_height * sizeof(*ppt));
     	if (!pptInit)
 	    return;
-    	pwidthInit = xalloc (overall_height * sizeof(*pwidth));
+        pwidthInit = malloc(overall_height * sizeof(*pwidth));
     	if (!pwidthInit)
     	{
-	    xfree (pptInit);
+	    free(pptInit);
 	    return;
     	}
 	ppt = pptInit;
@@ -143,13 +143,13 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     }
     else
     {
-	spanRec.points = xalloc (overall_height * sizeof (*ppt));
+	spanRec.points = malloc(overall_height * sizeof (*ppt));
 	if (!spanRec.points)
 	    return;
-	spanRec.widths = xalloc (overall_height * sizeof (int));
+	spanRec.widths = malloc(overall_height * sizeof (int));
 	if (!spanRec.widths)
 	{
-	    xfree (spanRec.points);
+	    free(spanRec.points);
 	    return;
 	}
 	ppt = spanRec.points;
@@ -229,8 +229,8 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     if (!spanData)
     {
     	(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
-    	xfree (pwidthInit);
-    	xfree (pptInit);
+        free(pwidthInit);
+        free(pptInit);
     	if (pixel != oldPixel)
     	{
 	    DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
@@ -283,13 +283,13 @@ miFillRectPolyHelper (
     }
     else
     {
-	spanRec.points = xalloc (h * sizeof (*ppt));
+	spanRec.points = malloc(h * sizeof (*ppt));
 	if (!spanRec.points)
 	    return;
-	spanRec.widths = xalloc (h * sizeof (int));
+	spanRec.widths = malloc(h * sizeof (int));
 	if (!spanRec.widths)
 	{
-	    xfree (spanRec.points);
+	    free(spanRec.points);
 	    return;
 	}
 	ppt = spanRec.points;
@@ -1107,13 +1107,13 @@ miLineArc (
     }
     if (!spanData)
     {
-    	points = xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
+        points = malloc(sizeof(DDXPointRec) * pGC->lineWidth);
     	if (!points)
 	    return;
-    	widths = xalloc(sizeof(int) * pGC->lineWidth);
+        widths = malloc(sizeof(int) * pGC->lineWidth);
     	if (!widths)
     	{
-	    xfree(points);
+	    free(points);
 	    return;
     	}
     	oldPixel = pGC->fgPixel;
@@ -1126,13 +1126,13 @@ miLineArc (
     }
     else
     {
-	points = xalloc (pGC->lineWidth * sizeof (DDXPointRec));
+	points = malloc(pGC->lineWidth * sizeof (DDXPointRec));
 	if (!points)
 	    return;
-	widths = xalloc (pGC->lineWidth * sizeof (int));
+	widths = malloc(pGC->lineWidth * sizeof (int));
 	if (!widths)
 	{
-	    xfree (points);
+	    free(points);
 	    return;
 	}
 	spanRec.points = points;
@@ -1148,8 +1148,8 @@ miLineArc (
     if (!spanData)
     {
     	(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
-    	xfree(widths);
-    	xfree(points);
+        free(widths);
+        free(points);
     	if (pixel != oldPixel)
     	{
 	    DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
diff --git a/mi/miwindow.c b/mi/miwindow.c
index c233393..2550ca2 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -245,7 +245,7 @@ miHandleValidateExposures(WindowPtr pWin)
 	    REGION_UNINIT(pScreen, &val->after.borderExposed);
 	    (*WindowExposures)(pChild, &val->after.exposed, NullRegion);
 	    REGION_UNINIT(pScreen, &val->after.exposed);
-	    xfree(val);
+	    free(val);
 	    pChild->valdata = NULL;
 	    if (pChild->firstChild)
 	    {
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index ad84c01..1175bc1 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -737,7 +737,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
     dospans = (pGC->fillStyle != FillSolid);
     if (dospans)
     {
-	widths = xalloc(sizeof(int) * numPts);
+	widths = malloc(sizeof(int) * numPts);
 	if (!widths)
 	    return;
 	maxw = 0;
@@ -754,12 +754,12 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
 		   (unsigned char *) pGC->dash, (int)pGC->numInDashList,
 		   &dinfo.dashOffsetInit);
     }
-    points = xalloc(sizeof(DDXPointRec) * numPts);
+    points = malloc(sizeof(DDXPointRec) * numPts);
     if (!points)
     {
 	if (dospans)
 	{
-	    xfree(widths);
+	    free(widths);
 	}
 	return;
     }
@@ -836,9 +836,9 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
 	    }
 	}
     }
-    xfree(points);
+    free(points);
     if (dospans)
     {
-	xfree(widths);
+	free(widths);
     }
 }
diff --git a/mi/mizerline.c b/mi/mizerline.c
index 46e2e2a..07cfbe1 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -155,8 +155,8 @@ miZeroLine(
     width = xright - xleft + 1;
     height = ybottom - ytop + 1;
     list_len = (height >= width) ? height : width;
-    pspanInit = xalloc(list_len * sizeof(DDXPointRec));
-    pwidthInit = xalloc(list_len * sizeof(int));
+    pspanInit = malloc(list_len * sizeof(DDXPointRec));
+    pwidthInit = malloc(list_len * sizeof(int));
     if (!pspanInit || !pwidthInit)
 	return;
 
@@ -359,8 +359,8 @@ miZeroLine(
 	(*pGC->ops->FillSpans)(pDraw, pGC, Nspans, pspanInit,
 			       pwidthInit, FALSE);
 
-    xfree(pwidthInit);
-    xfree(pspanInit);
+    free(pwidthInit);
+    free(pspanInit);
 }
 
 void
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 247cb83..1959c8b 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -480,7 +480,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
     if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec)))
 	return;
 
-    pScreenPriv = xalloc(sizeof(cwScreenRec));
+    pScreenPriv = malloc(sizeof(cwScreenRec));
     if (!pScreenPriv)
 	return;
 
@@ -516,7 +516,7 @@ cwCloseScreen (int i, ScreenPtr pScreen)
     if (ps)
 	cwFiniRender(pScreen);
 
-    xfree((pointer)pScreenPriv);
+    free((pointer)pScreenPriv);
 
     return (*pScreen->CloseScreen)(i, pScreen);
 }
diff --git a/miext/cw/cw_render.c b/miext/cw/cw_render.c
index dfe2681..165c44f 100644
--- a/miext/cw/cw_render.c
+++ b/miext/cw/cw_render.c
@@ -73,7 +73,7 @@ cwCreatePicturePrivate (PicturePtr pPicture)
     int		    error;
     cwPicturePtr    pPicturePrivate;
 
-    pPicturePrivate = xalloc (sizeof (cwPictureRec));
+    pPicturePrivate = malloc(sizeof (cwPictureRec));
     if (!pPicturePrivate)
 	return NULL;
     
@@ -83,7 +83,7 @@ cwCreatePicturePrivate (PicturePtr pPicture)
 						      &error);
     if (!pPicturePrivate->pBackingPicture)
     {
-	xfree (pPicturePrivate);
+	free(pPicturePrivate);
 	return NULL;
     }
 
@@ -107,7 +107,7 @@ cwDestroyPicturePrivate (PicturePtr pPicture)
     {
 	if (pPicturePrivate->pBackingPicture)
 	    FreePicture (pPicturePrivate->pBackingPicture, 0);
-	xfree (pPicturePrivate);
+	free(pPicturePrivate);
 	setCwPicture(pPicture, NULL);
     }
 }
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index de18573..551cb72 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -1511,7 +1511,7 @@ damageText (DrawablePtr	    pDrawable,
 
     imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
 
-    charinfo = xalloc(count * sizeof(CharInfoPtr));
+    charinfo = malloc(count * sizeof(CharInfoPtr));
     if (!charinfo)
 	return x;
 
@@ -1533,7 +1533,7 @@ damageText (DrawablePtr	    pDrawable,
 	    (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
 				      FONTGLYPHS(pGC->font));
     }
-    xfree(charinfo);
+    free(charinfo);
     return x + w;
 }
 
@@ -1848,7 +1848,7 @@ damageCloseScreen (int i, ScreenPtr pScreen)
     unwrap (pScrPriv, pScreen, CreateGC);
     unwrap (pScrPriv, pScreen, CopyWindow);
     unwrap (pScrPriv, pScreen, CloseScreen);
-    xfree (pScrPriv);
+    free(pScrPriv);
     return (*pScreen->CloseScreen) (i, pScreen);
 }
 
@@ -1890,7 +1890,7 @@ DamageSetup (ScreenPtr pScreen)
     if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec)))
 	return FALSE;
 
-    pScrPriv = xalloc (sizeof (DamageScrPrivRec));
+    pScrPriv = malloc(sizeof (DamageScrPrivRec));
     if (!pScrPriv)
 	return FALSE;
 
@@ -1926,7 +1926,7 @@ DamageCreate (DamageReportFunc  damageReport,
     damageScrPriv(pScreen);
     DamagePtr	pDamage;
 
-    pDamage = xalloc (sizeof (DamageRec));
+    pDamage = malloc(sizeof (DamageRec));
     if (!pDamage)
 	return 0;
     pDamage->pNext = 0;
@@ -2054,7 +2054,7 @@ DamageDestroy (DamagePtr    pDamage)
     pDamage->devPrivates = NULL;
     REGION_UNINIT (pScreen, &pDamage->damage);
     REGION_UNINIT (pScreen, &pDamage->pendingDamage);
-    xfree (pDamage);
+    free(pDamage);
 }
 
 Bool
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 5f24946..7a24af8 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -98,10 +98,10 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
 
     if (s->pixmap_data_size < rowbytes) {
         if (s->pixmap_data != NULL)
-            xfree(s->pixmap_data);
+            free(s->pixmap_data);
 
         s->pixmap_data_size = rowbytes;
-        s->pixmap_data = xalloc(s->pixmap_data_size);
+        s->pixmap_data = malloc(s->pixmap_data_size);
         if (s->pixmap_data == NULL)
             return;
 
@@ -157,12 +157,12 @@ RootlessCloseScreen(int i, ScreenPtr pScreen)
     pScreen->CloseScreen = s->CloseScreen;
 
     if (s->pixmap_data != NULL) {
-        xfree (s->pixmap_data);
+        free(s->pixmap_data);
         s->pixmap_data = NULL;
         s->pixmap_data_size = 0;
     }
 
-    xfree(s);
+    free(s);
     return pScreen->CloseScreen(i, pScreen);
 }
 
@@ -641,7 +641,7 @@ RootlessAllocatePrivates(ScreenPtr pScreen)
     if (!dixRequestPrivate(rootlessGCPrivateKey, sizeof(RootlessGCRec)))
         return FALSE;
 
-    s = xalloc(sizeof(RootlessScreenRec));
+    s = malloc(sizeof(RootlessScreenRec));
     if (! s) return FALSE;
     SETSCREENREC(pScreen, s);
 
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 55c7b96..22a548a 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -187,7 +187,7 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
     REGION_UNINIT(pScreen, &winRec->damage);
 #endif
 
-    xfree(winRec);
+    free(winRec);
     SETWINREC(pWin, NULL);
 }
 
@@ -421,7 +421,7 @@ RootlessEnsureFrame(WindowPtr pWin)
     if (pWin->drawable.class != InputOutput)
         return NULL;
 
-    winRec = xalloc(sizeof(RootlessWindowRec));
+    winRec = malloc(sizeof(RootlessWindowRec));
 
     if (!winRec)
         return NULL;
@@ -448,7 +448,7 @@ RootlessEnsureFrame(WindowPtr pWin)
                                               pShape))
     {
         RL_DEBUG_MSG("implementation failed to create frame!\n");
-        xfree(winRec);
+        free(winRec);
         SETWINREC(pWin, NULL);
         return NULL;
     }
@@ -984,7 +984,7 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
             copy_rect_width = copy_rect.x2 - copy_rect.x1;
             copy_rect_height = copy_rect.y2 - copy_rect.y1;
             copy_rowbytes = ((copy_rect_width * Bpp) + 31) & ~31;
-            gResizeDeathBits = xalloc(copy_rowbytes
+            gResizeDeathBits = malloc(copy_rowbytes
                                       * copy_rect_height);
 
             if (copy_rect_width * copy_rect_height >
@@ -1028,7 +1028,7 @@ StartFrameResize(WindowPtr pWin, Bool gravity,
 
         RootlessStartDrawing(pWin);
 
-        gResizeDeathBits = xalloc(winRec->bytesPerRow * winRec->height);
+        gResizeDeathBits = malloc(winRec->bytesPerRow * winRec->height);
 
         memcpy(gResizeDeathBits, winRec->pixelData,
                winRec->bytesPerRow * winRec->height);
@@ -1170,7 +1170,7 @@ FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
     }
 
     if (gResizeDeathBits != NULL) {
-        xfree(gResizeDeathBits);
+        free(gResizeDeathBits);
         gResizeDeathBits = NULL;
     }
 
diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c
index 608ccd2..e027e76 100644
--- a/miext/shadow/shadow.c
+++ b/miext/shadow/shadow.c
@@ -107,7 +107,7 @@ shadowCloseScreen(int i, ScreenPtr pScreen)
 #endif
     if (pBuf->pPixmap)
 	pScreen->DestroyPixmap(pBuf->pPixmap);
-    xfree(pBuf);
+    free(pBuf);
     return pScreen->CloseScreen(i, pScreen);
 }
 
@@ -139,7 +139,7 @@ shadowSetup(ScreenPtr pScreen)
     if (!DamageSetup(pScreen))
 	return FALSE;
 
-    pBuf = xalloc(sizeof(shadowBufRec));
+    pBuf = malloc(sizeof(shadowBufRec));
     if (!pBuf)
 	return FALSE;
 #ifdef BACKWARDS_COMPATIBILITY
@@ -154,7 +154,7 @@ shadowSetup(ScreenPtr pScreen)
 				 TRUE, pScreen, pScreen);
 #endif
     if (!pBuf->pDamage) {
-	xfree(pBuf);
+	free(pBuf);
 	return FALSE;
     }
 
diff --git a/miext/shadow/shalloc.c b/miext/shadow/shalloc.c
index 72aa28b..f57cb52 100644
--- a/miext/shadow/shalloc.c
+++ b/miext/shadow/shalloc.c
@@ -45,6 +45,6 @@ shadowAlloc (int width, int height, int bpp)
 
     /* Cant use PixmapBytePad -- the structure is probably not initialized yet */
     stride = BitmapBytePad (width * bpp);
-    fb = xalloc (stride * height);
+    fb = malloc(stride * height);
     return fb;
 }
diff --git a/os/WaitFor.c b/os/WaitFor.c
index dfe85e5..e663004 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -431,7 +431,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
 
     if (!timer)
     {
-	timer = xalloc(sizeof(struct _OsTimerRec));
+	timer = malloc(sizeof(struct _OsTimerRec));
 	if (!timer)
 	    return NULL;
     }
@@ -516,7 +516,7 @@ TimerFree(OsTimerPtr timer)
     if (!timer)
 	return;
     TimerCancel(timer);
-    xfree(timer);
+    free(timer);
 }
 
 void
@@ -536,7 +536,7 @@ TimerInit(void)
     while ((timer = timers))
     {
 	timers = timer->next;
-	xfree(timer);
+	free(timer);
     }
 }
 
diff --git a/os/access.c b/os/access.c
index d057e04..a39366e 100644
--- a/os/access.c
+++ b/os/access.c
@@ -238,12 +238,12 @@ typedef struct _host {
 	int		requested;
 } HOST;
 
-#define MakeHost(h,l)	(h)=xalloc(sizeof *(h)+(l));\
+#define MakeHost(h,l)	(h)=malloc(sizeof *(h)+(l));\
 			if (h) { \
 			   (h)->addr=(unsigned char *) ((h) + 1);\
 			   (h)->requested = FALSE; \
 			}
-#define FreeHost(h)	xfree(h)
+#define FreeHost(h)	free(h)
 static HOST *selfhosts = NULL;
 static HOST *validhosts = NULL;
 static int AccessEnabled = DEFAULT_ACCESS_CONTROL;
@@ -587,7 +587,7 @@ DefineSelf (int fd)
         Error ("Getting interface count");    
     if (len < (ifn.lifn_count * sizeof(struct lifreq))) {
 	len = ifn.lifn_count * sizeof(struct lifreq);
-	bufptr = xalloc(len);
+	bufptr = malloc(len);
     }
 #endif
     
@@ -1131,12 +1131,12 @@ Bool LocalClient(ClientPtr client)
 	    &alen, (pointer *)&addr);
 	if (family == -1)
 	{
-	    xfree (from);
+	    free(from);
 	    return FALSE;
 	}
 	if (family == FamilyLocal)
 	{
-	    xfree (from);
+	    free(from);
 	    return TRUE;
 	}
 	for (host = selfhosts; host; host = host->next)
@@ -1144,7 +1144,7 @@ Bool LocalClient(ClientPtr client)
 	    if (addrEqual (family, addr, alen, host))
 		return TRUE;
 	}
-	xfree (from);
+	free(from);
     }
     return FALSE;
 }
@@ -1214,7 +1214,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
     }
 #endif
 
-    *lccp = Xcalloc(sizeof(LocalClientCredRec));
+    *lccp = calloc(1, sizeof(LocalClientCredRec));
     if (*lccp == NULL)
 	return -1;
     lcc = *lccp;
@@ -1250,7 +1250,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
 #endif
     lcc->nSuppGids = ucred_getgroups(peercred, &gids);
     if (lcc->nSuppGids > 0) {
-	lcc->pSuppGids = Xcalloc((lcc->nSuppGids) * sizeof(int));
+	lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int));
 	if (lcc->pSuppGids == NULL) {
 	    lcc->nSuppGids = 0;
 	} else {
@@ -1287,9 +1287,9 @@ FreeLocalClientCreds(LocalClientCredRec *lcc)
 {
     if (lcc != NULL) {
 	if (lcc->nSuppGids > 0) {
-	    Xfree(lcc->pSuppGids);
+	    free(lcc->pSuppGids);
 	}
-	Xfree(lcc);
+	free(lcc);
     }
 }
 
@@ -1484,7 +1484,7 @@ GetHosts (
     }
     if (n)
     {
-        *data = ptr = xalloc (n);
+        *data = ptr = malloc(n);
 	if (!ptr)
 	{
 	    return(BadAlloc);
@@ -1743,7 +1743,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
 	}
     }
 
-    s = xalloc(sizeof(struct siType));
+    s = malloc(sizeof(struct siType));
     if (s == NULL)
 	return BadAlloc;
 
@@ -2085,7 +2085,7 @@ static Bool
 siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id)
 {
     Bool parsedOK = FALSE;
-    char *addrbuf = xalloc(len + 1);
+    char *addrbuf = malloc(len + 1);
 
     if (addrbuf == NULL) {
 	return FALSE;
@@ -2119,7 +2119,7 @@ siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id)
 	}
     }
 
-    xfree(addrbuf);
+    free(addrbuf);
     return parsedOK;
 }
 
diff --git a/os/connection.c b/os/connection.c
index 61ba72a..bbcfa51 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -226,7 +226,7 @@ void SetConnectionTranslation(int conn, int client)
             }
             node = &((*node)->next);
         }
-        *node = xalloc(sizeof(struct _ct_node));
+        *node = malloc(sizeof(struct _ct_node));
         (*node)->next = NULL;
         (*node)->key = conn;
         (*node)->value = client;
@@ -244,7 +244,7 @@ void ClearConnectionTranslation(void)
         {
             struct _ct_node *temp = node;
             node = node->next;
-            xfree(temp);
+            free(temp);
         }
     }
 }
@@ -397,7 +397,7 @@ CreateWellKnownSockets(void)
 	}
 	else
 	{
-	    ListenTransFds = xalloc (ListenTransCount * sizeof (int));
+	    ListenTransFds = malloc(ListenTransCount * sizeof (int));
 
 	    for (i = 0; i < ListenTransCount; i++)
 	    {
@@ -679,7 +679,7 @@ ClientAuthorized(ClientPtr client,
 			proto_n, auth_proto, auth_id);
 	    }
 
-	    xfree (from);
+	    free(from);
 	}
 
 	if (auth_id == (XID) ~0L) {
@@ -701,7 +701,7 @@ ClientAuthorized(ClientPtr client,
 	    AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen,
 		      proto_n, auth_proto, auth_id);
 
-	    xfree (from);
+	    free(from);
 	}
     }
     priv->auth_id = auth_id;
@@ -737,7 +737,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
 #endif
 	)
 	return NullClient;
-    oc = xalloc(sizeof(OsCommRec));
+    oc = malloc(sizeof(OsCommRec));
     if (!oc)
 	return NullClient;
     oc->trans_conn = trans_conn;
@@ -748,7 +748,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
     oc->conn_time = conn_time;
     if (!(client = NextAvailableClient((pointer)oc)))
     {
-	xfree (oc);
+	free(oc);
 	return NullClient;
     }
 #if !defined(WIN32)
@@ -1040,7 +1040,7 @@ CloseDownConnection(ClientPtr client)
 #endif
     CloseDownFileDescriptor(oc);
     FreeOsBuffers(oc);
-    xfree(client->osPrivate);
+    free(client->osPrivate);
     client->osPrivate = (pointer)NULL;
     if (auditTrailLevel > 1)
 	AuditF("client %d disconnected\n", client->index);
@@ -1276,8 +1276,8 @@ void ListenOnOpenFD(int fd, int noxauth) {
         ciptr->flags = ciptr->flags | TRANS_NOXAUTH;
 
     /* Allocate space to store it */
-    ListenTransFds = (int *) xrealloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int));
-    ListenTransConns = (XtransConnInfo *) xrealloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo));
+    ListenTransFds = (int *) realloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int));
+    ListenTransConns = (XtransConnInfo *) realloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo));
     
     /* Store it */
     ListenTransConns[ListenTransCount] = ciptr;
diff --git a/os/io.c b/os/io.c
index 64b64ae..8335102 100644
--- a/os/io.c
+++ b/os/io.c
@@ -215,8 +215,8 @@ ReadRequestFromClient(ClientPtr client)
 	    register ConnectionInputPtr aci = AvailableInput->input;
 	    if (aci->size > BUFWATERMARK)
 	    {
-		xfree(aci->buffer);
-		xfree(aci);
+		free(aci->buffer);
+		free(aci);
 	    }
 	    else
 	    {
@@ -310,7 +310,7 @@ ReadRequestFromClient(ClientPtr client)
 		/* make buffer bigger to accomodate request */
 		char *ibuf;
 
-		ibuf = (char *)xrealloc(oci->buffer, needed);
+		ibuf = (char *)realloc(oci->buffer, needed);
 		if (!ibuf)
 		{
 		    YieldControlDeath();
@@ -360,7 +360,7 @@ ReadRequestFromClient(ClientPtr client)
 	{
 	    char *ibuf;
 
-	    ibuf = (char *)xrealloc(oci->buffer, BUFSIZE);
+	    ibuf = (char *)realloc(oci->buffer, BUFSIZE);
 	    if (ibuf)
 	    {
 		oci->size = BUFSIZE;
@@ -479,8 +479,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
 	    ConnectionInputPtr aci = AvailableInput->input;
 	    if (aci->size > BUFWATERMARK)
 	    {
-		xfree(aci->buffer);
-		xfree(aci);
+		free(aci->buffer);
+		free(aci);
 	    }
 	    else
 	    {
@@ -506,7 +506,7 @@ InsertFakeRequest(ClientPtr client, char *data, int count)
     {
 	char *ibuf;
 
-	ibuf = (char *)xrealloc(oci->buffer, gotnow + count);
+	ibuf = (char *)realloc(oci->buffer, gotnow + count);
 	if (!ibuf)
 	    return(FALSE);
 	oci->size = gotnow + count;
@@ -937,7 +937,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
 	    {
 		unsigned char *obuf;
 
-		obuf = (unsigned char *)xrealloc(oco->buf,
+		obuf = (unsigned char *)realloc(oco->buf,
 						 notWritten + BUFSIZE);
 		if (!obuf)
 		{
@@ -994,8 +994,8 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount)
     }
     if (oco->size > BUFWATERMARK)
     {
-	xfree(oco->buf);
-	xfree(oco);
+	free(oco->buf);
+	free(oco);
     }
     else
     {
@@ -1011,13 +1011,13 @@ AllocateInputBuffer(void)
 {
     ConnectionInputPtr oci;
 
-    oci = xalloc(sizeof(ConnectionInput));
+    oci = malloc(sizeof(ConnectionInput));
     if (!oci)
 	return NULL;
-    oci->buffer = xalloc(BUFSIZE);
+    oci->buffer = malloc(BUFSIZE);
     if (!oci->buffer)
     {
-	xfree(oci);
+	free(oci);
 	return NULL;
     }
     oci->size = BUFSIZE;
@@ -1032,13 +1032,13 @@ AllocateOutputBuffer(void)
 {
     ConnectionOutputPtr oco;
 
-    oco = xalloc(sizeof(ConnectionOutput));
+    oco = malloc(sizeof(ConnectionOutput));
     if (!oco)
 	return NULL;
-    oco->buf = xcalloc(1, BUFSIZE);
+    oco->buf = calloc(1, BUFSIZE);
     if (!oco->buf)
     {
-	xfree(oco);
+	free(oco);
 	return NULL;
     }
     oco->size = BUFSIZE;
@@ -1058,8 +1058,8 @@ FreeOsBuffers(OsCommPtr oc)
     {
 	if (FreeInputs)
 	{
-	    xfree(oci->buffer);
-	    xfree(oci);
+	    free(oci->buffer);
+	    free(oci);
 	}
 	else
 	{
@@ -1074,8 +1074,8 @@ FreeOsBuffers(OsCommPtr oc)
     {
 	if (FreeOutputs)
 	{
-	    xfree(oco->buf);
-	    xfree(oco);
+	    free(oco->buf);
+	    free(oco);
 	}
 	else
 	{
@@ -1095,13 +1095,13 @@ ResetOsBuffers(void)
     while ((oci = FreeInputs))
     {
 	FreeInputs = oci->next;
-	xfree(oci->buffer);
-	xfree(oci);
+	free(oci->buffer);
+	free(oci);
     }
     while ((oco = FreeOutputs))
     {
 	FreeOutputs = oco->next;
-	xfree(oco->buf);
-	xfree(oco);
+	free(oco->buf);
+	free(oco);
     }
 }
diff --git a/os/log.c b/os/log.c
index 3773315..ff78545 100644
--- a/os/log.c
+++ b/os/log.c
@@ -170,7 +170,7 @@ LogInit(const char *fname, const char *backup)
     char *logFileName = NULL;
 
     if (fname && *fname) {
-	/* xalloc() can't be used yet. */
+	/* malloc() can't be used yet. */
 	logFileName = malloc(strlen(fname) + strlen(display) + 1);
 	if (!logFileName)
 	    FatalError("Cannot allocate space for the log file name\n");
@@ -217,7 +217,7 @@ LogInit(const char *fname, const char *backup)
      * needed.
      */
     if (saveBuffer && bufferSize > 0) {
-	free(saveBuffer);	/* Must be free(), not xfree() */
+	free(saveBuffer);	/* Must be free(), not free() */
 	saveBuffer = NULL;
 	bufferSize = 0;
     }
@@ -297,7 +297,7 @@ LogVWrite(int verb, const char *f, va_list args)
 	} else if (needBuffer) {
 	    /*
 	     * Note, this code is used before OsInit() has been called, so
-	     * xalloc() and friends can't be used.
+	     * malloc() and friends can't be used.
 	     */
 	    if (len > bufferUnused) {
 		bufferSize += 1024;
diff --git a/os/mitauth.c b/os/mitauth.c
index 1a26dce..4b8f6e9 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -55,12 +55,12 @@ MitAddCookie (
 {
     struct auth	*new;
 
-    new = xalloc (sizeof (struct auth));
+    new = malloc(sizeof (struct auth));
     if (!new)
 	return 0;
-    new->data = xalloc ((unsigned) data_length);
+    new->data = malloc((unsigned) data_length);
     if (!new->data) {
-	xfree(new);
+	free(new);
 	return 0;
     }
     new->next = mit_auth;
@@ -96,8 +96,8 @@ MitResetCookie (void)
 
     for (auth = mit_auth; auth; auth=next) {
 	next = auth->next;
-	xfree (auth->data);
-	xfree (auth);
+	free(auth->data);
+	free(auth);
     }
     mit_auth = 0;
     return 0;
@@ -152,8 +152,8 @@ MitRemoveCookie (
 		prev->next = auth->next;
 	    else
 		mit_auth = auth->next;
-	    xfree (auth->data);
-	    xfree (auth);
+	    free(auth->data);
+	    free(auth);
 	    return 1;
 	}
     }
diff --git a/os/rpcauth.c b/os/rpcauth.c
index ec7c01f..ad6ebf9 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -66,7 +66,7 @@ authdes_ezdecode(const char *inmsg, int len)
     XDR             xdr;
     SVCXPRT         xprt;
 
-    temp_inmsg = xalloc(len);
+    temp_inmsg = malloc(len);
     memmove(temp_inmsg, inmsg, len);
 
     memset((char *)&msg, 0, sizeof(msg));
@@ -79,7 +79,7 @@ authdes_ezdecode(const char *inmsg, int len)
     why = AUTH_FAILED; 
     xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE);
 
-    if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL)
+    if ((r.rq_clntcred = malloc(MAX_AUTH_BYTES)) == NULL)
         goto bad1;
     r.rq_xprt = &xprt;
 
@@ -106,7 +106,7 @@ authdes_ezdecode(const char *inmsg, int len)
     return (((struct authdes_cred *) r.rq_clntcred)->adc_fullname.name); 
 
 bad2:
-    xfree(r.rq_clntcred);
+    free(r.rq_clntcred);
 bad1:
     return ((char *)0); /* ((struct authdes_cred *) NULL); */
 }
diff --git a/os/utils.c b/os/utils.c
index 3dffbd8..c89da94 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -995,7 +995,7 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
 #endif
 
 	len = strlen(hnameptr) + 1;
-	result = xalloc(len + sizeof(AUTHORIZATION_NAME) + 4);
+	result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
 
 	p = result;
         *p++ = sizeof(AUTHORIZATION_NAME) >> 8;
@@ -1373,11 +1373,11 @@ Popen(char *command, char *type)
     if ((*type != 'r' && *type != 'w') || type[1])
 	return NULL;
 
-    if ((cur = xalloc(sizeof(struct pid))) == NULL)
+    if ((cur = malloc(sizeof(struct pid))) == NULL)
 	return NULL;
 
     if (pipe(pdes) < 0) {
-	xfree(cur);
+	free(cur);
 	return NULL;
     }
 
@@ -1392,7 +1392,7 @@ Popen(char *command, char *type)
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
-	xfree(cur);
+	free(cur);
 	if (OsSignal(SIGALRM, old_alarm) == SIG_ERR)
 	  perror("signal");
 	return NULL;
@@ -1459,11 +1459,11 @@ Fopen(char *file, char *type)
     if ((*type != 'r' && *type != 'w') || type[1])
 	return NULL;
 
-    if ((cur = xalloc(sizeof(struct pid))) == NULL)
+    if ((cur = malloc(sizeof(struct pid))) == NULL)
 	return NULL;
 
     if (pipe(pdes) < 0) {
-	xfree(cur);
+	free(cur);
 	return NULL;
     }
 
@@ -1471,7 +1471,7 @@ Fopen(char *file, char *type)
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
-	xfree(cur);
+	free(cur);
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1565,7 +1565,7 @@ Pclose(pointer iop)
 	pidlist = cur->next;
     else
 	last->next = cur->next;
-    xfree(cur);
+    free(cur);
 
     /* allow EINTR again */
     OsReleaseSignals ();
diff --git a/os/xdmauth.c b/os/xdmauth.c
index 7fab731..31c1b4c 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -239,7 +239,7 @@ XdmClientAuthTimeout (long now)
 		prev->next = next;
 	    else
 		xdmClients = next;
-	    xfree (client);
+	    free(client);
 	}
 	else
 	    prev = client;
@@ -259,20 +259,20 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
 	    *reason = "Bad XDM authorization key length";
 	return NULL;
     }
-    client = xalloc (sizeof (XdmClientAuthRec));
+    client = malloc(sizeof (XdmClientAuthRec));
     if (!client)
 	return NULL;
     XdmClientAuthDecode (plain, client);
     if (!XdmcpCompareKeys (&client->rho, rho))
     {
-	xfree (client);
+	free(client);
 	if (reason)
 	    *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)";
 	return NULL;
     }
     for (i = 18; i < 24; i++)
 	if (plain[i] != 0) {
-	    xfree (client);
+	    free(client);
 	    if (reason)
 		*reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)";
 	    return NULL;
@@ -287,15 +287,15 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
 #if defined(TCPCONN) || defined(STREAMSCONN)
 	    if (family == FamilyInternet &&
 		memcmp((char *)addr, client->client, 4) != 0) {
-		xfree (client);
-		xfree (addr);
+		free(client);
+		free(addr);
 		if (reason)
 		    *reason = "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)";
 		return NULL;
 
 	    }
 #endif
-	    xfree (addr);
+	    free(addr);
 	}
     }
     now = time(0);
@@ -308,7 +308,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
     XdmClientAuthTimeout (now);
     if (abs (client->time - now) > TwentyMinutes)
     {
-	xfree (client);
+	free(client);
 	if (reason)
 	    *reason = "Excessive XDM-AUTHORIZATION-1 time offset";
 	return NULL;
@@ -317,7 +317,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
     {
 	if (XdmClientAuthCompare (existing, client))
 	{
-	    xfree (client);
+	    free(client);
 	    if (reason)
 		*reason = "XDM authorization key matches an existing client!";
 	    return NULL;
@@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, const char *data, XID id)
     /* the first octet of the key must be zero */
     if (key_bits[0] != '\0')
 	return 0;
-    new = xalloc (sizeof (XdmAuthorizationRec));
+    new = malloc(sizeof (XdmAuthorizationRec));
     if (!new)
 	return 0;
     new->next = xdmAuth;
@@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie,
     /* Auth packets must be a multiple of 8 bytes long */
     if (cookie_length & 7)
 	return (XID) -1;
-    plain = xalloc (cookie_length);
+    plain = malloc(cookie_length);
     if (!plain)
 	return (XID) -1;
     for (auth = xdmAuth; auth; auth=auth->next) {
@@ -394,11 +394,11 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie,
 	{
 	    client->next = xdmClients;
 	    xdmClients = client;
-	    xfree (plain);
+	    free(plain);
 	    return auth->id;
 	}
     }
-    xfree (plain);
+    free(plain);
     return (XID) -1;
 }
 
@@ -411,13 +411,13 @@ XdmResetCookie (void)
     for (auth = xdmAuth; auth; auth=next_auth)
     {
 	next_auth = auth->next;
-	xfree (auth);
+	free(auth);
     }
     xdmAuth = 0;
     for (client = xdmClients; client; client=next_client)
     {
 	next_client = client->next;
-	xfree (client);
+	free(client);
     }
     xdmClients = (XdmClientAuthPtr) 0;
     return 1;
@@ -430,21 +430,21 @@ XdmToID (unsigned short cookie_length, char *cookie)
     XdmClientAuthPtr	client;
     unsigned char	*plain;
 
-    plain = xalloc (cookie_length);
+    plain = malloc(cookie_length);
     if (!plain)
 	return (XID) -1;
     for (auth = xdmAuth; auth; auth=auth->next) {
 	XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length);
 	if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL)
 	{
-	    xfree (client);
-	    xfree (cookie);
-	    xfree (plain);
+	    free(client);
+	    free(cookie);
+	    free(plain);
 	    return auth->id;
 	}
     }
-    xfree (cookie);
-    xfree (plain);
+    free(cookie);
+    free(plain);
     return (XID) -1;
 }
 
@@ -489,7 +489,7 @@ XdmRemoveCookie (unsigned short data_length, const char *data)
 	    XdmcpCompareKeys (key_bits, &auth->key))
  	{
 	    xdmAuth = auth->next;
-	    xfree (auth);
+	    free(auth);
 	    return 1;
 	}
     }
diff --git a/os/xdmcp.c b/os/xdmcp.c
index cae7d40..38b2197 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -391,7 +391,7 @@ XdmcpRegisterAuthentication (
 				     AuthenticationNames.length + 1) &&
 	  XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas,
 				     AuthenticationDatas.length + 1) &&
-	  (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
+	  (newFuncs = malloc((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
     {
 	XdmcpDisposeARRAY8 (&AuthenticationName);
 	XdmcpDisposeARRAY8 (&AuthenticationData);
@@ -402,7 +402,7 @@ XdmcpRegisterAuthentication (
     newFuncs[AuthenticationNames.length-1].Validator = Validator;
     newFuncs[AuthenticationNames.length-1].Generator = Generator;
     newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth;
-    xfree (AuthenticationFuncsList);
+    free(AuthenticationFuncsList);
     AuthenticationFuncsList = newFuncs;
     AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName;
     AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData;
@@ -492,18 +492,18 @@ XdmcpRegisterConnection (
     }
     if (ConnectionAddresses.length + 1 == 256)
 	return;
-    newAddress = xalloc (addrlen * sizeof (CARD8));
+    newAddress = malloc(addrlen * sizeof (CARD8));
     if (!newAddress)
 	return;
     if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1))
     {
-	xfree (newAddress);
+	free(newAddress);
 	return;
     }
     if (!XdmcpReallocARRAYofARRAY8 (&ConnectionAddresses,
 				    ConnectionAddresses.length +  1))
     {
-	xfree (newAddress);
+	free(newAddress);
 	return;
     }
     ConnectionTypes.data[ConnectionTypes.length - 1] = (CARD16) type;
@@ -533,12 +533,12 @@ XdmcpRegisterAuthorization (const char *name, int namelen)
     ARRAY8  authName;
     int	    i;
 
-    authName.data = xalloc (namelen * sizeof (CARD8));
+    authName.data = malloc(namelen * sizeof (CARD8));
     if (!authName.data)
 	return;
     if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1))
     {
-	xfree (authName.data);
+	free(authName.data);
 	return;
     }
     for (i = 0; i < namelen; i++)
diff --git a/os/xprintf.c b/os/xprintf.c
index 07eaa1f..3fe19b3 100644
--- a/os/xprintf.c
+++ b/os/xprintf.c
@@ -54,7 +54,7 @@ Xvprintf(const char *format, va_list va)
     size = vsnprintf(NULL, 0, format, va2);
     va_end(va2);
 
-    ret = (char *)Xalloc(size + 1);
+    ret = (char *)malloc(size + 1);
     if (ret == NULL)
         return NULL;
 
diff --git a/os/xsha1.c b/os/xsha1.c
index 355862f..5ea71da 100644
--- a/os/xsha1.c
+++ b/os/xsha1.c
@@ -12,7 +12,7 @@
 
 void *x_sha1_init(void)
 {
-    SHA1_CTX *ctx = xalloc(sizeof(*ctx));
+    SHA1_CTX *ctx = malloc(sizeof(*ctx));
     if (!ctx)
         return NULL;
     SHA1Init(ctx);
@@ -30,7 +30,7 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 {
     SHA1_CTX *sha1_ctx = ctx;
     SHA1Final(result, sha1_ctx);
-    xfree(sha1_ctx);
+    free(sha1_ctx);
     return 1;
 }
 
@@ -40,7 +40,7 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 
 void *x_sha1_init(void)
 {
-    CC_SHA1_CTX *ctx = xalloc(sizeof(*ctx));
+    CC_SHA1_CTX *ctx = malloc(sizeof(*ctx));
     if (!ctx)
         return NULL;
     CC_SHA1_Init(ctx);
@@ -58,7 +58,7 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 {
     CC_SHA1_CTX *sha1_ctx = ctx;
     CC_SHA1_Final(result, sha1_ctx);
-    xfree(sha1_ctx);
+    free(sha1_ctx);
     return 1;
 }
 
@@ -107,7 +107,7 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 
 void *x_sha1_init(void)
 {
-    sha1_ctx *ctx = xalloc(sizeof(*ctx));
+    sha1_ctx *ctx = malloc(sizeof(*ctx));
     if(!ctx)
         return NULL;
     sha1_begin(ctx);
@@ -123,7 +123,7 @@ int x_sha1_update(void *ctx, void *data, int size)
 int x_sha1_final(void *ctx, unsigned char result[20])
 {
     sha1_end(result, ctx);
-    xfree(ctx);
+    free(ctx);
     return 1;
 }
 
@@ -135,12 +135,12 @@ int x_sha1_final(void *ctx, unsigned char result[20])
 void *x_sha1_init(void)
 {
     int ret;
-    SHA_CTX *ctx = xalloc(sizeof(*ctx));
+    SHA_CTX *ctx = malloc(sizeof(*ctx));
     if (!ctx)
         return NULL;
     ret = SHA1_Init(ctx);
     if (!ret) {
-        xfree(ctx);
+        free(ctx);
         return NULL;
     }
     return ctx;
@@ -152,7 +152,7 @@ int x_sha1_update(void *ctx, void *data, int size)
     SHA_CTX *sha_ctx = ctx;
     ret = SHA1_Update(sha_ctx, data, size);
     if (!ret)
-        xfree(sha_ctx);
+        free(sha_ctx);
     return ret;
 }
 
@@ -161,7 +161,7 @@ int x_sha1_final(void *ctx, unsigned char result[20])
     int ret;
     SHA_CTX *sha_ctx = ctx;
     ret = SHA1_Final(result, sha_ctx);
-    xfree(sha_ctx);
+    free(sha_ctx);
     return ret;
 }
 
diff --git a/randr/randr.c b/randr/randr.c
index b63a7f2..ffb34d6 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -98,9 +98,9 @@ RRCloseScreen (int i, ScreenPtr pScreen)
     for (j = pScrPriv->numOutputs - 1; j >= 0; j--)
 	RROutputDestroy (pScrPriv->outputs[j]);
     
-    xfree (pScrPriv->crtcs);
-    xfree (pScrPriv->outputs);
-    xfree (pScrPriv);
+    free(pScrPriv->crtcs);
+    free(pScrPriv->outputs);
+    free(pScrPriv);
     RRNScreens -= 1;	/* ok, one fewer screen with RandR running */
     return (*pScreen->CloseScreen) (i, pScreen);    
 }
@@ -225,7 +225,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
     if (!RRInit ())
 	return FALSE;
 
-    pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec));
+    pScrPriv = (rrScrPrivPtr) calloc(1, sizeof (rrScrPrivRec));
     if (!pScrPriv)
 	return FALSE;
 
@@ -302,7 +302,7 @@ RRFreeClient (pointer data, XID id)
 	    	*pHead = pRREvent->next;
 	}
     }
-    xfree ((pointer) pRREvent);
+    free((pointer) pRREvent);
     return 1;
 }
 
@@ -316,9 +316,9 @@ RRFreeEvents (pointer data, XID id)
     for (pCur = *pHead; pCur; pCur = pNext) {
 	pNext = pCur->next;
 	FreeResource (pCur->clientResource, RRClientType);
-	xfree ((pointer) pCur);
+	free((pointer) pCur);
     }
-    xfree ((pointer) pHead);
+    free((pointer) pHead);
     return 1;
 }
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index a9eb2d2..f2b30eb 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -64,15 +64,15 @@ RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
 
     /* make space for the crtc pointer */
     if (pScrPriv->numCrtcs)
-	crtcs = xrealloc (pScrPriv->crtcs, 
+	crtcs = realloc(pScrPriv->crtcs, 
 			  (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
     else
-	crtcs = xalloc (sizeof (RRCrtcPtr));
+	crtcs = malloc(sizeof (RRCrtcPtr));
     if (!crtcs)
 	return FALSE;
     pScrPriv->crtcs = crtcs;
     
-    crtc = xcalloc (1, sizeof (RRCrtcRec));
+    crtc = calloc(1, sizeof (RRCrtcRec));
     if (!crtc)
 	return NULL;
     crtc->id = FakeClientID (0);
@@ -181,17 +181,17 @@ RRCrtcNotify (RRCrtcPtr	    crtc,
 	if (numOutputs)
 	{
 	    if (crtc->numOutputs)
-		newoutputs = xrealloc (crtc->outputs,
+		newoutputs = realloc(crtc->outputs,
 				    numOutputs * sizeof (RROutputPtr));
 	    else
-		newoutputs = xalloc (numOutputs * sizeof (RROutputPtr));
+		newoutputs = malloc(numOutputs * sizeof (RROutputPtr));
 	    if (!newoutputs)
 		return FALSE;
 	}
 	else
 	{
 	    if (crtc->outputs)
-		xfree (crtc->outputs);
+		free(crtc->outputs);
 	    newoutputs = NULL;
 	}
 	crtc->outputs = newoutputs;
@@ -442,10 +442,10 @@ RRCrtcDestroyResource (pointer value, XID pid)
 	}
     }
     if (crtc->gammaRed)
-	xfree (crtc->gammaRed);
+	free(crtc->gammaRed);
     if (crtc->mode)
 	RRModeDestroy (crtc->mode);
-    xfree (crtc);
+    free(crtc);
     return 1;
 }
 
@@ -558,14 +558,14 @@ RRCrtcGammaSetSize (RRCrtcPtr	crtc,
 	return TRUE;
     if (size)
     {
-	gamma = xalloc (size * 3 * sizeof (CARD16));
+	gamma = malloc(size * 3 * sizeof (CARD16));
 	if (!gamma)
 	    return FALSE;
     }
     else
 	gamma = NULL;
     if (crtc->gammaRed)
-	xfree (crtc->gammaRed);
+	free(crtc->gammaRed);
     crtc->gammaRed = gamma;
     crtc->gammaGreen = gamma + size;
     crtc->gammaBlue = gamma + size*2;
@@ -704,7 +704,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
     extraLen = rep.length << 2;
     if (extraLen)
     {
-	extra = xalloc (extraLen);
+	extra = malloc(extraLen);
 	if (!extra)
 	    return BadAlloc;
     }
@@ -749,7 +749,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
     if (extraLen)
     {
 	WriteToClient (client, extraLen, (char *) extra);
-	xfree (extra);
+	free(extra);
     }
     
     return client->noClientException;
@@ -791,7 +791,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
     }
     if (numOutputs)
     {
-	outputs = xalloc (numOutputs * sizeof (RROutputPtr));
+	outputs = malloc(numOutputs * sizeof (RROutputPtr));
 	if (!outputs)
 	    return BadAlloc;
     }
@@ -806,7 +806,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	if (rc != Success)
 	{
 	    if (outputs)
-		xfree (outputs);
+		free(outputs);
 	    return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;
 	}
 	/* validate crtc for this output */
@@ -816,7 +816,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	if (j == outputs[i]->numCrtcs)
 	{
 	    if (outputs)
-		xfree (outputs);
+		free(outputs);
 	    return BadMatch;
 	}
 	/* validate mode for this output */
@@ -831,7 +831,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	if (j == outputs[i]->numModes + outputs[i]->numUserModes)
 	{
 	    if (outputs)
-		xfree (outputs);
+		free(outputs);
 	    return BadMatch;
 	}
     }
@@ -851,7 +851,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	    if (k == outputs[i]->numClones)
 	    {
 		if (outputs)
-		    xfree (outputs);
+		    free(outputs);
 		return BadMatch;
 	    }
 	}
@@ -901,7 +901,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	 */
 	client->errorValue = stuff->rotation;
 	if (outputs)
-	    xfree (outputs);
+	    free(outputs);
 	return BadValue;
     }
 
@@ -914,7 +914,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	     */
 	    client->errorValue = stuff->rotation;
 	    if (outputs)
-		xfree (outputs);
+		free(outputs);
 	    return BadMatch;
 	}
     
@@ -944,7 +944,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	    {
 		client->errorValue = stuff->x;
 		if (outputs)
-		    xfree (outputs);
+		    free(outputs);
 		return BadValue;
 	    }
 	    
@@ -952,7 +952,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
 	    {
 		client->errorValue = stuff->y;
 		if (outputs)
-		    xfree (outputs);
+		    free(outputs);
 		return BadValue;
 	    }
 	}
@@ -980,7 +980,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
     
 sendReply:
     if (outputs)
-	xfree (outputs);
+	free(outputs);
     
     rep.type = X_Reply;
     /* rep.status has already been filled in */
@@ -1196,7 +1196,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
     len = crtc->gammaSize * 3 * 2;
     
     if (crtc->gammaSize) {
-	extra = xalloc(len);
+	extra = malloc(len);
 	if (!extra)
 	    return BadAlloc;
     }
@@ -1216,7 +1216,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
 	memcpy(extra, crtc->gammaRed, len);
 	client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
 	WriteSwappedDataToClient (client, len, extra);
-	xfree(extra);
+	free(extra);
     }
     return client->noClientException;
 }
@@ -1354,7 +1354,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
     nextra = (transform_filter_length (pending) +
 	      transform_filter_length (current));
 
-    reply = xalloc (sizeof (xRRGetCrtcTransformReply) + nextra);
+    reply = malloc(sizeof (xRRGetCrtcTransformReply) + nextra);
     if (!reply)
 	return BadAlloc;
 
@@ -1382,6 +1382,6 @@ ProcRRGetCrtcTransform (ClientPtr client)
 	swapl (&reply->length, n);
     }
     WriteToClient (client, sizeof (xRRGetCrtcTransformReply) + nextra, (char *) reply);
-    xfree(reply);
+    free(reply);
     return client->noClientException;
 }
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index ffb46a4..ad1439d 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -108,7 +108,7 @@ ProcRRSelectInput (ClientPtr client)
 	if (!pRREvent)
 	{
 	    /* build the entry */
-	    pRREvent = (RREventPtr) xalloc (sizeof (RREventRec));
+	    pRREvent = (RREventPtr) malloc(sizeof (RREventRec));
 	    if (!pRREvent)
 		return BadAlloc;
 	    pRREvent->next = 0;
@@ -131,7 +131,7 @@ ProcRRSelectInput (ClientPtr client)
 	     */
 	    if (!pHead)
 	    {
-		pHead = (RREventPtr *) xalloc (sizeof (RREventPtr));
+		pHead = (RREventPtr *) malloc(sizeof (RREventPtr));
 		if (!pHead ||
 		    !AddResource (pWin->drawable.id, RREventType, (pointer)pHead))
 		{
@@ -174,7 +174,7 @@ ProcRRSelectInput (ClientPtr client)
 		    pNewRREvent->next = pRREvent->next;
 		else
 		    *pHead = pRREvent->next;
-		xfree (pRREvent);
+		free(pRREvent);
 	    }
 	}
     }
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 20066d5..fdf3726 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -55,10 +55,10 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
 	}
     
     if (output->numModes)
-	modes = xrealloc (output->modes, 
+	modes = realloc(output->modes,
 			  (output->numModes + 1) * sizeof (RRModePtr));
     else
-	modes = xalloc (sizeof (RRModePtr));
+	modes = malloc(sizeof (RRModePtr));
     if (!modes)
     {
 	RRModeDestroy (mode);
@@ -134,7 +134,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
 		    newMode = mode;
 		}
 	    }
-	    xfree (size->pRates);
+	    free(size->pRates);
 	}
 	else
 	{
@@ -144,7 +144,7 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
 	}
     }
     if (pScrPriv->nSizes)
-	xfree (pScrPriv->pSizes);
+	free(pScrPriv->pSizes);
     pScrPriv->pSizes = NULL;
     pScrPriv->nSizes = 0;
 	    
@@ -279,7 +279,7 @@ RRRegisterSize (ScreenPtr	    pScreen,
     for (i = 0; i < pScrPriv->nSizes; i++)
 	if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
 	    return &pScrPriv->pSizes[i];
-    pNew = xrealloc (pScrPriv->pSizes,
+    pNew = realloc(pScrPriv->pSizes,
 		     (pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
     if (!pNew)
 	return 0;
@@ -303,7 +303,7 @@ Bool RRRegisterRate (ScreenPtr		pScreen,
 	if (pSize->pRates[i].rate == rate)
 	    return TRUE;
 
-    pNew = xrealloc (pSize->pRates,
+    pNew = realloc(pSize->pRates,
 		     (pSize->nRates + 1) * sizeof (RRScreenRate));
     if (!pNew)
 	return FALSE;
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 1396193..01511e2 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -58,7 +58,7 @@ RRModeCreate (xRRModeInfo   *modeInfo,
     if (!RRInit ())
 	return NULL;
 
-    mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1);
+    mode = malloc(sizeof (RRModeRec) + modeInfo->nameLength + 1);
     if (!mode)
 	return NULL;
     mode->refcnt = 1;
@@ -69,13 +69,13 @@ RRModeCreate (xRRModeInfo   *modeInfo,
     mode->userScreen = userScreen;
 
     if (num_modes)
-	newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr));
+	newModes = realloc(modes, (num_modes + 1) * sizeof (RRModePtr));
     else
-	newModes = xalloc (sizeof (RRModePtr));
+	newModes = malloc(sizeof (RRModePtr));
 
     if (!newModes)
     {
-	xfree (mode);
+	free(mode);
 	return NULL;
     }
 
@@ -164,7 +164,7 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
     RRModePtr	*screen_modes;
     int		num_screen_modes = 0;
 
-    screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
+    screen_modes = malloc((num_modes ? num_modes : 1) * sizeof (RRModePtr));
     if (!screen_modes)
 	return NULL;
     
@@ -243,14 +243,14 @@ RRModeDestroy (RRModePtr mode)
 	    num_modes--;
 	    if (!num_modes)
 	    {
-		xfree (modes);
+		free(modes);
 		modes = NULL;
 	    }
 	    break;
 	}
     }
     
-    xfree (mode);
+    free(mode);
 }
 
 static int
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 3a1b8bb..b1a5dbb 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -63,16 +63,16 @@ RROutputCreate (ScreenPtr   pScreen,
     pScrPriv = rrGetScrPriv(pScreen);
 
     if (pScrPriv->numOutputs)
-	outputs = xrealloc (pScrPriv->outputs, 
+	outputs = realloc(pScrPriv->outputs,
 			    (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
     else
-	outputs = xalloc (sizeof (RROutputPtr));
+	outputs = malloc(sizeof (RROutputPtr));
     if (!outputs)
 	return FALSE;
 
     pScrPriv->outputs = outputs;
     
-    output = xalloc (sizeof (RROutputRec) + nameLength + 1);
+    output = malloc(sizeof (RROutputRec) + nameLength + 1);
     if (!output)
 	return NULL;
     output->id = FakeClientID (0);
@@ -128,14 +128,14 @@ RROutputSetClones (RROutputPtr  output,
     }
     if (numClones)
     {
-	newClones = xalloc (numClones * sizeof (RROutputPtr));
+	newClones = malloc(numClones * sizeof (RROutputPtr));
 	if (!newClones)
 	    return FALSE;
     }
     else
 	newClones = NULL;
     if (output->clones)
-	xfree (output->clones);
+	free(output->clones);
     memcpy (newClones, clones, numClones * sizeof (RROutputPtr));
     output->clones = newClones;
     output->numClones = numClones;
@@ -167,7 +167,7 @@ RROutputSetModes (RROutputPtr	output,
 
     if (numModes)
     {
-	newModes = xalloc (numModes * sizeof (RRModePtr));
+	newModes = malloc(numModes * sizeof (RRModePtr));
 	if (!newModes)
 	    return FALSE;
     }
@@ -177,7 +177,7 @@ RROutputSetModes (RROutputPtr	output,
     {
 	for (i = 0; i < output->numModes; i++)
 	    RRModeDestroy (output->modes[i]);
-	xfree (output->modes);
+	free(output->modes);
     }
     memcpy (newModes, modes, numModes * sizeof (RRModePtr));
     output->modes = newModes;
@@ -212,10 +212,10 @@ RROutputAddUserMode (RROutputPtr    output,
 	    return BadMatch;
 
     if (output->userModes)
-	newModes = xrealloc (output->userModes,
+	newModes = realloc(output->userModes,
 			     (output->numUserModes + 1) * sizeof (RRModePtr));
     else
-	newModes = xalloc (sizeof (RRModePtr));
+	newModes = malloc(sizeof (RRModePtr));
     if (!newModes)
 	return BadAlloc;
 
@@ -274,14 +274,14 @@ RROutputSetCrtcs (RROutputPtr	output,
     }
     if (numCrtcs)
     {
-	newCrtcs = xalloc (numCrtcs * sizeof (RRCrtcPtr));
+	newCrtcs = malloc(numCrtcs * sizeof (RRCrtcPtr));
 	if (!newCrtcs)
 	    return FALSE;
     }
     else
 	newCrtcs = NULL;
     if (output->crtcs)
-	xfree (output->crtcs);
+	free(output->crtcs);
     memcpy (newCrtcs, crtcs, numCrtcs * sizeof (RRCrtcPtr));
     output->crtcs = newCrtcs;
     output->numCrtcs = numCrtcs;
@@ -398,20 +398,20 @@ RROutputDestroyResource (pointer value, XID pid)
     {
 	for (m = 0; m < output->numModes; m++)
 	    RRModeDestroy (output->modes[m]);
-	xfree (output->modes);
+	free(output->modes);
     }
     
     for (m = 0; m < output->numUserModes; m++)
 	RRModeDestroy (output->userModes[m]);
     if (output->userModes)
-	xfree (output->userModes);
+	free(output->userModes);
 
     if (output->crtcs)
-	xfree (output->crtcs);
+	free(output->crtcs);
     if (output->clones)
-	xfree (output->clones);
+	free(output->clones);
     RRDeleteAllOutputProperties (output);
-    xfree (output);
+    free(output);
     return 1;
 }
 
@@ -474,7 +474,7 @@ ProcRRGetOutputInfo (ClientPtr client)
     if (extraLen)
     {
 	rep.length += bytes_to_int32(extraLen);
-	extra = xalloc (extraLen);
+	extra = malloc(extraLen);
 	if (!extra)
 	    return BadAlloc;
     }
@@ -524,7 +524,7 @@ ProcRRGetOutputInfo (ClientPtr client)
     if (extraLen)
     {
 	WriteToClient (client, extraLen, (char *) extra);
-	xfree (extra);
+	free(extra);
     }
     
     return client->noClientException;
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 12e30e4..5fc04a9 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -76,10 +76,10 @@ RRDeleteAllOutputProperties (RROutputPtr output)
 	event.timestamp = currentTime.milliseconds;
 	RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
 	if (prop->current.data)
-	    xfree(prop->current.data);
+	    free(prop->current.data);
 	if (prop->pending.data)
-	    xfree(prop->pending.data);
-	xfree(prop);
+	    free(prop->pending.data);
+	free(prop);
     }
 }
 
@@ -97,7 +97,7 @@ RRCreateOutputProperty (Atom property)
 {
     RRPropertyPtr   prop;
 
-    prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec));
+    prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
     if (!prop)
 	return NULL;
     prop->next = NULL;
@@ -116,14 +116,14 @@ static void
 RRDestroyOutputProperty (RRPropertyPtr prop)
 {
     if (prop->valid_values)
-	xfree (prop->valid_values);
+	free(prop->valid_values);
     if (prop->current.data)
-	xfree(prop->current.data);
+	free(prop->current.data);
     if (prop->pending.data)
-	xfree(prop->pending.data);
+	free(prop->pending.data);
     if (prop->valid_values)
-	xfree(prop->valid_values);
-    xfree(prop);
+	free(prop->valid_values);
+    free(prop);
 }
 
 void
@@ -201,7 +201,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
 	pointer	    new_data = NULL, old_data = NULL;
 
 	total_size = total_len * size_in_bytes;
-	new_value.data = (pointer)xalloc (total_size);
+	new_value.data = (pointer)malloc(total_size);
 	if (!new_value.data && total_size)
 	{
 	    if (add)
@@ -239,11 +239,11 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
 					   prop->propertyName, &new_value))
 	{
 	    if (new_value.data)
-		xfree (new_value.data);
+		free(new_value.data);
 	    return (BadValue);
 	}
 	if (prop_value->data)
-	    xfree (prop_value->data);
+	    free(prop_value->data);
 	*prop_value = new_value;
     }
 
@@ -372,7 +372,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
     if (range && (num_values & 1))
 	return BadMatch;
 
-    new_values = xalloc (num_values * sizeof (INT32));
+    new_values = malloc(num_values * sizeof (INT32));
     if (!new_values && num_values)
 	return BadAlloc;
     if (num_values)
@@ -385,7 +385,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
     if (prop->is_pending && !pending)
     {
 	if (prop->pending.data)
-	    xfree (prop->pending.data);
+	    free(prop->pending.data);
 	RRInitOutputPropertyValue (&prop->pending);
     }
 
@@ -394,7 +394,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
     prop->immutable = immutable;
     prop->num_valid = num_values;
     if (prop->valid_values)
-	xfree (prop->valid_values);
+	free(prop->valid_values);
     prop->valid_values = new_values;
 
     if (add) {
@@ -422,7 +422,7 @@ ProcRRListOutputProperties (ClientPtr client)
     for (prop = output->properties; prop; prop = prop->next)
 	numProps++;
     if (numProps)
-        if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
+        if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
             return(BadAlloc);
 
     rep.type = X_Reply;
@@ -445,7 +445,7 @@ ProcRRListOutputProperties (ClientPtr client)
     {
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
-        xfree(pAtoms);
+        free(pAtoms);
     }
     return(client->noClientException);
 }
@@ -468,7 +468,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
 	return BadName;
     
     if (prop->num_valid) {
-	extra = xalloc(prop->num_valid * sizeof(INT32));
+	extra = malloc(prop->num_valid * sizeof(INT32));
 	if (!extra)
 	    return BadAlloc;
     }
@@ -491,7 +491,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
         client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
         WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
 				 extra);
-        xfree(extra);
+        free(extra);
     }
     return(client->noClientException);
 }
@@ -699,7 +699,7 @@ ProcRRGetOutputProperty (ClientPtr client)
     len = min(n - ind, 4 * stuff->longLength);
 
     if (len) {
-	extra = xalloc(len);
+	extra = malloc(len);
 	if (!extra)
 	    return BadAlloc;
     }
@@ -745,7 +745,7 @@ ProcRRGetOutputProperty (ClientPtr client)
 	}
 	WriteSwappedDataToClient(client, len,
 				 extra);
-	xfree(extra);
+	free(extra);
     }
 
     if (stuff->delete && (reply.bytesAfter == 0))
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 26de1e2..c372d46 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -383,10 +383,10 @@ rrGetScreenResources(ClientPtr client, Bool query)
 	extraLen = rep.length << 2;
 	if (extraLen)
 	{
-	    extra = xalloc (extraLen);
+	    extra = malloc(extraLen);
 	    if (!extra)
 	    {
-		xfree (modes);
+		free(modes);
 		return BadAlloc;
 	    }
 	}
@@ -450,7 +450,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
 		    mode->mode.nameLength);
 	    names += mode->mode.nameLength;
 	}
-    	xfree (modes);
+        free(modes);
 	assert (bytes_to_int32((char *) names - (char *) extra) == rep.length);
     }
     
@@ -468,7 +468,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
     if (extraLen)
     {
 	WriteToClient (client, extraLen, (char *) extra);
-	xfree (extra);
+	free(extra);
     }
     return client->noClientException;
 }
@@ -666,10 +666,10 @@ ProcRRGetScreenInfo (ClientPtr client)
 
 	if (extraLen)
 	{
-	    extra = (CARD8 *) xalloc (extraLen);
+	    extra = (CARD8 *) malloc(extraLen);
 	    if (!extra)
 	    {
-		xfree (pData);
+		free(pData);
 		return BadAlloc;
 	    }
 	}
@@ -715,7 +715,7 @@ ProcRRGetScreenInfo (ClientPtr client)
 		}
 	    }
 	}
-        xfree (pData);
+        free(pData);
 	
 	data8 = (CARD8 *) rates;
 
@@ -738,7 +738,7 @@ ProcRRGetScreenInfo (ClientPtr client)
     if (extraLen)
     {
 	WriteToClient (client, extraLen, (char *) extra);
-	xfree (extra);
+	free(extra);
     }
     return (client->noClientException);
 }
@@ -831,7 +831,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	 * Invalid size ID
 	 */
 	client->errorValue = stuff->sizeID;
-	xfree (pData);
+	free(pData);
 	return BadValue;
     }
     pSize = &pData->sizes[stuff->sizeID];
@@ -853,7 +853,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	 * Invalid rotation
 	 */
 	client->errorValue = stuff->rotation;
-	xfree (pData);
+	free(pData);
 	return BadValue;
     }
 
@@ -863,7 +863,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	 * requested rotation or reflection not supported by screen
 	 */
 	client->errorValue = stuff->rotation;
-	xfree (pData);
+	free(pData);
 	return BadMatch;
     }
 
@@ -888,7 +888,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 	     * Invalid rate
 	     */
 	    client->errorValue = rate;
-	    xfree (pData);
+	    free(pData);
 	    return BadValue;
 	}
 	mode = pSize->pRates[i].mode;
@@ -954,7 +954,7 @@ ProcRRSetScreenConfig (ClientPtr client)
 sendReply:
     
     if (pData)
-	xfree (pData);
+	free(pData);
 
     rep.type = X_Reply;
     /* rep.status has already been filled in */
@@ -997,7 +997,7 @@ RR10CurrentSizeID (ScreenPtr pScreen)
 		    sizeID = (CARD16) i;
 		    break;
 		}
-	    xfree (data);
+	    free(data);
 	}
     }
     return sizeID;
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index 06f6298..7fd4fa0 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -38,7 +38,7 @@ void
 RRTransformFini (RRTransformPtr transform)
 {
     if (transform->params)
-	xfree (transform->params);
+	free(transform->params);
 }
 
 Bool
@@ -75,7 +75,7 @@ RRTransformSetFilter (RRTransformPtr	dst,
 
     if (nparams)
     {
-	new_params = xalloc (nparams * sizeof (xFixed));
+	new_params = malloc(nparams * sizeof (xFixed));
 	if (!new_params)
 	    return FALSE;
 	memcpy (new_params, params, nparams * sizeof (xFixed));
@@ -83,7 +83,7 @@ RRTransformSetFilter (RRTransformPtr	dst,
     else
 	new_params = NULL;
     if (dst->params)
-	xfree (dst->params);
+	free(dst->params);
     dst->filter = filter;
     dst->params = new_params;
     dst->nparams = nparams;
diff --git a/record/record.c b/record/record.c
index 1a10c9e..9303740 100644
--- a/record/record.c
+++ b/record/record.c
@@ -825,7 +825,7 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
 
 		EventToXI(pei->event, &xi_events, &count);
 		RecordSendProtocolEvents(pRCAP, pContext, xi_events, count);
-		xfree(xi_events);
+		free(xi_events);
 	    } /* end this RCAP selects device events */
 	} /* end for each RCAP on this context */
     } /* end for each enabled context */
@@ -913,7 +913,7 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
 		    RecordClientPrivatePtr pClientPriv;
 		    /* no Record proc vector; allocate one */
 		    pClientPriv = (RecordClientPrivatePtr)
-				xalloc(sizeof(RecordClientPrivateRec));
+				malloc(sizeof(RecordClientPrivateRec));
 		    if (!pClientPriv)
 			return BadAlloc;
 		    /* copy old proc vector to new */
@@ -1033,7 +1033,7 @@ RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
 		    pClient->requestVector = pClientPriv->originalVector;
 		    dixSetPrivate(&pClient->devPrivates,
 				  RecordClientPrivateKey, NULL);
-		    xfree(pClientPriv);
+		    free(pClientPriv);
 		}
 	    } /* end if this RCAP specifies any requests */
 	} /* end if not future clients */
@@ -1101,8 +1101,8 @@ RecordDeleteClientFromRCAP(RecordClientsAndProtocolPtr pRCAP, int position)
 	}
 	/* free the RCAP */
 	if (pRCAP->clientIDsSeparatelyAllocated)
-	    xfree(pRCAP->pClientIDs);
-	xfree(pRCAP);
+	    free(pRCAP->pClientIDs);
+	free(pRCAP);
     }
 } /* RecordDeleteClientFromRCAP */
 
@@ -1130,7 +1130,7 @@ RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
     {
 	if (pRCAP->clientIDsSeparatelyAllocated)
 	{
-	    XID *pNewIDs = (XID *)xrealloc(pRCAP->pClientIDs,
+	    XID *pNewIDs = (XID *)realloc(pRCAP->pClientIDs,
 			(pRCAP->sizeClients + CLIENT_ARRAY_GROWTH_INCREMENT) *
 								sizeof(XID));
 	    if (!pNewIDs)
@@ -1140,7 +1140,7 @@ RecordAddClientToRCAP(RecordClientsAndProtocolPtr pRCAP, XID clientspec)
 	}
 	else
 	{
-	    XID *pNewIDs = (XID *)xalloc((pRCAP->sizeClients +
+	    XID *pNewIDs = (XID *)malloc((pRCAP->sizeClients +
 				CLIENT_ARRAY_GROWTH_INCREMENT) * sizeof(XID));
 	    if (!pNewIDs)
 		return;
@@ -1246,7 +1246,7 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs, int nspecs
  *	  - XRecordCurrentClients expanded to a list of all currently
  *	    connected clients - excludespec (if non-zero)
  *	The returned array may be the passed array modified in place, or
- *	it may be an Xalloc'ed array.  The caller should keep a pointer to the
+ *	it may be an malloc'ed array.  The caller should keep a pointer to the
  *	original array and free the returned array if it is different.
  *
  *	*pNumClientspecs is set to the number of elements in the returned
@@ -1278,7 +1278,7 @@ RecordCanonicalizeClientSpecifiers(XID *pClientspecs, int *pNumClientspecs, XID
 	    pClientspecs[i] == XRecordCurrentClients)
 	{ /* expand All/Current */
 	    int j, nc;
-	    XID *pCanon = (XID *)xalloc(sizeof(XID) * (currentMaxClients + 1));
+	    XID *pCanon = (XID *)malloc(sizeof(XID) * (currentMaxClients + 1));
 	    if (!pCanon) return NULL;
 	    for (nc = 0, j = 1; j < currentMaxClients; j++)
 	    {
@@ -1492,7 +1492,7 @@ RecordAllocIntervals(SetInfoPtr psi, int nIntervals)
 {
     assert(!psi->intervals);
     psi->intervals = (RecordSetInterval *)
-			xalloc(nIntervals * sizeof(RecordSetInterval));
+			malloc(nIntervals * sizeof(RecordSetInterval));
     if (!psi->intervals)
 	return BadAlloc;
     bzero(psi->intervals, nIntervals * sizeof(RecordSetInterval));
@@ -1663,7 +1663,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
      * range for extension replies.
      */
     maxSets = PREDEFSETS + 2 * stuff->nRanges;
-    si = (SetInfoPtr)xalloc(sizeof(SetInfoRec) * maxSets);
+    si = (SetInfoPtr)malloc(sizeof(SetInfoRec) * maxSets);
     if (!si)
     {
 	err = BadAlloc;
@@ -1755,7 +1755,7 @@ RecordRegisterClients(RecordContextPtr pContext, ClientPtr client, xRecordRegist
 
     /* allocate memory for the whole RCAP */
 
-    pRCAP = (RecordClientsAndProtocolPtr)xalloc(totRCAPsize);
+    pRCAP = (RecordClientsAndProtocolPtr)malloc(totRCAPsize);
     if (!pRCAP) 
     {
 	err = BadAlloc;
@@ -1869,11 +1869,11 @@ bailout:
     {
 	for (i = 0; i < maxSets; i++)
 	    if (si[i].intervals)
-		xfree(si[i].intervals);
-	xfree(si);
+		free(si[i].intervals);
+	free(si);
     }
     if (pCanonClients && pCanonClients != (XID *)&stuff[1])
-	xfree(pCanonClients);
+	free(pCanonClients);
     return err;
 } /* RecordRegisterClients */
 
@@ -1918,14 +1918,14 @@ ProcRecordCreateContext(ClientPtr client)
     REQUEST_AT_LEAST_SIZE(xRecordCreateContextReq);
     LEGAL_NEW_RESOURCE(stuff->context, client);
 
-    pContext = (RecordContextPtr)xalloc(sizeof(RecordContextRec));
+    pContext = (RecordContextPtr)malloc(sizeof(RecordContextRec));
     if (!pContext)
 	goto bailout;
 
     /* make sure there is room in ppAllContexts to store the new context */
 
     ppNewAllContexts = (RecordContextPtr *)
-	xrealloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
+	realloc(ppAllContexts, sizeof(RecordContextPtr) * (numContexts + 1));
     if (!ppNewAllContexts)
 	goto bailout;
     ppAllContexts = ppNewAllContexts;
@@ -1956,7 +1956,7 @@ ProcRecordCreateContext(ClientPtr client)
     }
 bailout:
     if (pContext)
-	xfree(pContext);
+	free(pContext);
     return err;
 } /* ProcRecordCreateContext */
 
@@ -2005,7 +2005,7 @@ ProcRecordUnregisterClients(ClientPtr client)
 	RecordDeleteClientFromContext(pContext, pCanonClients[i]);
     }
     if (pCanonClients != (XID *)&stuff[1])
-	xfree(pCanonClients);
+	free(pCanonClients);
     return Success;
 } /* ProcRecordUnregisterClients */
 
@@ -2046,7 +2046,7 @@ RecordAllocRanges(GetContextRangeInfoPtr pri, int nRanges)
 #define SZINCR 8
 
     newsize = max(pri->size + SZINCR, nRanges);
-    pNewRange = (xRecordRange *)xrealloc(pri->pRanges,
+    pNewRange = (xRecordRange *)realloc(pri->pRanges,
 			 newsize * sizeof(xRecordRange));
     if (!pNewRange)
 	return BadAlloc;
@@ -2237,7 +2237,7 @@ ProcRecordGetContext(ClientPtr client)
 
     /* allocate and initialize space for record range info */
 
-    pRangeInfo = (GetContextRangeInfoPtr)xalloc(
+    pRangeInfo = (GetContextRangeInfoPtr)malloc(
 				nRCAPs * sizeof(GetContextRangeInfoRec));
     if (!pRangeInfo && nRCAPs > 0)
 	return BadAlloc;
@@ -2352,9 +2352,9 @@ ProcRecordGetContext(ClientPtr client)
 bailout:
     for (i = 0; i < nRCAPs; i++)
     {
-	if (pRangeInfo[i].pRanges) xfree(pRangeInfo[i].pRanges);
+	if (pRangeInfo[i].pRanges) free(pRangeInfo[i].pRanges);
     }
-    xfree(pRangeInfo);
+    free(pRangeInfo);
     return err;
 } /* ProcRecordGetContext */
 
@@ -2522,7 +2522,7 @@ RecordDeleteContext(pointer value, XID id)
 	}
     }
 
-    xfree(pContext);
+    free(pContext);
 
     /* remove context from AllContexts list */
 
@@ -2531,7 +2531,7 @@ RecordDeleteContext(pointer value, XID id)
 	ppAllContexts[i] = ppAllContexts[numContexts - 1];
 	if (--numContexts == 0)
 	{
-	    xfree(ppAllContexts);
+	    free(ppAllContexts);
 	    ppAllContexts = NULL;
 	}
     }
@@ -2764,14 +2764,14 @@ RecordConnectionSetupInfo(RecordContextPtr pContext, NewClientInfoRec *pci)
 
     if (pci->client->swapped)
     {
-	char *pConnSetup = (char *)xalloc(prefixsize + restsize);
+	char *pConnSetup = (char *)malloc(prefixsize + restsize);
 	if (!pConnSetup)
 	    return;
 	SwapConnSetupPrefix(pci->prefix, (xConnSetupPrefix*)pConnSetup);
 	SwapConnSetupInfo((char*)pci->setup, (char*)(pConnSetup + prefixsize));
 	RecordAProtocolElement(pContext, pci->client, XRecordClientStarted,
 			       (pointer)pConnSetup, prefixsize + restsize, 0);
-	xfree(pConnSetup);
+	free(pConnSetup);
     }
     else
     {
diff --git a/record/set.c b/record/set.c
index f0e094e..f2064fd 100644
--- a/record/set.c
+++ b/record/set.c
@@ -87,7 +87,7 @@ typedef struct {
 static void
 BitVectorDestroySet(RecordSetPtr pSet)
 {
-    xfree(pSet);
+    free(pSet);
 }
 
 static unsigned long
@@ -199,7 +199,7 @@ BitVectorCreateSet(RecordSetInterval *pIntervals, int nIntervals,
     }
     else
     {
-	pbvs = (BitVectorSetPtr)Xcalloc(memsize);
+	pbvs = (BitVectorSetPtr)calloc(1, memsize);
 	if (!pbvs) return NULL;
 	pbvs->baseSet.ops = &BitVectorSetOperations;
     }
@@ -233,7 +233,7 @@ typedef struct {
 static void
 IntervalListDestroySet(RecordSetPtr pSet)
 {
-    xfree(pSet);
+    free(pSet);
 }
 
 static unsigned long
@@ -302,7 +302,7 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
 
     if (nIntervals > 0)
     {
-	stackIntervals = (RecordSetInterval *)xalloc(
+	stackIntervals = (RecordSetInterval *)malloc(
 				sizeof(RecordSetInterval) * nIntervals);
 	if (!stackIntervals) return NULL;
 
@@ -353,14 +353,14 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals,
     else
     {
 	prls = (IntervalListSetPtr)
-	    xalloc(sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval));
+	    malloc(sizeof(IntervalListSet) + nIntervals * sizeof(RecordSetInterval));
 	if (!prls) goto bailout;
 	prls->baseSet.ops = &IntervalListSetOperations;
     }
     memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
     prls->nIntervals = nIntervals;
 bailout:
-    if (stackIntervals) xfree(stackIntervals);
+    if (stackIntervals) free(stackIntervals);
     return (RecordSetPtr)prls;
 }
 
diff --git a/render/animcur.c b/render/animcur.c
index 276e5e4..d207bcc 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -123,7 +123,7 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen)
     Unwrap(as, pScreen, RecolorCursor);
     SetAnimCurScreen(pScreen,0);
     ret = (*pScreen->CloseScreen) (index, pScreen);
-    xfree (as);
+    free(as);
     return ret;
 }
 
@@ -350,7 +350,7 @@ AnimCurInit (ScreenPtr pScreen)
             animCurState[i].time = 0;
         }
     }
-    as = (AnimCurScreenPtr) xalloc (sizeof (AnimCurScreenRec));
+    as = (AnimCurScreenPtr) malloc(sizeof (AnimCurScreenRec));
     if (!as)
 	return FALSE;
     Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
@@ -382,7 +382,7 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
 	if (IsAnimCur (cursors[i]))
 	    return BadMatch;
 	
-    pCursor = (CursorPtr) xalloc (sizeof (CursorRec) +
+    pCursor = (CursorPtr) malloc(sizeof (CursorRec) +
 				  sizeof (AnimCurRec) +
 				  ncursor * sizeof (AnimCurElt));
     if (!pCursor)
@@ -406,7 +406,7 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp
 		  RT_NONE, NULL, DixCreateAccess);
     if (rc != Success) {
 	dixFreePrivates(pCursor->devPrivates);
-	xfree(pCursor);
+	free(pCursor);
 	return rc;
     }
 	
diff --git a/render/filter.c b/render/filter.c
index 89cc064..8bb6d5e 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -60,18 +60,18 @@ PictureGetFilterId (char *filter, int len, Bool makeit)
 	    return i;
     if (!makeit)
 	return -1;
-    name = xalloc (len + 1);
+    name = malloc(len + 1);
     if (!name)
 	return -1;
     memcpy (name, filter, len);
     name[len] = '\0';
     if (filterNames)
-	names = xrealloc (filterNames, (nfilterNames + 1) * sizeof (char *));
+	names = realloc(filterNames, (nfilterNames + 1) * sizeof (char *));
     else
-	names = xalloc (sizeof (char *));
+	names = malloc(sizeof (char *));
     if (!names)
     {
-	xfree (name);
+	free(name);
 	return -1;
     }
     filterNames = names;
@@ -117,8 +117,8 @@ PictureFreeFilterIds (void)
     int	    i;
 
     for (i = 0; i < nfilterNames; i++)
-	xfree (filterNames[i]);
-    xfree (filterNames);
+	free(filterNames[i]);
+    free(filterNames);
     nfilterNames = 0;
     filterNames = 0;
 }
@@ -144,9 +144,9 @@ PictureAddFilter (ScreenPtr			    pScreen,
 	if (ps->filters[i].id == id)
 	    return -1;
     if (ps->filters)
-	filters = xrealloc (ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec));
+	filters = realloc(ps->filters, (ps->nfilters + 1) * sizeof (PictFilterRec));
     else
-	filters = xalloc (sizeof (PictFilterRec));
+	filters = malloc(sizeof (PictFilterRec));
     if (!filters)
 	return -1;
     ps->filters = filters;
@@ -177,11 +177,11 @@ PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias)
 	PictFilterAliasPtr  aliases;
 
 	if (ps->filterAliases)
-	    aliases = xrealloc (ps->filterAliases,
+	    aliases = realloc(ps->filterAliases,
 				(ps->nfilterAliases + 1) *
 				sizeof (PictFilterAliasRec));
 	else
-	    aliases = xalloc (sizeof (PictFilterAliasRec));
+	    aliases = malloc(sizeof (PictFilterAliasRec));
 	if (!aliases)
 	    return FALSE;
 	ps->filterAliases = aliases;
@@ -273,8 +273,8 @@ PictureResetFilters (ScreenPtr pScreen)
 {
     PictureScreenPtr    ps = GetPictureScreen(pScreen);
 
-    xfree (ps->filters);
-    xfree (ps->filterAliases);
+    free(ps->filters);
+    free(ps->filterAliases);
     PictureFreeFilterIds ();
 }
 
@@ -335,10 +335,10 @@ SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
 
     if (nparams != pPicture->filter_nparams)
     {
-	xFixed *new_params = xalloc (nparams * sizeof (xFixed));
+	xFixed *new_params = malloc(nparams * sizeof (xFixed));
 	if (!new_params && nparams)
 	    return BadAlloc;
-	xfree (pPicture->filter_params);
+	free(pPicture->filter_params);
 	pPicture->filter_params = new_params;
 	pPicture->filter_nparams = nparams;
     }
diff --git a/render/glyph.c b/render/glyph.c
index 6b81118..e5b8f86 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -302,7 +302,7 @@ FreeGlyph (GlyphPtr glyph, int format)
 
 	FreeGlyphPicture(glyph);
 	FreeGlyphPrivates(glyph);
-	xfree (glyph);
+	free(glyph);
     }
 }
 
@@ -321,7 +321,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id)
     {
 	FreeGlyphPicture(glyph);
 	FreeGlyphPrivates(glyph);
-	xfree (glyph);
+	free(glyph);
 	glyph = gr->glyph;
     }
     else if (gr->glyph != glyph)
@@ -381,7 +381,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth)
     int		     i;
 
     size = screenInfo.numScreens * sizeof (PicturePtr);
-    glyph = (GlyphPtr) xalloc (size + sizeof (GlyphRec));
+    glyph = (GlyphPtr) malloc(size + sizeof (GlyphRec));
     if (!glyph)
 	return 0;
     glyph->refcnt = 0;
@@ -412,14 +412,14 @@ bail:
     }
 
     FreeGlyphPrivates(glyph);
-    xfree (glyph);
+    free(glyph);
     return 0;
 }
     
 Bool
 AllocateGlyphHash (GlyphHashPtr hash, GlyphHashSetPtr hashSet)
 {
-    hash->table = xcalloc (hashSet->size, sizeof (GlyphRefRec));
+    hash->table = calloc(hashSet->size, sizeof (GlyphRefRec));
     if (!hash->table)
 	return FALSE;
     hash->hashSet = hashSet;
@@ -462,7 +462,7 @@ ResizeGlyphHash (GlyphHashPtr hash, CARD32 change, Bool global)
 		++newHash.tableEntries;
 	    }
 	}
-	xfree (hash->table);
+	free(hash->table);
     }
     *hash = newHash;
     if (global)
@@ -490,13 +490,13 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format)
     }
 
     size = sizeof (GlyphSetRec);
-    glyphSet = xcalloc (1, size);
+    glyphSet = calloc(1, size);
     if (!glyphSet)
 	return FALSE;
 
     if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0]))
     {
-	xfree (glyphSet);
+	free(glyphSet);
 	return FALSE;
     }
     glyphSet->refcnt = 1;
@@ -525,15 +525,15 @@ FreeGlyphSet (pointer	value,
 	}
 	if (!globalGlyphs[glyphSet->fdepth].tableEntries)
 	{
-	    xfree (globalGlyphs[glyphSet->fdepth].table);
+	    free(globalGlyphs[glyphSet->fdepth].table);
 	    globalGlyphs[glyphSet->fdepth].table = 0;
 	    globalGlyphs[glyphSet->fdepth].hashSet = 0;
 	}
 	else
 	    ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE);
-	xfree (table);
+	free(table);
 	dixFreePrivates(glyphSet->devPrivates);
-	xfree (glyphSet);
+	free(glyphSet);
     }
     return Success;
 }
diff --git a/render/miindex.c b/render/miindex.c
index 4e0cf00..c42a15b 100644
--- a/render/miindex.c
+++ b/render/miindex.c
@@ -260,15 +260,15 @@ miInitIndexed (ScreenPtr	pScreen,
 	    pixels[p] = p;
     }
     
-    pIndexed = xalloc (sizeof (miIndexedRec));
+    pIndexed = malloc(sizeof (miIndexedRec));
     if (!pIndexed)
 	return FALSE;
     
     pFormat->index.nvalues = num;
-    pFormat->index.pValues = xalloc (num * sizeof (xIndexValue));
+    pFormat->index.pValues = malloc(num * sizeof (xIndexValue));
     if (!pFormat->index.pValues)
     {
-	xfree (pIndexed);
+	free(pIndexed);
 	return FALSE;
     }
     
@@ -324,12 +324,12 @@ miCloseIndexed (ScreenPtr	pScreen,
 {
     if (pFormat->index.devPrivate)
     {
-	xfree (pFormat->index.devPrivate);
+	free(pFormat->index.devPrivate);
 	pFormat->index.devPrivate = 0;
     }
     if (pFormat->index.pValues)
     {
-	xfree (pFormat->index.pValues);
+	free(pFormat->index.pValues);
 	pFormat->index.pValues = 0;
     }
 }
diff --git a/render/mipict.c b/render/mipict.c
index b5dfcb2..1dad88e 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -106,7 +106,7 @@ miChangePictureClip (PicturePtr    pPicture,
 	if (!clientClip)
 	    return BadAlloc;
 	clientClipType = CT_REGION;
-	xfree(value);
+	free(value);
 	break;
     }
     (*ps->DestroyPictureClip) (pPicture);
diff --git a/render/mitri.c b/render/mitri.c
index a92c19b..a805a71 100644
--- a/render/mitri.c
+++ b/render/mitri.c
@@ -144,7 +144,7 @@ miTriStrip (CARD8	    op,
     if (npoint < 3)
 	return;
     ntri = npoint - 2;
-    tris = xalloc (ntri * sizeof (xTriangle));
+    tris = malloc(ntri * sizeof (xTriangle));
     if (!tris)
 	return;
     for (tri = tris; npoint >= 3; npoint--, points++, tri++)
@@ -154,7 +154,7 @@ miTriStrip (CARD8	    op,
 	tri->p3 = points[2];
     }
     (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
-    xfree (tris);
+    free(tris);
 }
 
 void
@@ -176,7 +176,7 @@ miTriFan (CARD8		op,
     if (npoint < 3)
 	return;
     ntri = npoint - 2;
-    tris = xalloc (ntri * sizeof (xTriangle));
+    tris = malloc(ntri * sizeof (xTriangle));
     if (!tris)
 	return;
     first = points++;
@@ -187,5 +187,5 @@ miTriFan (CARD8		op,
 	tri->p3 = points[1];
     }
     (*ps->Triangles) (op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, tris);
-    xfree (tris);
+    free(tris);
 }
diff --git a/render/picture.c b/render/picture.c
index 48693b8..aab9391 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -89,8 +89,8 @@ PictureCloseScreen (int index, ScreenPtr pScreen)
 	    (*ps->CloseIndexed) (pScreen, &ps->formats[n]);
     GlyphUninit (pScreen);
     SetPictureScreen(pScreen, 0);
-    xfree (ps->formats);
-    xfree (ps);
+    free(ps->formats);
+    free(ps);
     return ret;
 }
 
@@ -337,7 +337,7 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
     }
     
 
-    pFormats = xcalloc (nformats, sizeof (PictFormatRec));
+    pFormats = calloc(nformats, sizeof (PictFormatRec));
     if (!pFormats)
 	return 0;
     for (f = 0; f < nformats; f++)
@@ -638,7 +638,7 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     {
 	if (!AddResource (formats[n].id, PictFormatType, (pointer) (formats+n)))
 	{
-	    xfree (formats);
+	    free(formats);
 	    return FALSE;
 	}
 	if (formats[n].type == PictTypeIndexed)
@@ -669,10 +669,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
 	}
 	formats[n].format = PICT_FORMAT(0,type,a,r,g,b);
     }
-    ps = (PictureScreenPtr) xalloc (sizeof (PictureScreenRec));
+    ps = (PictureScreenPtr) malloc(sizeof (PictureScreenRec));
     if (!ps)
     {
-	xfree (formats);
+	free(formats);
 	return FALSE;
     }
     SetPictureScreen(pScreen, ps);
@@ -699,8 +699,8 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
     {
 	PictureResetFilters (pScreen);
 	SetPictureScreen(pScreen, 0);
-	xfree (formats);
-	xfree (ps);
+	free(formats);
+	free(ps);
 	return FALSE;
     }
 
@@ -753,7 +753,7 @@ CreatePicture (Picture		pid,
     PicturePtr		pPicture;
     PictureScreenPtr	ps = GetPictureScreen(pDrawable->pScreen);
 
-    pPicture = (PicturePtr)xalloc(sizeof(PictureRec));
+    pPicture = (PicturePtr)malloc(sizeof(PictureRec));
     if (!pPicture)
     {
 	*error = BadAlloc;
@@ -874,7 +874,7 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
         dpos = stopPoints[i];
     }
 
-    pGradient->gradient.stops = xalloc(stopCount*sizeof(PictGradientStop));
+    pGradient->gradient.stops = malloc(stopCount*sizeof(PictGradientStop));
     if (!pGradient->gradient.stops) {
         *error = BadAlloc;
         return;
@@ -896,7 +896,7 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
 static PicturePtr createSourcePicture(void)
 {
     PicturePtr pPicture;
-    pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
+    pPicture = (PicturePtr) malloc(sizeof(PictureRec));
     pPicture->pDrawable = 0;
     pPicture->pFormat = 0;
     pPicture->pNext = 0;
@@ -918,10 +918,10 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictSolidFill));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
     pPicture->pSourcePict->type = SourcePictTypeSolidFill;
@@ -947,10 +947,10 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictLinearGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictLinearGradient));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
 
@@ -960,7 +960,7 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
 
     initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
     if (*error) {
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
     return pPicture;
@@ -988,10 +988,10 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictRadialGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictRadialGradient));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
     radial = &pPicture->pSourcePict->radial;
@@ -1012,7 +1012,7 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
     
     initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
     if (*error) {
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
     return pPicture;
@@ -1036,10 +1036,10 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
     }
 
     pPicture->id = pid;
-    pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictConicalGradient));
+    pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictConicalGradient));
     if (!pPicture->pSourcePict) {
         *error = BadAlloc;
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
 
@@ -1049,7 +1049,7 @@ CreateConicalGradientPicture (Picture pid, xPointFixed *center, xFixed angle,
 
     initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
     if (*error) {
-        xfree(pPicture);
+        free(pPicture);
         return 0;
     }
     return pPicture;
@@ -1385,7 +1385,7 @@ SetPictureTransform (PicturePtr	    pPicture,
     {
 	if (!pPicture->transform)
 	{
-	    pPicture->transform = (PictTransform *) xalloc (sizeof (PictTransform));
+	    pPicture->transform = (PictTransform *) malloc(sizeof (PictTransform));
 	    if (!pPicture->transform)
 		return BadAlloc;
 	}
@@ -1395,7 +1395,7 @@ SetPictureTransform (PicturePtr	    pPicture,
     {
 	if (pPicture->transform)
 	{
-	    xfree (pPicture->transform);
+	    free(pPicture->transform);
 	    pPicture->transform = 0;
 	}
     }
@@ -1527,14 +1527,14 @@ FreePicture (pointer	value,
     if (--pPicture->refcnt == 0)
     {
 	if (pPicture->transform)
-	    xfree (pPicture->transform);
+	    free(pPicture->transform);
 
 	if (pPicture->pSourcePict)
 	{
 	    if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
-		xfree(pPicture->pSourcePict->linear.stops);
+		free(pPicture->pSourcePict->linear.stops);
 
-	    xfree(pPicture->pSourcePict);
+	    free(pPicture->pSourcePict);
 	}
 
 	if (pPicture->pDrawable)
@@ -1569,7 +1569,7 @@ FreePicture (pointer	value,
             }
         }
 	dixFreePrivates(pPicture->devPrivates);
-	xfree (pPicture);
+	free(pPicture);
     }
     return Success;
 }
diff --git a/render/render.c b/render/render.c
index 3c505d6..c9d3e8e 100644
--- a/render/render.c
+++ b/render/render.c
@@ -375,7 +375,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
 	       ndepth * sizeof (xPictDepth) +
 	       nvisual * sizeof (xPictVisual) +
 	       numSubpixel * sizeof (CARD32));
-    reply = (xRenderQueryPictFormatsReply *) xcalloc (1, rlength);
+    reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength);
     if (!reply)
 	return BadAlloc;
     reply->type = X_Reply;
@@ -512,7 +512,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
 	swapl (&reply->numSubpixel, n);
     }
     WriteToClient(client, rlength, (char *) reply);
-    xfree (reply);
+    free(reply);
     return client->noClientException;
 }
 
@@ -542,7 +542,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
     num = pFormat->index.nvalues;
     rlength = (sizeof (xRenderQueryPictIndexValuesReply) + 
 	       num * sizeof(xIndexValue));
-    reply = (xRenderQueryPictIndexValuesReply *) xalloc (rlength);
+    reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
     if (!reply)
 	return BadAlloc;
 
@@ -571,7 +571,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
     }
 
     WriteToClient(client, rlength, (char *) reply);
-    xfree(reply);
+    free(reply);
     return (client->noClientException);
 }
 
@@ -1058,7 +1058,7 @@ ProcRenderAddGlyphs (ClientPtr client)
     }
     else
     {
-	glyphsBase = (GlyphNewPtr) Xcalloc (nglyphs * sizeof (GlyphNewRec));
+	glyphsBase = (GlyphNewPtr)calloc(nglyphs, sizeof (GlyphNewRec));
 	if (!glyphsBase)
 	    return BadAlloc;
     }
@@ -1200,7 +1200,7 @@ ProcRenderAddGlyphs (ClientPtr client)
 	AddGlyph (glyphSet, glyphs[i].glyph, glyphs[i].id);
 
     if (glyphsBase != glyphsLocal)
-	Xfree (glyphsBase);
+	free(glyphsBase);
     return client->noClientException;
 bail:
     if (pSrc)
@@ -1209,9 +1209,9 @@ bail:
 	FreeScratchPixmapHeader (pSrcPix);
     for (i = 0; i < nglyphs; i++)
 	if (glyphs[i].glyph && ! glyphs[i].found)
-	    xfree (glyphs[i].glyph);
+	    free(glyphs[i].glyph);
     if (glyphsBase != glyphsLocal)
-	Xfree (glyphsBase);
+	free(glyphsBase);
     return err;
 }
 
@@ -1335,7 +1335,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	glyphsBase = glyphsLocal;
     else
     {
-	glyphsBase = (GlyphPtr *) xalloc (nglyph * sizeof (GlyphPtr));
+	glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof (GlyphPtr));
 	if (!glyphsBase)
 	    return BadAlloc;
     }
@@ -1343,7 +1343,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	listsBase = listsLocal;
     else
     {
-	listsBase = (GlyphListPtr) xalloc (nlist * sizeof (GlyphListRec));
+	listsBase = (GlyphListPtr) malloc(nlist * sizeof (GlyphListRec));
 	if (!listsBase)
 	    return BadAlloc;
     }
@@ -1366,9 +1366,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 		if (rc != Success)
 		{
 		    if (glyphsBase != glyphsLocal)
-			xfree (glyphsBase);
+			free(glyphsBase);
 		    if (listsBase != listsLocal)
-			xfree (listsBase);
+			free(listsBase);
 		    return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
 		}
 	    }
@@ -1422,9 +1422,9 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 		     glyphsBase);
 
     if (glyphsBase != glyphsLocal)
-	xfree (glyphsBase);
+	free(glyphsBase);
     if (listsBase != listsLocal)
-	xfree (listsBase);
+	free(listsBase);
     
     return client->noClientException;
 }
@@ -1518,23 +1518,23 @@ ProcRenderCreateCursor (ClientPtr client)
     if ( stuff->x > width 
       || stuff->y > height )
 	return (BadMatch);
-    argbbits = xalloc (width * height * sizeof (CARD32));
+    argbbits = malloc(width * height * sizeof (CARD32));
     if (!argbbits)
 	return (BadAlloc);
     
     stride = BitmapBytePad(width);
     nbytes_mono = stride*height;
-    srcbits = xcalloc(1, nbytes_mono);
+    srcbits = calloc(1, nbytes_mono);
     if (!srcbits)
     {
-	xfree (argbbits);
+	free(argbbits);
 	return (BadAlloc);
     }
-    mskbits = xcalloc(1, nbytes_mono);
+    mskbits = calloc(1, nbytes_mono);
     if (!mskbits)
     {
-	xfree(argbbits);
-	xfree(srcbits);
+	free(argbbits);
+	free(srcbits);
 	return (BadAlloc);
     }
 
@@ -1554,27 +1554,27 @@ ProcRenderCreateCursor (ClientPtr client)
 	pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
 	if (!pFormat)
 	{
-	    xfree (argbbits);
-	    xfree (srcbits);
-	    xfree (mskbits);
+	    free(argbbits);
+	    free(srcbits);
+	    free(mskbits);
 	    return (BadImplementation);
 	}
 	pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32,
 					    CREATE_PIXMAP_USAGE_SCRATCH);
 	if (!pPixmap)
 	{
-	    xfree (argbbits);
-	    xfree (srcbits);
-	    xfree (mskbits);
+	    free(argbbits);
+	    free(srcbits);
+	    free(mskbits);
 	    return (BadAlloc);
 	}
 	pPicture = CreatePicture (0, &pPixmap->drawable, pFormat, 0, 0, 
 				  client, &error);
 	if (!pPicture)
 	{
-	    xfree (argbbits);
-	    xfree (srcbits);
-	    xfree (mskbits);
+	    free(argbbits);
+	    free(srcbits);
+	    free(mskbits);
 	    return error;
 	}
 	(*pScreen->DestroyPixmap) (pPixmap);
@@ -1658,7 +1658,7 @@ ProcRenderCreateCursor (ClientPtr client)
     }
     else
     {
-	xfree (argbbits);
+	free(argbbits);
 	argbbits = 0;
     }
     
@@ -1735,7 +1735,7 @@ ProcRenderQueryFilters (ClientPtr client)
     }
     len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
     total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);
-    reply = (xRenderQueryFiltersReply *) xalloc (total_bytes);
+    reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
     if (!reply)
 	return BadAlloc;
     aliases = (INT16 *) (reply + 1);
@@ -1806,7 +1806,7 @@ ProcRenderQueryFilters (ClientPtr client)
 	swapl(&reply->numFilters, n);
     }
     WriteToClient(client, total_bytes, (char *) reply);
-    xfree (reply);
+    free(reply);
     
     return(client->noClientException);
 }
@@ -1847,7 +1847,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
     if (client->req_len & 1)
 	return BadLength;
     ncursor = (client->req_len - (bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
-    cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
+    cursors = malloc(ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
     if (!cursors)
 	return BadAlloc;
     deltas = (CARD32 *) (cursors + ncursor);
@@ -1858,7 +1858,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
 				      RT_CURSOR, client, DixReadAccess);
 	if (ret != Success)
 	{
-	    xfree (cursors);
+	    free(cursors);
 	    return (ret == BadValue) ? BadCursor : ret;
 	}
 	deltas[i] = elt->delay;
@@ -1866,7 +1866,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
     }
     ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor, client,
 			    stuff->cid);
-    xfree (cursors);
+    free(cursors);
     if (ret != Success)
 	return ret;
     
@@ -2669,7 +2669,7 @@ PanoramiXRenderCreatePicture (ClientPtr client)
 				      XRC_DRAWABLE, client, DixWriteAccess);
     if (result != Success)
 	return (result == BadValue) ? BadDrawable : result;
-    if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+    if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
     newPict->type = XRT_PICTURE;
     newPict->info[0].id = stuff->pid;
@@ -2695,7 +2695,7 @@ PanoramiXRenderCreatePicture (ClientPtr client)
     if (result == Success)
 	AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
     else 
-	xfree(newPict);
+	free(newPict);
 
     return (result);
 }
@@ -2905,7 +2905,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
     VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len)))
+	(extra = (char *) malloc(extra_len)))
     {
 	memcpy (extra, stuff + 1, extra_len);
 	FOR_NSCREENS_FORWARD(j) {
@@ -2931,7 +2931,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
 	    result = (*PanoramiXSaveRenderVector[X_RenderFillRectangles]) (client);
 	    if(result != Success) break;
 	}
-	xfree(extra);
+	free(extra);
     }
 
     return result;
@@ -2954,7 +2954,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
 
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len))) {
+	(extra = (char *) malloc(extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -2991,7 +2991,7 @@ PanoramiXRenderTrapezoids(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        xfree(extra);
+        free(extra);
     }
 
     return result;
@@ -3014,7 +3014,7 @@ PanoramiXRenderTriangles(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
 
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len))) {
+	(extra = (char *) malloc(extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3047,7 +3047,7 @@ PanoramiXRenderTriangles(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        xfree(extra);
+        free(extra);
     }
 
     return result;
@@ -3070,7 +3070,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
 
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len))) {
+	(extra = (char *) malloc(extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3099,7 +3099,7 @@ PanoramiXRenderTriStrip(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        xfree(extra);
+        free(extra);
     }
 
     return result;
@@ -3122,7 +3122,7 @@ PanoramiXRenderTriFan(ClientPtr client)
     extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
 
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len))) {
+	(extra = (char *) malloc(extra_len))) {
 	memcpy (extra, stuff + 1, extra_len);
 
 	FOR_NSCREENS_FORWARD(j) {
@@ -3151,7 +3151,7 @@ PanoramiXRenderTriFan(ClientPtr client)
 	    if(result != Success) break;
 	}
 	
-        xfree(extra);
+        free(extra);
     }
 
     return result;
@@ -3171,7 +3171,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
     VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
     if (extra_len &&
-	(extra = (char *) xalloc (extra_len)))
+	(extra = (char *) malloc(extra_len)))
     {
 	memcpy (extra, stuff + 1, extra_len);
 	x_off = stuff->xOff;
@@ -3188,7 +3188,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
 	    result = (*PanoramiXSaveRenderVector[X_RenderAddTraps]) (client);
 	    if(result != Success) break;
 	}
-	xfree(extra);
+	free(extra);
     }
 
     return result;
@@ -3203,7 +3203,7 @@ PanoramiXRenderCreateSolidFill (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
 
-    if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+    if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPict->type = XRT_PICTURE;
@@ -3222,7 +3222,7 @@ PanoramiXRenderCreateSolidFill (ClientPtr client)
     if (result == Success)
 	AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
     else
-	xfree(newPict);
+	free(newPict);
 
     return result;
 }
@@ -3236,7 +3236,7 @@ PanoramiXRenderCreateLinearGradient (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
 
-    if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+    if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPict->type = XRT_PICTURE;
@@ -3255,7 +3255,7 @@ PanoramiXRenderCreateLinearGradient (ClientPtr client)
     if (result == Success)
 	AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
     else
-	xfree(newPict);
+	free(newPict);
 
     return result;
 }
@@ -3269,7 +3269,7 @@ PanoramiXRenderCreateRadialGradient (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
 
-    if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+    if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPict->type = XRT_PICTURE;
@@ -3288,7 +3288,7 @@ PanoramiXRenderCreateRadialGradient (ClientPtr client)
     if (result == Success)
 	AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
     else
-	xfree(newPict);
+	free(newPict);
 
     return result;
 }
@@ -3302,7 +3302,7 @@ PanoramiXRenderCreateConicalGradient (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
 
-    if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+    if(!(newPict = (PanoramiXRes *) malloc(sizeof(PanoramiXRes))))
 	return BadAlloc;
 
     newPict->type = XRT_PICTURE;
@@ -3321,7 +3321,7 @@ PanoramiXRenderCreateConicalGradient (ClientPtr client)
     if (result == Success)
 	AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
     else
-	xfree(newPict);
+	free(newPict);
 
     return result;
 }
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 0afa55a..d0e93f2 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -47,7 +47,7 @@ static void fake_init_sprite(DeviceIntPtr dev)
     sprite = dev->spriteInfo->sprite;
 
     sprite->spriteTraceSize = 10;
-    sprite->spriteTrace = xcalloc(sprite->spriteTraceSize, sizeof(WindowPtr));
+    sprite->spriteTrace = calloc(sprite->spriteTraceSize, sizeof(WindowPtr));
     sprite->spriteTraceGood = 1;
     sprite->spriteTrace[0] = &root;
     sprite->hot.x = SPRITE_X;
@@ -132,7 +132,7 @@ void init_window(WindowPtr window, WindowPtr parent, int id)
         window->drawable.height = 200;
     }
     window->parent = parent;
-    window->optional = xcalloc(1, sizeof(WindowOptRec));
+    window->optional = calloc(1, sizeof(WindowOptRec));
     g_assert(window->optional);
 }
 
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index f20a10a..211cce6 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -141,12 +141,12 @@ static void test_XIRawEvent(RawDeviceEvent *in)
 
     test_values_XIRawEvent(in, out, FALSE);
 
-    swapped = xcalloc(1, sizeof(xEvent) + out->length * 4);
+    swapped = calloc(1, sizeof(xEvent) + out->length * 4);
     XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
     test_values_XIRawEvent(in, swapped, TRUE);
 
-    xfree(out);
-    xfree(swapped);
+    free(out);
+    free(swapped);
 }
 
 static void test_convert_XIFocusEvent(void)
@@ -400,12 +400,12 @@ static void test_XIDeviceEvent(DeviceEvent *in)
 
     test_values_XIDeviceEvent(in, out, FALSE);
 
-    swapped = xcalloc(1, sizeof(xEvent) + out->length * 4);
+    swapped = calloc(1, sizeof(xEvent) + out->length * 4);
     XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
     test_values_XIDeviceEvent(in, swapped, TRUE);
 
-    xfree(out);
-    xfree(swapped);
+    free(out);
+    free(swapped);
 }
 
 static void test_convert_XIDeviceEvent(void)
@@ -756,12 +756,12 @@ static void test_XIDeviceChangedEvent(DeviceChangedEvent *in)
 
     test_values_XIDeviceChangedEvent(in, out, FALSE);
 
-    swapped = xcalloc(1, sizeof(xEvent) + out->length * 4);
+    swapped = calloc(1, sizeof(xEvent) + out->length * 4);
     XI2EventSwap((xGenericEvent*)out, (xGenericEvent*)swapped);
     test_values_XIDeviceChangedEvent(in, swapped, TRUE);
 
-    xfree(out);
-    xfree(swapped);
+    free(out);
+    free(swapped);
 }
 
 static void test_convert_XIDeviceChangedEvent(void)
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 2aba0ce..b7e6c7b 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -196,7 +196,7 @@ CursorCloseScreen (int index, ScreenPtr pScreen)
     Unwrap (cs, pScreen, DisplayCursor, display_proc);
     deleteCursorHideCountsForScreen(pScreen);
     ret = (*pScreen->CloseScreen) (index, pScreen);
-    xfree (cs);
+    free(cs);
     return ret;
 }
 
@@ -229,7 +229,7 @@ XFixesSelectCursorInput (ClientPtr	pClient,
     }
     if (!e)
     {
-	e = (CursorEventPtr) xalloc (sizeof (CursorEventRec));
+	e = (CursorEventPtr) malloc(sizeof (CursorEventRec));
 	if (!e)
 	    return BadAlloc;
 
@@ -249,7 +249,7 @@ XFixesSelectCursorInput (ClientPtr	pClient,
 	    if (!AddResource (pWindow->drawable.id, CursorWindowType,
 			      (pointer) pWindow))
 	    {
-		xfree (e);
+		free(e);
 		return BadAlloc;
 	    }
 
@@ -389,7 +389,7 @@ ProcXFixesGetCursorImage (ClientPtr client)
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
-    rep = xalloc (sizeof (xXFixesGetCursorImageReply) +
+    rep = malloc(sizeof (xXFixesGetCursorImageReply) +
 		  npixels * sizeof (CARD32));
     if (!rep)
 	return BadAlloc;
@@ -423,7 +423,7 @@ ProcXFixesGetCursorImage (ClientPtr client)
     }
     WriteToClient(client, sizeof (xXFixesGetCursorImageReply) +
 			 (npixels << 2), (char *) rep);
-    xfree (rep);
+    free(rep);
     return client->noClientException;
 }
 
@@ -544,7 +544,7 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
     name = pCursor->name ? NameForAtom (pCursor->name) : "";
     nbytes = strlen (name);
     nbytesRound = pad_to_int32(nbytes);
-    rep = xalloc (sizeof (xXFixesGetCursorImageAndNameReply) +
+    rep = malloc(sizeof (xXFixesGetCursorImageAndNameReply) +
 		  npixels * sizeof (CARD32) + nbytesRound);
     if (!rep)
 	return BadAlloc;
@@ -583,7 +583,7 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
     }
     WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) +
 			 (npixels << 2) + nbytesRound, (char *) rep);
-    xfree (rep);
+    free(rep);
     return client->noClientException;
 }
 
@@ -801,7 +801,7 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
     CursorScreenPtr    cs = GetCursorScreen(pScreen);
     CursorHideCountPtr pChc;
 
-    pChc = (CursorHideCountPtr) xalloc(sizeof(CursorHideCountRec));
+    pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec));
     if (pChc == NULL) {
 	return BadAlloc;
     }
@@ -818,7 +818,7 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
      */
     if (!AddResource (pChc->resource, CursorHideCountType, 
 		      (pointer) pChc)) {
-	xfree(pChc);
+	free(pChc);
 	return BadAlloc;
     }
 
@@ -839,7 +839,7 @@ deleteCursorHideCount (CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
     while (pChc != NULL) {
 	pNext = pChc->pNext;
 	if (pChc == pChcToDel) {
-	    xfree(pChc);
+	    free(pChc);
 	    if (pChcLast == NULL) {
 		cs->pCursorHideCounts = pNext;
 	    } else {
@@ -995,7 +995,7 @@ CursorFreeClient (pointer data, XID id)
 	if (e == old)
 	{
 	    *prev = e->next;
-	    xfree (e);
+	    free(e);
 	    break;
 	}
     }
@@ -1043,8 +1043,8 @@ createInvisibleCursor (void)
     unsigned char *psrcbits, *pmaskbits;
     CursorMetricRec cm;
 
-    psrcbits = (unsigned char *) xcalloc(4, 1);
-    pmaskbits = (unsigned char *) xcalloc(4, 1);
+    psrcbits = (unsigned char *) calloc(4, 1);
+    pmaskbits = (unsigned char *) calloc(4, 1);
     if (psrcbits == NULL || pmaskbits == NULL) {
 	return NULL;
     }
@@ -1080,7 +1080,7 @@ XFixesCursorInit (void)
 	ScreenPtr	pScreen = screenInfo.screens[i];
 	CursorScreenPtr	cs;
 
-	cs = (CursorScreenPtr) xalloc (sizeof (CursorScreenRec));
+	cs = (CursorScreenPtr) malloc(sizeof (CursorScreenRec));
 	if (!cs)
 	    return FALSE;
 	Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
diff --git a/xfixes/region.c b/xfixes/region.c
index 5d195a3..2649c06 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -568,7 +568,7 @@ ProcXFixesFetchRegion (ClientPtr client)
     pBox = REGION_RECTS (pRegion);
     nBox = REGION_NUM_RECTS (pRegion);
     
-    reply = xalloc (sizeof (xXFixesFetchRegionReply) +
+    reply = malloc(sizeof (xXFixesFetchRegionReply) +
 		    nBox * sizeof (xRectangle));
     if (!reply)
 	return BadAlloc;
@@ -601,7 +601,7 @@ ProcXFixesFetchRegion (ClientPtr client)
     }
     (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) +
 			 nBox * sizeof (xRectangle), (char *) reply);
-    xfree (reply);
+    free(reply);
     return (client->noClientException);
 }
 
@@ -812,7 +812,7 @@ ProcXFixesExpandRegion (ClientPtr client)
     pSrc = REGION_RECTS(pSource);
     if (nBoxes)
     {
-	pTmp = xalloc (nBoxes * sizeof (BoxRec));
+	pTmp = malloc(nBoxes * sizeof (BoxRec));
 	if (!pTmp)
 	    return BadAlloc;
 	for (i = 0; i < nBoxes; i++)
@@ -829,7 +829,7 @@ ProcXFixesExpandRegion (ClientPtr client)
 	    REGION_INIT (pScreen, &r, &pTmp[i], 0);
 	    REGION_UNION (pScreen, pDestination, pDestination, &r);
 	}
-	xfree(pTmp);
+	free(pTmp);
     }
     if (ret == Success) 
 	ret = client->noClientException;
diff --git a/xfixes/select.c b/xfixes/select.c
index 5ba7896..6d86f63 100644
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -160,7 +160,7 @@ XFixesSelectSelectionInput (ClientPtr	pClient,
     }
     if (!e)
     {
-	e = (SelectionEventPtr) xalloc (sizeof (SelectionEventRec));
+	e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec));
 	if (!e)
 	    return BadAlloc;
 
@@ -181,7 +181,7 @@ XFixesSelectSelectionInput (ClientPtr	pClient,
 	    if (!AddResource (pWindow->drawable.id, SelectionWindowType,
 			      (pointer) pWindow))
 	    {
-		xfree (e);
+		free(e);
 		return BadAlloc;
 	    }
 
@@ -256,7 +256,7 @@ SelectionFreeClient (pointer data, XID id)
 	if (e == old)
 	{
 	    *prev = e->next;
-	    xfree (e);
+	    free(e);
 	    CheckSelectionCallback ();
 	    break;
 	}
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index d40aa33..0e3c6f4 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -57,10 +57,10 @@ XkbSymInterpretRec *prev_interpret;
 	if (compat->sym_interpret==NULL)
 	    compat->num_si= 0;
 	prev_interpret = compat->sym_interpret;
-	compat->sym_interpret= xrealloc(compat->sym_interpret,
+	compat->sym_interpret= realloc(compat->sym_interpret,
 					nSI * sizeof(XkbSymInterpretRec));
 	if (compat->sym_interpret==NULL) {
-	    xfree(prev_interpret);
+	    free(prev_interpret);
 	    compat->size_si= compat->num_si= 0;
 	    return BadAlloc;
 	}
@@ -70,13 +70,13 @@ XkbSymInterpretRec *prev_interpret;
 	}
 	return Success;
     }
-   compat= xcalloc(1, sizeof(XkbCompatMapRec));
+   compat= calloc(1, sizeof(XkbCompatMapRec));
     if (compat==NULL)
 	return BadAlloc;
     if (nSI>0) {
-	compat->sym_interpret= xcalloc(nSI, sizeof(XkbSymInterpretRec));
+	compat->sym_interpret= calloc(nSI, sizeof(XkbSymInterpretRec));
 	if (!compat->sym_interpret) {
-	    xfree(compat);
+	    free(compat);
 	    return BadAlloc;
 	}
     }
@@ -102,12 +102,12 @@ register XkbCompatMapPtr compat;
 	bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec));
     if (which&XkbSymInterpMask) {
 	if ((compat->sym_interpret)&&(compat->size_si>0))
-	    xfree(compat->sym_interpret);
+	    free(compat->sym_interpret);
 	compat->size_si= compat->num_si= 0;
 	compat->sym_interpret= NULL;
     }
     if (freeMap) {
-	xfree(compat);
+	free(compat);
 	xkb->compat= NULL;
     }
     return;
@@ -123,7 +123,7 @@ XkbNamesPtr	names;
     if (xkb==NULL)
 	return BadMatch;
     if (xkb->names==NULL) {
-	xkb->names = xcalloc(1, sizeof(XkbNamesRec));
+	xkb->names = calloc(1, sizeof(XkbNamesRec));
 	if (xkb->names==NULL)
 	    return BadAlloc;
     }
@@ -135,7 +135,7 @@ XkbNamesPtr	names;
 	type= xkb->map->types;
 	for (i=0;i<xkb->map->num_types;i++,type++) {
 	    if (type->level_names==NULL) {
-		type->level_names= xcalloc(type->num_levels, sizeof(Atom));
+		type->level_names= calloc(type->num_levels, sizeof(Atom));
 		if (type->level_names==NULL)
 		    return BadAlloc;
 	    }
@@ -146,24 +146,24 @@ XkbNamesPtr	names;
 	    (!XkbIsLegalKeycode(xkb->max_key_code))||
 	    (xkb->max_key_code<xkb->min_key_code)) 
 	    return BadValue;
-	names->keys= xcalloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec));
+	names->keys= calloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec));
 	if (names->keys==NULL)
 	    return BadAlloc;
     }
     if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) {
 	if (names->key_aliases==NULL) {
-	    names->key_aliases= xcalloc(nTotalAliases, sizeof(XkbKeyAliasRec));
+	    names->key_aliases= calloc(nTotalAliases, sizeof(XkbKeyAliasRec));
 	}
 	else if (nTotalAliases>names->num_key_aliases) {
 	    XkbKeyAliasRec *prev_aliases = names->key_aliases;
 
-	    names->key_aliases= xrealloc(names->key_aliases,
+	    names->key_aliases= realloc(names->key_aliases,
 					 nTotalAliases * sizeof(XkbKeyAliasRec));
 	    if (names->key_aliases!=NULL) {
 		memset(&names->key_aliases[names->num_key_aliases], 0,
 			(nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec));
 	    } else {
-		xfree(prev_aliases);
+		free(prev_aliases);
 	    }
 	}
 	if (names->key_aliases==NULL) {
@@ -174,18 +174,18 @@ XkbNamesPtr	names;
     }
     if ((which&XkbRGNamesMask)&&(nTotalRG>0)) {
 	if (names->radio_groups==NULL) {
-	    names->radio_groups= xcalloc(nTotalRG, sizeof(Atom));
+	    names->radio_groups= calloc(nTotalRG, sizeof(Atom));
 	}
 	else if (nTotalRG>names->num_rg) {
 	    Atom *prev_radio_groups = names->radio_groups;
 
-	    names->radio_groups= xrealloc(names->radio_groups,
+	    names->radio_groups= realloc(names->radio_groups,
 					  nTotalRG * sizeof(Atom));
 	    if (names->radio_groups!=NULL) {
 		memset(&names->radio_groups[names->num_rg], 0,
 			(nTotalRG - names->num_rg) * sizeof(Atom));
 	    } else {
-		xfree(prev_radio_groups);
+		free(prev_radio_groups);
 	    }
 	}
 	if (names->radio_groups==NULL)
@@ -213,29 +213,29 @@ XkbNamesPtr	names;
 	    type= map->types;
 	    for (i=0;i<map->num_types;i++,type++) {
 		if (type->level_names!=NULL) {
-		    xfree(type->level_names);
+		    free(type->level_names);
 		    type->level_names= NULL;
 		}
 	    }
 	}
     }
     if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
-	xfree(names->keys);
+	free(names->keys);
 	names->keys= NULL;
 	names->num_keys= 0;
     }
     if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){
-	xfree(names->key_aliases);
+	free(names->key_aliases);
 	names->key_aliases=NULL;
 	names->num_key_aliases=0;
     }
     if ((which&XkbRGNamesMask)&&(names->radio_groups)) {
-	xfree(names->radio_groups);
+	free(names->radio_groups);
 	names->radio_groups= NULL;
 	names->num_rg= 0;
     }
     if (freeMap) {
-	xfree(names);
+	free(names);
 	xkb->names= NULL;
     }
     return;
@@ -251,7 +251,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which)
 	return BadMatch;
 
     if (xkb->ctrls==NULL) {
-	xkb->ctrls= xcalloc(1, sizeof(XkbControlsRec));
+	xkb->ctrls= calloc(1, sizeof(XkbControlsRec));
 	if (!xkb->ctrls)
 	    return BadAlloc;
     }
@@ -263,7 +263,7 @@ static void
 XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
 {
     if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
-	xfree(xkb->ctrls);
+	free(xkb->ctrls);
 	xkb->ctrls= NULL;
     }
     return;
@@ -277,7 +277,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
     if (xkb==NULL)
 	return BadMatch;
     if (xkb->indicators==NULL) {
-	xkb->indicators= xcalloc(1, sizeof(XkbIndicatorRec));
+	xkb->indicators= calloc(1, sizeof(XkbIndicatorRec));
 	if (!xkb->indicators)
 	    return BadAlloc;
     }
@@ -288,7 +288,7 @@ static void
 XkbFreeIndicatorMaps(XkbDescPtr xkb)
 {
     if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
-	xfree(xkb->indicators);
+	free(xkb->indicators);
 	xkb->indicators= NULL;
     }
     return;
@@ -301,7 +301,7 @@ XkbAllocKeyboard(void)
 {
 XkbDescRec *xkb;
 
-    xkb = xcalloc(1, sizeof(XkbDescRec));
+    xkb = calloc(1, sizeof(XkbDescRec));
     if (xkb)
 	xkb->device_spec= XkbUseCoreKbd;
     return xkb;
@@ -332,6 +332,6 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
     if (which&XkbControlsMask)
 	XkbFreeControls(xkb,XkbAllControlsMask,TRUE);
     if (freeAll)
-	xfree(xkb);
+	free(xkb);
     return;
 }
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index b01005d..7a3659f 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -51,7 +51,7 @@ _XkbFreeGeomLeafElems(	Bool			freeAll,
     if ((freeAll)||(*elems==NULL)) {
 	*num_inout= *sz_inout= 0;
 	if (*elems!=NULL) {
-	    xfree(*elems);
+	    free(*elems);
 	    *elems= NULL;
 	}	
 	return;
@@ -115,7 +115,7 @@ register char *ptr;
     if (freeAll) {
 	(*num_inout)= (*sz_inout)= 0;
 	if (*elems) {
-	    xfree(*elems);
+	    free(*elems);
 	    *elems= NULL;
 	}
     }
@@ -138,11 +138,11 @@ _XkbClearProperty(char *prop_in)
 XkbPropertyPtr	prop= (XkbPropertyPtr)prop_in;
 
     if (prop->name) {
-	xfree(prop->name);
+	free(prop->name);
 	prop->name= NULL;
     }
     if (prop->value) {
-	xfree(prop->value);
+	free(prop->value);
 	prop->value= NULL;
     }
     return;
@@ -184,7 +184,7 @@ _XkbClearColor(char *color_in)
 XkbColorPtr	color= (XkbColorPtr)color_in;
 
     if (color->spec)
-	xfree(color->spec);
+	free(color->spec);
     return;
 }
 
@@ -381,11 +381,11 @@ XkbDoodadPtr	doodad= (XkbDoodadPtr)doodad_in;
    	case XkbTextDoodad: 
 	    {
 		if (doodad->text.text!=NULL) {
-		    xfree(doodad->text.text);
+		    free(doodad->text.text);
 		    doodad->text.text= NULL;
 		}
 		if (doodad->text.font!=NULL) {
-		    xfree(doodad->text.font);
+		    free(doodad->text.font);
 		    doodad->text.font= NULL;
 		}
 	    }
@@ -393,7 +393,7 @@ XkbDoodadPtr	doodad= (XkbDoodadPtr)doodad_in;
    	case XkbLogoDoodad: 
 	    {
 		if (doodad->logo.logo_name!=NULL) {
-		    xfree(doodad->logo.logo_name);
+		    free(doodad->logo.logo_name);
 		    doodad->logo.logo_name= NULL;
 		}
 	    }
@@ -413,7 +413,7 @@ register XkbDoodadPtr	doodad;
 	    _XkbClearDoodad((char *)doodad);
 	}
 	if (freeAll)
-	    xfree(doodads);
+	    free(doodads);
     }
     return;
 }
@@ -442,10 +442,10 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
 	XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
     if (freeMap) {
 	if (geom->label_font!=NULL) {
-	    xfree(geom->label_font);
+	    free(geom->label_font);
 	    geom->label_font= NULL;
 	}
-	xfree(geom);
+	free(geom);
     }
     return;
 }
@@ -469,8 +469,8 @@ _XkbGeomAlloc(	void **		old,
 
     *total= (*num)+num_new;
     if ((*old)!=NULL)
-	 (*old)= xrealloc((*old),(*total)*sz_elem);
-    else (*old)= xcalloc((*total),sz_elem);
+	 (*old)= realloc((*old),(*total)*sz_elem);
+    else (*old)= calloc((*total),sz_elem);
     if ((*old)==NULL) {
 	*total= *num= 0;
 	return BadAlloc;
@@ -615,7 +615,7 @@ XkbGeometryPtr	geom;
 Status		rtrn;
 
     if (xkb->geom==NULL) {
-	xkb->geom= xcalloc(1, sizeof(XkbGeometryRec));
+	xkb->geom= calloc(1, sizeof(XkbGeometryRec));
 	if (!xkb->geom)
 	    return BadAlloc;
     }
@@ -664,8 +664,8 @@ register XkbPropertyPtr prop;
     for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
 	if ((prop->name)&&(strcmp(name,prop->name)==0)) {
 	    if (prop->value)
-		xfree(prop->value);
-	    prop->value= xalloc(strlen(value)+1);
+		free(prop->value);
+	    prop->value= malloc(strlen(value)+1);
 	    if (prop->value)
 		strcpy(prop->value,value);
 	    return prop;
@@ -676,13 +676,13 @@ register XkbPropertyPtr prop;
 	return NULL;
     }
     prop= &geom->properties[geom->num_properties];
-    prop->name= xalloc(strlen(name)+1);
+    prop->name= malloc(strlen(name)+1);
     if (!name)
 	return NULL;
     strcpy(prop->name,name);
-    prop->value= xalloc(strlen(value)+1);
+    prop->value= malloc(strlen(value)+1);
     if (!value) {
-	xfree(prop->name);
+	free(prop->name);
 	prop->name= NULL;
 	return NULL;
     }
@@ -738,7 +738,7 @@ register XkbColorPtr color;
     }
     color= &geom->colors[geom->num_colors];
     color->pixel= pixel;
-    color->spec= xalloc(strlen(spec)+1);
+    color->spec= malloc(strlen(spec)+1);
     if (!color->spec)
 	return NULL;
     strcpy(color->spec,spec);
@@ -852,7 +852,7 @@ XkbSectionPtr	section;
 	return NULL;
     if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
 	if (section->rows) {
-	    xfree(section->rows);
+	    free(section->rows);
 	    section->rows= NULL;
 	    section->sz_rows= section->num_rows= 0;
 	}
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index fd12e2b..27151b8 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -59,7 +59,7 @@ XkbClientMapPtr map;
     }
 
     if (xkb->map==NULL) {
-	map= xcalloc(1, sizeof(XkbClientMapRec));
+	map= calloc(1, sizeof(XkbClientMapRec));
 	if (map==NULL)
 	    return BadAlloc;
 	xkb->map= map;
@@ -68,7 +68,7 @@ XkbClientMapPtr map;
 
     if ((which&XkbKeyTypesMask)&&(nTotalTypes>0)) {
 	if (map->types==NULL) {
-	    map->types= xcalloc(nTotalTypes, sizeof(XkbKeyTypeRec));
+	    map->types= calloc(nTotalTypes, sizeof(XkbKeyTypeRec));
 	    if (map->types==NULL)
 		return BadAlloc;
 	    map->num_types= 0;
@@ -77,9 +77,9 @@ XkbClientMapPtr map;
 	else if (map->size_types<nTotalTypes) {
 	    XkbKeyTypeRec *prev_types = map->types;
 
-	    map->types= xrealloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec));
+	    map->types= realloc(map->types,nTotalTypes * sizeof(XkbKeyTypeRec));
 	    if (map->types==NULL) {
-		xfree(prev_types);
+		free(prev_types);
 		map->num_types= map->size_types= 0;
 		return BadAlloc;
 	    }
@@ -92,7 +92,7 @@ XkbClientMapPtr map;
 	int nKeys= XkbNumKeys(xkb);
 	if (map->syms==NULL) {
 	    map->size_syms= (nKeys*15)/10;
-	    map->syms= xcalloc(map->size_syms, sizeof(KeySym));
+	    map->syms= calloc(map->size_syms, sizeof(KeySym));
 	    if (!map->syms) {
 		map->size_syms= 0;
 		return BadAlloc;
@@ -102,7 +102,7 @@ XkbClientMapPtr map;
 	}
 	if (map->key_sym_map==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->key_sym_map= xcalloc(i, sizeof(XkbSymMapRec));
+	    map->key_sym_map= calloc(i, sizeof(XkbSymMapRec));
 	    if (map->key_sym_map==NULL)
 		return BadAlloc;
 	}
@@ -114,7 +114,7 @@ XkbClientMapPtr map;
 	    return BadMatch;
 	if (map->modmap==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->modmap= xcalloc(i, sizeof(unsigned char));
+	    map->modmap= calloc(i, sizeof(unsigned char));
 	    if (map->modmap==NULL)
 		return BadAlloc;
 	}
@@ -131,7 +131,7 @@ XkbServerMapPtr map;
     if (xkb==NULL)
 	return BadMatch;
     if (xkb->server==NULL) {
-	map= xcalloc(1, sizeof(XkbServerMapRec));
+	map= calloc(1, sizeof(XkbServerMapRec));
 	if (map==NULL)
 	    return BadAlloc;
 	for (i=0;i<XkbNumVirtualMods;i++) {
@@ -147,7 +147,7 @@ XkbServerMapPtr map;
 	    return BadMatch;
 	if (map->explicit==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->explicit= xcalloc(i, sizeof(unsigned char));
+	    map->explicit= calloc(i, sizeof(unsigned char));
 	    if (map->explicit==NULL)
 		return BadAlloc;
 	}
@@ -160,7 +160,7 @@ XkbServerMapPtr map;
         if (nNewActions<1)
 	    nNewActions= 1;
 	if (map->acts==NULL) {
-	    map->acts= xcalloc((nNewActions+1), sizeof(XkbAction));
+	    map->acts= calloc((nNewActions+1), sizeof(XkbAction));
 	    if (map->acts==NULL)
 		return BadAlloc;
 	    map->num_acts= 1;
@@ -170,9 +170,9 @@ XkbServerMapPtr map;
 	    unsigned need;
 	    XkbAction *prev_acts = map->acts;
 	    need= map->num_acts+nNewActions;
-	    map->acts= xrealloc(map->acts,need * sizeof(XkbAction));
+	    map->acts= realloc(map->acts,need * sizeof(XkbAction));
 	    if (map->acts==NULL) {
-		xfree(prev_acts);
+		free(prev_acts);
 	        map->num_acts= map->size_acts= 0;
 	        return BadAlloc;
 	    }
@@ -182,7 +182,7 @@ XkbServerMapPtr map;
 	}
 	if (map->key_acts==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->key_acts= xcalloc(i, sizeof(unsigned short));
+	    map->key_acts= calloc(i, sizeof(unsigned short));
 	    if (map->key_acts==NULL)
 		return BadAlloc;
 	}
@@ -194,7 +194,7 @@ XkbServerMapPtr map;
 	    return BadMatch;
 	if (map->behaviors==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->behaviors= xcalloc(i, sizeof(XkbBehavior));
+	    map->behaviors= calloc(i, sizeof(XkbBehavior));
 	    if (map->behaviors==NULL)
 		return BadAlloc;
 	}
@@ -206,7 +206,7 @@ XkbServerMapPtr map;
 	    return BadMatch;
 	if (map->vmodmap==NULL) {
 	    i= xkb->max_key_code+1;
-	    map->vmodmap= xcalloc(i, sizeof(unsigned short));
+	    map->vmodmap= calloc(i, sizeof(unsigned short));
 	    if (map->vmodmap==NULL)
 		return BadAlloc;
 	}
@@ -222,33 +222,33 @@ XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
     if ((!from)||(!into))
 	return BadMatch;
     if (into->map) {
-	xfree(into->map);
+	free(into->map);
 	into->map= NULL;
     }
     if (into->preserve) {
-	xfree(into->preserve);
+	free(into->preserve);
 	into->preserve= NULL;
     }
     if (into->level_names) {
-	xfree(into->level_names);
+	free(into->level_names);
 	into->level_names= NULL;
     }
     *into= *from;
     if ((from->map)&&(into->map_count>0)) {
-	into->map= xcalloc(into->map_count, sizeof(XkbKTMapEntryRec));
+	into->map= calloc(into->map_count, sizeof(XkbKTMapEntryRec));
 	if (!into->map)
 	    return BadAlloc;
 	memcpy(into->map,from->map,into->map_count*sizeof(XkbKTMapEntryRec));
     }
     if ((from->preserve)&&(into->map_count>0)) {
-	into->preserve= xcalloc(into->map_count, sizeof(XkbModsRec));
+	into->preserve= calloc(into->map_count, sizeof(XkbModsRec));
 	if (!into->preserve)
 	    return BadAlloc;
 	memcpy(into->preserve,from->preserve,
 				into->map_count*sizeof(XkbModsRec));
     }
     if ((from->level_names)&&(into->num_levels>0)) {
-	into->level_names= xcalloc(into->num_levels, sizeof(Atom));
+	into->level_names= calloc(into->num_levels, sizeof(Atom));
 	if (!into->level_names)
 	    return BadAlloc;
 	memcpy(into->level_names,from->level_names,
@@ -299,10 +299,10 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
     type= &xkb->map->types[type_ndx];
     if (map_count==0) {
 	if (type->map!=NULL)
-	    xfree(type->map);
+	    free(type->map);
 	type->map= NULL;
 	if (type->preserve!=NULL)
-	    xfree(type->preserve);
+	    free(type->preserve);
 	type->preserve= NULL;
 	type->map_count= 0;
     }
@@ -310,27 +310,27 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 	XkbKTMapEntryRec *prev_map = type->map;
 
 	if ((map_count>type->map_count)||(type->map==NULL))
-	    type->map = xrealloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
+	    type->map = realloc(type->map,map_count * sizeof(XkbKTMapEntryRec));
 	if (!type->map) {
 	    if (prev_map) 
-		xfree(prev_map);
+		free(prev_map);
 	    return BadAlloc;
 	}
 	if (want_preserve) {
 	    XkbModsRec *prev_preserve = type->preserve;
 
 	    if ((map_count>type->map_count)||(type->preserve==NULL)) {
-		type->preserve = xrealloc(type->preserve,
+		type->preserve = realloc(type->preserve,
 					  map_count * sizeof(XkbModsRec));
 	    }
 	    if (!type->preserve) {
 		if (prev_preserve) 
-		    xfree(prev_preserve);
+		    free(prev_preserve);
 		return BadAlloc;
 	    }
 	}
 	else if (type->preserve!=NULL) {
-	    xfree(type->preserve);
+	    free(type->preserve);
 	    type->preserve= NULL;
 	}
 	type->map_count= map_count;
@@ -339,11 +339,11 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
     if ((new_num_lvls>type->num_levels)||(type->level_names==NULL)) {
 	Atom * prev_level_names = type->level_names;
 
-	type->level_names = xrealloc(type->level_names,
+	type->level_names = realloc(type->level_names,
 				     new_num_lvls * sizeof(Atom));
 	if (!type->level_names) {
 	    if (prev_level_names) 
-		xfree(prev_level_names);
+		free(prev_level_names);
 	    return BadAlloc;
 	}
     }
@@ -397,7 +397,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 	if (nResize>0) {
 	    int nextMatch;
 	    xkb->map->size_syms= (nTotal*15)/10;
-	    newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym));
+	    newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
 	    if (newSyms==NULL)
 		return BadAlloc;
 	    nextMatch= 0;
@@ -423,7 +423,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nMatchingKeys;
 		}
 	    }
 	    type->num_levels= new_num_lvls;
-	    xfree(xkb->map->syms);
+	    free(xkb->map->syms);
 	    xkb->map->syms= newSyms;
 	    xkb->map->num_syms= nSyms;
 	    return Success;
@@ -499,7 +499,7 @@ KeySym	*newSyms;
 	return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
     }
     xkb->map->size_syms+= (needed>32?needed:32);
-    newSyms = xcalloc(xkb->map->size_syms, sizeof(KeySym));
+    newSyms = calloc(xkb->map->size_syms, sizeof(KeySym));
     if (newSyms==NULL)
 	return NULL;
     newSyms[0]= NoSymbol;
@@ -519,7 +519,7 @@ KeySym	*newSyms;
 	xkb->map->key_sym_map[i].offset = nSyms;
 	nSyms+= nKeySyms;
     }
-    xfree(xkb->map->syms);
+    free(xkb->map->syms);
     xkb->map->syms = newSyms;
     xkb->map->num_syms = nSyms;
     return &xkb->map->syms[xkb->map->key_sym_map[key].offset];
@@ -638,10 +638,10 @@ int	tmp;
 	    if (xkb->map->key_sym_map) {
 		XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map;
 
-		xkb->map->key_sym_map = xrealloc(xkb->map->key_sym_map,
+		xkb->map->key_sym_map = realloc(xkb->map->key_sym_map,
 						(maxKC+1) * sizeof(XkbSymMapRec));
 		if (!xkb->map->key_sym_map) {
-		    xfree(prev_key_sym_map);
+		    free(prev_key_sym_map);
 		    return BadAlloc;
 		}
 		bzero((char *)&xkb->map->key_sym_map[xkb->max_key_code],
@@ -656,10 +656,10 @@ int	tmp;
 	    if (xkb->map->modmap) {
 		unsigned char *prev_modmap = xkb->map->modmap;
 
-		xkb->map->modmap = xrealloc(xkb->map->modmap,
+		xkb->map->modmap = realloc(xkb->map->modmap,
 					    (maxKC+1) * sizeof(unsigned char));
 		if (!xkb->map->modmap) {
-		    xfree(prev_modmap);
+		    free(prev_modmap);
 		    return BadAlloc;
 		}
 		bzero((char *)&xkb->map->modmap[xkb->max_key_code],tmp);
@@ -675,10 +675,10 @@ int	tmp;
 	    if (xkb->server->behaviors) {
 		XkbBehavior *prev_behaviors = xkb->server->behaviors;
 
-		xkb->server->behaviors = xrealloc(xkb->server->behaviors,
+		xkb->server->behaviors = realloc(xkb->server->behaviors,
 						(maxKC+1) * sizeof(XkbBehavior));
 		if (!xkb->server->behaviors) {
-		    xfree(prev_behaviors);
+		    free(prev_behaviors);
 		    return BadAlloc;
 		}
 		bzero((char *)&xkb->server->behaviors[xkb->max_key_code],
@@ -693,10 +693,10 @@ int	tmp;
 	    if (xkb->server->key_acts) {
 		unsigned short *prev_key_acts = xkb->server->key_acts;
 
-		xkb->server->key_acts= xrealloc(xkb->server->key_acts,
+		xkb->server->key_acts= realloc(xkb->server->key_acts,
 						(maxKC+1) * sizeof(unsigned short));
 		if (!xkb->server->key_acts) {
-		    xfree(prev_key_acts);
+		    free(prev_key_acts);
 		    return BadAlloc;
 		}
 		bzero((char *)&xkb->server->key_acts[xkb->max_key_code],
@@ -711,10 +711,10 @@ int	tmp;
 	    if (xkb->server->vmodmap) {
 		unsigned short *prev_vmodmap = xkb->server->vmodmap;
 
-		xkb->server->vmodmap= xrealloc(xkb->server->vmodmap,
+		xkb->server->vmodmap= realloc(xkb->server->vmodmap,
 						(maxKC+1) * sizeof(unsigned short));
 		if (!xkb->server->vmodmap) {
-		    xfree(prev_vmodmap);
+		    free(prev_vmodmap);
 		    return BadAlloc;
 		}
 		bzero((char *)&xkb->server->vmodmap[xkb->max_key_code],
@@ -730,10 +730,10 @@ int	tmp;
 	if ((xkb->names)&&(xkb->names->keys)) {
 	    XkbKeyNameRec *prev_keys = xkb->names->keys;
 
-	    xkb->names->keys = xrealloc(xkb->names->keys,
+	    xkb->names->keys = realloc(xkb->names->keys,
 					(maxKC+1) * sizeof(XkbKeyNameRec));
 	    if (!xkb->names->keys) {
-		xfree(prev_keys);
+		free(prev_keys);
 		return BadAlloc;
 	    }
 	    bzero((char *)&xkb->names->keys[xkb->max_key_code],
@@ -768,7 +768,7 @@ XkbAction *newActs;
 	return &xkb->server->acts[xkb->server->key_acts[key]];
     }
     xkb->server->size_acts= xkb->server->num_acts+needed+8;
-    newActs = xcalloc(xkb->server->size_acts, sizeof(XkbAction));
+    newActs = calloc(xkb->server->size_acts, sizeof(XkbAction));
     if (newActs==NULL)
 	return NULL;
     newActs[0].type = XkbSA_NoAction;
@@ -794,7 +794,7 @@ XkbAction *newActs;
 	xkb->server->key_acts[i]= nActs;
 	nActs+= nKeyActs;
     }
-    xfree(xkb->server->acts);
+    free(xkb->server->acts);
     xkb->server->acts = newActs;
     xkb->server->num_acts= nActs;
     return &xkb->server->acts[xkb->server->key_acts[key]];
@@ -817,42 +817,42 @@ XkbClientMapPtr	map;
 		XkbKeyTypePtr	type;
 		for (i=0,type=map->types;i<map->num_types;i++,type++) {
 		    if (type->map!=NULL) {
-			xfree(type->map);
+			free(type->map);
 			type->map= NULL;
 		    }
 		    if (type->preserve!=NULL) {
-			xfree(type->preserve);
+			free(type->preserve);
 			type->preserve= NULL;
 		    }
 		    type->map_count= 0;
 		    if (type->level_names!=NULL) {
-			xfree(type->level_names);
+			free(type->level_names);
 			type->level_names= NULL;
 		    }
 		}
 	    }
-	    xfree(map->types);
+	    free(map->types);
 	    map->num_types= map->size_types= 0;
 	    map->types= NULL;
 	}
     }
     if (what&XkbKeySymsMask) {
 	if (map->key_sym_map!=NULL) {
-	    xfree(map->key_sym_map);
+	    free(map->key_sym_map);
 	    map->key_sym_map= NULL;
 	}
 	if (map->syms!=NULL) {
-	    xfree(map->syms);
+	    free(map->syms);
 	    map->size_syms= map->num_syms= 0;
 	    map->syms= NULL;
 	}
     }
     if ((what&XkbModifierMapMask)&&(map->modmap!=NULL)) {
-	xfree(map->modmap);
+	free(map->modmap);
 	map->modmap= NULL;
     }
     if (freeMap) {
-	xfree(xkb->map);
+	free(xkb->map);
 	xkb->map= NULL;
     }
     return;
@@ -869,31 +869,31 @@ XkbServerMapPtr	map;
 	what= XkbAllServerInfoMask;
     map= xkb->server;
     if ((what&XkbExplicitComponentsMask)&&(map->explicit!=NULL)) {
-	xfree(map->explicit);
+	free(map->explicit);
 	map->explicit= NULL;
     }
     if (what&XkbKeyActionsMask) {
 	if (map->key_acts!=NULL) {
-	    xfree(map->key_acts);
+	    free(map->key_acts);
 	    map->key_acts= NULL;
 	}
 	if (map->acts!=NULL) {
-	    xfree(map->acts);
+	    free(map->acts);
 	    map->num_acts= map->size_acts= 0;
 	    map->acts= NULL;
 	}
     }
     if ((what&XkbKeyBehaviorsMask)&&(map->behaviors!=NULL)) {
-	xfree(map->behaviors);
+	free(map->behaviors);
 	map->behaviors= NULL;
     }
     if ((what&XkbVirtualModMapMask)&&(map->vmodmap!=NULL)) {
-	xfree(map->vmodmap);
+	free(map->vmodmap);
 	map->vmodmap= NULL;
     }
 
     if (freeMap) {
-	xfree(xkb->server);
+	free(xkb->server);
 	xkb->server= NULL;
     }
     return;
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 2bb4a24..ee3dfcc 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -388,7 +388,7 @@ unsigned		changed,tmp;
     nSyms= XkbKeyNumSyms(xkb,key);
     syms= XkbKeySymsPtr(xkb,key);
     if (nSyms>IBUF_SIZE) {
-	interps= xcalloc(nSyms, sizeof(XkbSymInterpretPtr));
+	interps= calloc(nSyms, sizeof(XkbSymInterpretPtr));
 	if (interps==NULL) {
 	    interps= ibuf;
 	    nSyms= IBUF_SIZE;
@@ -422,7 +422,7 @@ unsigned		changed,tmp;
 	pActs= XkbResizeKeyActions(xkb,key,nSyms);
 	if (!pActs) {
             if (nSyms > IBUF_SIZE)
-                xfree(interps);
+                free(interps);
 	    return FALSE;
         }
 	new_vmodmask= 0;
@@ -507,7 +507,7 @@ unsigned		changed,tmp;
 	mc->changed|= changed;
     }
     if (interps!=ibuf)
-	xfree(interps);
+	free(interps);
     return TRUE;
 }
 
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index e212ea3..eee3887 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -97,7 +97,7 @@ char *		tmp;
     if ((list->szPool-list->nPool)<wlen) {
 	if (wlen>1024)	list->szPool+= XkbPaddedSize(wlen*2);
 	else		list->szPool+= 1024;
-	list->pool= xrealloc(list->pool, list->szPool * sizeof(char));
+	list->pool= realloc(list->pool, list->szPool * sizeof(char));
 	if (!list->pool)
 	    return BadAlloc;
     }
@@ -201,7 +201,7 @@ char	tmpname[PATH_MAX];
     if (!in)
     {
         if (buf != NULL)
-	    xfree (buf);
+	    free(buf);
 #ifdef WIN32
 	unlink(tmpname);
 #endif
@@ -209,10 +209,10 @@ char	tmpname[PATH_MAX];
     }
     list->nFound[what]= 0;
     if (buf) {
-        xfree(buf);
+        free(buf);
         buf = NULL;
     }
-    buf = xalloc(PATH_MAX * sizeof(char));
+    buf = malloc(PATH_MAX * sizeof(char));
     if (!buf)
         return BadAlloc;
     while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
@@ -268,7 +268,7 @@ char	tmpname[PATH_MAX];
     unlink(tmpname);
 #endif
     if (buf != NULL)
-        xfree (buf);
+        free(buf);
     return status;
 }
 
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 4ccddda..a9b5ca9 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -131,7 +131,7 @@ Win32System(const char *cmdline)
 	    LocalFree(buffer);
 	}
 
-	xfree(cmd);
+	free(cmd);
 	return -1;
     }
     /* Wait until child process exits. */
@@ -142,7 +142,7 @@ Win32System(const char *cmdline)
     /* Close process and thread handles. */
     CloseHandle( pi.hProcess );
     CloseHandle( pi.hThread );
-    xfree(cmd);
+    free(cmd);
 
     return dwExitCode;
 }
@@ -235,7 +235,7 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
 		  xkm_output_dir, keymap);
 
     if (xkbbasedirflag != emptystring) {
-	xfree(xkbbasedirflag);
+	free(xkbbasedirflag);
     }
     
 #ifndef WIN32
@@ -265,7 +265,7 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
 		nameRtrn[nameRtrnLen-1]= '\0';
 	    }
             if (buf != NULL)
-                xfree (buf);
+                free(buf);
 	    return TRUE;
 	}
 	else
@@ -285,7 +285,7 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
     if (nameRtrn)
 	nameRtrn[0]= '\0';
     if (buf != NULL)
-        xfree (buf);
+        free(buf);
     return FALSE;
 }
 
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 3467c42..3b15a47 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -78,7 +78,7 @@ static void
 FreeInputLine(InputLine *line)
 {
     if (line->line!=line->buf)
-	xfree(line->line);
+	free(line->line);
     line->line_num= 1;
     line->num_line= 0;
     line->sz_line= DFLT_LINE_SIZE;
@@ -91,11 +91,11 @@ InputLineAddChar(InputLine *line,int ch)
 {
     if (line->num_line>=line->sz_line) {
 	if (line->line==line->buf) {
-	    line->line= xalloc(line->sz_line*2);
+	    line->line= malloc(line->sz_line*2);
 	    memcpy(line->line,line->buf,line->sz_line);
 	}
 	else {
-	    line->line= xrealloc((char *)line->line,line->sz_line*2);
+	    line->line= realloc((char *)line->line,line->sz_line*2);
 	}
 	line->sz_line*= 2;
     }
@@ -474,7 +474,7 @@ int len;
     if ((!str1)||(!str2))
 	return str1;
     len= strlen(str1)+strlen(str2)+1;
-    str1= xrealloc(str1,len * sizeof(char));
+    str1= realloc(str1,len * sizeof(char));
     if (str1)
 	strcat(str1,str2);
     return str1;
@@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
 static void
 FreeMultiDefs(XkbRF_MultiDefsPtr defs)
 {
-  if (defs->options) xfree(defs->options);
-  if (defs->layout[1])  xfree(defs->layout[1]);
-  if (defs->variant[1])  xfree(defs->variant[1]);
+  if (defs->options) free(defs->options);
+  if (defs->layout[1])  free(defs->layout[1]);
+  if (defs->variant[1])  free(defs->variant[1]);
 }
 
 static void
@@ -769,7 +769,7 @@ int	len, ndx;
 	}
 	str= index(&str[0],'%');
     }
-    name= xalloc(len+1);
+    name= malloc(len+1);
     str= orig;
     outstr= name;
     while (*str!='\0') {
@@ -819,7 +819,7 @@ int	len, ndx;
     }
     *outstr++= '\0';
     if (orig!=name)
-	xfree(orig);
+	free(orig);
     return name;
 }
 
@@ -864,11 +864,11 @@ XkbRF_AddRule(XkbRF_RulesPtr	rules)
     if (rules->sz_rules<1) {
 	rules->sz_rules= 16;
 	rules->num_rules= 0;
-	rules->rules= xcalloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
+	rules->rules= calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
     }
     else if (rules->num_rules>=rules->sz_rules) {
 	rules->sz_rules*= 2;
-	rules->rules= xrealloc(rules->rules,
+	rules->rules= realloc(rules->rules,
 				rules->sz_rules * sizeof(XkbRF_RuleRec));
     }
     if (!rules->rules) {
@@ -886,11 +886,11 @@ XkbRF_AddGroup(XkbRF_RulesPtr	rules)
     if (rules->sz_groups<1) {
 	rules->sz_groups= 16;
 	rules->num_groups= 0;
-	rules->groups= xcalloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
+	rules->groups= calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
     }
     else if (rules->num_groups >= rules->sz_groups) {
 	rules->sz_groups *= 2;
-	rules->groups= xrealloc(rules->groups,
+	rules->groups= realloc(rules->groups,
 				rules->sz_groups * sizeof(XkbRF_GroupRec));
     }
     if (!rules->groups) {
@@ -972,7 +972,7 @@ Bool		ok;
 XkbRF_RulesPtr
 XkbRF_Create(void)
 {
-    return xcalloc(1, sizeof( XkbRF_RulesRec));
+    return calloc(1, sizeof( XkbRF_RulesRec));
 }
 
 /***====================================================================***/
@@ -988,32 +988,32 @@ XkbRF_GroupPtr	group;
 	return;
     if (rules->rules) {
 	for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
-	    if (rule->model)	xfree(rule->model);
-	    if (rule->layout)	xfree(rule->layout);
-	    if (rule->variant)	xfree(rule->variant);
-	    if (rule->option)	xfree(rule->option);
-	    if (rule->keycodes)	xfree(rule->keycodes);
-	    if (rule->symbols)	xfree(rule->symbols);
-	    if (rule->types)	xfree(rule->types);
-	    if (rule->compat)	xfree(rule->compat);
-	    if (rule->geometry)	xfree(rule->geometry);
+	    if (rule->model)	free(rule->model);
+	    if (rule->layout)	free(rule->layout);
+	    if (rule->variant)	free(rule->variant);
+	    if (rule->option)	free(rule->option);
+	    if (rule->keycodes)	free(rule->keycodes);
+	    if (rule->symbols)	free(rule->symbols);
+	    if (rule->types)	free(rule->types);
+	    if (rule->compat)	free(rule->compat);
+	    if (rule->geometry)	free(rule->geometry);
 	    bzero((char *)rule,sizeof(XkbRF_RuleRec));
 	}
-	xfree(rules->rules);
+	free(rules->rules);
 	rules->num_rules= rules->sz_rules= 0;
 	rules->rules= NULL;
     }
 
     if (rules->groups) {
 	for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
-	    if (group->name)	xfree(group->name);
-	    if (group->words)	xfree(group->words);
+	    if (group->name)	free(group->name);
+	    if (group->words)	free(group->words);
 	}
-	xfree(rules->groups);
+	free(rules->groups);
 	rules->num_groups= 0;
 	rules->groups= NULL;
     }
     if (freeRules)
-	xfree(rules);
+	free(rules);
     return;
 }
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 29052bf..e354b74 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -1365,7 +1365,7 @@ unsigned	i,len;
 char		*desc,*start;
 
     len= (rep->length*4)-(SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply));
-    start= desc= xcalloc(1, len);
+    start= desc= calloc(1, len);
     if (!start)
 	return BadAlloc;
     if ( rep->nTypes>0 )
@@ -1405,7 +1405,7 @@ char		*desc,*start;
     }
     WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep);
     WriteToClient(client, len, start);
-    xfree((char *)start);
+    free((char *)start);
     return client->noClientException;
 }
 
@@ -2186,8 +2186,8 @@ unsigned	 first,last;
     if (maxRG>(int)xkbi->nRadioGroups) {
         int sz = maxRG*sizeof(XkbRadioGroupRec);
         if (xkbi->radioGroups)
-             xkbi->radioGroups= xrealloc(xkbi->radioGroups,sz);
-        else xkbi->radioGroups= xcalloc(1, sz);
+             xkbi->radioGroups= realloc(xkbi->radioGroups,sz);
+        else xkbi->radioGroups= calloc(1, sz);
         if (xkbi->radioGroups) {
              if (xkbi->nRadioGroups)
                 bzero(&xkbi->radioGroups[xkbi->nRadioGroups],
@@ -2629,7 +2629,7 @@ int		size;
 
     size= rep->length*4;
     if (size>0) {
-	data = xalloc(size);
+	data = malloc(size);
 	if (data) {
 	    register unsigned i,bit;
 	    xkbModsWireDesc *	grp;
@@ -2680,7 +2680,7 @@ int		size;
     WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep);
     if (data) {
 	WriteToClient(client, size, data);
-	xfree((char *)data);
+	free((char *)data);
     }
     return client->noClientException;
 }
@@ -2777,7 +2777,7 @@ _XkbSetCompatMap(ClientPtr client, DeviceIntPtr dev,
 	XkbSymInterpretPtr	sym;
 	if ((unsigned)(req->firstSI+req->nSI)>compat->num_si) {
 	    compat->num_si= req->firstSI+req->nSI;
-	    compat->sym_interpret= xrealloc(compat->sym_interpret,
+	    compat->sym_interpret= realloc(compat->sym_interpret,
 					    compat->num_si * sizeof(XkbSymInterpretRec));
 	    if (!compat->sym_interpret) {
 		compat->num_si= 0;
@@ -2995,7 +2995,7 @@ register unsigned	bit;
     length = rep->length*4;
     if (length>0) {
 	CARD8 *to;
-	to= map= xalloc(length);
+	to= map= malloc(length);
 	if (map) {
 	    xkbIndicatorMapWireDesc  *wire = (xkbIndicatorMapWireDesc *)to;
 	    for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
@@ -3034,7 +3034,7 @@ register unsigned	bit;
     WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep);
     if (map) {
 	WriteToClient(client, length, (char *)map);
-	xfree((char *)map);
+	free((char *)map);
     }
     return client->noClientException;
 }
@@ -3632,7 +3632,7 @@ register int            n;
 	swapl(&rep->indicators,n);
     }
 
-    start = desc = xalloc(length);
+    start = desc = malloc(length);
     if ( !start )
 	return BadAlloc;
     if (xkb->names) {
@@ -3756,7 +3756,7 @@ register int            n;
     }
     WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep);
     WriteToClient(client, length, start);
-    xfree((char *)start);
+    free((char *)start);
     return client->noClientException;
 }
 
@@ -4118,7 +4118,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff)
             tmp+= stuff->nKeyAliases*2;
         }
         else if (names->key_aliases!=NULL) {
-            xfree(names->key_aliases);
+            free(names->key_aliases);
             names->key_aliases= NULL;
             names->num_key_aliases= 0;
         }
@@ -4137,7 +4137,7 @@ _XkbSetNames(ClientPtr client, DeviceIntPtr dev, xkbSetNamesReq *stuff)
             tmp+= stuff->nRadioGroups;
         }
         else if (names->radio_groups) {
-            xfree(names->radio_groups);
+            free(names->radio_groups);
             names->radio_groups= NULL;
             names->num_rg= 0;
         }
@@ -4740,7 +4740,7 @@ XkbSendGeometry(	ClientPtr		client,
 
     if (geom!=NULL) {
 	len= rep->length*4;
-	start= desc= xalloc(len);
+	start= desc= malloc(len);
 	if (!start)
 	    return BadAlloc;
 	desc=  XkbWriteCountedString(desc,geom->label_font,client->swapped);
@@ -4784,7 +4784,7 @@ XkbSendGeometry(	ClientPtr		client,
     if (len>0)
 	WriteToClient(client, len, start);
     if (start!=NULL)
-	xfree((char *)start);
+	free((char *)start);
     if (freeGeom)
 	XkbFreeGeometry(geom,XkbGeomAllMask,TRUE);
     return client->noClientException;
@@ -4834,7 +4834,7 @@ CARD16	len,*plen;
 	swaps(plen,n);
     }
     len= *plen;
-    str= xalloc(len+1);
+    str= malloc(len+1);
     if (str) {
 	memcpy(str,&wire[2],len);
 	str[len]= '\0';
@@ -5182,16 +5182,16 @@ char *		wire;
             return BadAlloc;
 	val= _GetCountedString(&wire,client->swapped);
         if (!val) {
-            xfree(name);
+            free(name);
             return BadAlloc;
         }
 	if (XkbAddGeomProperty(geom,name,val)==NULL) {
-            xfree(name);
-            xfree(val);
+            free(name);
+            free(val);
 	    return BadAlloc;
         }
-        xfree(name);
-        xfree(val);
+        free(name);
+        free(val);
     }
 
     if (req->nColors<2) {
@@ -5218,10 +5218,10 @@ char *		wire;
 	if (!name)
             return BadAlloc;
         if (!XkbAddGeomColor(geom,name,geom->num_colors)) {
-            xfree(name);
+            free(name);
 	    return BadAlloc;
         }
-        xfree(name);
+        free(name);
     }
     if (req->nColors!=geom->num_colors) {
 	client->errorValue= _XkbErrCode3(0x05,req->nColors,geom->num_colors);
@@ -5449,7 +5449,7 @@ unsigned char	*wire,*str,*tmp,*legal;
     wire= *pWire;
     len= (*(unsigned char *)wire++);
     if (len>0) {
-	str= xcalloc(1, len+1);
+	str= calloc(1, len+1);
 	if (str) {
 	    tmp= str;
 	    for (i=0;i<len;i++) {
@@ -5460,7 +5460,7 @@ unsigned char	*wire,*str,*tmp,*legal;
 	    if (tmp!=str)
 		*tmp++= '\0';
 	    else {
-		xfree(str);
+		free(str);
 		str= NULL;
 	    }
 	}
@@ -5511,7 +5511,7 @@ ProcXkbListComponents(ClientPtr client)
 	return BadLength;
     if ((status=XkbDDXList(dev,&list,client))!=Success) {
 	if (list.pool) {
-	    xfree(list.pool);
+	    free(list.pool);
 	    list.pool= NULL;
 	}
 	return status;
@@ -5545,7 +5545,7 @@ ProcXkbListComponents(ClientPtr client)
     WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep);
     if (list.nPool && list.pool) {
 	WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool);
-	xfree(list.pool);
+	free(list.pool);
 	list.pool= NULL;
     }
     return client->noClientException;
@@ -5886,11 +5886,11 @@ ProcXkbGetKbdByName(ClientPtr client)
 	XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
 	new= NULL;
     }
-    if (names.keycodes)	{ xfree(names.keycodes); names.keycodes= NULL; }
-    if (names.types)	{ xfree(names.types); names.types= NULL; }
-    if (names.compat)	{ xfree(names.compat); names.compat= NULL; }
-    if (names.symbols)	{ xfree(names.symbols); names.symbols= NULL; }
-    if (names.geometry)	{ xfree(names.geometry); names.geometry= NULL; }
+    if (names.keycodes)	{ free(names.keycodes); names.keycodes= NULL; }
+    if (names.types)	{ free(names.types); names.types= NULL; }
+    if (names.compat)	{ free(names.compat); names.compat= NULL; }
+    if (names.symbols)	{ free(names.symbols); names.symbols= NULL; }
+    if (names.geometry)	{ free(names.geometry); names.geometry= NULL; }
     return client->noClientException;
 }
 
@@ -6205,12 +6205,12 @@ char *			str;
     }
     WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
 
-    str= xalloc(nameLen);
+    str= malloc(nameLen);
     if (!str) 
 	return BadAlloc;
     XkbWriteCountedString(str,dev->name,client->swapped);
     WriteToClient(client,nameLen,str);
-    xfree(str);
+    free(str);
     length-= nameLen;
 
     if (rep.nBtnsRtrn>0) {
@@ -6459,7 +6459,7 @@ _XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev,
 	nBtns= dev->button->numButtons;
 	acts= dev->button->xkb_acts;
 	if (acts==NULL) {
-	    acts= xcalloc(nBtns, sizeof(XkbAction));
+	    acts= calloc(nBtns, sizeof(XkbAction));
 	    if (!acts)
 		return BadAlloc;
 	    dev->button->xkb_acts= acts;
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 6a9943f..0a1a873 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -70,7 +70,7 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
 {
     xkbDeviceInfoPtr xkbPrivPtr;
 
-    xkbPrivPtr = (xkbDeviceInfoPtr) xcalloc(1, sizeof(xkbDeviceInfoRec));
+    xkbPrivPtr = (xkbDeviceInfoPtr) calloc(1, sizeof(xkbDeviceInfoRec));
     if (!xkbPrivPtr)
 	return;
     xkbPrivPtr->unwrapProc = NULL;
@@ -1020,7 +1020,7 @@ register int	i;
 
     if (xkbi->szFilters==0) {
 	xkbi->szFilters = 4;
-	xkbi->filters = xcalloc(xkbi->szFilters, sizeof(XkbFilterRec));
+	xkbi->filters = calloc(xkbi->szFilters, sizeof(XkbFilterRec));
 	/* 6/21/93 (ef) -- XXX! deal with allocation failure */
     }
     for (i=0;i<xkbi->szFilters;i++) {
@@ -1030,7 +1030,7 @@ register int	i;
 	}
     }
     xkbi->szFilters*=2;
-    xkbi->filters= xrealloc(xkbi->filters,
+    xkbi->filters= realloc(xkbi->filters,
                             xkbi->szFilters * sizeof(XkbFilterRec));
     /* 6/21/93 (ef) -- XXX! deal with allocation failure */
     bzero(&xkbi->filters[xkbi->szFilters/2],
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 9755f98..0a6a76c 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -1041,7 +1041,7 @@ XkbInterestPtr	interest;
 	    return ((interest->resource==id)?interest:NULL);
 	interest = interest->next;
     }
-    interest = xcalloc(1, sizeof(XkbInterestRec));
+    interest = calloc(1, sizeof(XkbInterestRec));
     if (interest) {
 	interest->dev = dev;
 	interest->client = client;
@@ -1085,7 +1085,7 @@ ClientPtr	client = NULL;
 	    autoCtrls= interest->autoCtrls;
 	    autoValues= interest->autoCtrlValues;
 	    client= interest->client;
-	    xfree(interest);
+	    free(interest);
 	    found= TRUE;
 	}
 	while ((!found)&&(interest->next)) {
@@ -1095,7 +1095,7 @@ ClientPtr	client = NULL;
 		autoCtrls= victim->autoCtrls;
 		autoValues= victim->autoCtrlValues;
 		client= victim->client;
-		xfree(victim);
+		free(victim);
 		found= TRUE;
 	    }
 	    interest = interest->next;
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 4a3219e..93175c5 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -140,14 +140,14 @@ XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO)
     if (!rmlvo)
         return;
 
-    xfree(rmlvo->rules);
-    xfree(rmlvo->model);
-    xfree(rmlvo->layout);
-    xfree(rmlvo->variant);
-    xfree(rmlvo->options);
+    free(rmlvo->rules);
+    free(rmlvo->model);
+    free(rmlvo->layout);
+    free(rmlvo->variant);
+    free(rmlvo->options);
 
     if (freeRMLVO)
-        xfree(rmlvo);
+        free(rmlvo);
     else
         memset(rmlvo, 0, sizeof(XkbRMLVOSet));
 }
@@ -174,7 +174,7 @@ char *			pval;
 	ErrorF("[xkb] Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
 	return TRUE;
     }
-    pval= (char*) xalloc(len);
+    pval= (char*) malloc(len);
     if (!pval) {
 	ErrorF("[xkb] Allocation error: %s proprerty not created\n",
 						_XKB_RF_NAMES_PROP_ATOM);
@@ -212,7 +212,7 @@ char *			pval;
     }
     dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8,
 			    PropModeReplace, len, pval, TRUE);
-    xfree(pval);
+    free(pval);
     return TRUE;
 }
 
@@ -220,19 +220,19 @@ static void
 XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
 {
     if (XkbRulesUsed)
-        xfree(XkbRulesUsed);
+        free(XkbRulesUsed);
     XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL);
     if (XkbModelUsed)
-	xfree(XkbModelUsed);
+	free(XkbModelUsed);
     XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL);
     if (XkbLayoutUsed)
-	xfree(XkbLayoutUsed);
+	free(XkbLayoutUsed);
     XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL);
     if (XkbVariantUsed)
-	xfree(XkbVariantUsed);
+	free(XkbVariantUsed);
     XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL);
     if (XkbOptionsUsed)
-	xfree(XkbOptionsUsed);
+	free(XkbOptionsUsed);
     XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL);
     if (XkbWantRulesProp)
 	QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
@@ -244,27 +244,27 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
 {
     if (rmlvo->rules) {
         if (XkbRulesDflt)
-	    xfree(XkbRulesDflt);
+	    free(XkbRulesDflt);
         XkbRulesDflt= _XkbDupString(rmlvo->rules);
     }
     if (rmlvo->model) {
 	if (XkbModelDflt)
-	    xfree(XkbModelDflt);
+	    free(XkbModelDflt);
 	XkbModelDflt= _XkbDupString(rmlvo->model);
     }
     if (rmlvo->layout) {
 	if (XkbLayoutDflt)
-	    xfree(XkbLayoutDflt);
+	    free(XkbLayoutDflt);
 	XkbLayoutDflt= _XkbDupString(rmlvo->layout);
     }
     if (rmlvo->variant) {
 	if (XkbVariantDflt)
-	    xfree(XkbVariantDflt);
+	    free(XkbVariantDflt);
 	XkbVariantDflt= _XkbDupString(rmlvo->variant);
     }
     if (rmlvo->options) {
 	if (XkbOptionsDflt)
-	    xfree(XkbOptionsDflt);
+	    free(XkbOptionsDflt);
 	XkbOptionsDflt= _XkbDupString(rmlvo->options);
     }
     return;
@@ -273,15 +273,15 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
 void
 XkbDeleteRulesDflts(void)
 {
-    xfree(XkbRulesDflt);
+    free(XkbRulesDflt);
     XkbRulesDflt = NULL;
-    xfree(XkbModelDflt);
+    free(XkbModelDflt);
     XkbModelDflt = NULL;
-    xfree(XkbLayoutDflt);
+    free(XkbLayoutDflt);
     XkbLayoutDflt = NULL;
-    xfree(XkbVariantDflt);
+    free(XkbVariantDflt);
     XkbVariantDflt = NULL;
-    xfree(XkbOptionsDflt);
+    free(XkbOptionsDflt);
     XkbOptionsDflt = NULL;
 
     XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE);
@@ -515,20 +515,20 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
     memset(&changes, 0, sizeof(changes));
     XkbSetCauseUnknown(&cause);
 
-    dev->key = xcalloc(1, sizeof(*dev->key));
+    dev->key = calloc(1, sizeof(*dev->key));
     if (!dev->key) {
         ErrorF("XKB: Failed to allocate key class\n");
         return FALSE;
     }
     dev->key->sourceid = dev->id;
 
-    dev->kbdfeed = xcalloc(1, sizeof(*dev->kbdfeed));
+    dev->kbdfeed = calloc(1, sizeof(*dev->kbdfeed));
     if (!dev->kbdfeed) {
         ErrorF("XKB: Failed to allocate key feedback class\n");
         goto unwind_key;
     }
 
-    xkbi = xcalloc(1, sizeof(*xkbi));
+    xkbi = calloc(1, sizeof(*xkbi));
     if (!xkbi) {
         ErrorF("XKB: Failed to allocate XKB info\n");
         goto unwind_kbdfeed;
@@ -620,13 +620,13 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
 unwind_desc:
     XkbFreeKeyboard(xkb, 0, TRUE);
 unwind_info:
-    xfree(xkbi);
+    free(xkbi);
     dev->key->xkbInfo = NULL;
 unwind_kbdfeed:
-    xfree(dev->kbdfeed);
+    free(dev->kbdfeed);
     dev->kbdfeed = NULL;
 unwind_key:
-    xfree(dev->key);
+    free(dev->key);
     dev->key = NULL;
     return FALSE;
 }
@@ -645,7 +645,7 @@ void
 XkbFreeInfo(XkbSrvInfoPtr xkbi)
 {
     if (xkbi->radioGroups) {
-	xfree(xkbi->radioGroups);
+	free(xkbi->radioGroups);
 	xkbi->radioGroups= NULL;
     }
     if (xkbi->mouseKeyTimer) {
@@ -677,7 +677,7 @@ XkbFreeInfo(XkbSrvInfoPtr xkbi)
 	XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,TRUE);
 	xkbi->desc= NULL;
     }
-    xfree(xkbi);
+    free(xkbi);
     return;
 }
 
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 8c28513..6097f85 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -524,7 +524,7 @@ Bool			checkNames;
     sli= NULL;
     checkAccel= checkNames= FALSE;
     if ((kf!=NULL)&&(kf->xkb_sli==NULL)) {
-	kf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec));
+	kf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
 	if (sli==NULL)
 	    return NULL; /* ALLOCATION ERROR */
 	if (dev->key && dev->key->xkbInfo)
@@ -567,7 +567,7 @@ Bool			checkNames;
 	}
     }
     else if ((lf!=NULL)&&(lf->xkb_sli==NULL)) {
-	lf->xkb_sli= sli= xcalloc(1, sizeof(XkbSrvLedInfoRec));
+	lf->xkb_sli= sli= calloc(1, sizeof(XkbSrvLedInfoRec));
 	if (sli==NULL)
 	    return NULL; /* ALLOCATION ERROR */
 	if (dev->key && dev->key->xkbInfo)
@@ -585,9 +585,9 @@ Bool			checkNames;
 	sli->names=		NULL;
     }
     if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
-	sli->names= xcalloc(XkbNumIndicators, sizeof(Atom));
+	sli->names= calloc(XkbNumIndicators, sizeof(Atom));
     if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
-	sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+	sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
     if (checkNames) {
 	register unsigned i,bit;
 	sli->namesPresent=	0;
@@ -605,12 +605,12 @@ void
 XkbFreeSrvLedInfo(XkbSrvLedInfoPtr sli)
 {
     if ((sli->flags&XkbSLI_IsDefault)==0) {
-	if (sli->maps)	xfree(sli->maps);
-	if (sli->names)	xfree(sli->names);
+	if (sli->maps)	free(sli->maps);
+	if (sli->names)	free(sli->names);
     }
     sli->maps= NULL;
     sli->names= NULL;
-    xfree(sli);
+    free(sli);
     return;
 }
 
@@ -633,7 +633,7 @@ XkbCopySrvLedInfo(	DeviceIntPtr		from,
     if (!src)
 	goto finish;
 
-    sli_new = xcalloc(1, sizeof( XkbSrvLedInfoRec));
+    sli_new = calloc(1, sizeof( XkbSrvLedInfoRec));
     if (!sli_new)
 	goto finish;
 
@@ -644,8 +644,8 @@ XkbCopySrvLedInfo(	DeviceIntPtr		from,
 	sli_new->fb.lf = lf;
 
     if (!(sli_new->flags & XkbSLI_IsDefault)) {
-	sli_new->names= xcalloc(XkbNumIndicators, sizeof(Atom));
-	sli_new->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+	sli_new->names= calloc(XkbNumIndicators, sizeof(Atom));
+	sli_new->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
     } /* else sli_new->names/maps is pointing to
 	dev->key->xkbInfo->desc->names->indicators;
 	dev->key->xkbInfo->desc->names->indicators; */
@@ -715,9 +715,9 @@ XkbSrvLedInfoPtr	sli;
 	}
     }
     if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
-	sli->names= xcalloc(XkbNumIndicators, sizeof(Atom));
+	sli->names= calloc(XkbNumIndicators, sizeof(Atom));
     if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
-	sli->maps= xcalloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
+	sli->maps= calloc(XkbNumIndicators, sizeof(XkbIndicatorMapRec));
     return sli;
 }
 
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 6d0901a..e3fb9dc 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -410,7 +410,7 @@ int			maxNumberOfGroups;
     if (maxSymsPerKey <= 0)
         return NULL;
 
-    syms = xcalloc(1, sizeof(*syms));
+    syms = calloc(1, sizeof(*syms));
     if (!syms)
         return NULL;
 
@@ -427,9 +427,9 @@ int			maxNumberOfGroups;
     syms->maxKeyCode = xkb->max_key_code;
 
     tmp = syms->mapWidth * (xkb->max_key_code - xkb->min_key_code + 1);
-    syms->map = xcalloc(tmp, sizeof(*syms->map));
+    syms->map = calloc(tmp, sizeof(*syms->map));
     if (!syms->map) {
-        xfree(syms);
+        free(syms);
         return NULL;
     }
 
@@ -911,7 +911,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
     /* client map */
     if (src->map) {
         if (!dst->map) {
-            tmp = xcalloc(1, sizeof(XkbClientMapRec));
+            tmp = calloc(1, sizeof(XkbClientMapRec));
             if (!tmp)
                 return FALSE;
             dst->map = tmp;
@@ -920,10 +920,10 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->map->syms) {
             if (src->map->size_syms != dst->map->size_syms) {
                 if (dst->map->syms)
-                    tmp = xrealloc(dst->map->syms,
+                    tmp = realloc(dst->map->syms,
                                    src->map->size_syms * sizeof(KeySym));
                 else
-                    tmp = xalloc(src->map->size_syms * sizeof(KeySym));
+                    tmp = malloc(src->map->size_syms * sizeof(KeySym));
                 if (!tmp)
                     return FALSE;
                 dst->map->syms = tmp;
@@ -934,7 +934,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->map->syms) {
-                xfree(dst->map->syms);
+                free(dst->map->syms);
                 dst->map->syms = NULL;
             }
         }
@@ -944,11 +944,11 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->map->key_sym_map) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->map->key_sym_map)
-                    tmp = xrealloc(dst->map->key_sym_map,
+                    tmp = realloc(dst->map->key_sym_map,
                                    (src->max_key_code + 1) *
                                      sizeof(XkbSymMapRec));
                 else
-                    tmp = xalloc((src->max_key_code + 1) *
+                    tmp = malloc((src->max_key_code + 1) *
                                  sizeof(XkbSymMapRec));
                 if (!tmp)
                     return FALSE;
@@ -959,7 +959,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->map->key_sym_map) {
-                xfree(dst->map->key_sym_map);
+                free(dst->map->key_sym_map);
                 dst->map->key_sym_map = NULL;
             }
         }
@@ -968,7 +968,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
             if (src->map->num_types > dst->map->size_types ||
                 !dst->map->types || !dst->map->size_types) {
                 if (dst->map->types && dst->map->size_types) {
-                    tmp = xrealloc(dst->map->types,
+                    tmp = realloc(dst->map->types,
                                    src->map->num_types * sizeof(XkbKeyTypeRec));
                     if (!tmp)
                         return FALSE;
@@ -978,7 +978,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                             sizeof(XkbKeyTypeRec));
                 }
                 else {
-                    tmp = xcalloc(src->map->num_types, sizeof(XkbKeyTypeRec));
+                    tmp = calloc(src->map->num_types, sizeof(XkbKeyTypeRec));
                     if (!tmp)
                         return FALSE;
                     dst->map->types = tmp;
@@ -989,14 +989,14 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                 for (i = src->map->num_types, dtype = (dst->map->types + i);
                      i < dst->map->num_types; i++, dtype++) {
                     if (dtype->level_names)
-                        xfree(dtype->level_names);
+                        free(dtype->level_names);
                     dtype->level_names = NULL;
                     dtype->num_levels = 0;
                     if (dtype->map_count) {
                         if (dtype->map)
-                            xfree(dtype->map);
+                            free(dtype->map);
                         if (dtype->preserve)
-                            xfree(dtype->preserve);
+                            free(dtype->preserve);
                     }
                 }
             }
@@ -1008,7 +1008,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                     if (stype->num_levels != dtype->num_levels &&
                         dtype->num_levels && dtype->level_names &&
                         i < dst->map->num_types) {
-                        tmp = xrealloc(dtype->level_names,
+                        tmp = realloc(dtype->level_names,
                                        stype->num_levels * sizeof(Atom));
                         if (!tmp)
                             continue;
@@ -1016,7 +1016,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                     }
                     else if (!dtype->num_levels || !dtype->level_names ||
                              i >= dst->map->num_types) {
-                        tmp = xalloc(stype->num_levels * sizeof(Atom));
+                        tmp = malloc(stype->num_levels * sizeof(Atom));
                         if (!tmp)
                             continue;
                         dtype->level_names = tmp;
@@ -1028,7 +1028,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                 else {
                     if (dtype->num_levels && dtype->level_names &&
                         i < dst->map->num_types)
-                        xfree(dtype->level_names);
+                        free(dtype->level_names);
                     dtype->num_levels = 0;
                     dtype->level_names = NULL;
                 }
@@ -1041,7 +1041,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                         if (stype->map_count != dtype->map_count &&
                             dtype->map_count && dtype->map &&
                             i < dst->map->num_types) {
-                            tmp = xrealloc(dtype->map,
+                            tmp = realloc(dtype->map,
                                            stype->map_count *
                                              sizeof(XkbKTMapEntryRec));
                             if (!tmp)
@@ -1050,7 +1050,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                         }
                         else if (!dtype->map_count || !dtype->map ||
                                  i >= dst->map->num_types) {
-                            tmp = xalloc(stype->map_count *
+                            tmp = malloc(stype->map_count *
                                            sizeof(XkbKTMapEntryRec));
                             if (!tmp)
                                 return FALSE;
@@ -1062,7 +1062,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                     }
                     else {
                         if (dtype->map && i < dst->map->num_types)
-                            xfree(dtype->map);
+                            free(dtype->map);
                         dtype->map = NULL;
                     }
 
@@ -1070,7 +1070,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                         if (stype->map_count != dtype->map_count &&
                             dtype->map_count && dtype->preserve &&
                             i < dst->map->num_types) {
-                            tmp = xrealloc(dtype->preserve,
+                            tmp = realloc(dtype->preserve,
                                            stype->map_count *
                                              sizeof(XkbModsRec));
                             if (!tmp)
@@ -1079,7 +1079,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                         }
                         else if (!dtype->preserve || !dtype->map_count ||
                                  i >= dst->map->num_types) {
-                            tmp = xalloc(stype->map_count *
+                            tmp = malloc(stype->map_count *
                                          sizeof(XkbModsRec));
                             if (!tmp)
                                 return FALSE;
@@ -1091,7 +1091,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                     }
                     else {
                         if (dtype->preserve && i < dst->map->num_types)
-                            xfree(dtype->preserve);
+                            free(dtype->preserve);
                         dtype->preserve = NULL;
                     }
 
@@ -1100,9 +1100,9 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                 else {
                     if (dtype->map_count && i < dst->map->num_types) {
                         if (dtype->map)
-                            xfree(dtype->map);
+                            free(dtype->map);
                         if (dtype->preserve)
-                            xfree(dtype->preserve);
+                            free(dtype->preserve);
                     }
                     dtype->map_count = 0;
                     dtype->map = NULL;
@@ -1118,13 +1118,13 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
                 for (i = 0, dtype = dst->map->types; i < dst->map->num_types;
                      i++, dtype++) {
                     if (dtype->level_names)
-                        xfree(dtype->level_names);
+                        free(dtype->level_names);
                     if (dtype->map && dtype->map_count)
-                        xfree(dtype->map);
+                        free(dtype->map);
                     if (dtype->preserve && dtype->map_count)
-                        xfree(dtype->preserve);
+                        free(dtype->preserve);
                 }
-                xfree(dst->map->types);
+                free(dst->map->types);
                 dst->map->types = NULL;
             }
             dst->map->num_types = 0;
@@ -1134,9 +1134,9 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->map->modmap) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->map->modmap)
-                    tmp = xrealloc(dst->map->modmap, src->max_key_code + 1);
+                    tmp = realloc(dst->map->modmap, src->max_key_code + 1);
                 else
-                    tmp = xalloc(src->max_key_code + 1);
+                    tmp = malloc(src->max_key_code + 1);
                 if (!tmp)
                     return FALSE;
                 dst->map->modmap = tmp;
@@ -1145,7 +1145,7 @@ _XkbCopyClientMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->map->modmap) {
-                xfree(dst->map->modmap);
+                free(dst->map->modmap);
                 dst->map->modmap = NULL;
             }
         }
@@ -1166,7 +1166,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
     /* server map */
     if (src->server) {
         if (!dst->server) {
-            tmp = xcalloc(1, sizeof(XkbServerMapRec));
+            tmp = calloc(1, sizeof(XkbServerMapRec));
             if (!tmp)
                 return FALSE;
             dst->server = tmp;
@@ -1175,9 +1175,9 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->server->explicit) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->server->explicit)
-                    tmp = xrealloc(dst->server->explicit, src->max_key_code + 1);
+                    tmp = realloc(dst->server->explicit, src->max_key_code + 1);
                 else
-                    tmp = xalloc(src->max_key_code + 1);
+                    tmp = malloc(src->max_key_code + 1);
                 if (!tmp)
                     return FALSE;
                 dst->server->explicit = tmp;
@@ -1187,7 +1187,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->server->explicit) {
-                xfree(dst->server->explicit);
+                free(dst->server->explicit);
                 dst->server->explicit = NULL;
             }
         }
@@ -1195,10 +1195,10 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->server->acts) {
             if (src->server->size_acts != dst->server->size_acts) {
                 if (dst->server->acts)
-                    tmp = xrealloc(dst->server->acts,
+                    tmp = realloc(dst->server->acts,
                                    src->server->size_acts * sizeof(XkbAction));
                 else
-                    tmp = xalloc(src->server->size_acts * sizeof(XkbAction));
+                    tmp = malloc(src->server->size_acts * sizeof(XkbAction));
                 if (!tmp)
                     return FALSE;
                 dst->server->acts = tmp;
@@ -1208,7 +1208,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->server->acts) {
-                xfree(dst->server->acts);
+                free(dst->server->acts);
                 dst->server->acts = NULL;
             }
         }
@@ -1218,11 +1218,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->server->key_acts) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->server->key_acts)
-                    tmp = xrealloc(dst->server->key_acts,
+                    tmp = realloc(dst->server->key_acts,
                                    (src->max_key_code + 1) *
                                      sizeof(unsigned short));
                 else
-                    tmp = xalloc((src->max_key_code + 1) *
+                    tmp = malloc((src->max_key_code + 1) *
                                  sizeof(unsigned short));
                 if (!tmp)
                     return FALSE;
@@ -1233,7 +1233,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->server->key_acts) {
-                xfree(dst->server->key_acts);
+                free(dst->server->key_acts);
                 dst->server->key_acts = NULL;
             }
         }
@@ -1241,11 +1241,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->server->behaviors) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->server->behaviors)
-                    tmp = xrealloc(dst->server->behaviors,
+                    tmp = realloc(dst->server->behaviors,
                                    (src->max_key_code + 1) *
                                    sizeof(XkbBehavior));
                 else
-                    tmp = xalloc((src->max_key_code + 1) *
+                    tmp = malloc((src->max_key_code + 1) *
                                  sizeof(XkbBehavior));
                 if (!tmp)
                     return FALSE;
@@ -1256,7 +1256,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->server->behaviors) {
-                xfree(dst->server->behaviors);
+                free(dst->server->behaviors);
                 dst->server->behaviors = NULL;
             }
         }
@@ -1266,11 +1266,11 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         if (src->server->vmodmap) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->server->vmodmap)
-                    tmp = xrealloc(dst->server->vmodmap,
+                    tmp = realloc(dst->server->vmodmap,
                                    (src->max_key_code + 1) *
                                    sizeof(unsigned short));
                 else
-                    tmp = xalloc((src->max_key_code + 1) *
+                    tmp = malloc((src->max_key_code + 1) *
                                  sizeof(unsigned short));
                 if (!tmp)
                     return FALSE;
@@ -1281,7 +1281,7 @@ _XkbCopyServerMap(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->server->vmodmap) {
-                xfree(dst->server->vmodmap);
+                free(dst->server->vmodmap);
                 dst->server->vmodmap = NULL;
             }
         }
@@ -1302,7 +1302,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
     /* names */
     if (src->names) {
         if (!dst->names) {
-            dst->names = xcalloc(1, sizeof(XkbNamesRec));
+            dst->names = calloc(1, sizeof(XkbNamesRec));
             if (!dst->names)
                 return FALSE;
         }
@@ -1310,10 +1310,10 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         if (src->names->keys) {
             if (src->max_key_code != dst->max_key_code) {
                 if (dst->names->keys)
-                    tmp = xrealloc(dst->names->keys, (src->max_key_code + 1) *
+                    tmp = realloc(dst->names->keys, (src->max_key_code + 1) *
                                    sizeof(XkbKeyNameRec));
                 else
-                    tmp = xalloc((src->max_key_code + 1) *
+                    tmp = malloc((src->max_key_code + 1) *
                                  sizeof(XkbKeyNameRec));
                 if (!tmp)
                     return FALSE;
@@ -1324,7 +1324,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->names->keys) {
-                xfree(dst->names->keys);
+                free(dst->names->keys);
                 dst->names->keys = NULL;
             }
         }
@@ -1332,11 +1332,11 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         if (src->names->num_key_aliases) {
             if (src->names->num_key_aliases != dst->names->num_key_aliases) {
                 if (dst->names->key_aliases)
-                    tmp = xrealloc(dst->names->key_aliases,
+                    tmp = realloc(dst->names->key_aliases,
                                    src->names->num_key_aliases *
                                      sizeof(XkbKeyAliasRec));
                 else
-                    tmp = xalloc(src->names->num_key_aliases *
+                    tmp = malloc(src->names->num_key_aliases *
                                  sizeof(XkbKeyAliasRec));
                 if (!tmp)
                     return FALSE;
@@ -1347,7 +1347,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->names->key_aliases) {
-                xfree(dst->names->key_aliases);
+                free(dst->names->key_aliases);
                 dst->names->key_aliases = NULL;
             }
         }
@@ -1356,10 +1356,10 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         if (src->names->num_rg) {
             if (src->names->num_rg != dst->names->num_rg) {
                 if (dst->names->radio_groups)
-                    tmp = xrealloc(dst->names->radio_groups,
+                    tmp = realloc(dst->names->radio_groups,
                                    src->names->num_rg * sizeof(Atom));
                 else
-                    tmp = xalloc(src->names->num_rg * sizeof(Atom));
+                    tmp = malloc(src->names->num_rg * sizeof(Atom));
                 if (!tmp)
                     return FALSE;
                 dst->names->radio_groups = tmp;
@@ -1369,7 +1369,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->names->radio_groups)
-                xfree(dst->names->radio_groups);
+                free(dst->names->radio_groups);
         }
         dst->names->num_rg = src->names->num_rg;
 
@@ -1403,7 +1403,7 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst)
     /* compat */
     if (src->compat) {
         if (!dst->compat) {
-            dst->compat = xcalloc(1, sizeof(XkbCompatMapRec));
+            dst->compat = calloc(1, sizeof(XkbCompatMapRec));
             if (!dst->compat)
                 return FALSE;
         }
@@ -1411,11 +1411,11 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst)
         if (src->compat->sym_interpret && src->compat->num_si) {
             if (src->compat->num_si != dst->compat->size_si) {
                 if (dst->compat->sym_interpret)
-                    tmp = xrealloc(dst->compat->sym_interpret,
+                    tmp = realloc(dst->compat->sym_interpret,
                                    src->compat->num_si *
                                      sizeof(XkbSymInterpretRec));
                 else
-                    tmp = xalloc(src->compat->num_si *
+                    tmp = malloc(src->compat->num_si *
                                  sizeof(XkbSymInterpretRec));
                 if (!tmp)
                     return FALSE;
@@ -1429,7 +1429,7 @@ _XkbCopyCompat(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->compat->sym_interpret && dst->compat->size_si)
-                xfree(dst->compat->sym_interpret);
+                free(dst->compat->sym_interpret);
 
             dst->compat->sym_interpret = NULL;
             dst->compat->num_si = 0;
@@ -1463,7 +1463,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
     /* geometry */
     if (src->geom) {
         if (!dst->geom) {
-            dst->geom = xcalloc(sizeof(XkbGeometryRec), 1);
+            dst->geom = calloc(sizeof(XkbGeometryRec), 1);
             if (!dst->geom)
                 return FALSE;
         }
@@ -1479,17 +1479,17 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                          dprop = dst->geom->properties + i;
                          i < dst->geom->num_properties;
                          i++, dprop++) {
-                        xfree(dprop->name);
-                        xfree(dprop->value);
+                        free(dprop->name);
+                        free(dprop->value);
                     }
                 }
 
                 if (dst->geom->sz_properties)
-                    tmp = xrealloc(dst->geom->properties,
+                    tmp = realloc(dst->geom->properties,
                                    src->geom->num_properties *
                                     sizeof(XkbPropertyRec));
                 else
-                    tmp = xalloc(src->geom->num_properties *
+                    tmp = malloc(src->geom->num_properties *
                                   sizeof(XkbPropertyRec));
                 if (!tmp)
                     return FALSE;
@@ -1513,13 +1513,13 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                  i++, sprop++, dprop++) {
                 if (i < dst->geom->num_properties) {
                     if (strlen(sprop->name) != strlen(dprop->name)) {
-                        tmp = xrealloc(dprop->name, strlen(sprop->name) + 1);
+                        tmp = realloc(dprop->name, strlen(sprop->name) + 1);
                         if (!tmp)
                             return FALSE;
                         dprop->name = tmp;
                     }
                     if (strlen(sprop->value) != strlen(dprop->value)) {
-                        tmp = xrealloc(dprop->value, strlen(sprop->value) + 1);
+                        tmp = realloc(dprop->value, strlen(sprop->value) + 1);
                         if (!tmp)
                             return FALSE;
                         dprop->value = tmp;
@@ -1541,10 +1541,10 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                 for (i = 0, dprop = dst->geom->properties;
                      i < dst->geom->num_properties;
                      i++, dprop++) {
-                    xfree(dprop->name);
-                    xfree(dprop->value);
+                    free(dprop->name);
+                    free(dprop->value);
                 }
-                xfree(dst->geom->properties);
+                free(dst->geom->properties);
                 dst->geom->properties = NULL;
             }
 
@@ -1560,16 +1560,16 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                          dcolor = dst->geom->colors + i;
                          i < dst->geom->num_colors;
                          i++, dcolor++) {
-                        xfree(dcolor->spec);
+                        free(dcolor->spec);
                     }
                 }
 
                 if (dst->geom->sz_colors)
-                    tmp = xrealloc(dst->geom->colors,
+                    tmp = realloc(dst->geom->colors,
                                    src->geom->num_colors *
                                     sizeof(XkbColorRec));
                 else
-                    tmp = xalloc(src->geom->num_colors *
+                    tmp = malloc(src->geom->num_colors *
                                   sizeof(XkbColorRec));
                 if (!tmp)
                     return FALSE;
@@ -1591,7 +1591,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                  i++, scolor++, dcolor++) {
                 if (i < dst->geom->num_colors) {
                     if (strlen(scolor->spec) != strlen(dcolor->spec)) {
-                        tmp = xrealloc(dcolor->spec, strlen(scolor->spec) + 1);
+                        tmp = realloc(dcolor->spec, strlen(scolor->spec) + 1);
                         if (!tmp)
                             return FALSE;
                         dcolor->spec = tmp;
@@ -1611,9 +1611,9 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                 for (i = 0, dcolor = dst->geom->colors;
                      i < dst->geom->num_colors;
                      i++, dcolor++) {
-                    xfree(dcolor->spec);
+                    free(dcolor->spec);
                 }
-                xfree(dst->geom->colors);
+                free(dst->geom->colors);
                 dst->geom->colors = NULL;
             }
 
@@ -1631,11 +1631,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                      j < dshape->num_outlines;
                      j++, doutline++) {
                     if (doutline->sz_points)
-                        xfree(doutline->points);
+                        free(doutline->points);
                 }
 
                 if (dshape->sz_outlines) {
-                    xfree(dshape->outlines);
+                    free(dshape->outlines);
                     dshape->outlines = NULL;
                 }
 
@@ -1645,7 +1645,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
 
         if (src->geom->num_shapes) {
-            tmp = xcalloc(src->geom->num_shapes, sizeof(XkbShapeRec));
+            tmp = calloc(src->geom->num_shapes, sizeof(XkbShapeRec));
             if (!tmp)
                 return FALSE;
             dst->geom->shapes = tmp;
@@ -1654,7 +1654,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                  i < src->geom->num_shapes;
                  i++, sshape++, dshape++) {
                 if (sshape->num_outlines) {
-                    tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec));
+                    tmp = calloc(sshape->num_outlines, sizeof(XkbOutlineRec));
                     if (!tmp)
                         return FALSE;
                     dshape->outlines = tmp;
@@ -1665,7 +1665,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                          j < sshape->num_outlines;
                          j++, soutline++, doutline++) {
                         if (soutline->num_points) {
-                            tmp = xalloc(soutline->num_points *
+                            tmp = malloc(soutline->num_points *
                                           sizeof(XkbPointRec));
                             if (!tmp)
                                 return FALSE;
@@ -1721,7 +1721,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->geom->sz_shapes) {
-                xfree(dst->geom->shapes);
+                free(dst->geom->shapes);
             }
             dst->geom->shapes = NULL;
             dst->geom->num_shapes = 0;
@@ -1739,11 +1739,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                      j < dsection->num_rows;
                      j++, drow++) {
                     if (drow->num_keys)
-                        xfree(drow->keys);
+                        free(drow->keys);
                 }
 
                 if (dsection->num_rows)
-                    xfree(dsection->rows);
+                    free(dsection->rows);
 
                 /* cut and waste from geom/doodad below. */
                 for (j = 0, ddoodad = dsection->doodads;
@@ -1751,24 +1751,24 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                      j++, ddoodad++) {
                     if (ddoodad->any.type == XkbTextDoodad) {
                         if (ddoodad->text.text) {
-                            xfree(ddoodad->text.text);
+                            free(ddoodad->text.text);
                             ddoodad->text.text = NULL;
                         }
                         if (ddoodad->text.font) {
-                            xfree(ddoodad->text.font);
+                            free(ddoodad->text.font);
                             ddoodad->text.font = NULL;
                         }
                      }
                      else if (ddoodad->any.type == XkbLogoDoodad) {
                         if (ddoodad->logo.logo_name) {
-                            xfree(ddoodad->logo.logo_name);
+                            free(ddoodad->logo.logo_name);
                             ddoodad->logo.logo_name = NULL;
                         }
                     }
                 }
 
                 if (dsection->num_doodads)
-                    xfree(dsection->doodads);
+                    free(dsection->doodads);
             }
 
             dst->geom->num_sections = 0;
@@ -1777,11 +1777,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
 
         if (src->geom->num_sections) {
             if (dst->geom->sz_sections)
-                tmp = xrealloc(dst->geom->sections,
+                tmp = realloc(dst->geom->sections,
                                src->geom->num_sections *
                                 sizeof(XkbSectionRec));
             else
-                tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec));
+                tmp = malloc(src->geom->num_sections * sizeof(XkbSectionRec));
             if (!tmp)
                 return FALSE;
             memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec));
@@ -1796,7 +1796,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                  i++, ssection++, dsection++) {
                 *dsection = *ssection;
                 if (ssection->num_rows) {
-                    tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
+                    tmp = calloc(ssection->num_rows, sizeof(XkbRowRec));
                     if (!tmp)
                         return FALSE;
                     dsection->rows = tmp;
@@ -1808,7 +1808,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                      j < ssection->num_rows;
                      j++, srow++, drow++) {
                     if (srow->num_keys) {
-                        tmp = xalloc(srow->num_keys * sizeof(XkbKeyRec));
+                        tmp = malloc(srow->num_keys * sizeof(XkbKeyRec));
                         if (!tmp)
                             return FALSE;
                         drow->keys = tmp;
@@ -1824,7 +1824,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                 }
 
                 if (ssection->num_doodads) {
-                    tmp = xcalloc(ssection->num_doodads, sizeof(XkbDoodadRec));
+                    tmp = calloc(ssection->num_doodads, sizeof(XkbDoodadRec));
                     if (!tmp)
                         return FALSE;
                     dsection->doodads = tmp;
@@ -1861,7 +1861,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->geom->sz_sections) {
-                xfree(dst->geom->sections);
+                free(dst->geom->sections);
             }
 
             dst->geom->sections = NULL;
@@ -1878,17 +1878,17 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
                  i++, ddoodad++) {
                  if (ddoodad->any.type == XkbTextDoodad) {
                     if (ddoodad->text.text) {
-                        xfree(ddoodad->text.text);
+                        free(ddoodad->text.text);
                         ddoodad->text.text = NULL;
                     }
                     if (ddoodad->text.font) {
-                        xfree(ddoodad->text.font);
+                        free(ddoodad->text.font);
                         ddoodad->text.font = NULL;
                     }
                  }
                  else if (ddoodad->any.type == XkbLogoDoodad) {
                     if (ddoodad->logo.logo_name) {
-                        xfree(ddoodad->logo.logo_name);
+                        free(ddoodad->logo.logo_name);
                         ddoodad->logo.logo_name = NULL;
                     }
                 }
@@ -1899,11 +1899,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
 
         if (src->geom->num_doodads) {
             if (dst->geom->sz_doodads)
-                tmp = xrealloc(dst->geom->doodads,
+                tmp = realloc(dst->geom->doodads,
                                src->geom->num_doodads *
                                 sizeof(XkbDoodadRec));
             else
-                tmp = xalloc(src->geom->num_doodads *
+                tmp = malloc(src->geom->num_doodads *
                               sizeof(XkbDoodadRec));
             if (!tmp)
                 return FALSE;
@@ -1935,7 +1935,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->geom->sz_doodads) {
-                xfree(dst->geom->doodads);
+                free(dst->geom->doodads);
             }
 
             dst->geom->doodads = NULL;
@@ -1947,11 +1947,11 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         if (src->geom->num_key_aliases) {
             if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) {
                 if (dst->geom->sz_key_aliases)
-                    tmp = xrealloc(dst->geom->key_aliases,
+                    tmp = realloc(dst->geom->key_aliases,
                                    src->geom->num_key_aliases *
                                     2 * XkbKeyNameLength);
                 else
-                    tmp = xalloc(src->geom->num_key_aliases *
+                    tmp = malloc(src->geom->num_key_aliases *
                                   2 * XkbKeyNameLength);
                 if (!tmp)
                     return FALSE;
@@ -1967,7 +1967,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->geom->key_aliases) {
-                xfree(dst->geom->key_aliases);
+                free(dst->geom->key_aliases);
             }
             dst->geom->key_aliases = NULL;
             dst->geom->num_key_aliases = 0;
@@ -1977,14 +1977,14 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         /* font */
         if (src->geom->label_font) {
             if (!dst->geom->label_font) {
-                tmp = xalloc(strlen(src->geom->label_font));
+                tmp = malloc(strlen(src->geom->label_font));
                 if (!tmp)
                     return FALSE;
                 dst->geom->label_font = tmp;
             }
             else if (strlen(src->geom->label_font) !=
                 strlen(dst->geom->label_font)) {
-                tmp = xrealloc(dst->geom->label_font,
+                tmp = realloc(dst->geom->label_font,
                                strlen(src->geom->label_font));
                 if (!tmp)
                     return FALSE;
@@ -1999,7 +1999,7 @@ _XkbCopyGeom(XkbDescPtr src, XkbDescPtr dst)
         }
         else {
             if (dst->geom->label_font) {
-                xfree(dst->geom->label_font);
+                free(dst->geom->label_font);
             }
             dst->geom->label_font = NULL;
             dst->geom->label_color = NULL;
@@ -2028,7 +2028,7 @@ _XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst)
     /* indicators */
     if (src->indicators) {
         if (!dst->indicators) {
-            dst->indicators = xalloc(sizeof(XkbIndicatorRec));
+            dst->indicators = malloc(sizeof(XkbIndicatorRec));
             if (!dst->indicators)
                 return FALSE;
         }
@@ -2036,7 +2036,7 @@ _XkbCopyIndicators(XkbDescPtr src, XkbDescPtr dst)
     }
     else {
         if (dst->indicators) {
-            xfree(dst->indicators);
+            free(dst->indicators);
             dst->indicators = NULL;
         }
     }
@@ -2049,7 +2049,7 @@ _XkbCopyControls(XkbDescPtr src, XkbDescPtr dst)
     /* controls */
     if (src->ctrls) {
         if (!dst->ctrls) {
-            dst->ctrls = xalloc(sizeof(XkbControlsRec));
+            dst->ctrls = malloc(sizeof(XkbControlsRec));
             if (!dst->ctrls)
                 return FALSE;
         }
@@ -2057,7 +2057,7 @@ _XkbCopyControls(XkbDescPtr src, XkbDescPtr dst)
     }
     else {
         if (dst->ctrls) {
-            xfree(dst->ctrls);
+            free(dst->ctrls);
             dst->ctrls = NULL;
         }
     }
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index a201731..5d3372d 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -58,7 +58,7 @@ char *new;
    
    if (str==NULL)
 	return NULL;
-   new= xcalloc(strlen(str)+1,sizeof(char));
+   new= calloc(strlen(str)+1,sizeof(char));
    if (new)
 	strcpy(new,str);
    return new;
@@ -74,10 +74,10 @@ int	newCount= *newCountRtrn;
     if (oldPtr==NULL) {
 	if (newCount==0)
 	    return NULL;
-	oldPtr= xcalloc(newCount,elemSize);
+	oldPtr= calloc(newCount,elemSize);
     }
     else if (oldCount<newCount) {
-	oldPtr= xrealloc(oldPtr,newCount*elemSize);
+	oldPtr= realloc(oldPtr,newCount*elemSize);
 	if (oldPtr!=NULL) {
 	    char *tmp= (char *)oldPtr;
 	    bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize);
commit 96c7ab27c383ec767f62a7a11e5fd76f86363fbc
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 00:28:25 2010 +0700

    Deprecate allocation functions which are plain wrappers for C stdlib
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/os.h b/include/os.h
index 226e2b9..7f358ee 100644
--- a/include/os.h
+++ b/include/os.h
@@ -218,19 +218,20 @@ extern _X_EXPORT int set_font_authorizations(
 /*
  * Use malloc(3) instead.
  */
-extern _X_EXPORT void *Xalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) X_DEPRECATED;
 /*
  * Use calloc(3) instead
  */
-extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) X_DEPRECATED;
 /*
  * Use realloc(3) instead
  */
-extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/);
+extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
+    X_DEPRECATED;
 /*
  * Use free(3) instead
  */
-extern _X_EXPORT void Xfree(void * /*ptr*/);
+extern _X_EXPORT void Xfree(void * /*ptr*/) X_DEPRECATED;
 
 #endif
 
commit a5dba0f5caefce236ebd5f71948e5a659bea58e4
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 00:27:47 2010 +0700

    Document allocation functions, noting deviations from C library
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/os.h b/include/os.h
index b491177..226e2b9 100644
--- a/include/os.h
+++ b/include/os.h
@@ -214,18 +214,54 @@ extern _X_EXPORT int set_font_authorizations(
 
 #ifndef _HAVE_XALLOC_DECLS
 #define _HAVE_XALLOC_DECLS
+
+/*
+ * Use malloc(3) instead.
+ */
 extern _X_EXPORT void *Xalloc(unsigned long /*amount*/);
+/*
+ * Use calloc(3) instead
+ */
 extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/);
+/*
+ * Use realloc(3) instead
+ */
 extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/);
+/*
+ * Use free(3) instead
+ */
 extern _X_EXPORT void Xfree(void * /*ptr*/);
+
 #endif
 
+/*
+ * This function malloc(3)s buffer, terminating the server if there is not
+ * enough memory.
+ */
 extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/);
+/*
+ * This function calloc(3)s buffer, terminating the server if there is not
+ * enough memory.
+ */
 extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/);
+/*
+ * This function realloc(3)s passed buffer, terminating the server if there is
+ * not enough memory.
+ */
 extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/);
 
+/*
+ * This function strdup(3)s passed string. The only difference from the library
+ * function that it is safe to pass NULL, as NULL will be returned.
+ */
 extern _X_EXPORT char *Xstrdup(const char *s);
+
+/*
+ * This function strdup(3)s passed string, terminating the server if there is
+ * not enough memory. If NULL is passed to this function, NULL is returned.
+ */
 extern _X_EXPORT char *XNFstrdup(const char *s);
+
 extern _X_EXPORT char *Xprintf(const char *fmt, ...);
 extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
 extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
commit e983848ab44b0769f97f6207f1aa8b4f127be6a9
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu May 6 00:16:24 2010 +0700

    Clean {X,XNF}{alloc,calloc,realloc,free,strdup} from pre-C89 baggage
    
    C89 guarantees alignment of pointers returned from malloc/calloc/realloc, so
    stop fiddling with alignment manually and just pass the arguments to library
    functions.
    
    Also convert silent error when negative size is passed into function into
    warning in log file.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/os.h b/include/os.h
index 3b07bde..b491177 100644
--- a/include/os.h
+++ b/include/os.h
@@ -214,15 +214,15 @@ extern _X_EXPORT int set_font_authorizations(
 
 #ifndef _HAVE_XALLOC_DECLS
 #define _HAVE_XALLOC_DECLS
-extern _X_EXPORT pointer Xalloc(unsigned long /*amount*/);
-extern _X_EXPORT pointer Xcalloc(unsigned long /*amount*/);
-extern _X_EXPORT pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
-extern _X_EXPORT void Xfree(pointer /*ptr*/);
+extern _X_EXPORT void *Xalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/);
+extern _X_EXPORT void Xfree(void * /*ptr*/);
 #endif
 
-extern _X_EXPORT pointer XNFalloc(unsigned long /*amount*/);
-extern _X_EXPORT pointer XNFcalloc(unsigned long /*amount*/);
-extern _X_EXPORT pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
+extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/);
+extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/);
 
 extern _X_EXPORT char *Xstrdup(const char *s);
 extern _X_EXPORT char *XNFstrdup(const char *s);
diff --git a/os/utils.c b/os/utils.c
index 7ab7cc3..3dffbd8 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1024,32 +1024,30 @@ set_font_authorizations(char **authorizations, int *authlen, pointer client)
 void *
 Xalloc(unsigned long amount)
 {
-    void *ptr;
+    /*
+     * Xalloc used to return NULL when large amount of memory is requested. In
+     * order to catch the buggy callers this warning has been added, slated to
+     * removal by anyone who touches this code (or just looks at it) in 2011.
+     *
+     * -- Mikhail Gusarov
+     */
+    if ((long)amount <= 0)
+	ErrorF("Warning: Xalloc: "
+	       "requesting unpleasantly large amount of memory: %lu bytes.\n",
+               amount);
 
-    if ((long)amount <= 0) {
-	return NULL;
-    }
-    /* aligned extra on long word boundary */
-    amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
-    ptr = malloc(amount);
-    return ptr;
+    return malloc(amount);
 }
 
 /*****************
- * XNFalloc 
- * "no failure" realloc
+ * XNFalloc
+ * "no failure" alloc
  *****************/
 
 void *
 XNFalloc(unsigned long amount)
 {
-    void *ptr;
-
-    if ((long)amount <= 0)
-        return NULL;
-    /* aligned extra on long word boundary */
-    amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
-    ptr = malloc(amount);
+    void *ptr = malloc(amount);
     if (!ptr)
         FatalError("Out of memory");
     return ptr;
@@ -1062,12 +1060,7 @@ XNFalloc(unsigned long amount)
 void *
 Xcalloc(unsigned long amount)
 {
-    void *ret;
-
-    ret = Xalloc (amount);
-    if (ret)
-	bzero (ret, (int) amount);
-    return ret;
+    return calloc(1, amount);
 }
 
 /*****************
@@ -1077,13 +1070,9 @@ Xcalloc(unsigned long amount)
 void *
 XNFcalloc(unsigned long amount)
 {
-    void *ret;
-
-    ret = Xalloc (amount);
-    if (ret)
-	bzero (ret, (int) amount);
-    else if ((long)amount > 0)
-        FatalError("Out of memory");
+    void *ret = calloc(1, amount);
+    if (!ret)
+        FatalError("XNFcalloc: Out of memory");
     return ret;
 }
 
@@ -1092,21 +1081,21 @@ XNFcalloc(unsigned long amount)
  *****************/
 
 void *
-Xrealloc(pointer ptr, unsigned long amount)
+Xrealloc(void *ptr, unsigned long amount)
 {
+    /*
+     * Xrealloc used to return NULL when large amount of memory is requested. In
+     * order to catch the buggy callers this warning has been added, slated to
+     * removal by anyone who touches this code (or just looks at it) in 2011.
+     *
+     * -- Mikhail Gusarov
+     */
     if ((long)amount <= 0)
-    {
-	if (ptr && !amount)
-	    free(ptr);
-	return NULL;
-    }
-    amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
-    if (ptr)
-        ptr = realloc(ptr, amount);
-    else
-	ptr = malloc(amount);
+	ErrorF("Warning: Xrealloc: "
+	       "requesting unpleasantly large amount of memory: %lu bytes.\n",
+               amount);
 
-    return ptr;
+    return realloc(ptr, amount);
 }
                     
 /*****************
@@ -1115,14 +1104,12 @@ Xrealloc(pointer ptr, unsigned long amount)
  *****************/
 
 void *
-XNFrealloc(pointer ptr, unsigned long amount)
+XNFrealloc(void *ptr, unsigned long amount)
 {
-    if ((ptr = Xrealloc(ptr, amount)) == NULL)
-    {
-	if ((long)amount > 0)
-            FatalError( "Out of memory" );
-    }
-    return ptr;
+    void *ret = realloc(ptr, amount);
+    if (!ret)
+	FatalError("XNFrealloc: Out of memory");
+    return ret;
 }
 
 /*****************
@@ -1131,39 +1118,32 @@ XNFrealloc(pointer ptr, unsigned long amount)
  *****************/    
 
 void
-Xfree(pointer ptr)
+Xfree(void *ptr)
 {
-    if (ptr)
-	free(ptr); 
+    free(ptr);
 }
 
 
 char *
 Xstrdup(const char *s)
 {
-    char *sd;
-
     if (s == NULL)
 	return NULL;
-
-    sd = Xalloc(strlen(s) + 1);
-    if (sd != NULL)
-	strcpy(sd, s);
-    return sd;
+    return strdup(s);
 }
 
-
 char *
 XNFstrdup(const char *s)
 {
-    char *sd;
+    char *ret;
 
     if (s == NULL)
 	return NULL;
 
-    sd = XNFalloc(strlen(s) + 1);
-    strcpy(sd, s);
-    return sd;
+    ret = strdup(s);
+    if (!ret)
+	FatalError("XNFstrdup: Out of memory");
+    return ret;
 }
 
 
commit 4f0006c2203abe0b7660c5068d6afe236f9bd2a4
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Mon May 10 08:36:02 2010 -0400

    dri2: Copy front to fake front in swapbuffer
    
    If we don't have a fake front, nothing will happen.  The fix was extracted
    from a bigger patch from Francisco Jerez.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=27305
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Pauli Nieminen <suokkos at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 11442d0..143163d 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -634,6 +634,8 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
     ScreenPtr	    pScreen = pDraw->pScreen;
     DRI2DrawablePtr pPriv;
     CARD64          ust = 0;
+    BoxRec          box;
+    RegionRec       region;
 
     pPriv = DRI2GetDrawable(pDraw);
     if (pPriv == NULL) {
@@ -645,6 +647,14 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
     pPriv->swapsPending--;
     pPriv->swap_count++;
 
+    box.x1 = 0;
+    box.y1 = 0;
+    box.x2 = pDraw->width;
+    box.y2 = pDraw->height;
+    REGION_INIT(pScreen, &region, &box, 0);
+    DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+		   DRI2BufferFrontLeft);
+
     ust = ((CARD64)tv_sec * 1000000) + tv_usec;
     if (swap_complete)
 	swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count);
commit ba1f1f9d9e48226f1ef6b3222a8d92fc969d6560
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue May 11 09:49:34 2010 -0700

    XQuartz GL: Fix __glXAquaScreenCreateDrawable prototype
    
    Fixes regression introduced in 9de0e31746d5f0d9d39d11c94ec3cbc04a9935fc
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index ad9ebbd..8092cfa 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -169,7 +169,7 @@ void warn_func(void * p1, char *format, ...);
 
 // some prototypes
 static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen);
-static __GLXdrawable * __glXAquaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, __GLXconfig *conf);
+static __GLXdrawable * __glXAquaScreenCreateDrawable(ClientPtr client, __GLXscreen *screen, DrawablePtr pDraw, XID drawId, int type, XID glxDrawId, __GLXconfig *conf);
 
 static void __glXAquaContextDestroy(__GLXcontext *baseContext);
 static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
@@ -639,10 +639,12 @@ static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
 }
 
 static __GLXdrawable *
-__glXAquaScreenCreateDrawable(__GLXscreen *screen,
+__glXAquaScreenCreateDrawable(ClientPtr client,
+                              __GLXscreen *screen,
 			      DrawablePtr pDraw,
-			      int type,
 			      XID drawId,
+			      int type,
+			      XID glxDrawId,
 			      __GLXconfig *conf) {
   __GLXAquaDrawable *glxPriv;
 
@@ -653,7 +655,7 @@ __glXAquaScreenCreateDrawable(__GLXscreen *screen,
 
   memset(glxPriv, 0, sizeof *glxPriv);
 
-  if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, drawId, conf)) {
+  if(!__glXDrawableInit(&glxPriv->base, screen, pDraw, type, glxDrawId, conf)) {
     xfree(glxPriv);
     return NULL;
   }
commit 286935c6f4965a6b09de1fb9e579a00afa14082a
Author: Keith Packard <keithp at keithp.com>
Date:   Tue May 11 09:08:40 2010 -0700

    Remember drawable ID used to find damage target for use in events. Bug 5730.
    
    Using Composite, window pixmaps are given names in the client resource
    namespace and yet may not have any XID recorded in the drawable
    structure. As such, we need to remember the XID used to lookup the
    pixmap in the resource database so that we can report the correct XID
    back to the client in damage events.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/damageext/damageext.c b/damageext/damageext.c
index 462796e..4e9019c 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -51,7 +51,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
     ev.type = DamageEventBase + XDamageNotify;
     ev.level = pDamageExt->level;
     ev.sequenceNumber = pClient->sequence;
-    ev.drawable = pDrawable->id;
+    ev.drawable = pDamageExt->drawable;
     ev.damage = pDamageExt->id;
     ev.timestamp = currentTime.milliseconds;
     ev.geometry.x = pDrawable->x;
@@ -205,6 +205,7 @@ ProcDamageCreate (ClientPtr client)
     if (!pDamageExt)
 	return BadAlloc;
     pDamageExt->id = stuff->damage;
+    pDamageExt->drawable = stuff->drawable;
     pDamageExt->pDrawable = pDrawable;
     pDamageExt->level = level;
     pDamageExt->pClient = client;
diff --git a/damageext/damageextint.h b/damageext/damageextint.h
index 45c5ff9..d40ba3e 100644
--- a/damageext/damageextint.h
+++ b/damageext/damageextint.h
@@ -55,6 +55,7 @@ typedef struct _DamageExt {
     DamageReportLevel	level;
     ClientPtr		pClient;
     XID			id;
+    XID			drawable;
 } DamageExtRec, *DamageExtPtr;
 
 #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \
commit 3df22b293c1f1d27e7ce16662744c578d35b5aba
Merge: fa6c701... 9de0e31...
Author: Keith Packard <keithp at keithp.com>
Date:   Tue May 11 08:38:44 2010 -0700

    Merge remote branch 'krh/dri2-resource-fixes'

commit fa6c7012572093a82c9389682977efff85590719
Author: Cyril Brulebois <kibi at debian.org>
Date:   Mon Mar 1 02:11:36 2010 +0100

    Fix null pointer dereference in xf86_reload_cursors().
    
    Upon resume, X may try to dereference a null pointer, which has been
    reported in Debian bug #507916 (http://bugs.debian.org/507916).
    
    Jim Paris came up with a patch which solves the problem for him. Here's
    a (hopefully) fixed version of his patch (without the typo).
    
    Cc: Jim Paris <jim at jtan.com>
    Signed-off-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-By: Matthias Hopf <mhopf at suse.de>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index f90ecc2..cfbe778 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -609,7 +609,7 @@ xf86_reload_cursors (ScreenPtr screen)
     cursor_screen_priv = dixLookupPrivate(&screen->devPrivates,
 					  xf86CursorScreenKey);
     /* return if HW cursor is inactive, to avoid displaying two cursors */
-    if (!cursor_screen_priv->isUp)
+    if (!cursor_screen_priv || !cursor_screen_priv->isUp)
 	return;
 
     scrn = xf86Screens[screen->myNum];
commit 9de0e31746d5f0d9d39d11c94ec3cbc04a9935fc
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Thu Apr 29 16:36:10 2010 -0400

    dri2: Take an XID for tracking the DRI2 drawable
    
    Some pixmaps (window pixmaps and scratch pixmaps) don't have the
    drawable->id set and thus DRI2 gets confused when using that field
    for looking up the DRI2 drawable.  Go back to using privates for getting
    at the DRI2 drawable from a DrawablePtr.  We need to keep the resource
    tracking in place so we can remove the DRI2 drawable when the X resource
    it was created for goes away.  Additionally, we also now track the DRI2
    drawable using a client XID so we can reclaim the DRI2 drawable even if
    the client goes before the drawable and doesn't destroy the DRI2 drawable.
    
    Tested-by: Owen W. Taylor <otaylor at fishsoup.net>
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 087d52e..ec3bbe6 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -512,8 +512,9 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
     if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
 	return NULL;
 
-    pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
-						pDraw, GLX_DRAWABLE_WINDOW,
+    pGlxDraw = glxc->pGlxScreen->createDrawable(client, glxc->pGlxScreen,
+						pDraw, drawId,
+						GLX_DRAWABLE_WINDOW,
 						drawId, glxc->config);
 
     /* since we are creating the drawablePrivate, drawId should be new */
@@ -1104,15 +1105,17 @@ __glXDrawableRelease(__GLXdrawable *drawable)
 }
 
 static int 
-DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
-		    DrawablePtr pDraw, XID glxDrawableId, int type)
+DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen,
+		    __GLXconfig *config, DrawablePtr pDraw, XID drawableId,
+		    XID glxDrawableId, int type)
 {
     __GLXdrawable *pGlxDraw;
 
     if (pGlxScreen->pScreen != pDraw->pScreen)
 	return BadMatch;
 
-    pGlxDraw = pGlxScreen->createDrawable(pGlxScreen, pDraw, type,
+    pGlxDraw = pGlxScreen->createDrawable(client, pGlxScreen, pDraw,
+					  drawableId, type,
 					  glxDrawableId, config);
     if (pGlxDraw == NULL)
 	return BadAlloc;
@@ -1125,7 +1128,7 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
     /* Add the glx drawable under the XID of the underlying X drawable
      * too.  That way we'll get a callback in DrawableGone and can
      * clean up properly when the drawable is destroyed. */
-    if (pDraw->id != glxDrawableId &&
+    if (drawableId != glxDrawableId &&
 	!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
 	pGlxDraw->destroy (pGlxDraw);
 	return BadAlloc;
@@ -1153,7 +1156,7 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
 	return BadPixmap;
     }
 
-    err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw,
+    err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw, drawableId,
 			      glxDrawableId, GLX_DRAWABLE_PIXMAP);
 
     return err;
@@ -1316,7 +1319,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
 	return BadAlloc;
 
     return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
-			       glxDrawableId, GLX_DRAWABLE_PBUFFER);
+			       glxDrawableId, glxDrawableId,
+			       GLX_DRAWABLE_PBUFFER);
 }
 
 int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc)
@@ -1439,7 +1443,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
 	return err;
 
     return DoCreateGLXDrawable(client, pGlxScreen, config,
-			       pDraw, req->glxwindow, GLX_DRAWABLE_WINDOW);
+			       pDraw, req->window,
+			       req->glxwindow, GLX_DRAWABLE_WINDOW);
 }
 
 int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
diff --git a/glx/glxdri.c b/glx/glxdri.c
index 9810a73..1d8c902 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -683,10 +683,12 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 }
 
 static __GLXdrawable *
-__glXDRIscreenCreateDrawable(__GLXscreen *screen,
+__glXDRIscreenCreateDrawable(ClientPtr client,
+			     __GLXscreen *screen,
 			     DrawablePtr pDraw,
-			     int type,
 			     XID drawId,
+			     int type,
+			     XID glxDrawId,
 			     __GLXconfig *glxConfig)
 {
     __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
@@ -700,7 +702,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
 	return NULL;
 
     if (!__glXDrawableInit(&private->base, screen,
-			   pDraw, type, drawId, glxConfig)) {
+			   pDraw, type, glxDrawId, glxConfig)) {
         xfree(private);
 	return NULL;
     }
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index c34e29a..bad4516 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -430,10 +430,12 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 }
 
 static __GLXdrawable *
-__glXDRIscreenCreateDrawable(__GLXscreen *screen,
+__glXDRIscreenCreateDrawable(ClientPtr client,
+			     __GLXscreen *screen,
 			     DrawablePtr pDraw,
-			     int type,
 			     XID drawId,
+			     int type,
+			     XID glxDrawId,
 			     __GLXconfig *glxConfig)
 {
     __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
@@ -446,7 +448,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
 
     private->screen = driScreen;
     if (!__glXDrawableInit(&private->base, screen,
-			   pDraw, type, drawId, glxConfig)) {
+			   pDraw, type, glxDrawId, glxConfig)) {
         xfree(private);
 	return NULL;
     }
@@ -457,7 +459,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
     private->base.waitGL	= __glXDRIdrawableWaitGL;
     private->base.waitX		= __glXDRIdrawableWaitX;
 
-    if (DRI2CreateDrawable(pDraw)) {
+    if (DRI2CreateDrawable(client, pDraw, drawId)) {
 	    xfree(private);
 	    return NULL;
     }
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 918383c..4ba448a 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -301,10 +301,12 @@ glxChangeGC(GCPtr gc, BITS32 mask, CARD32 val)
 }
 
 static __GLXdrawable *
-__glXDRIscreenCreateDrawable(__GLXscreen *screen,
+__glXDRIscreenCreateDrawable(ClientPtr client,
+			     __GLXscreen *screen,
 			     DrawablePtr pDraw,
-			     int type,
 			     XID drawId,
+			     int type,
+			     XID glxDrawId,
 			     __GLXconfig *glxConfig)
 {
     __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
@@ -319,7 +321,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
 
     private->screen = driScreen;
     if (!__glXDrawableInit(&private->base, screen,
-			   pDraw, type, drawId, glxConfig)) {
+			   pDraw, type, glxDrawId, glxConfig)) {
         xfree(private);
 	return NULL;
     }
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index d52099f..861e03c 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -134,10 +134,12 @@ struct __GLXscreen {
 				    __GLXconfig *modes,
 				    __GLXcontext *shareContext);
 
-    __GLXdrawable *(*createDrawable)(__GLXscreen *context,
+    __GLXdrawable *(*createDrawable)(ClientPtr client,
+				     __GLXscreen *context,
 				     DrawablePtr pDraw,
-				     int type,
 				     XID drawId,
+				     int type,
+				     XID glxDrawId,
 				     __GLXconfig *modes);
     int            (*swapInterval)  (__GLXdrawable *drawable,
 				     int interval);
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 6c4dabc..11442d0 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -37,6 +37,7 @@
 #include <errno.h>
 #include <xf86drm.h>
 #include "xf86Module.h"
+#include "list.h"
 #include "scrnintstr.h"
 #include "windowstr.h"
 #include "dixstruct.h"
@@ -50,12 +51,18 @@ CARD8 dri2_minor;
 
 static int           dri2ScreenPrivateKeyIndex;
 static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKeyIndex;
+static int dri2WindowPrivateKeyIndex;
+static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex;
+static int dri2PixmapPrivateKeyIndex;
+static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex;
 static RESTYPE       dri2DrawableRes;
 
 typedef struct _DRI2Screen *DRI2ScreenPtr;
 
 typedef struct _DRI2Drawable {
     DRI2ScreenPtr        dri2_screen;
+    DrawablePtr		 drawable;
+    struct list		 reference_list;
     int			 width;
     int			 height;
     DRI2BufferPtr	*buffers;
@@ -74,6 +81,7 @@ typedef struct _DRI2Drawable {
 
 typedef struct _DRI2Screen {
     ScreenPtr			 screen;
+    int				 refcnt;
     unsigned int		 numDrivers;
     const char			**driverNames;
     const char			*deviceName;
@@ -99,35 +107,33 @@ DRI2GetScreen(ScreenPtr pScreen)
 static DRI2DrawablePtr
 DRI2GetDrawable(DrawablePtr pDraw)
 {
-    DRI2DrawablePtr pPriv;
-    int rc;
+    WindowPtr pWin;
+    PixmapPtr pPixmap;
 
-    rc = dixLookupResourceByType((pointer *) &pPriv, pDraw->id,
-				 dri2DrawableRes, NULL, DixReadAccess);
-    if (rc != Success)
-	return NULL;
-
-    return pPriv;
+    if (pDraw->type == DRAWABLE_WINDOW) {
+	pWin = (WindowPtr) pDraw;
+	return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
+    } else {
+	pPixmap = (PixmapPtr) pDraw;
+	return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
+    }
 }
 
-int
-DRI2CreateDrawable(DrawablePtr pDraw)
+static DRI2DrawablePtr
+DRI2AllocateDrawable(DrawablePtr pDraw)
 {
     DRI2ScreenPtr   ds = DRI2GetScreen(pDraw->pScreen);
     DRI2DrawablePtr pPriv;
     CARD64          ust;
-    int		    rc;
-
-    rc = dixLookupResourceByType((pointer *) &pPriv, pDraw->id,
-				 dri2DrawableRes, NULL, DixReadAccess);
-    if (rc == Success || rc != BadValue)
-	return rc;
+    WindowPtr pWin;
+    PixmapPtr pPixmap;
 
     pPriv = xalloc(sizeof *pPriv);
     if (pPriv == NULL)
-	return BadAlloc;
+	return NULL;
 
     pPriv->dri2_screen = ds;
+    pPriv->drawable = pDraw;
     pPriv->width = pDraw->width;
     pPriv->height = pDraw->height;
     pPriv->buffers = NULL;
@@ -145,9 +151,77 @@ DRI2CreateDrawable(DrawablePtr pDraw)
     pPriv->swap_limit = 1; /* default to double buffering */
     pPriv->last_swap_msc = 0;
     pPriv->last_swap_ust = 0;
+    list_init(&pPriv->reference_list);
+
+    if (pDraw->type == DRAWABLE_WINDOW) {
+	pWin = (WindowPtr) pDraw;
+	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
+    } else {
+	pPixmap = (PixmapPtr) pDraw;
+	dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
+    }
+
+    return pPriv;
+}
+
+typedef struct DRI2DrawableRefRec {
+    XID id;
+    XID dri2_id;
+    struct list link;
+} DRI2DrawableRefRec, *DRI2DrawableRefPtr;
+
+static DRI2DrawableRefPtr
+DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
+{
+    DRI2DrawableRefPtr ref;
+
+    list_for_each_entry(ref, &pPriv->reference_list, link) {
+	if (ref->id == id)
+	    return ref;
+    }
+    
+    return NULL;
+}
+
+static int
+DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id)
+{
+    DRI2DrawableRefPtr ref;
+
+    ref = malloc(sizeof *ref);
+    if (ref == NULL)
+	return BadAlloc;
+	
+    if (!AddResource(dri2_id, dri2DrawableRes, pPriv))
+	return BadAlloc;
+    if (!DRI2LookupDrawableRef(pPriv, id))
+	if (!AddResource(id, dri2DrawableRes, pPriv))
+	    return BadAlloc;
+
+    ref->id = id;
+    ref->dri2_id = dri2_id; 
+    list_add(&ref->link, &pPriv->reference_list);
+
+    return Success;
+}
 
-    if (!AddResource(pDraw->id, dri2DrawableRes, pPriv))
+int
+DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id)
+{
+    DRI2DrawablePtr pPriv;
+    XID dri2_id;
+    int rc;
+
+    pPriv = DRI2GetDrawable(pDraw);
+    if (pPriv == NULL)
+	pPriv = DRI2AllocateDrawable(pDraw);
+    if (pPriv == NULL)
 	return BadAlloc;
+    
+    dri2_id = FakeClientID(client->index);
+    rc = DRI2AddDrawableRef(pPriv, id, dri2_id);
+    if (rc != Success)
+	return rc;
 
     return Success;
 }
@@ -156,13 +230,45 @@ static int DRI2DrawableGone(pointer p, XID id)
 {
     DRI2DrawablePtr pPriv = p;
     DRI2ScreenPtr   ds = pPriv->dri2_screen;
-    DrawablePtr     root;
+    DRI2DrawableRefPtr ref, next;
+    WindowPtr pWin;
+    PixmapPtr pPixmap;
+    DrawablePtr pDraw;
     int i;
 
-    root = &WindowTable[ds->screen->myNum]->drawable;
+    list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
+	if (ref->dri2_id == id) {
+	    list_del(&ref->link);
+	    /* If this was the last ref under this X drawable XID,
+	     * unregister the X drawable resource. */
+	    if (!DRI2LookupDrawableRef(pPriv, ref->id))
+		FreeResourceByType(ref->id, dri2DrawableRes, TRUE);
+	    free(ref);
+	    break;
+	}
+
+	if (ref->id == id) {
+	    list_del(&ref->link);
+	    FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE);
+	    free(ref);
+	}
+    }
+
+    if (!list_is_empty(&pPriv->reference_list))
+	return Success;
+
+    pDraw = pPriv->drawable;
+    if (pDraw->type == DRAWABLE_WINDOW) {
+	pWin = (WindowPtr) pDraw;
+	dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
+    } else {
+	pPixmap = (PixmapPtr) pDraw;
+	dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
+    }
+
     if (pPriv->buffers != NULL) {
 	for (i = 0; i < pPriv->bufferCount; i++)
-	    (*ds->DestroyBuffer)(root, pPriv->buffers[i]);
+	    (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
 
 	xfree(pPriv->buffers);
     }
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index ce8a5df..5415a0b 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -198,7 +198,8 @@ extern _X_EXPORT Bool DRI2Connect(ScreenPtr pScreen,
 
 extern _X_EXPORT Bool DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic);
 
-extern _X_EXPORT int DRI2CreateDrawable(DrawablePtr pDraw);
+extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
+					DrawablePtr pDraw, XID id);
 
 extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
 
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 17df130..58eaa10 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -167,7 +167,7 @@ ProcDRI2CreateDrawable(ClientPtr client)
 		       &pDrawable, &status))
 	return status;
 
-    status = DRI2CreateDrawable(pDrawable);
+    status = DRI2CreateDrawable(client, pDrawable, stuff->drawable);
     if (status != Success)
 	return status;
 
commit 32381363cd8f43aeb741bad70bcf96a287dac0c9
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Sat May 1 13:15:00 2010 -0400

    list.h: Add list_for_each_entry_safe()
    
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/include/list.h b/include/list.h
index a126a65..89dc29d 100644
--- a/include/list.h
+++ b/include/list.h
@@ -94,4 +94,10 @@ list_is_empty(struct list *head)
 	 &pos->member != (head);					\
 	 pos = __container_of(pos->member.next, pos, member))
 
+#define list_for_each_entry_safe(pos, next, head, member)		\
+    for (pos = __container_of((head)->next, pos, member),		\
+	 next = __container_of(pos->member.next, pos, member);		\
+	 &pos->member != (head);					\
+	 pos = next, next = __container_of(next->member.next, next, member))
+
 #endif
commit 4a8a615d01b9ed18c272414bd11dc2fc661727e5
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Sat May 1 13:13:54 2010 -0400

    glxdri2: Hard-code the extension version we need
    
    If we use the #define'd version from dri_interface.h, the server will
    require at least that version of the extension.  If we're compiling against
    a dri_interface.h with a newer version we don't really require, glxdri2
    will require a too high version of the extension.
    
    The right approach is to just hard-code the version we need instead of
    using the #defines.
    
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 74d6ebc..c34e29a 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -653,7 +653,7 @@ initializeExtensions(__GLXDRIscreen *screen)
 
 #ifdef __DRI2_FLUSH
 	if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
-	    extensions[i]->version >= __DRI2_FLUSH_VERSION) {
+	    extensions[i]->version >= 3) {
 		screen->flush = (__DRI2flushExtension *) extensions[i];
 	}
 #endif
@@ -713,11 +713,11 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
     
     for (i = 0; extensions[i]; i++) {
         if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
-	    extensions[i]->version >= __DRI_CORE_VERSION) {
+	    extensions[i]->version >= 1) {
 		screen->core = (const __DRIcoreExtension *) extensions[i];
 	}
         if (strcmp(extensions[i]->name, __DRI_DRI2) == 0 &&
-	    extensions[i]->version >= __DRI_DRI2_VERSION) {
+	    extensions[i]->version >= 1) {
 		screen->dri2 = (const __DRIdri2Extension *) extensions[i];
 	}
     }
commit 6d7ba5e0fcb5d1bce6bb213dec009f3a0f802d26
Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Sat May 1 13:07:46 2010 -0400

    dix: Update element count in FreeResource*()
    
    FreeResource() keeps clientTable[cid].elements up to date with the
    number of resources allocated to the client.  The other free
    resource functions (FreeResourceByType(),
    FreeClientNeverRetainResources() and FreeClientResources()) don't
    maintain this invariant.
    
    Typically, the only consequence is that the element count is too high
    and we end up allocating the hash table bigger than necessary.  However,
    FreeResource() also relies on the element count to restart the search if
    the list of resources has been changed during a resource destruction
    callback.  Since FreeResourceByType() doesn't update the count, if we call
    that from a resource destruction callback from FreeResource(), the
    loop isn't restarted and we end up following an invalid next pointer.
    
    Furthermore, LookupClientResourceComplex() and
    FreeClientNeverRetainResources() don't use the element count to detect
    if a callback deleted a resource and may end up following an invalid
    next pointer if the resource system is called into recursively.
    
    Signed-off-by: Kristian Høgsberg <krh at bitplanet.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/resource.c b/dix/resource.c
index 91d0cfb..ab3762e 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -589,6 +589,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
 			      res->value, TypeNameString(res->type));
 #endif		    		    
 		*prev = res->next;
+		clientTable[cid].elements--;
 
 		CallResourceStateCallback(ResourceStateFreeing, res);
 
@@ -734,12 +735,14 @@ FreeClientNeverRetainResources(ClientPtr client)
     ResourcePtr *resources;
     ResourcePtr this;
     ResourcePtr *prev;
-    int j;
+    int j, elements;
+    int *eltptr;
 
     if (!client)
 	return;
 
     resources = clientTable[client->index].resources;
+    eltptr = &clientTable[client->index].elements;
     for (j=0; j < clientTable[client->index].buckets; j++) 
     {
 	prev = &resources[j];
@@ -753,11 +756,15 @@ FreeClientNeverRetainResources(ClientPtr client)
 			      this->value, TypeNameString(this->type));
 #endif		    
 		*prev = this->next;
+		clientTable[client->index].elements--;
 
 		CallResourceStateCallback(ResourceStateFreeing, this);
 
+		elements = *eltptr;
 		(*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
 		xfree(this);
+		if (*eltptr != elements)
+		    prev = &resources[j]; /* prev may no longer be valid */
 	    }
 	    else
 		prev = &this->next;
@@ -804,6 +811,7 @@ FreeClientResources(ClientPtr client)
 			  this->value, TypeNameString(this->type));
 #endif		    
 	    *head = this->next;
+	    clientTable[client->index].elements--;
 
 	    CallResourceStateCallback(ResourceStateFreeing, this);
 
commit 10de9e8ee37265a35ceeceb2007d711da70d4f2d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Apr 16 16:35:22 2010 +1000

    xfree86: dga needs to use the master keyboard state (#27573)
    
    GetPairedDevice() may not always return the keyboard, resulting in a
    null-pointer dereference when accessing the XKB state.
    For floating devices, the GetMaster() returns the device itself.
    
    X.Org Bug 27573 <http://bugs.freedesktop.org/show_bug.cgi?id=27573>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Tested-by: Ben Hutchings <ben at decadent.org.uk>

diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 1a10327..794a131 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -1088,13 +1088,15 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
     ButtonClassPtr  butc = mouse->button;
     DGAScreenPtr    pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
     DeviceEvent     ev;
+    DeviceIntPtr    master = GetMaster(mouse, MASTER_KEYBOARD);
 
     memset(&ev, 0, sizeof(ev));
     ev.header = ET_Internal;
     ev.length = sizeof(ev);
     ev.type = event->subtype;
     ev.corestate  = butc->state;
-    ev.corestate |= XkbStateFieldFromRec(&GetPairedDevice(mouse)->key->xkbInfo->state);
+    if (master && master->key)
+        ev.corestate |= XkbStateFieldFromRec(&master->key->xkbInfo->state);
 
     UpdateDeviceState(mouse, &ev);
 
commit 758b8614477b53dc3de2b884fec5ccaf8a736432
Author: David James <davidjames at google.com>
Date:   Mon May 10 14:00:49 2010 -0700

    Fix wrong bracket values when startOver = FALSE.
    
    Currently, SyncComputeBracketValues reuses old values of bracket_greater
    and bracket_less when startOver = FALSE. This can result in incorrect bracket
    values. To fix this issue, the startOver parameter is removed, and we do not
    reuse old values of bracket_greater and bracket_less.
    
    X.Org Bug 27023 <http://bugs.freedesktop.org/show_bug.cgi?id=27023>
    
    Signed-off-by: David James <davidjames at google.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/sync.c b/Xext/sync.c
index 990cb67..e865e52 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -94,7 +94,7 @@ static SyncCounter **SysCounterList = NULL;
 #define XSyncCAAllTrigger \
     (XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
 
-static void SyncComputeBracketValues(SyncCounter *, Bool);
+static void SyncComputeBracketValues(SyncCounter *);
 
 static void SyncInitServerTime(void);
 
@@ -167,7 +167,7 @@ SyncDeleteTriggerFromCounter(SyncTrigger *pTrigger)
     }
 
     if (IsSystemCounter(pTrigger->pCounter))
-	SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE);
+	SyncComputeBracketValues(pTrigger->pCounter);
 }
 
 
@@ -194,7 +194,7 @@ SyncAddTriggerToCounter(SyncTrigger *pTrigger)
     pTrigger->pCounter->pTriglist = pCur;
 
     if (IsSystemCounter(pTrigger->pCounter))
-	SyncComputeBracketValues(pTrigger->pCounter, /*startOver*/ TRUE);
+	SyncComputeBracketValues(pTrigger->pCounter);
 
     return Success;
 }
@@ -351,7 +351,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter,
     }
     else if (IsSystemCounter(pCounter))
     {
-	SyncComputeBracketValues(pCounter, /*startOver*/ TRUE);
+	SyncComputeBracketValues(pCounter);
     }
 
     return Success;
@@ -646,7 +646,7 @@ SyncChangeCounter(SyncCounter *pCounter, CARD64 newval)
 
     if (IsSystemCounter(pCounter))
     {
-	SyncComputeBracketValues(pCounter, /* startOver */ FALSE);
+	SyncComputeBracketValues(pCounter);
     }
 }
 
@@ -913,7 +913,7 @@ SyncDestroySystemCounter(pointer pSysCounter)
 }
 
 static void
-SyncComputeBracketValues(SyncCounter *pCounter, Bool startOver)
+SyncComputeBracketValues(SyncCounter *pCounter)
 {
     SyncTriggerList *pCur;
     SyncTrigger *pTrigger;
@@ -930,11 +930,8 @@ SyncComputeBracketValues(SyncCounter *pCounter, Bool startOver)
     if (ct == XSyncCounterNeverChanges)
 	return;
 
-    if (startOver)
-    {
-	XSyncMaxValue(&psci->bracket_greater);
-	XSyncMinValue(&psci->bracket_less);
-    }
+    XSyncMaxValue(&psci->bracket_greater);
+    XSyncMinValue(&psci->bracket_less);
 
     for (pCur = pCounter->pTriglist; pCur; pCur = pCur->next)
     {
commit 95074538cce93abc1739a4d9dd78b0500fb8fec9
Merge: c079977... 2160ff5...
Author: Keith Packard <keithp at keithp.com>
Date:   Mon May 10 13:49:33 2010 -0700

    Merge remote branch 'jamey/for-keith'

commit 2160ff5240d7e11bdc6cec8859fd1f10395c8edd
Author: Jamey Sharp <jamey at minilop.net>
Date:   Fri May 7 20:00:40 2010 -0700

    Simplify error-handling in dixChangeGC.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/dix/gc.c b/dix/gc.c
index 6490165..3058e15 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -263,78 +263,68 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		break;
 	    }
 	    case GCTile:
-	    {
-		XID newpix = 0;
 		if (pUnion)
 		{
 		    NEXT_PTR(PixmapPtr, pPixmap);
-		    rc = Success;
 		}
 		else
 		{
+		    XID newpix;
 		    NEXTVAL(XID, newpix);
 		    rc = dixLookupResourceByType((pointer *)&pPixmap, newpix,
 					   RT_PIXMAP, client, DixReadAccess);
-		}
-		if (rc == Success)
-		{
-		    if ((pPixmap->drawable.depth != pGC->depth) ||
-			(pPixmap->drawable.pScreen != pGC->pScreen))
+		    if (rc != Success)
 		    {
-			error = BadMatch;
-		    }
-		    else
-		    {
-			pPixmap->refcnt++;
-			if (!pGC->tileIsPixel)
-			    (* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
-			pGC->tileIsPixel = FALSE;
-			pGC->tile.pixmap = pPixmap;
+			clientErrorValue = newpix;
+			error = (rc == BadValue) ? BadPixmap : rc;
+			break;
 		    }
 		}
+		if ((pPixmap->drawable.depth != pGC->depth) ||
+		    (pPixmap->drawable.pScreen != pGC->pScreen))
+		{
+		    error = BadMatch;
+		}
 		else
 		{
-		    clientErrorValue = newpix;
-		    error = (rc == BadValue) ? BadPixmap : rc;
+		    pPixmap->refcnt++;
+		    if (!pGC->tileIsPixel)
+			(* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
+		    pGC->tileIsPixel = FALSE;
+		    pGC->tile.pixmap = pPixmap;
 		}
 		break;
-	    }
 	    case GCStipple:
-	    {
-		XID newstipple = 0;
 		if (pUnion)
 		{
 		    NEXT_PTR(PixmapPtr, pPixmap);
-		    rc = Success;
 		}
 		else
 		{
+		    XID newstipple;
 		    NEXTVAL(XID, newstipple)
 		    rc = dixLookupResourceByType((pointer *)&pPixmap, newstipple,
 					   RT_PIXMAP, client, DixReadAccess);
-		}
-		if (rc == Success)
-		{
-		    if ((pPixmap->drawable.depth != 1) ||
-			(pPixmap->drawable.pScreen != pGC->pScreen))
+		    if (rc != Success)
 		    {
-			error = BadMatch;
-		    }
-		    else
-		    {
-			pPixmap->refcnt++;
-			if (pGC->stipple)
-			    (* pGC->pScreen->DestroyPixmap)(pGC->stipple);
-			pGC->stipple = pPixmap;
+			clientErrorValue = newstipple;
+			error = (rc == BadValue) ? BadPixmap : rc;
+			break;
 		    }
 		}
+		if ((pPixmap->drawable.depth != 1) ||
+		    (pPixmap->drawable.pScreen != pGC->pScreen))
+		{
+		    error = BadMatch;
+		}
 		else
 		{
-		    clientErrorValue = newstipple;
-		    error = (rc == BadValue) ? BadPixmap : rc;
+		    pPixmap->refcnt++;
+		    if (pGC->stipple)
+			(* pGC->pScreen->DestroyPixmap)(pGC->stipple);
+		    pGC->stipple = pPixmap;
 		}
 		break;
-	    }
 	    case GCTileStipXOrigin:
 		NEXTVAL(INT16, pGC->patOrg.x);
 		break;
@@ -344,30 +334,27 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 	    case GCFont:
     	    {
 		FontPtr	pFont;
-		XID newfont = 0;
 		if (pUnion)
 		{
 		    NEXT_PTR(FontPtr, pFont);
-		    rc = Success;
 		}
 		else
 		{
+		    XID newfont;
 		    NEXTVAL(XID, newfont)
 		    rc = dixLookupResourceByType((pointer *)&pFont, newfont,
 					   RT_FONT, client, DixUseAccess);
+		    if (rc != Success)
+		    {
+			clientErrorValue = newfont;
+			error = (rc == BadValue) ? BadFont : rc;
+			break;
+		    }
 		}
-		if (rc == Success)
-		{
-		    pFont->refcnt++;
-		    if (pGC->font)
-    		        CloseFont(pGC->font, (Font)0);
-		    pGC->font = pFont;
-		 }
-		else
-		{
-		    clientErrorValue = newfont;
-		    error = (rc == BadValue) ? BadFont : rc;
-		}
+		pFont->refcnt++;
+		if (pGC->font)
+		    CloseFont(pGC->font, (Font)0);
+		pGC->font = pFont;
 		break;
 	    }
 	    case GCSubwindowMode:
@@ -403,22 +390,16 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 		NEXTVAL(INT16, pGC->clipOrg.y);
 		break;
 	    case GCClipMask:
-	    {
-		Pixmap pid = 0;
-		int    clipType = 0;
-
 		if (pUnion)
 		{
 		    NEXT_PTR(PixmapPtr, pPixmap);
 		}
 		else
 		{
+		    Pixmap pid;
 		    NEXTVAL(Pixmap, pid)
 		    if (pid == None)
-		    {
-			clipType = CT_NONE;
 			pPixmap = NullPixmap;
-		    }
 		    else {
 			rc = dixLookupResourceByType((pointer *)&pPixmap, pid,
 					       RT_PIXMAP, client,
@@ -426,6 +407,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 			if (rc != Success) {
 			    clientErrorValue = pid;
 			    error = (rc == BadValue) ? BadPixmap : rc;
+			    break;
 			}
 		    }
 		}
@@ -436,20 +418,13 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
 			(pPixmap->drawable.pScreen != pGC->pScreen))
 		    {
 			error = BadMatch;
+			break;
 		    }
-		    else
-		    {
-			clipType = CT_PIXMAP;
-			pPixmap->refcnt++;
-		    }
-		}
-		if(error == Success)
-		{
-		    (*pGC->funcs->ChangeClip)(pGC, clipType,
-					      (pointer)pPixmap, 0);
+		    pPixmap->refcnt++;
 		}
+		(*pGC->funcs->ChangeClip)(pGC, pPixmap ? CT_PIXMAP : CT_NONE,
+					  (pointer)pPixmap, 0);
 		break;
-	    }
 	    case GCDashOffset:
 		NEXTVAL(INT16, pGC->dashOffset);
 		break;
commit 4080cd42fde8b4c693eab7557581af2622479109
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat May 8 09:41:46 2010 -0700

    miPolyPoint bugfix: Check memory allocation before changing the GC.
    
    miPolyPoint ought to leave the GC unchanged even if it fails. ajax says:
    
    > We have a new winner for the oldest-bug competition!  It's actually
    > been like that since X11R1:
    >
    > -rw-r--r--. 1 ajax ajax 2817 1987-09-12 01:20 ddx/mi/mipolypnt.c
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 5d6243a..12771ee 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -73,6 +73,9 @@ miPolyPoint(
     int			i;
     xPoint 		*ppt;
 
+    if(!(pwidthInit = xalloc(npt * sizeof(int))))
+	return;
+
     /* make pointlist origin relative */
     if (mode == CoordModePrevious)
     {
@@ -107,8 +110,6 @@ miPolyPoint(
 	DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
 	ValidateGC(pDrawable, pGC);
     }
-    if(!(pwidthInit = xalloc(npt * sizeof(int))))
-	return;
     pwidth = pwidthInit;
     for(i = 0; i < npt; i++)
 	*pwidth++ = 1;
commit ccdaecc5471cc2d56b1702eeed4280bb4d58c515
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat May 8 12:26:47 2010 -0700

    Move AppendSpanGroup from miwideline.h to miwideline.c.
    
    Also make it stop being a macro.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miwideline.c b/mi/miwideline.c
index 7e18603..181b12e 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -52,6 +52,33 @@ from The Open Group.
 #include "miwideline.h"
 #include "mi.h"
 
+/*
+ * interface data to span-merging polygon filler
+ */
+
+typedef struct _SpanData {
+    SpanGroup	fgGroup, bgGroup;
+} SpanDataRec, *SpanDataPtr;
+
+static void
+AppendSpanGroup(GCPtr pGC, unsigned long pixel, Spans *spanPtr, SpanDataPtr spanData)
+{
+    SpanGroup *group, *othergroup = NULL;
+    if (pixel == pGC->fgPixel)
+    {
+	group = &spanData->fgGroup;
+	if (pGC->lineStyle == LineDoubleDash)
+	    othergroup = &spanData->bgGroup;
+    }
+    else
+    {
+	group = &spanData->bgGroup;
+	othergroup = &spanData->fgGroup;
+    }
+    miAppendSpans (group, othergroup, spanPtr);
+}
+
+
 static void miLineArc(DrawablePtr pDraw, GCPtr pGC,
 		      unsigned long pixel, SpanDataPtr spanData,
 		      LineFacePtr leftFace,
@@ -213,7 +240,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     else
     {
 	spanRec.count = ppt - spanRec.points;
-	AppendSpanGroup (pGC, pixel, &spanRec, spanData)
+	AppendSpanGroup (pGC, pixel, &spanRec, spanData);
     }
 }
 
@@ -282,7 +309,7 @@ miFillRectPolyHelper (
 	    y++;
 	}
 	spanRec.count = ppt - spanRec.points;
-	AppendSpanGroup (pGC, pixel, &spanRec, spanData)
+	AppendSpanGroup (pGC, pixel, &spanRec, spanData);
     }
 }
 
@@ -1132,7 +1159,7 @@ miLineArc (
     else
     {
 	spanRec.count = n;
-	AppendSpanGroup (pGC, pixel, &spanRec, spanData)
+	AppendSpanGroup (pGC, pixel, &spanRec, spanData);
     }
 }
 
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 41b8bb2..1665ebf 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -31,30 +31,6 @@ from The Open Group.
 #include "mispans.h"
 #include "mifpoly.h" /* for ICEIL */
 
-/* 
- * interface data to span-merging polygon filler
- */
-
-typedef struct _SpanData {
-    SpanGroup	fgGroup, bgGroup;
-} SpanDataRec, *SpanDataPtr;
-
-#define AppendSpanGroup(pGC, pixel, spanPtr, spanData) { \
-	SpanGroup   *group, *othergroup = NULL; \
-	if (pixel == pGC->fgPixel) \
-	{ \
-	    group = &spanData->fgGroup; \
-	    if (pGC->lineStyle == LineDoubleDash) \
-		othergroup = &spanData->bgGroup; \
-	} \
-	else \
-	{ \
-	    group = &spanData->bgGroup; \
-	    othergroup = &spanData->fgGroup; \
-	} \
-	miAppendSpans (group, othergroup, spanPtr); \
-}
-
 /*
  * Polygon edge description for integer wide-line routines
  */
commit 4272d6722c0f65bdfafc95e91cc2fdb8f6bd072e
Author: Jamey Sharp <jamey at minilop.net>
Date:   Sat May 8 12:18:37 2010 -0700

    Expand macros that are used only in miFillPolyHelper.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miwideline.c b/mi/miwideline.c
index 210a625..7e18603 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -138,8 +138,31 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
     while ((left_count || left_height) &&
 	   (right_count || right_height))
     {
-	MIPOLYRELOADLEFT
-	MIPOLYRELOADRIGHT
+	if (!left_height && left_count)
+	{
+	    left_height = left->height;
+	    left_x = left->x;
+	    left_stepx = left->stepx;
+	    left_signdx = left->signdx;
+	    left_e = left->e;
+	    left_dy = left->dy;
+	    left_dx = left->dx;
+	    --left_count;
+	    ++left;
+	}
+
+	if (!right_height && right_count)
+	{
+	    right_height = right->height;
+	    right_x = right->x;
+	    right_stepx = right->stepx;
+	    right_signdx = right->signdx;
+	    right_e = right->e;
+	    right_dy = right->dy;
+	    right_dx = right->dx;
+	    --right_count;
+	    ++right;
+	}
 
 	height = left_height;
 	if (height > right_height)
@@ -157,11 +180,23 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
 		ppt++;
 		*pwidth++ = right_x - left_x + 1;
 	    }
-    	    y++;
-    	
-	    MIPOLYSTEPLEFT
+	    y++;
 
-	    MIPOLYSTEPRIGHT
+	    left_x += left_stepx;
+	    left_e += left_dx;
+	    if (left_e > 0)
+	    {
+		left_x += left_signdx;
+		left_e -= left_dy;
+	    }
+
+	    right_x += right_stepx;
+	    right_e += right_dx;
+	    if (right_e > 0)
+	    {
+		right_x += right_signdx;
+		right_e -= right_dy;
+	    }
 	}
     }
     if (!spanData)
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 1f615d6..41b8bb2 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -99,46 +99,6 @@ typedef struct _LineFace {
  * macros for polygon fillers
  */
 
-#define MIPOLYRELOADLEFT    if (!left_height && left_count) { \
-	    	    	    	left_height = left->height; \
-	    	    	    	left_x = left->x; \
-	    	    	    	left_stepx = left->stepx; \
-	    	    	    	left_signdx = left->signdx; \
-	    	    	    	left_e = left->e; \
-	    	    	    	left_dy = left->dy; \
-	    	    	    	left_dx = left->dx; \
-	    	    	    	--left_count; \
-	    	    	    	++left; \
-			    }
-
-#define MIPOLYRELOADRIGHT   if (!right_height && right_count) { \
-	    	    	    	right_height = right->height; \
-	    	    	    	right_x = right->x; \
-	    	    	    	right_stepx = right->stepx; \
-	    	    	    	right_signdx = right->signdx; \
-	    	    	    	right_e = right->e; \
-	    	    	    	right_dy = right->dy; \
-	    	    	    	right_dx = right->dx; \
-	    	    	    	--right_count; \
-	    	    	    	++right; \
-			}
-
-#define MIPOLYSTEPLEFT  left_x += left_stepx; \
-    	    	    	left_e += left_dx; \
-    	    	    	if (left_e > 0) \
-    	    	    	{ \
-	    	    	    left_x += left_signdx; \
-	    	    	    left_e -= left_dy; \
-    	    	    	}
-
-#define MIPOLYSTEPRIGHT right_x += right_stepx; \
-    	    	    	right_e += right_dx; \
-    	    	    	if (right_e > 0) \
-    	    	    	{ \
-	    	    	    right_x += right_signdx; \
-	    	    	    right_e -= right_dy; \
-    	    	    	}
-
 #define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
     oldPixel = pGC->fgPixel; \
     if (pixel != oldPixel) { \
commit c0799779dffeef8cef228bdc57aa6c8b323e7485
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Apr 26 17:22:12 2010 -0700

    dmxBERestoreRenderGlyph was passing wrong value to free
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>

diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 4e55533..c8e8dae 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -1155,7 +1155,7 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
 		     len_images);
 
     /* Clean up */
-    free(len_images);
+    free(images);
     free(gids);
     free(glyphs);    
 }
commit 946f664b6ab421f69df3dc3213b14b085424c9e4
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu May 6 17:58:29 2010 -0400

    mi: Delete wide ellipse arc cache
    
    This does make wide ellipses slower, by a factor of twoish:
    
    946000.0   521000.0 (  0.55)   10-pixel wide ellipse
     98300.0    49900.0 (  0.51)   100-pixel wide ellipse
     17700.0     9310.0 (  0.53)   500-pixel wide ellipse
     16900.0     7980.0 (  0.47)   100-pixel wide dashed ellipse
     16100.0     5370.0 (  0.33)   100-pixel wide double-dashed ellipse
    
    But no one cares, and it's a modest size win:
    
       text	   data	    bss	    dec	    hex	filename
    1773824	  69552	  59288	1902664	 1d0848	hw/vfb/Xvfb.before
    1773112	  69552	  58648	1901312	 1d0300	hw/vfb/Xvfb
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index ddcbff7..1061436 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -385,47 +385,10 @@ typedef struct {
     char top, bot, hole;
 } miArcSpanData;
 
-typedef struct {
-    unsigned long lrustamp;
-    unsigned short lw;
-    unsigned short width, height;
-    miArcSpanData *spdata;
-} arcCacheRec;
-
-#define CACHESIZE 25
-
 static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
 			 int a0, int a1, int mask, miArcFacePtr right,
 			 miArcFacePtr left, miArcSpanData *spdata);
 
-static arcCacheRec arcCache[CACHESIZE];
-static unsigned long lrustamp;
-static arcCacheRec *lastCacheHit = &arcCache[0];
-static RESTYPE cacheType;
-
-static int
-miFreeArcCache (pointer data, XID id)
-{
-    int k;
-    arcCacheRec *cent;
-
-    if (id)
-	cacheType = 0;
-
-    for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++)
-    {
-	if (cent->spdata)
-	{
-	    cent->lrustamp = 0;
-	    cent->lw = 0;
-	    xfree(cent->spdata);
-	    cent->spdata = NULL;
-	}
-    }
-    lrustamp = 0;
-    return Success;
-}
-
 static void
 miComputeCircleSpans(
     int lw,
@@ -829,76 +792,21 @@ tailX(
 }
 
 static miArcSpanData *
-miComputeWideEllipse(
-    int  lw,
-    xArc *parc,
-    Bool *mustFree)
+miComputeWideEllipse(int lw, xArc *parc)
 {
-    miArcSpanData *spdata;
-    arcCacheRec *cent, *lruent;
+    miArcSpanData *spdata = NULL;
     int k;
-    arcCacheRec fakeent;
 
     if (!lw)
 	lw = 1;
-    if (parc->height <= 1500)
-    {
-	*mustFree = FALSE;
-	cent = lastCacheHit;
-	if (cent->lw == lw &&
-	    cent->width == parc->width && cent->height == parc->height)
-	{
-	    cent->lrustamp = ++lrustamp;
-	    return cent->spdata;
-	}
-	lruent = &arcCache[0];
-	for (k = CACHESIZE, cent = lruent; --k >= 0; cent++)
-	{
-	    if (cent->lw == lw &&
-		cent->width == parc->width && cent->height == parc->height)
-	    {
-		cent->lrustamp = ++lrustamp;
-		lastCacheHit = cent;
-		return cent->spdata;
-	    }
-	    if (cent->lrustamp < lruent->lrustamp)
-		lruent = cent;
-	}
-	if (!cacheType)
-	{
-	    cacheType = CreateNewResourceType(miFreeArcCache, "miArcCache");
-	    (void) AddResource(FakeClientID(0), cacheType, NULL);
-	}
-    } else {
-	lruent = &fakeent;
-	lruent->spdata = NULL;
-	*mustFree = TRUE;
-    }
     k = (parc->height >> 1) + ((lw - 1) >> 1);
-    spdata = lruent->spdata;
-    if (!spdata || spdata->k != k)
-    {
-	if (spdata)
-	    xfree(spdata);
-	spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
-	lruent->spdata = spdata;
-	if (!spdata)
-	{
-	    lruent->lrustamp = 0;
-	    lruent->lw = 0;
-	    return spdata;
-	}
-	spdata->spans = (miArcSpan *)(spdata + 1);
-	spdata->k = k;
-    }
+    spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
+    if (!spdata)
+	return NULL;
+    spdata->spans = (miArcSpan *)(spdata + 1);
+    spdata->k = k;
     spdata->top = !(lw & 1) && !(parc->width & 1);
     spdata->bot = !(parc->height & 1);
-    lruent->lrustamp = ++lrustamp;
-    lruent->lw = lw;
-    lruent->width = parc->width;
-    lruent->height = parc->height;
-    if (lruent != &fakeent)
-	lastCacheHit = lruent;
     if (parc->width == parc->height)
 	miComputeCircleSpans(lw, parc, spdata);
     else
@@ -917,7 +825,6 @@ miFillWideEllipse(
     int *widths;
     int *wids;
     miArcSpanData *spdata;
-    Bool mustFree;
     miArcSpan *span;
     int xorg, yorgu, yorgl;
     int n;
@@ -928,7 +835,7 @@ miFillWideEllipse(
     if (!widths)
 	return;
     points = (DDXPointPtr)((char *)widths + n);
-    spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
+    spdata = miComputeWideEllipse((int)pGC->lineWidth, parc);
     if (!spdata)
     {
 	xfree(widths);
@@ -1020,8 +927,7 @@ miFillWideEllipse(
 	    wids += 2;
 	}
     }
-    if (mustFree)
-	xfree(spdata);
+    xfree(spdata);
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
 
     xfree(widths);
@@ -3358,9 +3264,8 @@ drawArc (
 	int			flipRight = 0, flipLeft = 0;			
 	int			copyEnd = 0;
 	miArcSpanData		*spdata;
-	Bool			mustFree;
 
-	spdata = miComputeWideEllipse(l, tarc, &mustFree);
+	spdata = miComputeWideEllipse(l, tarc);
 	if (!spdata)
 	    return;
 
@@ -3572,8 +3477,7 @@ drawArc (
 			left->counterClock = temp;
 		}
 	}
-	if (mustFree)
-	    xfree(spdata);
+	xfree(spdata);
 }
 
 static void
commit 580b99bb8af4ea093953c2b885bd4272aaf02baf
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:39 2010 -0700

    Return BadPicture, not BadPixmap, if alpha-map is invalid.
    
    I believe this is what was intended.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/render/picture.c b/render/picture.c
index 18bfea2..48693b8 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1115,7 +1115,7 @@ ChangePicture (PicturePtr	pPicture,
 			if (error != Success)
 			{
 			    client->errorValue = pid;
-			    error = (error == BadValue) ? BadPixmap : error;
+			    error = (error == BadValue) ? RenderErrBase + BadPicture : error;
 			    break;
 			}
 			if (pAlpha->pDrawable == NULL ||
commit c677fc611b124c44adfcfb95718798105f26357b
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:38 2010 -0700

    VERIFY_PICTURE always returns BadPicture. Don't bother specifying.
    
    Same goes for VERIFY_ALPHA, VERIFY_XIN_PICTURE, and VERIFY_XIN_ALPHA.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 072e3a6..8398be7 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -622,8 +622,7 @@ static int dmxProcRenderSetPictureTransform(ClientPtr client)
     REQUEST(xRenderSetPictureTransformReq);
 
     REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
 
     /* For the following to work with PanoramiX, it assumes that Render
      * wraps the ProcRenderVector after dmxRenderInit has been called.
@@ -663,8 +662,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client)
     REQUEST(xRenderSetPictureFilterReq);
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
 
     /* For the following to work with PanoramiX, it assumes that Render
      * wraps the ProcRenderVector after dmxRenderInit has been called.
diff --git a/render/picturestr.h b/render/picturestr.h
index 6a8d76d..5a796f4 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -408,18 +408,18 @@ extern _X_EXPORT RESTYPE	GlyphSetType;
 #define GetPictureWindow(w) ((PicturePtr)dixLookupPrivate(&(w)->devPrivates, PictureWindowPrivateKey))
 #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p)
 
-#define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
+#define VERIFY_PICTURE(pPicture, pid, client, mode) {\
     int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
 	                             PictureType, client, mode);\
     if (rc != Success)\
-	return (rc == BadValue) ? err : rc;\
+	return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
 }
 
-#define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
+#define VERIFY_ALPHA(pPicture, pid, client, mode) {\
     if (pid == None) \
 	pPicture = 0; \
     else { \
-	VERIFY_PICTURE(pPicture, pid, client, mode, err); \
+	VERIFY_PICTURE(pPicture, pid, client, mode); \
     } \
 } \
 
diff --git a/render/render.c b/render/render.c
index 2d9e47a..3c505d6 100644
--- a/render/render.c
+++ b/render/render.c
@@ -631,8 +631,7 @@ ProcRenderChangePicture (ClientPtr client)
     int len;
 
     REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
 
     len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
     if (Ones(stuff->mask) != len)
@@ -651,8 +650,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client)
     int		    result;
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     if (!pPicture->pDrawable)
         return BadDrawable;
 
@@ -677,8 +675,7 @@ ProcRenderFreePicture (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xRenderFreePictureReq);
 
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess);
     FreeResource (stuff->picture, RT_NONE);
     return(client->noClientException);
 }
@@ -709,14 +706,11 @@ ProcRenderComposite (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, 
-		  RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess);
     if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
 	(pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
 	return BadMatch;
@@ -755,10 +749,8 @@ ProcRenderTrapezoids (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -797,10 +789,8 @@ ProcRenderTriangles (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -839,10 +829,8 @@ ProcRenderTriStrip (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -881,10 +869,8 @@ ProcRenderTriFan (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -1301,10 +1287,8 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess,
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -1458,8 +1442,7 @@ ProcRenderFillRectangles (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     
@@ -1524,8 +1507,7 @@ ProcRenderCreateCursor (ClientPtr client)
     REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
     
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
     if (!pSrc->pDrawable)
         return BadDrawable;
     pScreen = pSrc->pDrawable->pScreen;
@@ -1711,8 +1693,7 @@ ProcRenderSetPictureTransform (ClientPtr client)
     int		result;
 
     REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
     if (client->noClientException != Success)
         return(client->noClientException);
@@ -1841,8 +1822,7 @@ ProcRenderSetPictureFilter (ClientPtr client)
     char	*name;
     
     REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     name = (char *) (stuff + 1);
     params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
     nparams = ((xFixed *) stuff + client->req_len) - params;
@@ -1903,8 +1883,7 @@ ProcRenderAddTraps (ClientPtr client)
     REQUEST(xRenderAddTrapsReq);
 
     REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess);
     if (!pPicture->pDrawable)
         return BadDrawable;
     ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
@@ -2659,18 +2638,18 @@ SProcRenderDispatch (ClientPtr client)
 #include "panoramiX.h"
 #include "panoramiXsrv.h"
 
-#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\
+#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
     int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
                                      XRT_PICTURE, client, mode);\
     if (rc != Success)\
-	return (rc == BadValue) ? err : rc;\
+	return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
 }
 
-#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\
+#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
     if (pid == None) \
 	pPicture = 0; \
     else { \
-	VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err); \
+	VERIFY_XIN_PICTURE(pPicture, pid, client, mode); \
     } \
 } \
 
@@ -2730,8 +2709,7 @@ PanoramiXRenderChangePicture (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2751,8 +2729,7 @@ PanoramiXRenderSetPictureClipRectangles (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2772,8 +2749,7 @@ PanoramiXRenderSetPictureTransform (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2793,8 +2769,7 @@ PanoramiXRenderSetPictureFilter (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2816,8 +2791,7 @@ PanoramiXRenderFreePicture (ClientPtr client)
 
     client->errorValue = stuff->picture;
 
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess);
     
 
     FOR_NSCREENS_BACKWARD(j) {
@@ -2842,12 +2816,9 @@ PanoramiXRenderComposite (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xRenderCompositeReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, 
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, 
-		      RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     
     orig = *stuff;
     
@@ -2890,10 +2861,8 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client)
     INT16	    xSrc, ySrc;
 
     REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) +
 				 sizeof (xGlyphElt)))
@@ -2933,8 +2902,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
     int		    extra_len;
 
     REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
     if (extra_len &&
 	(extra = (char *) xalloc (extra_len)))
@@ -2980,10 +2948,8 @@ PanoramiXRenderTrapezoids(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
 
@@ -3042,10 +3008,8 @@ PanoramiXRenderTriangles(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
 
@@ -3100,10 +3064,8 @@ PanoramiXRenderTriStrip(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTriStripReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
 
@@ -3154,10 +3116,8 @@ PanoramiXRenderTriFan(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTriFanReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
 
@@ -3208,8 +3168,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
     INT16    	    x_off, y_off;
 
     REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
-    VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
     if (extra_len &&
 	(extra = (char *) xalloc (extra_len)))
diff --git a/xfixes/region.c b/xfixes/region.c
index 795caf0..5d195a3 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -270,8 +270,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client)
     REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
     LEGAL_NEW_RESOURCE (stuff->region, client);
 
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
     
     switch (pPicture->clientClipType) {
     case CT_PIXMAP:
@@ -770,8 +769,7 @@ ProcXFixesSetPictureClipRegion (ClientPtr client)
     REQUEST(xXFixesSetPictureClipRegionReq);
     
     REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     pScreen = pPicture->pDrawable->pScreen;
     ps = GetPictureScreen (pScreen);
     VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
commit 35761d5f811406bc0b6a68c1b02bdb699142745c
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:37 2010 -0700

    Introduce dixLookupFontable for "FONT or GC" parameters.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index a4eb3f6..68c5d52 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -427,18 +427,8 @@ ProcXF86BigfontQueryFont(
 	    return BadLength;
     }
 #endif
-    client->errorValue = stuff->id;		/* EITHER font or gc */
-    dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
-			    client, DixGetAttrAccess);
-    if (!pFont) {
-	GC *pGC;
-	dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC,
-				client, DixGetAttrAccess);
-        if (!pGC)
-            return BadFont;    /* procotol spec says only error is BadFont */
-
-	pFont = pGC->font;
-    }
+    if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
+	return BadFont;    /* procotol spec says only error is BadFont */
 
     pmax = FONTINKMAX(pFont);
     pmin = FONTINKMIN(pFont);
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 982c808..a2cffac 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1283,22 +1283,13 @@ ProcQueryFont(ClientPtr client)
 {
     xQueryFontReply	*reply;
     FontPtr pFont;
-    GC *pGC;
     int rc;
     REQUEST(xResourceReq);
     REQUEST_SIZE_MATCH(xResourceReq);
 
-    client->errorValue = stuff->id;		/* EITHER font or gc */
-    rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client,
-				 DixGetAttrAccess);
-    if (rc == BadValue) {
-	rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client,
-				     DixGetAttrAccess);
-	if (rc == Success)
-	    pFont = pGC->font;
-    }
+    rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
     if (rc != Success)
-	return (rc == BadValue) ? BadFont: rc;
+	return rc;
 
     {
 	xCharInfo	*pmax = FONTINKMAX(pFont);
@@ -1339,24 +1330,15 @@ ProcQueryTextExtents(ClientPtr client)
 {
     xQueryTextExtentsReply reply;
     FontPtr pFont;
-    GC *pGC;
     ExtentInfoRec info;
     unsigned long length;
     int rc;
     REQUEST(xQueryTextExtentsReq);
     REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
         
-    client->errorValue = stuff->fid;		/* EITHER font or gc */
-    rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client,
-				 DixGetAttrAccess);
-    if (rc == BadValue) {
-	rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client,
-			       DixGetAttrAccess);
-	if (rc == Success)
-	    pFont = pGC->font;
-    }
+    rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
     if (rc != Success)
-	return (rc == BadValue) ? BadFont: rc;
+	return rc;
 
     length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
     length = length << 1;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 8278d44..d610836 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -92,6 +92,7 @@ Author:  Adobe Systems Incorporated
 #include "windowstr.h"
 #include "dixstruct.h"
 #include "pixmapstr.h"
+#include "gcstruct.h"
 #include "scrnintstr.h"
 #define  XK_LATIN1
 #include <X11/keysymdef.h>
@@ -236,6 +237,23 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
 }
 
 int
+dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
+{
+    int rc;
+    GC *pGC;
+    client->errorValue = id;		/* EITHER font or gc */
+    rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
+    if (rc != BadValue)
+	return rc;
+    rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
+    if (rc == BadValue)
+	return BadFont;
+    if (rc == Success)
+	*pFont = pGC->font;
+    return rc;
+}
+
+int
 dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
 {
     pointer pRes;
diff --git a/glx/xfont.c b/glx/xfont.c
index b8b466d..e3c7f32 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -155,7 +155,6 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
     ClientPtr client = cl->client;
     xGLXUseXFontReq *req;
     FontPtr pFont;
-    GC *pGC;
     GLuint currentListIndex;
     __GLXcontext *cx;
     int error;
@@ -181,19 +180,9 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
     ** containing a font.
     */
 
-    error = dixLookupResourceByType((pointer *)&pFont,
-				    req->font, RT_FONT,
-				    client, DixReadAccess);
-    if (error != Success) {
-	error = dixLookupResourceByType((pointer *)&pGC,
-					req->font, RT_GC,
-					client, DixReadAccess);
-        if (error != Success) {
-	    client->errorValue = req->font;
-            return error == BadGC ? BadFont : error;
-	}
-	pFont = pGC->font;
-    }
+    error = dixLookupFontable(&pFont, req->font, client, DixReadAccess);
+    if (error != Success)
+	return error;
 
     return MakeBitmapsFromFont(pFont, req->first, req->count,
 				    req->listBase);
diff --git a/include/dix.h b/include/dix.h
index dc86257..893338f 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -199,6 +199,12 @@ extern _X_EXPORT int dixLookupGC(
     ClientPtr client,
     Mask access_mode);
 
+extern _X_EXPORT int dixLookupFontable(
+    FontPtr *result,
+    XID id,
+    ClientPtr client,
+    Mask access_mode);
+
 extern _X_EXPORT int dixLookupClient(
     ClientPtr *result,
     XID id,
commit 2eab697adba4b1858a530750e9a35fba79a7bf26
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri May 7 09:32:34 2010 -0700

    Constify function prototypes in auth & xdmcp code
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Tested-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/os.h b/include/os.h
index 453ab82..3b07bde 100644
--- a/include/os.h
+++ b/include/os.h
@@ -285,7 +285,7 @@ extern _X_EXPORT int AddHost(
     ClientPtr	/*client*/,
     int         /*family*/,
     unsigned    /*length*/,
-    pointer     /*pAddr*/);
+    const void */*pAddr*/);
 
 extern _X_EXPORT Bool ForEachHostInFamily (
     int	    /*family*/,
@@ -369,9 +369,9 @@ extern _X_EXPORT int AuthorizationFromID (
 
 extern _X_EXPORT XID CheckAuthorization(
     unsigned int /*namelength*/,
-    char * /*name*/,
+    const char * /*name*/,
     unsigned int /*datalength*/,
-    char * /*data*/,
+    const char * /*data*/,
     ClientPtr /*client*/,
     char ** /*reason*/
 );
@@ -380,22 +380,22 @@ extern _X_EXPORT void ResetAuthorization(void);
 
 extern _X_EXPORT int RemoveAuthorization (
     unsigned short	name_length,
-    char		*name,
+    const char		*name,
     unsigned short	data_length,
-    char		*data);
+    const char		*data);
 
 extern _X_EXPORT int AddAuthorization(
     unsigned int	/*name_length*/,
-    char *		/*name*/,
+    const char *	/*name*/,
     unsigned int	/*data_length*/,
     char *		/*data*/);
 
 #ifdef XCSECURITY
 extern _X_EXPORT XID GenerateAuthorization(
     unsigned int   /* name_length */,
-    char	*  /* name */,
+    const char	*  /* name */,
     unsigned int   /* data_length */,
-    char	*  /* data */,
+    const char	*  /* data */,
     unsigned int * /* data_length_return */,
     char	** /* data_return */);
 #endif
diff --git a/os/access.c b/os/access.c
index 74c340a..d057e04 100644
--- a/os/access.c
+++ b/os/access.c
@@ -215,11 +215,11 @@ static int ConvertAddr(struct sockaddr * /*saddr*/,
 		       pointer * /*addr*/);
 
 static int CheckAddr(int /*family*/,
-		     pointer /*pAddr*/,
+		     const void * /*pAddr*/,
 		     unsigned /*length*/);
 
 static Bool NewHost(int /*family*/,
-		    pointer /*addr*/,
+		    const void  * /*addr*/,
 		    int /*len*/,
 		    int /* addingLocalHosts */);
 
@@ -1316,7 +1316,7 @@ int
 AddHost (ClientPtr	client,
 	 int            family,
 	 unsigned       length,        /* of bytes in pAddr */
-	 pointer        pAddr)
+	 const void *   pAddr)
 {
     int rc, len;
 
@@ -1377,7 +1377,7 @@ ForEachHostInFamily (int	    family,
  * called when starting or resetting the server */
 static Bool
 NewHost (int		family,
-	 pointer	addr,
+	 const void *	addr,
 	 int		len,
 	 int		addingLocalHosts)
 {
@@ -1512,7 +1512,7 @@ GetHosts (
 static int
 CheckAddr (
     int			family,
-    pointer		pAddr,
+    const void *	pAddr,
     unsigned		length)
 {
     int	len;
diff --git a/os/auth.c b/os/auth.c
index a852e1c..7685751 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -159,9 +159,9 @@ RegisterAuthorizations (void)
 XID
 CheckAuthorization (
     unsigned int name_length,
-    char	*name,
+    const char	*name,
     unsigned int data_length,
-    char	*data,
+    const char	*data,
     ClientPtr client,
     char	**reason)	/* failure message.  NULL for default msg */
 {
@@ -256,9 +256,9 @@ AuthorizationFromID (
 int
 RemoveAuthorization (
 	unsigned short	name_length,
-	char		*name,
+	const char	*name,
 	unsigned short	data_length,
-	char		*data)
+	const char	*data)
 {
     int	i;
 
@@ -274,7 +274,8 @@ RemoveAuthorization (
 }
 
 int
-AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *data)
+AddAuthorization (unsigned name_length, const char *name,
+		  unsigned data_length, char *data)
 {
     int	i;
 
@@ -294,9 +295,9 @@ AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *
 XID
 GenerateAuthorization(
 	unsigned name_length,
-	char	*name,
+	const char	*name,
 	unsigned data_length,
-	char	*data,
+	const char	*data,
 	unsigned *data_length_return,
 	char	**data_return)
 {
diff --git a/os/mitauth.c b/os/mitauth.c
index a7968cb..1a26dce 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -50,7 +50,7 @@ static struct auth {
 int
 MitAddCookie (
     unsigned short	data_length,
-    char		*data,
+    const char		*data,
     XID			id)
 {
     struct auth	*new;
@@ -74,7 +74,7 @@ MitAddCookie (
 XID
 MitCheckCookie (
     unsigned short	data_length,
-    char		*data,
+    const char		*data,
     ClientPtr		client,
     char		**reason)
 {
@@ -139,7 +139,7 @@ MitFromID (
 int
 MitRemoveCookie (
 	unsigned short	data_length,
-	char		*data)
+	const char	*data)
 {
     struct auth	*auth, *prev;
 
@@ -167,7 +167,7 @@ static char cookie[16]; /* 128 bits */
 XID
 MitGenerateCookie (
     unsigned	data_length,
-    char	*data,
+    const char	*data,
     XID		id,
     unsigned	*data_length_return,
     char	**data_return)
diff --git a/os/osdep.h b/os/osdep.h
index 7b1c699..1d87592 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -114,7 +114,8 @@ SOFTWARE.
 #if defined(XDMCP) || defined(HASXDMAUTH)
 typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
 typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
-typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data);
+typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
+			      unsigned data_length, char *data);
 #endif
 
 typedef struct _connectionInput {
@@ -138,19 +139,19 @@ struct _osComm;
 #define AuthInitArgs void
 typedef void (*AuthInitFunc) (AuthInitArgs);
 
-#define AuthAddCArgs unsigned short data_length, char *data, XID id
+#define AuthAddCArgs unsigned short data_length, const char *data, XID id
 typedef int (*AuthAddCFunc) (AuthAddCArgs);
 
-#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason
+#define AuthCheckArgs unsigned short data_length, const char *data, ClientPtr client, char **reason
 typedef XID (*AuthCheckFunc) (AuthCheckArgs);
 
 #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
 typedef int (*AuthFromIDFunc) (AuthFromIDArgs);
 
-#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return
+#define AuthGenCArgs unsigned data_length, const char *data, XID id, unsigned *data_length_return, char **data_return
 typedef XID (*AuthGenCFunc) (AuthGenCArgs);
 
-#define AuthRemCArgs unsigned short data_length, char *data
+#define AuthRemCArgs unsigned short data_length, const char *data
 typedef int (*AuthRemCFunc) (AuthRemCArgs);
 
 #define AuthRstCArgs void
@@ -254,29 +255,29 @@ extern void XdmcpUseMsg (void);
 extern int XdmcpOptions(int argc, char **argv, int i);
 extern void XdmcpRegisterConnection (
     int	    type,
-    char    *address,
+    const char    *address,
     int	    addrlen);
 extern void XdmcpRegisterAuthorizations (void);
-extern void XdmcpRegisterAuthorization (char *name, int namelen);
+extern void XdmcpRegisterAuthorization (const char *name, int namelen);
 extern void XdmcpInit (void);
 extern void XdmcpReset (void);
 extern void XdmcpOpenDisplay(int sock);
 extern void XdmcpCloseDisplay(int sock);
 extern void XdmcpRegisterAuthentication (
-    char    *name,
+    const char    *name,
     int	    namelen,
-    char    *data,
+    const char    *data,
     int	    datalen,
     ValidatorFunc Validator,
     GeneratorFunc Generator,
     AddAuthorFunc AddAuth);
 
 struct sockaddr_in;
-extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
+extern void XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr);
 #endif
 
 #ifdef HASXDMAUTH
-extern void XdmAuthenticationInit (char *cookie, int cookie_length);
+extern void XdmAuthenticationInit (const char *cookie, int cookie_length);
 #endif
 
 #endif /* _OSDEP_H_ */
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 5ddbe21..ec7c01f 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -55,7 +55,7 @@ extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
 static enum auth_stat why;
 
 static char * 
-authdes_ezdecode(char *inmsg, int len)
+authdes_ezdecode(const char *inmsg, int len)
 {
     struct rpc_msg  msg;
     char            cred_area[MAX_AUTH_BYTES];
@@ -127,7 +127,7 @@ CheckNetName (
 static char rpc_error[MAXNETNAMELEN+50];
 
 _X_HIDDEN XID
-SecureRPCCheck (unsigned short data_length, char *data, 
+SecureRPCCheck (unsigned short data_length, const char *data,
     ClientPtr client, char **reason)
 {
     char *fullname;
@@ -158,7 +158,7 @@ SecureRPCInit (void)
 }
 
 _X_HIDDEN int
-SecureRPCAdd (unsigned short data_length, char *data, XID id)
+SecureRPCAdd (unsigned short data_length, const char *data, XID id)
 {
     if (data_length)
 	AddHost ((pointer) 0, FamilyNetname, data_length, data);
@@ -186,7 +186,7 @@ SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap)
 }
 
 _X_HIDDEN int
-SecureRPCRemove (unsigned short data_length, char *data)
+SecureRPCRemove (unsigned short data_length, const char *data)
 {
     return 0;
 }
diff --git a/os/xdmauth.c b/os/xdmauth.c
index e19e4f9..7fab731 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -96,7 +96,7 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
 }
 
 static Bool
-XdmAuthenticationAddAuth (int name_len, char *name, 
+XdmAuthenticationAddAuth (int name_len, const char *name,
     int data_len, char *data)
 {
     Bool    ret;
@@ -114,7 +114,7 @@ XdmAuthenticationAddAuth (int name_len, char *name,
 		 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1)
 
 static int
-HexToBinary (char *in, char *out, int len)
+HexToBinary (const char *in, char *out, int len)
 {
     int	    top, bottom;
 
@@ -137,7 +137,7 @@ HexToBinary (char *in, char *out, int len)
 }
 
 void
-XdmAuthenticationInit (char *cookie, int cookie_len)
+XdmAuthenticationInit (const char *cookie, int cookie_len)
 {
     bzero (privateKey.data, 8);
     if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2))
@@ -188,7 +188,7 @@ static Bool	    gotClock;
 #define TwentyFiveMinutes (25 * 60)
 
 static Bool
-XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b)
+XdmClientAuthCompare (const XdmClientAuthPtr a, const XdmClientAuthPtr b)
 {
     int	i;
 
@@ -201,7 +201,7 @@ XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b)
 }
 
 static void
-XdmClientAuthDecode (unsigned char *plain, XdmClientAuthPtr auth)
+XdmClientAuthDecode (const unsigned char *plain, XdmClientAuthPtr auth)
 {
     int	    i, j;
 
@@ -327,7 +327,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
 }
 
 int
-XdmAddCookie (unsigned short data_length, char *data, XID id)
+XdmAddCookie (unsigned short data_length, const char *data, XID id)
 {
     XdmAuthorizationPtr	new;
     unsigned char	*rho_bits, *key_bits;
@@ -375,7 +375,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id)
 }
 
 XID
-XdmCheckCookie (unsigned short cookie_length, char *cookie, 
+XdmCheckCookie (unsigned short cookie_length, const char *cookie,
     ClientPtr xclient, char **reason)
 {
     XdmAuthorizationPtr	auth;
@@ -464,7 +464,7 @@ XdmFromID (XID id, unsigned short *data_lenp, char **datap)
 }
 
 int
-XdmRemoveCookie (unsigned short data_length, char *data)
+XdmRemoveCookie (unsigned short data_length, const char *data)
 {
     XdmAuthorizationPtr	auth;
     XdmAuthKeyPtr	key_bits, rho_bits;
diff --git a/os/xdmcp.c b/os/xdmcp.c
index c1d650d..cae7d40 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -132,14 +132,14 @@ static struct multicastinfo {
 #endif
 
 static void XdmcpAddHost(
-    struct sockaddr    *from,
+    const struct sockaddr    *from,
     int			fromlen,
     ARRAY8Ptr		AuthenticationName,
     ARRAY8Ptr		hostname,
     ARRAY8Ptr		status);
 
 static void XdmcpSelectHost(
-    struct sockaddr	*host_sockaddr,
+    const struct sockaddr *host_sockaddr,
     int			host_len,
     ARRAY8Ptr		AuthenticationName);
 
@@ -169,10 +169,10 @@ static void send_keepalive_msg(void);
 static void recv_alive_msg(unsigned /*length*/);
 
 static void XdmcpFatal(
-    char * /*type*/,
+    const char * /*type*/,
     ARRAY8Ptr /*status*/);
  
-static void XdmcpWarning(char * /*str*/);
+static void XdmcpWarning(const char * /*str*/);
 
 static void get_manager_by_name(
     int /*argc*/,
@@ -210,7 +210,7 @@ static void XdmcpWakeupHandler(
 static ARRAY8 ManufacturerDisplayID;
 
 static void
-XdmcpRegisterManufacturerDisplayID (char *name, int length)
+XdmcpRegisterManufacturerDisplayID (const char *name, int length)
 {
     int	    i;
 
@@ -332,7 +332,7 @@ static struct sockaddr_in   BroadcastAddresses[MAX_BROADCAST];
 static int		    NumBroadcastAddresses;
 
 void
-XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr)
+XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr)
 {
     struct sockaddr_in	*bcast;
     if (NumBroadcastAddresses >= MAX_BROADCAST)
@@ -364,9 +364,9 @@ static AuthenticationFuncsPtr	AuthenticationFuncsList;
 
 void
 XdmcpRegisterAuthentication (
-    char    *name,
+    const char    *name,
     int	    namelen,
-    char    *data,
+    const char    *data,
     int	    datalen,
     ValidatorFunc Validator,
     GeneratorFunc Generator,
@@ -420,7 +420,7 @@ static ARRAY8Ptr	AuthenticationData = &noAuthenticationData;
 static AuthenticationFuncsPtr	AuthenticationFuncs;
 
 static void
-XdmcpSetAuthentication (ARRAY8Ptr name)
+XdmcpSetAuthentication (const ARRAY8Ptr name)
 {
     int	i;
 
@@ -445,7 +445,7 @@ static long		xdmcpGeneration;
 void
 XdmcpRegisterConnection (
     int	    type,
-    char    *address,
+    const char    *address,
     int	    addrlen)
 {
     int	    i;
@@ -528,7 +528,7 @@ XdmcpRegisterAuthorizations (void)
 }
 
 void
-XdmcpRegisterAuthorization (char *name, int namelen)
+XdmcpRegisterAuthorization (const char *name, int namelen)
 {
     ARRAY8  authName;
     int	    i;
@@ -554,7 +554,7 @@ XdmcpRegisterAuthorization (char *name, int namelen)
 static ARRAY8	DisplayClass;
 
 static void
-XdmcpRegisterDisplayClass (char *name, int length)
+XdmcpRegisterDisplayClass (const char *name, int length)
 {
     int	    i;
 
@@ -728,7 +728,7 @@ XdmcpWakeupHandler(
 
 static void
 XdmcpSelectHost(
-    struct sockaddr	*host_sockaddr,
+    const struct sockaddr	*host_sockaddr,
     int			host_len,
     ARRAY8Ptr		AuthenticationName)
 {
@@ -748,7 +748,7 @@ XdmcpSelectHost(
 /*ARGSUSED*/
 static void
 XdmcpAddHost(
-    struct sockaddr    *from,
+    const struct sockaddr    *from,
     int			fromlen,
     ARRAY8Ptr		AuthenticationName,
     ARRAY8Ptr		hostname,
@@ -854,7 +854,7 @@ send_packet(void)
  */
 
 static void
-XdmcpDeadSession (char *reason)
+XdmcpDeadSession (const char *reason)
 {
     ErrorF ("XDM: %s, declaring session dead\n", reason);
     state = XDM_INIT_STATE;
@@ -1448,7 +1448,7 @@ recv_alive_msg (unsigned length)
 
 static  void
 XdmcpFatal (
-    char	*type,
+    const char	*type,
     ARRAY8Ptr	status)
 {
     FatalError ("XDMCP fatal error: %s %*.*s\n", type,
@@ -1456,15 +1456,15 @@ XdmcpFatal (
 }
 
 static  void
-XdmcpWarning(char *str)
+XdmcpWarning(const char *str)
 {
     ErrorF("XDMCP warning: %s\n", str);
 }
 
 static void
 get_addr_by_name(
-    char *	argtype,
-    char *	namestr,
+    const char *argtype,
+    const char *namestr,
     int		port,
     int		socktype,
     SOCKADDR_TYPE *addr,
commit e2e2747f40c4b9e23dba38ea656d4c082e83a794
Author: Matthias Hopf <mhopf at suse.de>
Date:   Fri May 7 18:46:30 2010 +0200

    Fix mod() definition.
    
    Presumably no implications, especially security-wise.
    
    Signed-off-by: Matthias Hopf <mhopf at suse.de>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index 5fd1a67..ddcbff7 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1524,7 +1524,7 @@ miRoundCap(
 
 # define Dsin(d)	((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
 # define Dcos(d)	((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
-# define mod(a,b)	((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+# define mod(a,b)	((a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b))
 
 static double
 miDcos (double a)
commit 626f97688a89dbc5da80390d822d21b1a737de0e
Author: Adam Tkac <atkac at redhat.com>
Date:   Fri May 7 17:02:03 2010 +1000

    Export XkbCopyDeviceKeymap from Xorg, it is needed by VNC.
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index a5d25d0..b3a8319 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -906,7 +906,7 @@ extern Bool XkbCopyKeymap(
         XkbDescPtr              /* dst */,
         XkbDescPtr              /* src */);
 
-extern Bool XkbCopyDeviceKeymap(
+extern _X_EXPORT Bool XkbCopyDeviceKeymap(
         DeviceIntPtr            /* dst */,
         DeviceIntPtr            /* src */);
 
commit 21ed660f30a3f96c787ab00a16499e0fb034b2ad
Author: Chris Humbert <freedesktop at mahadri.com>
Date:   Fri May 7 17:02:43 2010 +1000

    dix: make DeviceEvent coordinates signed for Xinerama. #24986
    
    With Xinerama enabled, event coordinates are relative to Screen 0, so
    they can be negative.  The new DeviceEvent's coordinates are of type
    uint16_t, making screens above and to the left of Screen 0 unusable.
    
    X.Org Bug 24986 <https://bugs.freedesktop.org/show_bug.cgi?id=24986>
    
    Signed-off-by: Chris Humbert <freedesktop at mahadri.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/eventstr.h b/include/eventstr.h
index 79685c1..433227e 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -91,9 +91,9 @@ struct _DeviceEvent
         uint32_t button;  /**< Button number */
         uint32_t key;     /**< Key code */
     } detail;
-    uint16_t root_x;      /**< Pos relative to root window in integral data */
+    int16_t root_x;       /**< Pos relative to root window in integral data */
     float root_x_frac;    /**< Pos relative to root window in frac part */
-    uint16_t root_y;      /**< Pos relative to root window in integral part */
+    int16_t root_y;       /**< Pos relative to root window in integral part */
     float root_y_frac;    /**< Pos relative to root window in frac part */
     uint8_t    buttons[(MAX_BUTTONS + 7)/8]; /**< Button mask */
     struct {
commit 9802839d35aaf788790f1d0e8300db4693a70096
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri May 7 16:22:12 2010 +1000

    Xi: reset the known properties at the end of the server generation.
    
    Properties allocated through XIGetKnownProperty() aren't reset on the second
    server generation but keep the old value. As a result, wrong Atoms are
    supplied to the driver, resulting in potential data corruption or weird
    error message.
    
    Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server.
    The second X server generation won't have the FLOAT atom defined anymore,
    despite the users of this atom not noticing any errors.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index b7910cd..37f9856 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1122,6 +1122,7 @@ RestoreExtensionEvents(void)
 static void
 IResetProc(ExtensionEntry * unused)
 {
+    XIResetProperties();
 
     ReplySwapVector[IReqCode] = ReplyNotSwappd;
     EventSwapVector[DeviceValuator] = NotImplemented;
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index be07831..8b80637 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -403,6 +403,15 @@ XIGetKnownProperty(char *name)
     return 0;
 }
 
+void
+XIResetProperties(void)
+{
+    int i;
+
+    for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
+        dev_properties[i].type = None;
+}
+
 /**
  * Convert the given property's value(s) into @nelem_return integer values and
  * store them in @buf_return. If @nelem_return is larger than the number of
diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h
index 69b41fa..d8b8863 100644
--- a/Xi/xiproperty.h
+++ b/Xi/xiproperty.h
@@ -62,4 +62,7 @@ void SRepXIListProperties(ClientPtr client, int size,
                           xXIListPropertiesReply *rep);
 void SRepXIGetProperty(ClientPtr client, int size,
                        xXIGetPropertyReply *rep);
+
+void XIResetProperties(void);
+
 #endif /* XIPROPERTY_H */


More information about the Xquartz-changes mailing list