Fixed vector_push_back() call to use memmove() instead of memcpy() - allows for region overlap
This commit is contained in:
@@ -353,7 +353,7 @@ static inline int vector_push_back(vector_t* vec, const void* element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy the new element into the vector's data array
|
// Copy the new element into the vector's data array
|
||||||
memcpy((char*)vec->data + (vec->size * vec->element_size), element, vec->element_size);
|
memmove((char*)vec->data + (vec->size * vec->element_size), element, vec->element_size);
|
||||||
vec->size++;
|
vec->size++;
|
||||||
|
|
||||||
return 0; // Success
|
return 0; // Success
|
||||||
|
|||||||
Reference in New Issue
Block a user