about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resarr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/resarr.c b/src/resarr.c
index a597d86..a359d71 100644
--- a/src/resarr.c
+++ b/src/resarr.c
@@ -99,6 +99,21 @@ int resarr_swap(stype_resarr *first, stype_resarr *second) {
 	return 0;
 }
 
+int resarr_swap_quick(stype_resarr *first, stype_resarr *second) {
+	if (first == NULL || second == NULL) return -1;
+	if (first->elemsize != second->elemsize) return -1;
+	size_t size = first->elemcount;
+	size_t alloc = first->allocsize;
+	void *array = first->array;
+	first->elemcount = second->elemcount;
+	first->allocsize = second->allocsize;
+	first->array = second->array;
+	second->elemcount = size;
+	second->allocsize = alloc;
+	second->array = array;
+	return 0;
+}
+
 int resarr_clear(stype_resarr *arr) {
 	if (arr == NULL) return -1;
 	memset(