upload tizen2.0 source
[framework/uifw/xorg/lib/libsm.git] / src / sm_manager.c
old mode 100755 (executable)
new mode 100644 (file)
index 14b2bea..7a11a33
@@ -68,12 +68,11 @@ _SmsProtocolSetupProc (IceConn    iceConn,
      * Allocate new SmsConn.
      */
 
-    if ((smsConn = (SmsConn) malloc (sizeof (struct _SmsConn))) == NULL)
+    if ((smsConn = malloc (sizeof (struct _SmsConn))) == NULL)
     {
        const char *str = "Memory allocation failed";
 
-       if ((*failureReasonRet = (char *) malloc (strlen (str) + 1)) != NULL)
-           strcpy (*failureReasonRet, str);
+       *failureReasonRet = strdup (str);
 
        return (0);
     }
@@ -111,7 +110,8 @@ _SmsProtocolSetupProc (IceConn    iceConn,
 \f
 
 Status
-SmsInitialize(char *vendor, char *release, SmsNewClientProc newClientProc,
+SmsInitialize(const char *vendor, const char *release,
+             SmsNewClientProc newClientProc,
              SmPointer managerData, IceHostBasedAuthProc hostBasedAuthProc,
              int errorLength, char *errorStringRet)
 {
@@ -187,13 +187,11 @@ SmsRegisterClientReply(SmsConn smsConn, char *clientId)
     smRegisterClientReplyMsg   *pMsg;
     char                       *pData;
 
-    if ((smsConn->client_id = (char *) malloc (strlen (clientId) + 1)) == NULL)
+    if ((smsConn->client_id = strdup (clientId)) == NULL)
     {
        return (0);
     }
 
-    strcpy (smsConn->client_id, clientId);
-
     extra = ARRAY8_BYTES (strlen (clientId));
 
     IceGetHeaderExtra (iceConn, _SmsOpcode, SM_RegisterClientReply,
@@ -338,5 +336,5 @@ SmsCleanUp(SmsConn smsConn)
     if (smsConn->client_id)
        free (smsConn->client_id);
 
-    free ((char *) smsConn);
+    free (smsConn);
 }