diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /hw/xnest | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
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@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xnest')
-rw-r--r-- | hw/xnest/Color.c | 36 | ||||
-rw-r--r-- | hw/xnest/Cursor.c | 4 | ||||
-rw-r--r-- | hw/xnest/Display.c | 4 | ||||
-rw-r--r-- | hw/xnest/Font.c | 4 | ||||
-rw-r--r-- | hw/xnest/GC.c | 6 | ||||
-rw-r--r-- | hw/xnest/Keyboard.c | 6 | ||||
-rw-r--r-- | hw/xnest/Pixmap.c | 2 | ||||
-rw-r--r-- | hw/xnest/Screen.c | 18 |
8 files changed, 40 insertions, 40 deletions
diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 2e6de15e4..b3f0fc488 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 12f47e725..9ae210228 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 01290417c..b78aff597 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 7b388f0f4..f1ccd7e73 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 65425e98f..4082bfc57 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 1835c7071..570866bc4 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 676a2ba95..583f877f3 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 ca903d7ac..8c1c2449d 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 |