aboutsummaryrefslogtreecommitdiffstats
path: root/Vector.h
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2022-06-03 08:55:20 +0200
committerDaniel Lange <DLange@git.local>2022-06-03 08:55:20 +0200
commit937052b231259a47d881d539ad5748245ef55b99 (patch)
tree41071229fa007d8cf6902bb9253d2acd8cc66979 /Vector.h
parent1b805a31720727008b32b1129a167758519fd4db (diff)
downloaddebian_htop-937052b231259a47d881d539ad5748245ef55b99.tar.gz
debian_htop-937052b231259a47d881d539ad5748245ef55b99.tar.bz2
debian_htop-937052b231259a47d881d539ad5748245ef55b99.zip
New upstream version 3.2.1upstream/3.2.1
Diffstat (limited to 'Vector.h')
-rw-r--r--Vector.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/Vector.h b/Vector.h
index 0fdb706..b7b3903 100644
--- a/Vector.h
+++ b/Vector.h
@@ -22,6 +22,11 @@ typedef struct Vector_ {
int arraySize;
int growthRate;
int items;
+ /* lowest index of a pending soft remove/delete operation,
+ used to speed up compaction */
+ int dirty_index;
+ /* count of soft deletes, required for Vector_count to work in debug mode */
+ int dirty_count;
bool owner;
} Vector;
@@ -44,6 +49,15 @@ Object* Vector_take(Vector* this, int idx);
Object* Vector_remove(Vector* this, int idx);
+/* Vector_softRemove marks the item at index idx for deletion without
+ reclaiming any space. If owned, the item is immediately freed.
+
+ Vector_compact must be called to reclaim space.*/
+Object* Vector_softRemove(Vector* this, int idx);
+
+/* Vector_compact reclaims space free'd up by Vector_softRemove, if any. */
+void Vector_compact(Vector* this);
+
void Vector_moveUp(Vector* this, int idx);
void Vector_moveDown(Vector* this, int idx);
@@ -54,7 +68,11 @@ void Vector_set(Vector* this, int idx, void* data_);
Object* Vector_get(const Vector* this, int idx);
int Vector_size(const Vector* this);
-unsigned int Vector_count(const Vector* this);
+
+/* Vector_countEquals returns true if the number of non-NULL items
+ in the Vector is equal to expectedCount. This is only for debugging
+ and consistency checks. */
+bool Vector_countEquals(const Vector* this, unsigned int expectedCount);
#else /* NDEBUG */

© 2014-2024 Faster IT GmbH | imprint | privacy policy