From 537298e7d7f4b8455f2767b16ce10c8cd7e4be6a Mon Sep 17 00:00:00 2001 From: anschrammh Date: Sun, 13 Oct 2019 11:25:52 +0200 Subject: [PATCH] Code optimization when a NULL char *str is passed as argument --- src/app/Dictionary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/Dictionary.h b/src/app/Dictionary.h index b9399f5..42b69d7 100644 --- a/src/app/Dictionary.h +++ b/src/app/Dictionary.h @@ -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 {