Code optimization when a NULL char *str is passed as argument
This commit is contained in:
parent
bd23b4a3b2
commit
537298e7d7
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user