summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2022-05-29 20:37:26 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2022-06-03 15:52:56 -0400
commitc3ad9cf5b11772fbc9ff4dd793f0a7e897b5df5a (patch)
treed3bc8ae95c777e712e25b0e8c823f2d8c93d24ca
parenta9ce40d7f51dd20533d25e2a252afb1d09194d3f (diff)
downloadxorg-lib-libXft-c3ad9cf5b11772fbc9ff4dd793f0a7e897b5df5a.tar.gz
change the internal memory-allocator to use size_t
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/xftfreetype.c6
-rw-r--r--src/xftinit.c31
-rw-r--r--src/xftint.h4
3 files changed, 22 insertions, 19 deletions
diff --git a/src/xftfreetype.c b/src/xftfreetype.c
index 2db163b..4d11550 100644
--- a/src/xftfreetype.c
+++ b/src/xftfreetype.c
@@ -58,7 +58,7 @@ _XftGetFile (const FcChar8 *file, int id)
if (!f)
return NULL;
- XftMemAlloc (XFT_MEM_FILE, (int)(sizeof (XftFtFile) + strlen ((const char *) file) + 1));
+ XftMemAlloc (XFT_MEM_FILE, sizeof (XftFtFile) + strlen ((const char *) file) + 1);
if (XftDebug () & XFT_DBG_REF)
printf ("FontFile %s/%d matches new\n",
file, id);
@@ -776,7 +776,7 @@ XftFontOpenInfo (Display *dpy,
FcChar32 rehash_value;
FcBool antialias;
int max_glyph_memory;
- int alloc_size;
+ size_t alloc_size;
int ascent, descent, height;
int i;
int num_glyphs;
@@ -882,7 +882,7 @@ XftFontOpenInfo (Display *dpy,
alloc_size = (sizeof (XftFontInt) +
(size_t)num_glyphs * sizeof (XftGlyph *) +
hash_value * sizeof (XftUcsHash));
- font = malloc ((size_t)alloc_size);
+ font = malloc (alloc_size);
if (!font)
goto bail2;
diff --git a/src/xftinit.c b/src/xftinit.c
index 46196ab..0a52536 100644
--- a/src/xftinit.c
+++ b/src/xftinit.c
@@ -44,9 +44,9 @@ XftGetVersion (void)
static struct {
const char *name;
int alloc_count;
- int alloc_mem;
+ size_t alloc_mem;
int free_count;
- int free_mem;
+ size_t free_mem;
} XftInUse[XFT_MEM_NUM] = {
{ "XftDraw", 0, 0, 0, 0 },
{ "XftFont", 0, 0, 0, 0 },
@@ -54,12 +54,15 @@ static struct {
{ "XftGlyph", 0, 0, 0, 0 },
};
-static int XftAllocCount, XftAllocMem;
-static int XftFreeCount, XftFreeMem;
+static int XftAllocCount;
+static size_t XftAllocMem;
-static const int XftMemNotice = 1*1024*1024;
+static int XftFreeCount;
+static size_t XftFreeMem;
-static int XftAllocNotify, XftFreeNotify;
+static const size_t XftMemNotice = 1*1024*1024;
+
+static size_t XftAllocNotify, XftFreeNotify;
_X_HIDDEN void
XftMemReport (void)
@@ -69,20 +72,20 @@ XftMemReport (void)
printf ("\t Which Alloc Free\n");
printf ("\t count bytes count bytes\n");
for (i = 0; i < XFT_MEM_NUM; i++)
- printf ("\t%8.8s%8d%8d%8d%8d\n",
+ printf ("\t%8.8s%8d%8lu%8d%8lu\n",
XftInUse[i].name,
- XftInUse[i].alloc_count, XftInUse[i].alloc_mem,
- XftInUse[i].free_count, XftInUse[i].free_mem);
- printf ("\t%8.8s%8d%8d%8d%8d\n",
+ XftInUse[i].alloc_count, (unsigned long) XftInUse[i].alloc_mem,
+ XftInUse[i].free_count, (unsigned long) XftInUse[i].free_mem);
+ printf ("\t%8.8s%8d%8lu%8d%8lu\n",
"Total",
- XftAllocCount, XftAllocMem,
- XftFreeCount, XftFreeMem);
+ XftAllocCount, (unsigned long) XftAllocMem,
+ XftFreeCount, (unsigned long) XftFreeMem);
XftAllocNotify = 0;
XftFreeNotify = 0;
}
_X_HIDDEN void
-XftMemAlloc (int kind, int size)
+XftMemAlloc (int kind, size_t size)
{
if (XftDebug() & XFT_DBG_MEMORY)
{
@@ -97,7 +100,7 @@ XftMemAlloc (int kind, int size)
}
_X_HIDDEN void
-XftMemFree (int kind, int size)
+XftMemFree (int kind, size_t size)
{
if (XftDebug() & XFT_DBG_MEMORY)
{
diff --git a/src/xftint.h b/src/xftint.h
index a8400de..9882e12 100644
--- a/src/xftint.h
+++ b/src/xftint.h
@@ -415,10 +415,10 @@ void
XftMemReport (void);
void
-XftMemAlloc (int kind, int size);
+XftMemAlloc (int kind, size_t size);
void
-XftMemFree (int kind, int size);
+XftMemFree (int kind, size_t size);
/* xftlist.c */
FcFontSet *