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 /xfixes | |
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 'xfixes')
-rw-r--r-- | xfixes/cursor.c | 28 | ||||
-rw-r--r-- | xfixes/region.c | 8 | ||||
-rw-r--r-- | xfixes/select.c | 6 |
3 files changed, 21 insertions, 21 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 2aba0cec9..b7e6c7b8c 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 5d195a30c..2649c06ce 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 5ba7896cb..6d86f63af 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; } |