diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 10:33:15 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-09 17:37:09 -0800 |
commit | e77dd2e4bc8227ebdab70b4233cb33ed690fa264 (patch) | |
tree | c40965b2ffd7dc02afac66aca8ce05b6086d8446 /src/sm_client.c | |
parent | 46f3ef4460aa2c1c2cba22897694a1cea572d506 (diff) |
Remove a bunch of unnecessary casts with malloc & free calls
With modern compilers and headers, they cause more problems than they
solve and just hide real issues.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
Diffstat (limited to 'src/sm_client.c')
-rw-r--r-- | src/sm_client.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/sm_client.c b/src/sm_client.c index faf2b9f..23d8e32 100644 --- a/src/sm_client.c +++ b/src/sm_client.c @@ -138,7 +138,7 @@ SmcOpenConnection(char *networkIdsList, SmPointer context, return (NULL); } - if ((smcConn = (SmcConn) malloc (sizeof (struct _SmcConn))) == NULL) + if ((smcConn = malloc (sizeof (struct _SmcConn))) == NULL) { if (errorStringRet && errorLength > 0) { strncpy (errorStringRet, "Can't malloc", errorLength); @@ -158,7 +158,7 @@ SmcOpenConnection(char *networkIdsList, SmPointer context, setupstat == IceProtocolSetupIOError) { IceCloseConnection (iceConn); - free ((char *) smcConn); + free (smcConn); return (NULL); } else if (setupstat == IceProtocolAlreadyActive) @@ -169,7 +169,7 @@ SmcOpenConnection(char *networkIdsList, SmPointer context, * may not already have XSMP active on it. */ - free ((char *) smcConn); + free (smcConn); if (errorStringRet && errorLength > 0) { strncpy (errorStringRet, "Internal error in IceOpenConnection", errorLength); @@ -235,7 +235,7 @@ SmcOpenConnection(char *networkIdsList, SmPointer context, } free (smcConn->vendor); free (smcConn->release); - free ((char *) smcConn); + free (smcConn); return (NULL); } @@ -330,13 +330,13 @@ SmcCloseConnection(SmcConn smcConn, int count, char **reasonMsgs) while (ptr) { next = ptr->next; - free ((char *) ptr); + free (ptr); ptr = next; } } - free ((char *) smcConn); + free (smcConn); if (closeStatus == IceClosedNow) statusRet = SmcClosedNow; @@ -419,8 +419,7 @@ SmcGetProperties(SmcConn smcConn, SmcPropReplyProc propReplyProc, IceConn iceConn = smcConn->iceConn; _SmcPropReplyWait *wait, *ptr; - if ((wait = (_SmcPropReplyWait *) malloc ( - sizeof (_SmcPropReplyWait))) == NULL) + if ((wait = malloc (sizeof (_SmcPropReplyWait))) == NULL) { return (0); } @@ -454,8 +453,7 @@ SmcInteractRequest(SmcConn smcConn, int dialogType, smInteractRequestMsg *pMsg; _SmcInteractWait *wait, *ptr; - if ((wait = (_SmcInteractWait *) malloc ( - sizeof (_SmcInteractWait))) == NULL) + if ((wait = malloc (sizeof (_SmcInteractWait))) == NULL) { return (0); } @@ -534,8 +532,7 @@ SmcRequestSaveYourselfPhase2(SmcConn smcConn, wait = smcConn->phase2_wait; else { - if ((wait = (_SmcPhase2Wait *) malloc ( - sizeof (_SmcPhase2Wait))) == NULL) + if ((wait = malloc (sizeof (_SmcPhase2Wait))) == NULL) { return (0); } |