Code optimization when a NULL char *str is passed as argument

This commit is contained in:
anschrammh 2019-10-13 11:25:52 +02:00
parent bd23b4a3b2
commit 537298e7d7

View File

@ -19,8 +19,8 @@ namespace DictionaryHelper
{
if(string == NULL)
{
_string = (char *) malloc((sizeof(char)) * 2); //+1 for the string terminating character
strcpy(_string, "");
_string = (char *) malloc((sizeof(char)));
_string[0] = '\0';
}
else
{