The most I prefer is to use sizeof( variable ); No harmful for performance and would be better if the buffer type is changed.
-----Original Message----- From: "Enlightenment SVN"<no-re...@enlightenment.org> To: <enlightenment-...@lists.sourceforge.net>; Cc: Sent: 2012-05-23 (수) 09:53:08 Subject: E SVN: hyoyoung trunk/elementary/src/lib Log: elementary/cnp: don't calc sizeof char at buffer malloc Author: hyoyoung Date: 2012-05-22 17:53:07 -0700 (Tue, 22 May 2012) New Revision: 71337 Trac: http://trac.enlightenment.org/e/changeset/71337 Modified: trunk/elementary/src/lib/elm_cnp.c Modified: trunk/elementary/src/lib/elm_cnp.c =================================================================== --- trunk/elementary/src/lib/elm_cnp.c2012-05-23 00:51:11 UTC (rev 71336) +++ trunk/elementary/src/lib/elm_cnp.c2012-05-23 00:53:07 UTC (rev 71337) @@ -785,7 +785,7 @@ char *mkupstr; data = notify->data; - str = malloc(sizeof(char) * (data->length + 1)); + str = malloc((data->length + 1)); if (!str) return 0; strncpy(str, (char *)data->data, data->length); str[data->length] = '\0'; @@ -840,7 +840,7 @@ } else { - stripstr = p = malloc(data->length * sizeof(char) + 1); + stripstr = p = malloc(data->length + 1); if (!stripstr) return 0; memcpy(stripstr, data->data, data->length); stripstr[data->length] = 0; @@ -985,7 +985,7 @@ cnp_debug("Got some HTML: Checking encoding is useful\n"); data = notify->data; - char *stripstr = malloc(sizeof(char) * (data->length + 1)); + char *stripstr = malloc(data->length + 1); if (!stripstr) return 0; strncpy(stripstr, (char *)data->data, data->length); stripstr[data->length] = '\0'; ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-svn mailing list enlightenment-...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-svn ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel