Commit bf3501e0 authored by Alan Coopersmith's avatar Alan Coopersmith

Remove unnecessary casts of pointers to (char *) in calls to Xfree()

Left one cast behind that is necessary to change from const char *
to char * in src/xlibi18n/lcCharSet.c.
Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 6ead9dd9
......@@ -1105,10 +1105,10 @@ _XimProtoCloseIM(
next = ic->core.next;
#ifdef XIM_CONNECTABLE
if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) {
Xfree ((char *) ic);
Xfree (ic);
}
#else
Xfree ((char *) ic);
Xfree (ic);
#endif /* XIM_CONNECTABLE */
ic = next;
}
......
......@@ -231,7 +231,7 @@ _XimLocalCloseIM(
while (ic) {
(*ic->methods->destroy) (ic);
next = ic->core.next;
Xfree ((char *) ic);
Xfree (ic);
ic = next;
}
_XimLocalIMFree(im);
......
......@@ -227,7 +227,7 @@ _XimThaiCloseIM(XIM xim)
while (ic) {
(*ic->methods->destroy) (ic);
next = ic->core.next;
Xfree ((char *) ic);
Xfree (ic);
ic = next;
}
_XimThaiIMFree(im);
......
......@@ -564,9 +564,9 @@ close_converter(
XlcConv conv)
{
if (conv->state)
Xfree((char *) conv->state);
Xfree(conv->state);
Xfree((char *) conv);
Xfree(conv);
}
static XlcConv
......
......@@ -1224,7 +1224,7 @@ stdc_wcstocts(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -1544,7 +1544,7 @@ stdc_ctstowcs(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -1580,7 +1580,7 @@ stdc_cstowcs(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -1616,7 +1616,7 @@ mbstocts(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -2063,7 +2063,7 @@ stdc_wcstostr(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -2338,7 +2338,7 @@ ctstombs(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -2374,7 +2374,7 @@ cstombs(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -2583,7 +2583,7 @@ stdc_strtowcs(
ret:
if (buf)
Xfree((char *)buf);
Xfree(buf);
return (unconv_num1 + unconv_num2);
}
......@@ -2597,14 +2597,14 @@ close_converter(
XlcConv conv)
{
if (conv->state) {
Xfree((char *) conv->state);
Xfree(conv->state);
}
if (conv->methods) {
Xfree((char *) conv->methods);
Xfree(conv->methods);
}
Xfree((char *) conv);
Xfree(conv);
}
/* -------------------------------------------------------------------------- */
......
......@@ -1363,7 +1363,7 @@ static void
close_converter(
XlcConv conv)
{
Xfree((char *) conv);
Xfree(conv);
}
enum { MBSTOCS, WCSTOCS, MBTOCS, CSTOMBS, CSTOWCS, MBSTOWCS, WCSTOMBS,
......
......@@ -520,10 +520,10 @@ close_converter(
XlcConv conv)
{
if (conv->state) {
Xfree((char *) conv->state);
Xfree(conv->state);
}
Xfree((char *) conv);
Xfree(conv);
}
static XlcConv
......
......@@ -1420,7 +1420,7 @@ static void
close_converter(
XlcConv conv)
{
Xfree((char *) conv);
Xfree(conv);
}
......
......@@ -126,7 +126,7 @@ static void ResizeTable(DB db)
*head = entry;
}
}
Xfree((char *) otable);
Xfree(otable);
}
static void _XFreeContextDB(Display *display)
......@@ -140,12 +140,12 @@ static void _XFreeContextDB(Display *display)
for (i = db->mask + 1, pentry = db->table ; --i >= 0; pentry++) {
for (entry = *pentry; entry; entry = next) {
next = entry->next;
Xfree((char *)entry);
Xfree(entry);
}
}
Xfree((char *) db->table);
Xfree(db->table);
_XFreeMutex(&db->linfo);
Xfree((char *) db);
Xfree(db);
}
}
......@@ -186,7 +186,7 @@ int XSaveContext(
db->mask = INITHASHMASK;
db->table = Xcalloc(db->mask + 1, sizeof(TableEntry));
if (!db->table) {
Xfree((char *)db);
Xfree(db);
return XCNOMEM;
}
db->numentries = 0;
......@@ -289,7 +289,7 @@ int XDeleteContext(Display *display, XID rid, XContext context)
prev = &entry->next) {
if (entry->rid == rid && entry->context == context) {
*prev = entry->next;
Xfree((char *) entry);
Xfree(entry);
db->numentries--;
if (db->numentries < db->mask && db->mask > INITHASHMASK)
ResizeTable(db);
......
......@@ -58,7 +58,7 @@ Status XFetchName (
*name = (char *)data;
return(1);
}
if (data) Xfree ((char *)data);
if (data) Xfree (data);
*name = NULL;
return(0);
}
......@@ -89,7 +89,7 @@ Status XGetIconName (
*icon_name = (char*)data;
return(1);
}
if (data) Xfree ((char *)data);
if (data) Xfree (data);
*icon_name = NULL;
return(0);
}
......@@ -166,13 +166,13 @@ XFreeFont(
#ifdef USE_XF86BIGFONT
_XF86BigfontFreeFontMetrics(fs);
#else
Xfree ((char *) fs->per_char);
Xfree (fs->per_char);
#endif
}
_XFreeExtData(fs->ext_data);
if (fs->properties)
Xfree ((char *) fs->properties);
Xfree ((char *) fs);
Xfree (fs->properties);
Xfree (fs);
return 1;
}
......@@ -249,7 +249,7 @@ _XQueryFont (
fs->properties = Xmalloc (pbytes);
}
if (! fs->properties) {
Xfree((char *) fs);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
......@@ -271,8 +271,8 @@ _XQueryFont (
}
}
if (! fs->per_char) {
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
......@@ -493,7 +493,7 @@ _XF86BigfontQueryFont (
fs->properties = Xmalloc (pbytes);
}
if (! fs->properties) {
Xfree((char *) fs);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
......@@ -507,8 +507,8 @@ _XF86BigfontQueryFont (
any real font needs, so the combined total doesn't overflow either */
if (reply.nUniqCharInfos > ((ULONG_MAX / 2) / SIZEOF(xCharInfo)) ||
reply.nCharInfos > ((ULONG_MAX / 2) / sizeof(CARD16))) {
Xfree((char *) fs->properties);
Xfree((char *) fs);
Xfree(fs->properties);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
......@@ -524,15 +524,15 @@ _XF86BigfontQueryFont (
+ (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16);
pUniqCI = Xmalloc (nbytes);
if (!pUniqCI) {
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
if (! (fs->per_char = Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) {
Xfree((char *) pUniqCI);
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
Xfree(pUniqCI);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
_XEatDataWords(dpy, reply_left);
return (XFontStruct *)NULL;
}
......@@ -541,15 +541,15 @@ _XF86BigfontQueryFont (
for (i = 0; i < reply.nCharInfos; i++) {
if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) {
fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n");
Xfree((char *) pUniqCI);
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
Xfree(pUniqCI);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
return (XFontStruct *)NULL;
}
/* XXX the next statement won't work if short isn't 16 bits */
fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]];
}
Xfree((char *) pUniqCI);
Xfree(pUniqCI);
} else {
#ifdef HAS_SHM
XExtData *pData;
......@@ -558,8 +558,8 @@ _XF86BigfontQueryFont (
pData = Xmalloc(sizeof(XExtData));
if (!pData) {
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
return (XFontStruct *)NULL;
}
......@@ -577,9 +577,9 @@ _XF86BigfontQueryFont (
if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) {
if (extcodes->serverCapabilities & CAP_VerifiedLocal)
fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n");
Xfree((char *) pData);
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
Xfree(pData);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
/* Stop requesting shared memory transport from now on. */
extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
return (XFontStruct *)NULL;
......@@ -592,9 +592,9 @@ _XF86BigfontQueryFont (
&& buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32)
&& *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) {
shmdt(addr);
Xfree((char *) pData);
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
Xfree(pData);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
/* Stop requesting shared memory transport from now on. */
extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
return (XFontStruct *)NULL;
......@@ -611,8 +611,8 @@ _XF86BigfontQueryFont (
fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset);
#else
fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n");
if (fs->properties) Xfree((char *) fs->properties);
Xfree((char *) fs);
if (fs->properties) Xfree(fs->properties);
Xfree(fs);
/* Stop requesting shared memory transport from now on. */
extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
return (XFontStruct *)NULL;
......@@ -638,9 +638,9 @@ _XF86BigfontFreeFontMetrics (XFontStruct *fs)
XF86BigfontNumber)))
shmdt ((char *) pData->private_data);
else
Xfree ((char *) fs->per_char);
Xfree (fs->per_char);
#else
Xfree ((char *) fs->per_char);
Xfree (fs->per_char);
#endif
}
......@@ -693,14 +693,14 @@ int _XF86LoadQueryLocaleFont(
#ifdef USE_XF86BIGFONT
_XF86BigfontFreeFontMetrics(fs);
#else
Xfree ((char *) fs->per_char);
Xfree (fs->per_char);
#endif
}
_XFreeExtData(fs->ext_data);
if (fs->properties)
Xfree ((char *) fs->properties);
Xfree (fs->properties);
*fidp = fs->fid;
Xfree ((char *) fs);
Xfree (fs);
} else {
XFreeFont(dpy, fs);
}
......
......@@ -107,7 +107,7 @@ XFontStruct **info) /* RETURN */
if (! (finfo = Xmalloc(sizeof(XFontStruct) * size)))
goto clearwire;
if (! (flist = Xmalloc(sizeof(char *) * (size+1)))) {
Xfree((char *) finfo);
Xfree(finfo);
goto clearwire;
}
}
......@@ -152,7 +152,7 @@ XFontStruct **info) /* RETURN */
nbytes++; /* make first string 1 byte longer, to match XListFonts */
flist[i] = Xmalloc (nbytes);
if (! flist[i]) {
if (finfo[i].properties) Xfree((char *) finfo[i].properties);
if (finfo[i].properties) Xfree(finfo[i].properties);
goto badmem;
}
if (!i) {
......@@ -177,10 +177,10 @@ XFontStruct **info) /* RETURN */
if (j == 0)
flist[j]--; /* was incremented above */
Xfree(flist[j]);
if (finfo[j].properties) Xfree((char *) finfo[j].properties);
if (finfo[j].properties) Xfree(finfo[j].properties);
}
if (flist) Xfree((char *) flist);
if (finfo) Xfree((char *) finfo);
if (flist) Xfree(flist);
if (finfo) Xfree(finfo);
clearwire:
/* Clear the wire. */
......@@ -208,7 +208,7 @@ XFreeFontInfo (
for (i = 1; i < actualCount; i++) {
Xfree (names[i]);
}
Xfree((char *) names);
Xfree(names);
}
if (info) {
for (i = 0; i < actualCount; i++) {
......@@ -216,12 +216,12 @@ XFreeFontInfo (
#ifdef USE_XF86BIGFONT
_XF86BigfontFreeFontMetrics(&info[i]);
#else
Xfree ((char *) info[i].per_char);
Xfree (info[i].per_char);
#endif
if (info[i].properties)
Xfree ((char *) info[i].properties);
Xfree (info[i].properties);
}
Xfree((char *) info);
Xfree(info);
}
return 1;
}
......@@ -73,7 +73,7 @@ int *actualCount) /* RETURN */
}
if ((! flist) || (! ch)) {
if (flist) Xfree((char *) flist);
if (flist) Xfree(flist);
if (ch) Xfree(ch);
_XEatDataWords(dpy, rep.length);
*actualCount = 0;
......@@ -116,7 +116,7 @@ XFreeFontNames(char **list)
Xfree (*names);
}
Xfree (list[0]-1);
Xfree ((char *)list);
Xfree (list);
}
return 1;
}
......@@ -36,9 +36,9 @@ _XFreeExtData (XExtData *extension)
while (extension) {
if (extension->free_private)
(*extension->free_private)(extension);
else Xfree ((char *)extension->private_data);
else Xfree (extension->private_data);
temp = extension->next;
Xfree ((char *)extension);
Xfree (extension);
extension = temp;
}
return 0;
......
......@@ -44,7 +44,7 @@ XFreeGC (
UnlockDisplay(dpy);
SyncHandle();
_XFreeExtData(gc->ext_data);
Xfree ((char *) gc);
Xfree (gc);
return 1;
}
......@@ -57,7 +57,7 @@ char **XGetFontPath(
}
if ((! flist) || (! ch)) {
if (flist) Xfree((char *) flist);
if (flist) Xfree(flist);
if (ch) Xfree(ch);
_XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
......@@ -93,7 +93,7 @@ XFreeFontPath (char **list)
{
if (list != NULL) {
Xfree (list[0]-1);
Xfree ((char *)list);
Xfree (list);
}
return 1;
}
......@@ -75,7 +75,7 @@ Status XGetSizeHints (
if ((actual_type != XA_WM_SIZE_HINTS) ||
(nitems < OldNumPropSizeElements) || (actual_format != 32)) {
if (prop != NULL) Xfree ((char *)prop);
if (prop != NULL) Xfree (prop);
return(0);
}
hints->flags = (prop->flags & (USPosition|USSize|PAllHints));
......@@ -93,7 +93,7 @@ Status XGetSizeHints (
hints->min_aspect.y = cvtINT32toInt (prop->minAspectY);
hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX);
hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY);
Xfree((char *)prop);
Xfree(prop);
return(1);
}
......@@ -124,7 +124,7 @@ XWMHints *XGetWMHints (
if ((actual_type != XA_WM_HINTS) ||
(nitems < (NumPropWMHintsElements - 1)) || (actual_format != 32)) {
if (prop != NULL) Xfree ((char *)prop);
if (prop != NULL) Xfree (prop);
return(NULL);
}
/* static copies not allowed in library, due to reentrancy constraint*/
......@@ -142,7 +142,7 @@ XWMHints *XGetWMHints (
else
hints->window_group = 0;
}
Xfree ((char *)prop);
Xfree (prop);
return(hints);
}
......@@ -196,7 +196,7 @@ Status XGetIconSizes (
(nitems < NumPropIconSizeElements) ||
(nitems % NumPropIconSizeElements != 0) ||
(actual_format != 32)) {
if (prop != NULL) Xfree ((char *)prop);
if (prop != NULL) Xfree (prop);
return(0);
}
......@@ -204,7 +204,7 @@ Status XGetIconSizes (
nitems /= NumPropIconSizeElements;
if (! (hp = hints = Xcalloc (nitems, sizeof(XIconSize)))) {
if (prop) Xfree ((char *) prop);
if (prop) Xfree (prop);
return 0;
}
......@@ -221,7 +221,7 @@ Status XGetIconSizes (
}
*count = nitems;
*size_list = hints;
Xfree ((char *)prop);
Xfree (prop);
return(1);
}
......@@ -239,7 +239,7 @@ Status XGetCommand (
if (!XGetTextProperty (dpy, w, &tp, XA_WM_COMMAND)) return 0;
if (tp.encoding != XA_STRING || tp.format != 8) {
if (tp.value) Xfree ((char *) tp.value);
if (tp.value) Xfree (tp.value);
return 0;
}
......@@ -254,11 +254,11 @@ Status XGetCommand (
* create a string list and return if successful
*/
if (!XTextPropertyToStringList (&tp, &argv, &argc)) {
if (tp.value) Xfree ((char *) tp.value);
if (tp.value) Xfree (tp.value);
return (0);
}
if (tp.value) Xfree ((char *) tp.value);
if (tp.value) Xfree (tp.value);
*argvp = argv;
*argcp = argc;
return 1;
......@@ -317,7 +317,7 @@ XGetClassHint(
if ( (actual_type == XA_STRING) && (actual_format == 8) ) {
len_name = strlen((char *) data);
if (! (classhint->res_name = Xmalloc(len_name + 1))) {
Xfree((char *) data);
Xfree(data);
return (0);
}
strcpy(classhint->res_name, (char *) data);
......@@ -326,7 +326,7 @@ XGetClassHint(
if (! (classhint->res_class = Xmalloc(len_class + 1))) {
Xfree(classhint->res_name);
classhint->res_name = (char *) NULL;
Xfree((char *) data);
Xfree(data);
return (0);
}
strcpy(classhint->res_class, (char *) (data+len_name+1));
......
......@@ -83,7 +83,7 @@ Status XGetWMSizeHints (
if ((actual_type != XA_WM_SIZE_HINTS) ||
(nitems < OldNumPropSizeElements) || (actual_format != 32)) {
if (prop != NULL) Xfree ((char *)prop);
if (prop != NULL) Xfree (prop);
return False;
}
......@@ -112,7 +112,7 @@ Status XGetWMSizeHints (
*supplied |= (PBaseSize | PWinGravity);
}
hints->flags &= (*supplied); /* get rid of unwanted bits */
Xfree((char *)prop);
Xfree(prop);
return True;
}
......
......@@ -63,7 +63,7 @@ Status XGetRGBColormaps (
/* if wrong type or format, or too small for us, then punt */
if ((actual_type != XA_RGB_COLOR_MAP) || (actual_format != 32) ||
(nitems < OldNumPropStandardColormapElements)) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
......@@ -78,7 +78,7 @@ Status XGetRGBColormaps (
Screen *sp = _XScreenOfWindow (dpy, w);
if (!sp) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
def_visual = sp->root_visual->visualid;
......@@ -90,7 +90,7 @@ Status XGetRGBColormaps (
ncmaps = (nitems / NumPropStandardColormapElements);
if ((((unsigned long) ncmaps) * NumPropStandardColormapElements) !=
nitems) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
}
......@@ -101,7 +101,7 @@ Status XGetRGBColormaps (
*/
cmaps = Xmalloc (ncmaps * sizeof (XStandardColormap));
if (!cmaps) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
......@@ -126,7 +126,7 @@ Status XGetRGBColormaps (
map->killid = (old_style ? None : prop->killid);
}
}
Xfree ((char *) data);
Xfree (data);
*stdcmap = cmaps;
*count = ncmaps;
return True;
......
......@@ -81,7 +81,7 @@ Status XGetStandardColormap (
int i;
if (!sp) {
if (stdcmaps) Xfree ((char *) stdcmaps);
if (stdcmaps) Xfree (stdcmaps);
return False;
}
vid = sp->root_visual->visualid;
......@@ -91,7 +91,7 @@ Status XGetStandardColormap (
}
if (i == nstdcmaps) { /* not found */
Xfree ((char *) stdcmaps);
Xfree (stdcmaps);
return False;
}
use = &stdcmaps[i];
......@@ -111,7 +111,7 @@ Status XGetStandardColormap (
cmap->blue_mult = use->blue_mult;
cmap->base_pixel = use->base_pixel;
Xfree ((char *) stdcmaps); /* don't need alloced memory */
Xfree (stdcmaps); /* don't need alloced memory */
}
return stat;
}
......@@ -77,7 +77,7 @@ Status XGetWMColormapWindows (
return False;
if (actual_type != XA_WINDOW || actual_format != 32) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
......
......@@ -77,7 +77,7 @@ Status XGetWMProtocols (
return False;
if (actual_type != XA_ATOM || actual_format != 32) {
if (data) Xfree ((char *) data);
if (data) Xfree (data);
return False;
}
......