]> Kevux Git Server - fll/commitdiff
Update: Don't bother checking, just always update pointer.
authorKevin Day <thekevinday@gmail.com>
Wed, 15 Dec 2021 02:34:21 +0000 (20:34 -0600)
committerKevin Day <thekevinday@gmail.com>
Wed, 15 Dec 2021 02:34:21 +0000 (20:34 -0600)
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

index 8b5761cf43f7ce5f51f2fe0d029c4aa68015e4ba..ad958690c4ba44178dec0f6f2f3376c5e60ffb58 100644 (file)
@@ -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;
         }