From 06bb154df0a4d6e35885bce6a63057bd8f8636e8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 2 Mar 2017 15:38:08 +0100 Subject: replace (DE)ALLOCATE_LOCAL by malloc/free This is basically a backport of the following commits + replacing xalloc/xfree by malloc/free. Fixes ArcticaProject/nx-libs#358. commit 2761c103311a1160bc483fd0367d654733df8598 Author: Daniel Stone Date: Mon Nov 5 14:03:26 2007 +0000 OS: Remove usage of alloca Replace with heap allocations. commit 5e363500c86042c394595e1a6633581eb8fcd1bb Author: Daniel Stone Date: Mon Nov 5 14:38:28 2007 +0000 OS: Remove ALLOCATE_LOCAL from os.h Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and remove the include of Xalloca.h as well. --- nx-X11/programs/Xserver/mi/mibitblt.c | 42 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'nx-X11/programs/Xserver/mi/mibitblt.c') diff --git a/nx-X11/programs/Xserver/mi/mibitblt.c b/nx-X11/programs/Xserver/mi/mibitblt.c index 143f18043..2fdc32500 100644 --- a/nx-X11/programs/Xserver/mi/mibitblt.c +++ b/nx-X11/programs/Xserver/mi/mibitblt.c @@ -143,21 +143,21 @@ miCopyArea(pSrcDrawable, pDstDrawable, } pptFirst = ppt = (DDXPointPtr) - ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec)); + malloc(heightSrc * sizeof(DDXPointRec)); pwidthFirst = pwidth = (unsigned int *) - ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int)); + malloc(heightSrc * sizeof(unsigned int)); numRects = RegionNumRects(prgnSrcClip); boxes = RegionRects(prgnSrcClip); ordering = (unsigned int *) - ALLOCATE_LOCAL(numRects * sizeof(unsigned int)); + malloc(numRects * sizeof(unsigned int)); if(!pptFirst || !pwidthFirst || !ordering) { if (ordering) - DEALLOCATE_LOCAL(ordering); + free(ordering); if (pwidthFirst) - DEALLOCATE_LOCAL(pwidthFirst); + free(pwidthFirst); if (pptFirst) - DEALLOCATE_LOCAL(pptFirst); + free(pptFirst); return (RegionPtr)NULL; } @@ -264,9 +264,9 @@ miCopyArea(pSrcDrawable, pDstDrawable, if(realSrcClip) RegionDestroy(prgnSrcClip); - DEALLOCATE_LOCAL(ordering); - DEALLOCATE_LOCAL(pwidthFirst); - DEALLOCATE_LOCAL(pptFirst); + free(ordering); + free(pwidthFirst); + free(pptFirst); return prgnExposed; } @@ -436,12 +436,12 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) dixChangeGC(NullClient, pGCT, GCBackground, NULL, gcv); ValidateGC((DrawablePtr)pPixmap, pGCT); miClearDrawable((DrawablePtr)pPixmap, pGCT); - ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); - pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); + ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec)); + pwidth = pwidthFirst = (int *)malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { - if (pwidthFirst) DEALLOCATE_LOCAL(pwidthFirst); - if (pptFirst) DEALLOCATE_LOCAL(pptFirst); + if (pwidthFirst) free(pwidthFirst); + if (pptFirst) free(pptFirst); FreeScratchGC(pGCT); return; } @@ -467,8 +467,8 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) (*pGCT->ops->SetSpans)((DrawablePtr)pPixmap, pGCT, (char *)pbits, pptFirst, pwidthFirst, h, TRUE); - DEALLOCATE_LOCAL(pwidthFirst); - DEALLOCATE_LOCAL(pptFirst); + free(pwidthFirst); + free(pptFirst); /* Save current values from the client GC */ @@ -810,14 +810,14 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) break; case ZPixmap: - ppt = pptFirst = (DDXPointPtr)ALLOCATE_LOCAL(h * sizeof(DDXPointRec)); - pwidth = pwidthFirst = (int *)ALLOCATE_LOCAL(h * sizeof(int)); + ppt = pptFirst = (DDXPointPtr)malloc(h * sizeof(DDXPointRec)); + pwidth = pwidthFirst = (int *)malloc(h * sizeof(int)); if(!pptFirst || !pwidthFirst) { if (pwidthFirst) - DEALLOCATE_LOCAL(pwidthFirst); + free(pwidthFirst); if (pptFirst) - DEALLOCATE_LOCAL(pptFirst); + free(pptFirst); return; } if (pGC->miTranslate) @@ -836,8 +836,8 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) (*pGC->ops->SetSpans)(pDraw, pGC, (char *)pImage, pptFirst, pwidthFirst, h, TRUE); - DEALLOCATE_LOCAL(pwidthFirst); - DEALLOCATE_LOCAL(pptFirst); + free(pwidthFirst); + free(pptFirst); break; } } -- cgit v1.2.3