mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-25 23:35:45 +00:00
Replace copy loop by memmove in Vector_insert
This is basically the same change like in Vector_take, just in the opposite direction.
This commit is contained in:
parent
1704c29b90
commit
164051354f
4
Vector.c
4
Vector.c
@ -190,8 +190,8 @@ void Vector_insert(Vector* this, int idx, void* data_) {
|
||||
|
||||
Vector_checkArraySize(this);
|
||||
//assert(this->array[this->items] == NULL);
|
||||
for (int i = this->items; i > idx; i--) {
|
||||
this->array[i] = this->array[i-1];
|
||||
if(idx < this->items) {
|
||||
memmove(&this->array[idx + 1], &this->array[idx], (this->items - idx) * sizeof(this->array[0]));
|
||||
}
|
||||
this->array[idx] = data;
|
||||
this->items++;
|
||||
|
Loading…
Reference in New Issue
Block a user