summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-08 22:31:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-08 22:31:41 -0700
commit9a74512ffdc1628f1b87d2191439915c63b9104f (patch)
tree8a58dec4a8604228908b09cdb69a286d89c271d2
parent4033226105fa861ab5f0276850afc24c0fa45406 (diff)
downloadxorg-lib-libICE-9a74512ffdc1628f1b87d2191439915c63b9104f.tar.gz
Stop casting return values from malloc
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--include/X11/ICE/ICEmsg.h2
-rw-r--r--src/ICElibint.h2
-rw-r--r--src/accept.c8
-rw-r--r--src/authutil.c2
-rw-r--r--src/connect.c11
-rw-r--r--src/getauth.c4
-rw-r--r--src/iceauth.c2
-rw-r--r--src/listen.c11
-rw-r--r--src/listenwk.c9
-rw-r--r--src/misc.c9
-rw-r--r--src/ping.c2
-rw-r--r--src/process.c9
-rw-r--r--src/protosetup.c5
-rw-r--r--src/register.c27
-rw-r--r--src/replywait.c3
-rw-r--r--src/setauth.c2
-rw-r--r--src/watch.c7
17 files changed, 46 insertions, 69 deletions
diff --git a/include/X11/ICE/ICEmsg.h b/include/X11/ICE/ICEmsg.h
index d959264..2cb9112 100644
--- a/include/X11/ICE/ICEmsg.h
+++ b/include/X11/ICE/ICEmsg.h
@@ -244,7 +244,7 @@ extern IcePaAuthStatus _IcePaMagicCookie1Proc (
} \
else \
{ \
- _pData = (char *) malloc ((unsigned) _bytes); \
+ _pData = malloc (_bytes); \
if (_pData) \
_IceRead (_iceConn, _bytes, _pData); \
else \
diff --git a/src/ICElibint.h b/src/ICElibint.h
index e034194..cb53d83 100644
--- a/src/ICElibint.h
+++ b/src/ICElibint.h
@@ -210,7 +210,7 @@ typedef struct {
{ \
CARD16 _len; \
EXTRACT_CARD16 (_pBuf, _swap, _len); \
- _string = (char *) malloc (_len + 1); \
+ _string = malloc (_len + 1); \
memcpy (_string, _pBuf, _len); \
_pBuf += _len; \
_string[_len] = '\0'; \
diff --git a/src/accept.c b/src/accept.c
index 61bbd7f..6f23338 100644
--- a/src/accept.c
+++ b/src/accept.c
@@ -70,7 +70,7 @@ IceAcceptConnection (
* Create an ICE object for this connection.
*/
- if ((iceConn = (IceConn) malloc (sizeof (struct _IceConn))) == NULL)
+ if ((iceConn = malloc (sizeof (struct _IceConn))) == NULL)
{
_IceTransClose (newconn);
*statusRet = IceAcceptBadMalloc;
@@ -103,8 +103,7 @@ IceAcceptConnection (
iceConn->vendor = NULL;
iceConn->release = NULL;
- if ((iceConn->inbuf = iceConn->inbufptr =
- (char *) malloc (ICE_INBUFSIZE)) != NULL)
+ if ((iceConn->inbuf = iceConn->inbufptr = malloc (ICE_INBUFSIZE)) != NULL)
{
iceConn->inbufmax = iceConn->inbuf + ICE_INBUFSIZE;
}
@@ -116,8 +115,7 @@ IceAcceptConnection (
return (NULL);
}
- if ((iceConn->outbuf = iceConn->outbufptr =
- (char *) malloc (ICE_OUTBUFSIZE)) != NULL)
+ if ((iceConn->outbuf = iceConn->outbufptr = malloc (ICE_OUTBUFSIZE)) != NULL)
{
iceConn->outbufmax = iceConn->outbuf + ICE_OUTBUFSIZE;
}
diff --git a/src/authutil.c b/src/authutil.c
index 2a98f19..a8d2a22 100644
--- a/src/authutil.c
+++ b/src/authutil.c
@@ -255,7 +255,7 @@ IceReadAuthFileEntry (
&local.auth_data_length, &local.auth_data))
goto bad;
- if (!(ret = (IceAuthFileEntry *) malloc (sizeof (IceAuthFileEntry))))
+ if (!(ret = malloc (sizeof (IceAuthFileEntry))))
goto bad;
*ret = local;
diff --git a/src/connect.c b/src/connect.c
index c25b21f..276a356 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -144,7 +144,7 @@ IceOpenConnection (
}
}
- if ((iceConn = (IceConn) malloc (sizeof (struct _IceConn))) == NULL)
+ if ((iceConn = malloc (sizeof (struct _IceConn))) == NULL)
{
strncpy (errorStringRet, "Can't malloc", errorLength);
return (NULL);
@@ -194,8 +194,7 @@ IceOpenConnection (
iceConn->connect_to_me = NULL;
iceConn->protosetup_to_me = NULL;
- if ((iceConn->inbuf = iceConn->inbufptr =
- (char *) malloc (ICE_INBUFSIZE)) == NULL)
+ if ((iceConn->inbuf = iceConn->inbufptr = malloc (ICE_INBUFSIZE)) == NULL)
{
_IceFreeConnection (iceConn);
strncpy (errorStringRet, "Can't malloc", errorLength);
@@ -204,8 +203,7 @@ IceOpenConnection (
iceConn->inbufmax = iceConn->inbuf + ICE_INBUFSIZE;
- if ((iceConn->outbuf = iceConn->outbufptr =
- (char *) calloc (1, ICE_OUTBUFSIZE)) == NULL)
+ if ((iceConn->outbuf = iceConn->outbufptr = calloc (1, ICE_OUTBUFSIZE)) == NULL)
{
_IceFreeConnection (iceConn);
strncpy (errorStringRet, "Can't malloc", errorLength);
@@ -224,8 +222,7 @@ IceOpenConnection (
iceConn->saved_reply_waits = NULL;
iceConn->ping_waits = NULL;
- iceConn->connect_to_you = (_IceConnectToYouInfo *) malloc (
- sizeof (_IceConnectToYouInfo));
+ iceConn->connect_to_you = malloc (sizeof (_IceConnectToYouInfo));
iceConn->connect_to_you->auth_active = 0;
/*
diff --git a/src/getauth.c b/src/getauth.c
index e127206..09e0e1c 100644
--- a/src/getauth.c
+++ b/src/getauth.c
@@ -70,7 +70,7 @@ _IceGetPoAuthData (
{
*authDataLenRet = entry->auth_data_length;
- if ((*authDataRet = (char *) malloc (entry->auth_data_length)) != NULL)
+ if ((*authDataRet = malloc (entry->auth_data_length)) != NULL)
memcpy (*authDataRet, entry->auth_data, entry->auth_data_length);
}
else
@@ -111,7 +111,7 @@ _IceGetPaAuthData (
{
*authDataLenRet = entry->auth_data_length;
- if ((*authDataRet = (char *) malloc (entry->auth_data_length)) != NULL)
+ if ((*authDataRet = malloc (entry->auth_data_length)) != NULL)
memcpy (*authDataRet, entry->auth_data, entry->auth_data_length);
}
else
diff --git a/src/iceauth.c b/src/iceauth.c
index 3c0f623..f4d9f36 100644
--- a/src/iceauth.c
+++ b/src/iceauth.c
@@ -55,7 +55,7 @@ IceGenerateMagicCookie (
int value;
int i;
- if ((auth = (char *) malloc (len + 1)) == NULL)
+ if ((auth = malloc (len + 1)) == NULL)
return (NULL);
#ifdef ITIMER_REAL
diff --git a/src/listen.c b/src/listen.c
index 0bf1a80..9a449ae 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -62,8 +62,7 @@ IceListenForConnections (
return (0);
}
- if ((listenObjs = (struct _IceListenObj *) malloc (
- transCount * sizeof (struct _IceListenObj))) == NULL)
+ if ((listenObjs = malloc (transCount * sizeof (struct _IceListenObj))) == NULL)
{
for (i = 0; i < transCount; i++)
_IceTransClose (transConns[i]);
@@ -99,8 +98,7 @@ IceListenForConnections (
}
else
{
- *listenObjsRet = (IceListenObj *) malloc (
- *countRet * sizeof (IceListenObj));
+ *listenObjsRet = malloc (*countRet * sizeof (IceListenObj));
if (*listenObjsRet == NULL)
{
@@ -112,8 +110,7 @@ IceListenForConnections (
{
for (i = 0; i < *countRet; i++)
{
- (*listenObjsRet)[i] = (IceListenObj) malloc (
- sizeof (struct _IceListenObj));
+ (*listenObjsRet)[i] = malloc (sizeof (struct _IceListenObj));
if ((*listenObjsRet)[i] == NULL)
{
@@ -196,7 +193,7 @@ IceComposeNetworkIdList (
for (i = 0; i < count; i++)
len += (strlen (listenObjs[i]->network_id) + 1);
- list = (char *) malloc (len);
+ list = malloc (len);
if (list == NULL)
return (NULL);
diff --git a/src/listenwk.c b/src/listenwk.c
index cb80faf..7517ea8 100644
--- a/src/listenwk.c
+++ b/src/listenwk.c
@@ -64,8 +64,7 @@ IceListenForWellKnownConnections (
return (0);
}
- if ((listenObjs = (struct _IceListenObj *) malloc (
- transCount * sizeof (struct _IceListenObj))) == NULL)
+ if ((listenObjs = malloc (transCount * sizeof (struct _IceListenObj))) == NULL)
{
for (i = 0; i < transCount; i++)
_IceTransClose (transConns[i]);
@@ -99,8 +98,7 @@ IceListenForWellKnownConnections (
}
else
{
- *listenObjsRet = (IceListenObj *) malloc (
- *countRet * sizeof (IceListenObj));
+ *listenObjsRet = malloc (*countRet * sizeof (IceListenObj));
if (*listenObjsRet == NULL)
{
@@ -112,8 +110,7 @@ IceListenForWellKnownConnections (
{
for (i = 0; i < *countRet; i++)
{
- (*listenObjsRet)[i] = (IceListenObj) malloc (
- sizeof (struct _IceListenObj));
+ (*listenObjsRet)[i] = malloc (sizeof (struct _IceListenObj));
if ((*listenObjsRet)[i] == NULL)
{
diff --git a/src/misc.c b/src/misc.c
index 1693446..d2e9150 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -57,7 +57,7 @@ IceAllocScratch (
if (iceConn->scratch)
free (iceConn->scratch);
- iceConn->scratch = (char *) malloc ((unsigned) size);
+ iceConn->scratch = malloc (size);
iceConn->scratch_size = size;
}
@@ -421,8 +421,7 @@ _IceAddOpcodeMapping (
}
else if (iceConn->process_msg_info == NULL)
{
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
- sizeof (_IceProcessMsgInfo));
+ iceConn->process_msg_info = malloc (sizeof (_IceProcessMsgInfo));
iceConn->his_min_opcode = iceConn->his_max_opcode = hisOpcode;
}
else if (hisOpcode < iceConn->his_min_opcode)
@@ -432,7 +431,7 @@ _IceAddOpcodeMapping (
int newsize = iceConn->his_max_opcode - hisOpcode + 1;
int i;
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
+ iceConn->process_msg_info = malloc (
newsize * sizeof (_IceProcessMsgInfo));
memcpy (&iceConn->process_msg_info[
@@ -459,7 +458,7 @@ _IceAddOpcodeMapping (
int newsize = hisOpcode - iceConn->his_min_opcode + 1;
int i;
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
+ iceConn->process_msg_info = malloc (
newsize * sizeof (_IceProcessMsgInfo));
memcpy (iceConn->process_msg_info, oldVec,
diff --git a/src/ping.c b/src/ping.c
index 93d82de..9cb5394 100644
--- a/src/ping.c
+++ b/src/ping.c
@@ -39,7 +39,7 @@ IcePing (
IcePointer clientData
)
{
- _IcePingWait *newping = (_IcePingWait *) malloc (sizeof (_IcePingWait));
+ _IcePingWait *newping = malloc (sizeof (_IcePingWait));
_IcePingWait *ptr = iceConn->ping_waits;
if (newping == NULL)
diff --git a/src/process.c b/src/process.c
index f072674..f0c3369 100644
--- a/src/process.c
+++ b/src/process.c
@@ -921,7 +921,7 @@ ProcessConnectionSetup (
if ((hisAuthCount = message->authCount) > 0)
{
- hisAuthNames = (char **) malloc (hisAuthCount * sizeof (char *));
+ hisAuthNames = malloc (hisAuthCount * sizeof (char *));
EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
}
@@ -1056,7 +1056,7 @@ ProcessConnectionSetup (
AuthRequired (iceConn, hisAuthIndex, authDataLen, authData);
- iceConn->connect_to_me = setupInfo = (_IceConnectToMeInfo *)
+ iceConn->connect_to_me = setupInfo =
malloc (sizeof (_IceConnectToMeInfo));
setupInfo->my_version_index = myVersionIndex;
@@ -1967,7 +1967,7 @@ ProcessProtocolSetup (
if ((hisAuthCount = message->authCount) > 0)
{
- hisAuthNames = (char **) malloc (hisAuthCount * sizeof (char *));
+ hisAuthNames = malloc (hisAuthCount * sizeof (char *));
EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
}
@@ -2097,8 +2097,7 @@ ProcessProtocolSetup (
AuthRequired (iceConn, hisAuthIndex, authDataLen, authData);
iceConn->protosetup_to_me = setupInfo =
- (_IceProtoSetupToMeInfo *) malloc (
- sizeof (_IceProtoSetupToMeInfo));
+ malloc (sizeof (_IceProtoSetupToMeInfo));
setupInfo->his_opcode = hisOpcode;
setupInfo->my_opcode = myOpcode;
diff --git a/src/protosetup.c b/src/protosetup.c
index f10b030..fc6010a 100644
--- a/src/protosetup.c
+++ b/src/protosetup.c
@@ -112,7 +112,7 @@ IceProtocolSetup (
if (myProtocol->orig_client->auth_count > 0)
{
- authIndices = (int *) malloc (
+ authIndices = malloc (
myProtocol->orig_client->auth_count * sizeof (int));
_IceGetPoValidAuthIndices (myProtocol->protocol_name,
@@ -181,8 +181,7 @@ IceProtocolSetup (
replyWait.minor_opcode_of_request = ICE_ProtocolSetup;
replyWait.reply = (IcePointer) &reply;
- iceConn->protosetup_to_you = (_IceProtoSetupToYouInfo *) malloc (
- sizeof (_IceProtoSetupToYouInfo));
+ iceConn->protosetup_to_you = malloc (sizeof (_IceProtoSetupToYouInfo));
iceConn->protosetup_to_you->my_opcode = myOpcode;
iceConn->protosetup_to_you->my_auth_count = authCount;
iceConn->protosetup_to_you->auth_active = 0;
diff --git a/src/register.c b/src/register.c
index 20a6ad0..bf39711 100644
--- a/src/register.c
+++ b/src/register.c
@@ -67,8 +67,7 @@ IceRegisterForProtocolSetup (
if (i <= _IceLastMajorOpcode)
{
- p = _IceProtocols[i - 1].orig_client =
- (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol));
+ p = _IceProtocols[i - 1].orig_client = malloc (sizeof(_IcePoProtocol));
opcodeRet = i;
}
else if (_IceLastMajorOpcode == 255 ||
@@ -85,7 +84,7 @@ IceRegisterForProtocolSetup (
strdup(protocolName);
p = _IceProtocols[_IceLastMajorOpcode].orig_client =
- (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol));
+ malloc (sizeof (_IcePoProtocol));
_IceProtocols[_IceLastMajorOpcode].accept_client = NULL;
@@ -97,18 +96,15 @@ IceRegisterForProtocolSetup (
p->version_count = versionCount;
- p->version_recs = (IcePoVersionRec *) malloc (
- versionCount * sizeof (IcePoVersionRec));
+ p->version_recs = malloc (versionCount * sizeof (IcePoVersionRec));
memcpy (p->version_recs, versionRecs,
versionCount * sizeof (IcePoVersionRec));
if ((p->auth_count = authCount) > 0)
{
- p->auth_names = (char **) malloc (
- authCount * sizeof (char *));
+ p->auth_names = malloc (authCount * sizeof (char *));
- p->auth_procs = (IcePoAuthProc *) malloc (
- authCount * sizeof (IcePoAuthProc));
+ p->auth_procs = malloc (authCount * sizeof (IcePoAuthProc));
for (i = 0; i < authCount; i++)
{
@@ -169,7 +165,7 @@ IceRegisterForProtocolReply (
if (i <= _IceLastMajorOpcode)
{
p = _IceProtocols[i - 1].accept_client =
- (_IcePaProtocol *) malloc (sizeof (_IcePaProtocol));
+ malloc (sizeof (_IcePaProtocol));
opcodeRet = i;
}
else if (_IceLastMajorOpcode == 255 ||
@@ -188,7 +184,7 @@ IceRegisterForProtocolReply (
_IceProtocols[_IceLastMajorOpcode].orig_client = NULL;
p = _IceProtocols[_IceLastMajorOpcode].accept_client =
- (_IcePaProtocol *) malloc (sizeof (_IcePaProtocol));
+ malloc (sizeof (_IcePaProtocol));
opcodeRet = ++_IceLastMajorOpcode;
}
@@ -198,8 +194,7 @@ IceRegisterForProtocolReply (
p->version_count = versionCount;
- p->version_recs = (IcePaVersionRec *) malloc (
- versionCount * sizeof (IcePaVersionRec));
+ p->version_recs = malloc (versionCount * sizeof (IcePaVersionRec));
memcpy (p->version_recs, versionRecs,
versionCount * sizeof (IcePaVersionRec));
@@ -208,11 +203,9 @@ IceRegisterForProtocolReply (
if ((p->auth_count = authCount) > 0)
{
- p->auth_names = (char **) malloc (
- authCount * sizeof (char *));
+ p->auth_names = malloc (authCount * sizeof (char *));
- p->auth_procs = (IcePaAuthProc *) malloc (
- authCount * sizeof (IcePaAuthProc));
+ p->auth_procs = malloc (authCount * sizeof (IcePaAuthProc));
for (i = 0; i < authCount; i++)
{
diff --git a/src/replywait.c b/src/replywait.c
index d4cf898..b25c351 100644
--- a/src/replywait.c
+++ b/src/replywait.c
@@ -59,8 +59,7 @@ _IceAddReplyWait (
last = last->next;
}
- savedReplyWait = (_IceSavedReplyWait *) malloc (
- sizeof (_IceSavedReplyWait));
+ savedReplyWait = malloc (sizeof (_IceSavedReplyWait));
savedReplyWait->reply_wait = replyWait;
savedReplyWait->reply_ready = False;
diff --git a/src/setauth.c b/src/setauth.c
index 2e9f882..1017b02 100644
--- a/src/setauth.c
+++ b/src/setauth.c
@@ -100,7 +100,7 @@ IceSetPaAuthData (
_IcePaAuthDataEntries[j].auth_data_length =
entries[i].auth_data_length;
- _IcePaAuthDataEntries[j].auth_data = (char *) malloc (
+ _IcePaAuthDataEntries[j].auth_data = malloc (
entries[i].auth_data_length);
memcpy (_IcePaAuthDataEntries[j].auth_data,
entries[i].auth_data, entries[i].auth_data_length);
diff --git a/src/watch.c b/src/watch.c
index 42fb715..abbc265 100644
--- a/src/watch.c
+++ b/src/watch.c
@@ -48,8 +48,7 @@ IceAddConnectionWatch (
_IceWatchProc *newWatchProc;
int i;
- if ((newWatchProc = (_IceWatchProc *) malloc (
- sizeof (_IceWatchProc))) == NULL)
+ if ((newWatchProc = malloc (sizeof (_IceWatchProc))) == NULL)
{
return (0);
}
@@ -74,7 +73,7 @@ IceAddConnectionWatch (
for (i = 0; i < _IceConnectionCount; i++)
{
- _IceWatchedConnection *newWatchedConn = (_IceWatchedConnection *)
+ _IceWatchedConnection *newWatchedConn =
malloc (sizeof (_IceWatchedConnection));
newWatchedConn->iceConn = _IceConnectionObjs[i];
@@ -140,7 +139,7 @@ _IceConnectionOpened (
while (watchProc)
{
- _IceWatchedConnection *newWatchedConn = (_IceWatchedConnection *)
+ _IceWatchedConnection *newWatchedConn =
malloc (sizeof (_IceWatchedConnection));
_IceWatchedConnection *watchedConn;