From dcec1cb503d69a1c4ba48a1d70d0f3a772749a5a Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 14 Dec 2021 20:34:21 -0600 Subject: [PATCH] Update: Don't bother checking, just always update pointer. At this point the pointer has been allocated. If the pointer addresses are the same, then there is no problem. If they are different, then this properly replaces. Assigning this just removes the extra step of checking. --- level_0/f_memory/c/private-memory.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/level_0/f_memory/c/private-memory.c b/level_0/f_memory/c/private-memory.c index 8b5761c..ad95869 100644 --- a/level_0/f_memory/c/private-memory.c +++ b/level_0/f_memory/c/private-memory.c @@ -33,9 +33,7 @@ extern "C" { memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); } - if (pointer != new_pointer) { - *pointer = new_pointer; - } + *pointer = new_pointer; return F_none; } @@ -83,9 +81,7 @@ extern "C" { memset(((uint8_t *) new_pointer) + (type_size * length_old), 0, type_size * (length_new - length_old)); } - if (pointer != new_pointer) { - *pointer = new_pointer; - } + *pointer = new_pointer; return F_none; } -- 1.8.3.1