diff options
author | Adam Jackson <ajax@redhat.com> | 2009-01-22 02:11:16 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-01-22 02:11:16 -0500 |
commit | 132b464d734b077038e19b21e46d3a6258f4b998 (patch) | |
tree | 4fe179cf69d6013a32aaa8e17a28b3fc905e6274 /os | |
parent | 0fb4390526bb829ab17ff4635d41a3012f63c1b2 (diff) |
Remove a bunch of useless casts.
We've had void * for twenty years now people let's try to act like we
know how it works.
Diffstat (limited to 'os')
-rw-r--r-- | os/WaitFor.c | 2 | ||||
-rw-r--r-- | os/access.c | 12 | ||||
-rw-r--r-- | os/connection.c | 10 | ||||
-rw-r--r-- | os/io.c | 16 | ||||
-rw-r--r-- | os/mitauth.c | 4 | ||||
-rw-r--r-- | os/rpcauth.c | 4 | ||||
-rw-r--r-- | os/utils.c | 4 | ||||
-rw-r--r-- | os/xdmauth.c | 8 | ||||
-rw-r--r-- | os/xdmcp.c | 7 |
9 files changed, 33 insertions, 34 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c index 1633b4993..9a204c7a7 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -430,7 +430,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, if (!timer) { - timer = (OsTimerPtr)xalloc(sizeof(struct _OsTimerRec)); + timer = xalloc(sizeof(struct _OsTimerRec)); if (!timer) return NULL; } diff --git a/os/access.c b/os/access.c index 5d688a71e..34478768b 100644 --- a/os/access.c +++ b/os/access.c @@ -216,7 +216,7 @@ typedef struct _host { int requested; } HOST; -#define MakeHost(h,l) (h)=(HOST *) xalloc(sizeof *(h)+(l));\ +#define MakeHost(h,l) (h)=xalloc(sizeof *(h)+(l));\ if (h) { \ (h)->addr=(unsigned char *) ((h) + 1);\ (h)->requested = FALSE; \ @@ -1109,12 +1109,12 @@ Bool LocalClient(ClientPtr client) &alen, (pointer *)&addr); if (family == -1) { - xfree ((char *) from); + xfree (from); return FALSE; } if (family == FamilyLocal) { - xfree ((char *) from); + xfree (from); return TRUE; } for (host = selfhosts; host; host = host->next) @@ -1122,7 +1122,7 @@ Bool LocalClient(ClientPtr client) if (addrEqual (family, addr, alen, host)) return TRUE; } - xfree ((char *) from); + xfree (from); } return FALSE; } @@ -1462,7 +1462,7 @@ GetHosts ( } if (n) { - *data = ptr = (pointer) xalloc (n); + *data = ptr = xalloc (n); if (!ptr) { return(BadAlloc); @@ -1721,7 +1721,7 @@ siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, } } - s = (struct siType *) xalloc(sizeof(struct siType)); + s = xalloc(sizeof(struct siType)); if (s == NULL) return BadAlloc; diff --git a/os/connection.c b/os/connection.c index aa25938d9..14c91b541 100644 --- a/os/connection.c +++ b/os/connection.c @@ -227,7 +227,7 @@ void SetConnectionTranslation(int conn, int client) } node = &((*node)->next); } - *node = (struct _ct_node*)xalloc(sizeof(struct _ct_node)); + *node = xalloc(sizeof(struct _ct_node)); (*node)->next = NULL; (*node)->key = conn; (*node)->value = client; @@ -407,7 +407,7 @@ CreateWellKnownSockets(void) } else { - ListenTransFds = (int *) xalloc (ListenTransCount * sizeof (int)); + ListenTransFds = xalloc (ListenTransCount * sizeof (int)); for (i = 0; i < ListenTransCount; i++) { @@ -689,7 +689,7 @@ ClientAuthorized(ClientPtr client, proto_n, auth_proto, auth_id); } - xfree ((char *) from); + xfree (from); } if (auth_id == (XID) ~0L) { @@ -711,7 +711,7 @@ ClientAuthorized(ClientPtr client, AuthAudit(client, TRUE, (struct sockaddr *) from, fromlen, proto_n, auth_proto, auth_id); - xfree ((char *) from); + xfree (from); } } priv->auth_id = auth_id; @@ -747,7 +747,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) #endif ) return NullClient; - oc = (OsCommPtr)xalloc(sizeof(OsCommRec)); + oc = xalloc(sizeof(OsCommRec)); if (!oc) return NullClient; oc->trans_conn = trans_conn; @@ -1011,14 +1011,14 @@ AllocateInputBuffer(void) { ConnectionInputPtr oci; - oci = (ConnectionInputPtr)xalloc(sizeof(ConnectionInput)); + oci = xalloc(sizeof(ConnectionInput)); if (!oci) - return (ConnectionInputPtr)NULL; - oci->buffer = (char *)xalloc(BUFSIZE); + return NULL; + oci->buffer = xalloc(BUFSIZE); if (!oci->buffer) { xfree(oci); - return (ConnectionInputPtr)NULL; + return NULL; } oci->size = BUFSIZE; oci->bufptr = oci->buffer; @@ -1032,14 +1032,14 @@ AllocateOutputBuffer(void) { ConnectionOutputPtr oco; - oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); + oco = xalloc(sizeof(ConnectionOutput)); if (!oco) - return (ConnectionOutputPtr)NULL; - oco->buf = (unsigned char *) xcalloc(1, BUFSIZE); + return NULL; + oco->buf = xcalloc(1, BUFSIZE); if (!oco->buf) { xfree(oco); - return (ConnectionOutputPtr)NULL; + return NULL; } oco->size = BUFSIZE; oco->count = 0; diff --git a/os/mitauth.c b/os/mitauth.c index db66c44fb..a7968cbd7 100644 --- a/os/mitauth.c +++ b/os/mitauth.c @@ -55,10 +55,10 @@ MitAddCookie ( { struct auth *new; - new = (struct auth *) xalloc (sizeof (struct auth)); + new = xalloc (sizeof (struct auth)); if (!new) return 0; - new->data = (char *) xalloc ((unsigned) data_length); + new->data = xalloc ((unsigned) data_length); if (!new->data) { xfree(new); return 0; diff --git a/os/rpcauth.c b/os/rpcauth.c index 1a27c5882..5ddbe210b 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -66,7 +66,7 @@ authdes_ezdecode(char *inmsg, int len) XDR xdr; SVCXPRT xprt; - temp_inmsg = (char *) xalloc(len); + temp_inmsg = xalloc(len); memmove(temp_inmsg, inmsg, len); memset((char *)&msg, 0, sizeof(msg)); @@ -79,7 +79,7 @@ authdes_ezdecode(char *inmsg, int len) why = AUTH_FAILED; xdrmem_create(&xdr, temp_inmsg, len, XDR_DECODE); - if ((r.rq_clntcred = (caddr_t) xalloc(MAX_AUTH_BYTES)) == NULL) + if ((r.rq_clntcred = xalloc(MAX_AUTH_BYTES)) == NULL) goto bad1; r.rq_xprt = &xprt; diff --git a/os/utils.c b/os/utils.c index 0ed89dd15..56095b128 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1404,7 +1404,7 @@ Popen(char *command, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { @@ -1490,7 +1490,7 @@ Fopen(char *file, char *type) if ((*type != 'r' && *type != 'w') || type[1]) return NULL; - if ((cur = (struct pid *)xalloc(sizeof(struct pid))) == NULL) + if ((cur = xalloc(sizeof(struct pid))) == NULL) return NULL; if (pipe(pdes) < 0) { diff --git a/os/xdmauth.c b/os/xdmauth.c index 8cbcd581f..e19e4f93d 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -259,7 +259,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, *reason = "Bad XDM authorization key length"; return NULL; } - client = (XdmClientAuthPtr) xalloc (sizeof (XdmClientAuthRec)); + client = xalloc (sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); @@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id) /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; - new = (XdmAuthorizationPtr) xalloc (sizeof (XdmAuthorizationRec)); + new = xalloc (sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; @@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie, /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { @@ -430,7 +430,7 @@ XdmToID (unsigned short cookie_length, char *cookie) XdmClientAuthPtr client; unsigned char *plain; - plain = (unsigned char *) xalloc (cookie_length); + plain = xalloc (cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { diff --git a/os/xdmcp.c b/os/xdmcp.c index d819dd964..cf9558679 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -391,8 +391,7 @@ XdmcpRegisterAuthentication ( AuthenticationNames.length + 1) && XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas, AuthenticationDatas.length + 1) && - (newFuncs = (AuthenticationFuncsPtr) xalloc ( - (AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) + (newFuncs = xalloc ((AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec))))) { XdmcpDisposeARRAY8 (&AuthenticationName); XdmcpDisposeARRAY8 (&AuthenticationData); @@ -491,7 +490,7 @@ XdmcpRegisterConnection ( return; } } - newAddress = (CARD8 *) xalloc (addrlen * sizeof (CARD8)); + newAddress = xalloc (addrlen * sizeof (CARD8)); if (!newAddress) return; if (!XdmcpReallocARRAY16 (&ConnectionTypes, ConnectionTypes.length + 1)) @@ -532,7 +531,7 @@ XdmcpRegisterAuthorization (char *name, int namelen) ARRAY8 authName; int i; - authName.data = (CARD8 *) xalloc (namelen * sizeof (CARD8)); + authName.data = xalloc (namelen * sizeof (CARD8)); if (!authName.data) return; if (!XdmcpReallocARRAYofARRAY8 (&AuthorizationNames, AuthorizationNames.length +1)) |