Browse Source

Simpler list swap

Kajetan Johannes Hammerle 10 months ago
parent
commit
bfa9d55bc1
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/List.c

+ 3 - 4
src/List.c

@@ -142,8 +142,7 @@ size_t coreToStringList(CoreList* l, char* buffer, size_t n, CoreToString c) {
 }
 
 void coreSwapList(CoreList* a, CoreList* b) {
-    coreSwapSize(&a->length, &b->length);
-    coreSwapSize(&a->capacity, &b->capacity);
-    coreSwapSize(&a->dataSize, &b->dataSize);
-    coreSwapPointer(&a->data, &b->data);
+    CoreList tmp = *a;
+    *a = *b;
+    *b = tmp;
 }