From: Kevin Day Date: Thu, 25 Jul 2019 04:43:28 +0000 (-0500) Subject: Cleanup: fix comments and remove commented out memset X-Git-Tag: 0.4.3~15 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=8d1deb9881124c7568b42a8d7851d257a483dce3;p=fll Cleanup: fix comments and remove commented out memset According to the standards that I have read, calloc() guarantees zero'd memory, so memset is not needed. It so happens that the memset was commented out already, so just remove it. There are some memset related comments that incorrectly use the word 'bool' when the word 'char' should be used. --- diff --git a/level_0/f_memory/c/memory.c b/level_0/f_memory/c/memory.c index 7a224e9..a4963c7 100644 --- a/level_0/f_memory/c/memory.c +++ b/level_0/f_memory/c/memory.c @@ -28,7 +28,6 @@ extern "C"{ *pointer = calloc(type, length); if (*pointer) { - //memset(*pointer, 0, type * length); return f_none; } @@ -108,7 +107,7 @@ extern "C"{ if (new_pointer) { if (new_pointer != *pointer) { if (new_length > old_length) { - // bool * is of a data type size of 1, casting it to bool should result in a single-length increment + // char * is of a data type size of 1, casting it to char should result in a single-length increment // this is done to avoid problems with (void *) having arithmetic issues memset(((char *) new_pointer) + (type * old_length), 0, type * (new_length - old_length)); } @@ -149,7 +148,7 @@ extern "C"{ if (old_length > 0) { if (new_length < old_length) { - // bool * is of a data type size of 1, casting it to bool should result in a single-length increment + // char * is of a data type size of 1, casting it to char should result in a single-length increment // this is done to avoid problems with (void *) having arithmetic issues memset(((char *)*pointer) + new_length, 0, type * (old_length - new_length)); }