@@ -81,13 +81,13 @@ struct PersistentStorageArray : BaseStor
/* The value hasn't changed, so we pretend nothing happened.
* Saves a few cycles and such and it's pretty easy to check. */
if (this->storage[pos] == value) return;
/* We do not have made a backup; lets do so */
if (this->prev_storage != NULL) {
if (this->prev_storage == NULL) {
this->prev_storage = MallocT<TYPE>(SIZE);
memcpy(this->prev_storage, this->storage, sizeof(this->storage));
/* We only need to register ourselves when we made the backup
* as that is the only time something will have changed */
AddChangedStorage(this);
@@ -118,12 +118,13 @@ struct PersistentStorageArray : BaseStor
assert(this->prev_storage != NULL);
if (!keep_changes) {
memcpy(this->storage, this->prev_storage, sizeof(this->storage));
}
free(this->prev_storage);
this->prev_storage = NULL;
};
/**
* Class for temporary storage of data.
Status change: