[PATCH:xdm 3/5] Stop casting free() arguments to (char *)

Alan Coopersmith alan.coopersmith at oracle.com
Sat May 14 11:01:31 PDT 2011


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 chooser/chooser.c |   12 ++++++------
 xdm/access.c      |   18 +++++++++---------
 xdm/auth.c        |   14 +++++++-------
 xdm/choose.c      |   12 ++++++------
 xdm/dpylist.c     |    8 ++++----
 xdm/file.c        |    4 ++--
 xdm/krb5auth.c    |    6 +++---
 xdm/mitauth.c     |   12 ++++++------
 xdm/protodpy.c    |   10 +++++-----
 xdm/rpcauth.c     |    6 +++---
 xdm/server.c      |    2 +-
 xdm/util.c        |    4 ++--
 xdm/xdmauth.c     |   18 +++++++++---------
 xdm/xdmcp.c       |   12 ++++++------
 14 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/chooser/chooser.c b/chooser/chooser.c
index 01201b7..6033fb4 100644
--- a/chooser/chooser.c
+++ b/chooser/chooser.c
@@ -312,7 +312,7 @@ RebuildTable (int size)
 	qsort (newTable, size, sizeof (char *), HostnameCompare);
     }
     XawListChange (list, newTable, size, 0, TRUE);
-    free ((char *) NameTable);
+    free (NameTable);
     NameTable = newTable;
     NameTableSize = size;
 }
@@ -388,8 +388,8 @@ AddHostname (ARRAY8Ptr hostname, ARRAY8Ptr status, struct sockaddr *addr, int wi
 	}
 	if (!XdmcpAllocARRAY8 (&new->hostaddr, hostAddr.length))
 	{
-	    free ((char *) new->fullname);
-	    free ((char *) new);
+	    free (new->fullname);
+	    free (new);
 	    return 0;
 	}
 	memmove( new->hostaddr.data, hostAddr.data, hostAddr.length);
@@ -436,8 +436,8 @@ DisposeHostname (HostName *host)
     XdmcpDisposeARRAY8 (&host->hostname);
     XdmcpDisposeARRAY8 (&host->hostaddr);
     XdmcpDisposeARRAY8 (&host->status);
-    free ((char *) host->fullname);
-    free ((char *) host);
+    free (host->fullname);
+    free (host);
 }
 
 #if 0
@@ -551,7 +551,7 @@ RegisterHostaddr (struct sockaddr *addr, int len, xdmOpCode type)
     host->addr = (struct sockaddr *) malloc (len);
     if (!host->addr)
     {
-	free ((char *) host);
+	free (host);
 	return;
     }
     memmove( (char *) host->addr, (char *) addr, len);
diff --git a/xdm/access.c b/xdm/access.c
index ceace37..8db64b3 100644
--- a/xdm/access.c
+++ b/xdm/access.c
@@ -187,7 +187,7 @@ FreeHostEntry (HostEntry *h)
     case HOST_CHOOSER:
 	break;
     }
-    free ((char *) h);
+    free (h);
 }
 
 static void
@@ -212,7 +212,7 @@ FreeDisplayEntry (DisplayEntry *d)
 	next = h->next;
 	FreeHostEntry (h);
     }
-    free ((char *) d);
+    free (d);
 }
 
 static void
@@ -310,7 +310,7 @@ tryagain:
 	h->type = HOST_ALIAS;
 	h->entry.aliasName = strdup (hostOrAlias);
 	if (!h->entry.aliasName) {
-	    free ((char *) h);
+	    free (h);
 	    return NULL;
 	}
     }
@@ -371,7 +371,7 @@ tryagain:
 	{
 	    Debug ("No such host %s\n", hostOrAlias);
 	    LogError ("Access file \"%s\", host \"%s\" not found\n", accessFile, hostOrAlias);
-	    free ((char *) h);
+	    free (h);
 # if defined(IPv6) && defined(AF_INET6)
 	    if (ai)
 		freeaddrinfo(ai);
@@ -381,7 +381,7 @@ tryagain:
 	if (!XdmcpAllocARRAY8 (&h->entry.hostAddress, addr_length))
 	{
 	    LogOutOfMem ("ReadHostEntry\n");
-	    free ((char *) h);
+	    free (h);
 # if defined(IPv6) && defined(AF_INET6)
 	    if (ai)
 		freeaddrinfo(ai);
@@ -432,7 +432,7 @@ tryagain:
 	d->entry.aliasName = strdup (displayOrAlias);
 	if (!d->entry.aliasName)
 	{
-	    free ((char *) d);
+	    free (d);
 	    return NULL;
 	}
     }
@@ -453,7 +453,7 @@ tryagain:
 	    d->entry.displayPattern = strdup (displayOrAlias);
 	    if (!d->entry.displayPattern)
 	    {
-		free ((char *) d);
+		free (d);
 		return NULL;
 	    }
 	}
@@ -490,7 +490,7 @@ tryagain:
 	    if (addr == NULL)
 	    {
 		LogError ("Access file %s, display %s unknown\n", accessFile, displayOrAlias);
-		free ((char *) d);
+		free (d);
 # if defined(IPv6) && defined(AF_INET6)
 		if (ai)
 		    freeaddrinfo(ai);
@@ -501,7 +501,7 @@ tryagain:
 	    display = &d->entry.displayAddress;
 	    if (!XdmcpAllocARRAY8 (&display->clientAddress, addr_length))
 	    {
-		free ((char *) d);
+		free (d);
 # if defined(IPv6) && defined(AF_INET6)
 		if (ai)
 		    freeaddrinfo(ai);
diff --git a/xdm/auth.c b/xdm/auth.c
index ec3a1cc..10791d2 100644
--- a/xdm/auth.c
+++ b/xdm/auth.c
@@ -496,7 +496,7 @@ SetLocalAuthorization (struct display *d)
     {
 	for (i = 0; i < d->authNum; i++)
 	    XauDisposeAuth (d->authorizations[i]);
-	free ((char *) d->authorizations);
+	free (d->authorizations);
 	d->authorizations = (Xauth **) NULL;
 	d->authNum = 0;
     }
@@ -505,7 +505,7 @@ SetLocalAuthorization (struct display *d)
     for (i = 0; d->authNames[i]; i++)
 	;
     d->authNameNum = i;
-    free ((char *) d->authNameLens);
+    free (d->authNameLens);
     d->authNameLens = (unsigned short *) malloc
 				(d->authNameNum * sizeof (unsigned short));
     if (!d->authNameLens)
@@ -531,7 +531,7 @@ SetLocalAuthorization (struct display *d)
     {
 	for (i = 0; i < j; i++)
 	    XauDisposeAuth (auths[i]);
-	free ((char *) auths);
+	free (auths);
     }
 }
 
@@ -664,7 +664,7 @@ doneAddrs (void)
 		n = a->next;
 		free (a->address);
 		free (a->number);
-		free ((char *) a);
+		free (a);
 	}
 }
 
@@ -684,7 +684,7 @@ saveEntry (Xauth *auth)
 		new->address = malloc (auth->address_length);
 		if (!new->address) {
 			LogOutOfMem ("saveEntry");
-			free ((char *) new);
+			free (new);
 			return;
 		}
 		memmove( new->address, auth->address, (int) auth->address_length);
@@ -695,7 +695,7 @@ saveEntry (Xauth *auth)
 		if (!new->number) {
 			LogOutOfMem ("saveEntry");
 			free (new->address);
-			free ((char *) new);
+			free (new);
 			return;
 		}
 		memmove( new->number, auth->number, (int) auth->number_length);
@@ -707,7 +707,7 @@ saveEntry (Xauth *auth)
 			LogOutOfMem ("saveEntry");
 			free (new->number);
 			free (new->address);
-			free ((char *) new);
+			free (new);
 			return;
 		}
 		memmove( new->name, auth->name, (int) auth->name_length);
diff --git a/xdm/choose.c b/xdm/choose.c
index c4cda8a..05a58b8 100644
--- a/xdm/choose.c
+++ b/xdm/choose.c
@@ -130,7 +130,7 @@ RememberIndirectClient (
     i = (IndirectUsersPtr) malloc (sizeof (IndirectUsersRec));
     if (!XdmcpCopyARRAY8 (clientAddress, &i->client))
     {
-	free ((char *) i);
+	free (i);
 	return 0;
     }
     i->connectionType = connectionType;
@@ -157,7 +157,7 @@ ForgetIndirectClient (
 	    else
 		indirectUsers = i->next;
 	    XdmcpDisposeARRAY8 (&i->client);
-	    free ((char *) i);
+	    free (i);
 	    break;
 	}
 	prev = i;
@@ -268,7 +268,7 @@ IndirectChoice (
 		choices = next;
 	    XdmcpDisposeARRAY8 (&c->client);
 	    XdmcpDisposeARRAY8 (&c->choice);
-	    free ((char *) c);
+	    free (c);
 	}
 	else
 	{
@@ -318,7 +318,7 @@ RegisterIndirectChoice (
 	c->connectionType = connectionType;
 	if (!XdmcpCopyARRAY8 (clientAddress, &c->client))
 	{
-	    free ((char *) c);
+	    free (c);
 	    return 0;
 	}
     }
@@ -329,7 +329,7 @@ RegisterIndirectChoice (
     if (!XdmcpCopyARRAY8 (choice, &c->choice))
     {
 	XdmcpDisposeARRAY8 (&c->client);
-	free ((char *) c);
+	free (c);
 	return 0;
     }
     if (insert)
@@ -361,7 +361,7 @@ RemoveIndirectChoice (clientAddress, connectionType)
 		choices = c->next;
 	    XdmcpDisposeARRAY8 (&c->client);
 	    XdmcpDisposeARRAY8 (&c->choice);
-	    free ((char *) c);
+	    free (c);
 	    return;
 	}
 	prev = c;
diff --git a/xdm/dpylist.c b/xdm/dpylist.c
index 148f524..ad50e76 100644
--- a/xdm/dpylist.c
+++ b/xdm/dpylist.c
@@ -152,7 +152,7 @@ RemoveDisplay (struct display *old)
 	    {
 		for (i = 0; i < d->authNum; i++)
 		    XauDisposeAuth (d->authorizations[i]);
-		free ((char *) d->authorizations);
+		free (d->authorizations);
 	    }
 	    free (d->clientAuthFile);
 	    if (d->authFile)
@@ -169,7 +169,7 @@ RemoveDisplay (struct display *old)
 	    XdmcpDisposeARRAY8 (&d->clientAddr);
 #endif
 	    free (d->windowPath);
-	    free ((char *) d);
+	    free (d);
 	    break;
 	}
 	p = d;
@@ -190,7 +190,7 @@ NewDisplay (char *name, char *class)
     d->name = strdup (name);
     if (!d->name) {
 	LogOutOfMem ("NewDisplay");
-	free ((char *) d);
+	free (d);
 	return NULL;
     }
     if (class)
@@ -199,7 +199,7 @@ NewDisplay (char *name, char *class)
 	if (!d->class) {
 	    LogOutOfMem ("NewDisplay");
 	    free (d->name);
-	    free ((char *) d);
+	    free (d);
 	    return NULL;
 	}
     }
diff --git a/xdm/file.c b/xdm/file.c
index d64bb15..9cb0922 100644
--- a/xdm/file.c
+++ b/xdm/file.c
@@ -53,7 +53,7 @@ freeFileArgs (char **args)
 
     for (a = args; *a; a++)
 	free (*a);
-    free ((char *) args);
+    free (args);
 }
 
 static char **
@@ -133,7 +133,7 @@ freeSomeArgs (char **args, int n)
     a = args;
     while (n--)
 	free (*a++);
-    free ((char *) args);
+    free (args);
 }
 
 void
diff --git a/xdm/krb5auth.c b/xdm/krb5auth.c
index 2316945..094e54a 100644
--- a/xdm/krb5auth.c
+++ b/xdm/krb5auth.c
@@ -111,7 +111,7 @@ Krb5GetAuthFor(unsigned short namelen, char *name, char *dname)
 	if (!new->data)
 	{
 	    free (filename);
-	    free ((char *) new);
+	    free (new);
 	    return (Xauth *) 0;
 	}
 	strcpy(new->data, "UU:");
@@ -128,8 +128,8 @@ Krb5GetAuthFor(unsigned short namelen, char *name, char *dname)
     new->name = (char *) malloc (namelen);
     if (!new->name)
     {
-	free ((char *) new->data);
-	free ((char *) new);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     memmove( new->name, name, namelen);
diff --git a/xdm/mitauth.c b/xdm/mitauth.c
index a2b419a..372d2cf 100644
--- a/xdm/mitauth.c
+++ b/xdm/mitauth.c
@@ -69,23 +69,23 @@ MitGetAuth (unsigned short namelen, char *name)
     new->data = (char *) malloc (AUTH_DATA_LEN);
     if (!new->data)
     {
-	free ((char *) new);
+	free (new);
 	return (Xauth *) 0;
     }
     new->name = (char *) malloc (namelen);
     if (!new->name)
     {
-	free ((char *) new->data);
-	free ((char *) new);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     memmove( (char *)new->name, name, namelen);
     new->name_length = namelen;
     if (!GenerateAuthData (new->data, AUTH_DATA_LEN))
     {
-	free((char *) new->name);
-	free((char *) new->data);
-	free((char *) new);
+	free (new->name);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     new->data_length = AUTH_DATA_LEN;
diff --git a/xdm/protodpy.c b/xdm/protodpy.c
index f8ada4b..66d6213 100644
--- a/xdm/protodpy.c
+++ b/xdm/protodpy.c
@@ -111,7 +111,7 @@ NewProtoDisplay (
     pdpy->address = (XdmcpNetaddr) malloc (addrlen);
     if (!pdpy->address)
     {
-	free ((char *) pdpy);
+	free (pdpy);
 	return NULL;
     }
     pdpy->addrlen = addrlen;
@@ -121,8 +121,8 @@ NewProtoDisplay (
     pdpy->date = date;
     if (!XdmcpCopyARRAY8 (connectionAddress, &pdpy->connectionAddress))
     {
-	free ((char *) pdpy->address);
-	free ((char *) pdpy);
+	free (pdpy->address);
+	free (pdpy);
 	return NULL;
     }
     pdpy->sessionID = sessionID;
@@ -157,8 +157,8 @@ DisposeProtoDisplay (struct protoDisplay *pdpy)
     if (pdpy->xdmcpAuthorization)
 	XauDisposeAuth (pdpy->xdmcpAuthorization);
     XdmcpDisposeARRAY8 (&pdpy->connectionAddress);
-    free ((char *) pdpy->address);
-    free ((char *) pdpy);
+    free (pdpy->address);
+    free (pdpy);
 }
 
 #endif /* XDMCP */
diff --git a/xdm/rpcauth.c b/xdm/rpcauth.c
index de13aad..2dc4d9d 100644
--- a/xdm/rpcauth.c
+++ b/xdm/rpcauth.c
@@ -72,14 +72,14 @@ SecureRPCGetAuth (
     new->data = (char *) malloc (new->data_length);
     if (!new->data)
     {
-	free ((char *) new);
+	free (new);
 	return (Xauth *) 0;
     }
     new->name = (char *) malloc (namelen);
     if (!new->name)
     {
-	free ((char *) new->data);
-	free ((char *) new);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     memmove( new->name, name, namelen);
diff --git a/xdm/server.c b/xdm/server.c
index 9d4c4e2..0d69a8e 100644
--- a/xdm/server.c
+++ b/xdm/server.c
@@ -252,7 +252,7 @@ GetRemoteAddress (struct display *d, int fd)
     struct netbuf	netb;
 # endif
 
-    free ((char *) d->peer);
+    free (d->peer);
 # ifdef STREAMSCONN
     netb.maxlen = sizeof(buf);
     netb.buf = buf;
diff --git a/xdm/util.c b/xdm/util.c
index 3058450..cf1075e 100644
--- a/xdm/util.c
+++ b/xdm/util.c
@@ -233,7 +233,7 @@ parseArgs (char **argv, char *string)
 				save = malloc ((unsigned) (string - word + 1));
 				if (!newargv || !save) {
 					LogOutOfMem ("parseArgs");
-					free ((char *) argv);
+					free (argv);
 					free (newargv);
 					free (save);
 					return NULL;
@@ -264,7 +264,7 @@ freeArgs (char **argv)
 
     for (a = argv; *a; a++)
 	free (*a);
-    free ((char *) argv);
+    free (argv);
 }
 
 void
diff --git a/xdm/xdmauth.c b/xdm/xdmauth.c
index e01b306..fbee684 100644
--- a/xdm/xdmauth.c
+++ b/xdm/xdmauth.c
@@ -101,23 +101,23 @@ XdmGetAuthHelper (unsigned short namelen, char *name, int includeRho)
     new->data = (char *) malloc (new->data_length);
     if (!new->data)
     {
-	free ((char *) new);
+	free (new);
 	return (Xauth *) 0;
     }
     new->name = (char *) malloc (namelen);
     if (!new->name)
     {
-	free ((char *) new->data);
-	free ((char *) new);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     memmove( (char *)new->name, name, namelen);
     new->name_length = namelen;
     if (!GenerateAuthData ((char *)new->data, new->data_length))
     {
-	free ((char *) new->name);
-	free ((char *) new->data);
-	free ((char *) new);
+	free (new->name);
+	free (new->data);
+	free (new);
 	return (Xauth *) 0;
     }
     /*
@@ -162,9 +162,9 @@ XdmGetXdmcpAuth (struct protoDisplay *pdpy,
     if (!fileauth->name || !fileauth->data)
     {
 	XauDisposeAuth (xdmcpauth);
-	free ((char *) fileauth->name);
-	free ((char *) fileauth->data);
-	free ((char *) fileauth);
+	free (fileauth->name);
+	free (fileauth->data);
+	free (fileauth);
 	return;
     }
     /*
diff --git a/xdm/xdmcp.c b/xdm/xdmcp.c
index 96910c1..81be647 100644
--- a/xdm/xdmcp.c
+++ b/xdm/xdmcp.c
@@ -1229,7 +1229,7 @@ manage (
 	    }
 	    else
 	    {
-		free ((char *) class);
+		free (class);
 		class = (char *) NULL;
 	    }
 	    from_save = (XdmcpNetaddr) malloc (fromlen);
@@ -1243,7 +1243,7 @@ manage (
 	    d = NewDisplay (name, class);
 	    if (!d)
 	    {
-		free ((char *) from_save);
+		free (from_save);
 		send_failed (from, fromlen, name, sessionID,
 		  "out of memory", fd);
 		goto abort;
@@ -1276,8 +1276,8 @@ manage (
 		d->authorizations = (Xauth **) malloc (sizeof (Xauth *));
 		if (!d->authorizations)
 		{
-		    free ((char *) from_save);
-		    free ((char *) d);
+		    free (from_save);
+		    free (d);
 		    send_failed (from, fromlen, name, sessionID,
 		      "out of memory", fd);
 		    goto abort;
@@ -1293,8 +1293,8 @@ manage (
     }
 abort:
     XdmcpDisposeARRAY8 (&displayClass);
-    free ((char*) name);
-    free ((char*) class);
+    free (name);
+    free (class);
 }
 
 void
-- 
1.7.3.2



More information about the xorg-devel mailing list