[poppler] poppler/splash: SplashClip.cc, 1.1.1.1, 1.2 SplashFTFontFile.cc, 1.1.1.1, 1.2 SplashFont.cc, 1.1.1.1, 1.2 SplashPath.cc, 1.1.1.1, 1.2 SplashScreen.cc, 1.1.1.1, 1.2 SplashState.cc, 1.1.1.1, 1.2 SplashT1FontFile.cc, 1.1.1.1, 1.2 SplashXPath.cc, 1.1.1.1, 1.2 SplashXPathScanner.cc, 1.1.1.1, 1.2

Brad Hards bradh at freedesktop.org
Sat Aug 27 01:43:45 PDT 2005


Update of /cvs/poppler/poppler/splash
In directory gabe:/tmp/cvs-serv7837/splash

Modified Files:
	SplashClip.cc SplashFTFontFile.cc SplashFont.cc SplashPath.cc 
	SplashScreen.cc SplashState.cc SplashT1FontFile.cc 
	SplashXPath.cc SplashXPathScanner.cc 
Log Message:
Merge the gmalloc -> gmallocn changes from xpdf 3.0.1. This change is
based on martink's work (13-xpdf-3.01-goo-allocn.patch) with some
tweaking by me. There may be some residual gmallocn changes still to
be merged.


Index: SplashClip.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashClip.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashClip.cc	3 Mar 2005 19:45:59 -0000	1.1.1.1
+++ SplashClip.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -61,10 +61,10 @@
   yMax = clip->yMax;
   length = clip->length;
   size = clip->size;
-  paths = (SplashXPath **)gmalloc(size * sizeof(SplashXPath *));
-  flags = (Guchar *)gmalloc(size * sizeof(Guchar));
+  paths = (SplashXPath **)gmallocn(size, sizeof(SplashXPath *));
+  flags = (Guchar *)gmallocn(size, sizeof(Guchar));
   scanners = (SplashXPathScanner **)
-                 gmalloc(size * sizeof(SplashXPathScanner *));
+                 gmallocn(size, sizeof(SplashXPathScanner *));
   for (i = 0; i < length; ++i) {
     paths[i] = clip->paths[i]->copy();
     flags[i] = clip->flags[i];
@@ -92,10 +92,10 @@
     while (size < length + nPaths) {
       size *= 2;
     }
-    paths = (SplashXPath **)grealloc(paths, size * sizeof(SplashXPath *));
-    flags = (Guchar *)grealloc(flags, size * sizeof(Guchar));
+    paths = (SplashXPath **)greallocn(paths, size, sizeof(SplashXPath *));
+    flags = (Guchar *)greallocn(flags, size, sizeof(Guchar));
     scanners = (SplashXPathScanner **)
-                   grealloc(scanners, size * sizeof(SplashXPathScanner *));
+                   greallocn(scanners, size, sizeof(SplashXPathScanner *));
   }
 }
 

Index: SplashFTFontFile.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashFTFontFile.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashFTFontFile.cc	3 Mar 2005 19:45:59 -0000	1.1.1.1
+++ SplashFTFontFile.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -34,7 +34,7 @@
   if (FT_New_Face(engineA->lib, fileNameA, 0, &faceA)) {
     return NULL;
   }
-  codeToGIDA = (Gushort *)gmalloc(256 * sizeof(int));
+  codeToGIDA = (Gushort *)gmallocn(256, sizeof(int));
   for (i = 0; i < 256; ++i) {
     codeToGIDA[i] = 0;
     if ((name = encA[i])) {

Index: SplashFont.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashFont.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashFont.cc	3 Mar 2005 19:45:59 -0000	1.1.1.1
+++ SplashFont.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -70,9 +70,9 @@
   } else {
     cacheSets = 1;
   }
-  cache = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
-  cacheTags = (SplashFontCacheTag *)gmalloc(cacheSets * cacheAssoc *
-					      sizeof(SplashFontCacheTag));
+  cache = (Guchar *)gmallocn(cacheSets* cacheAssoc, glyphSize);
+  cacheTags = (SplashFontCacheTag *)gmallocn(cacheSets * cacheAssoc,
+					     sizeof(SplashFontCacheTag));
   for (i = 0; i < cacheSets * cacheAssoc; ++i) {
     cacheTags[i].mru = i & (cacheAssoc - 1);
   }

Index: SplashPath.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashPath.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashPath.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashPath.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -40,8 +40,8 @@
 SplashPath::SplashPath(SplashPath *path) {
   length = path->length;
   size = path->size;
-  pts = (SplashPathPoint *)gmalloc(size * sizeof(SplashPathPoint));
-  flags = (Guchar *)gmalloc(size * sizeof(Guchar));
+  pts = (SplashPathPoint *)gmallocn(size, sizeof(SplashPathPoint));
+  flags = (Guchar *)gmallocn(size, sizeof(Guchar));
   memcpy(pts, path->pts, length * sizeof(SplashPathPoint));
   memcpy(flags, path->flags, length * sizeof(Guchar));
   curSubpath = path->curSubpath;
@@ -61,8 +61,8 @@
     while (size < length + nPts) {
       size *= 2;
     }
-    pts = (SplashPathPoint *)grealloc(pts, size * sizeof(SplashPathPoint));
-    flags = (Guchar *)grealloc(flags, size * sizeof(Guchar));
+    pts = (SplashPathPoint *)greallocn(pts, size, sizeof(SplashPathPoint));
+    flags = (Guchar *)greallocn(flags, size, sizeof(Guchar));
   }
 }
 

Index: SplashScreen.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashScreen.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashScreen.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashScreen.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -32,7 +32,7 @@
   }
 
   // initialize the threshold matrix
-  mat = (SplashCoord *)gmalloc(2 * size * size * sizeof(SplashCoord));
+  mat = (SplashCoord *)gmallocn(2 * size * size, sizeof(SplashCoord));
   for (y = 0; y < 2 * size; ++y) {
     for (x = 0; x < size; ++x) {
       mat[y * size + x] = -1;
@@ -40,7 +40,7 @@
   }
 
   // build the distance matrix
-  dist = (SplashCoord *)gmalloc(2 * size * size * sizeof(SplashCoord));
+  dist = (SplashCoord *)gmallocn(2 * size * size, sizeof(SplashCoord));
   for (y = 0; y < size; ++y) {
     for (x = 0; x < size; ++x) {
       if (x + y < size - 1) {

Index: SplashState.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashState.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashState.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashState.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -51,7 +51,7 @@
   flatness = state->flatness;
   if (state->lineDash) {
     lineDashLength = state->lineDashLength;
-    lineDash = (SplashCoord *)gmalloc(lineDashLength * sizeof(SplashCoord));
+    lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
     memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
   } else {
     lineDash = NULL;
@@ -90,7 +90,7 @@
   gfree(lineDash);
   lineDashLength = lineDashLengthA;
   if (lineDashLength > 0) {
-    lineDash = (SplashCoord *)gmalloc(lineDashLength * sizeof(SplashCoord));
+    lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
     memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
   } else {
     lineDash = NULL;

Index: SplashT1FontFile.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashT1FontFile.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashT1FontFile.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashT1FontFile.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -48,8 +48,8 @@
       encStrSize += strlen(encA[i]) + 1;
     }
   }
-  encTmp = (char **)gmalloc(257 * sizeof(char *));
-  encStrTmp = (char *)gmalloc(encStrSize * sizeof(char));
+  encTmp = (char **)gmallocn(257, sizeof(char *));
+  encStrTmp = (char *)gmallocn(encStrSize, sizeof(char));
   encPtr = encStrTmp;
   for (i = 0; i < 256; ++i) {
     if (encA[i]) {

Index: SplashXPath.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashXPath.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashXPath.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashXPath.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -172,7 +172,7 @@
 SplashXPath::SplashXPath(SplashXPath *xPath) {
   length = xPath->length;
   size = xPath->size;
-  segs = (SplashXPathSeg *)gmalloc(size * sizeof(SplashXPathSeg));
+  segs = (SplashXPathSeg *)gmallocn(size, sizeof(SplashXPathSeg));
   memcpy(segs, xPath->segs, length * sizeof(SplashXPathSeg));
 }
 
@@ -189,7 +189,7 @@
     while (size < length + nSegs) {
       size *= 2;
     }
-    segs = (SplashXPathSeg *)grealloc(segs, size * sizeof(SplashXPathSeg));
+    segs = (SplashXPathSeg *)greallocn(segs, size, sizeof(SplashXPathSeg));
   }
 }
 

Index: SplashXPathScanner.cc
===================================================================
RCS file: /cvs/poppler/poppler/splash/SplashXPathScanner.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SplashXPathScanner.cc	3 Mar 2005 19:46:00 -0000	1.1.1.1
+++ SplashXPathScanner.cc	27 Aug 2005 08:43:43 -0000	1.2
@@ -222,8 +222,8 @@
       } else {
 	interSize *= 2;
       }
-      inter = (SplashIntersect *)grealloc(inter,
-					  interSize * sizeof(SplashIntersect));
+      inter = (SplashIntersect *)greallocn(inter, interSize,
+					   sizeof(SplashIntersect));
     }
 
     if (seg->flags & splashXPathHoriz) {



More information about the poppler mailing list