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)
|
if(string == NULL)
|
||||||
{
|
{
|
||||||
_string = (char *) malloc((sizeof(char)) * 2); //+1 for the string terminating character
|
_string = (char *) malloc((sizeof(char)));
|
||||||
strcpy(_string, "");
|
_string[0] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user