summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-01-01 01:43:46 +0100
committerHaru <haru@dotalux.com>2016-06-25 17:29:37 +0200
commitd174187cc32db324a9127dfc1eb0d181aec37f13 (patch)
treed164cbb4bbe12b2d98eae965cd43c603b0961dfd
parent98da34f0c6785a4227efa0f6718a7453e2991202 (diff)
downloadhercules-d174187cc32db324a9127dfc1eb0d181aec37f13.tar.gz
hercules-d174187cc32db324a9127dfc1eb0d181aec37f13.tar.bz2
hercules-d174187cc32db324a9127dfc1eb0d181aec37f13.tar.xz
hercules-d174187cc32db324a9127dfc1eb0d181aec37f13.zip
Implemented VECTOR_TRUNCATE
- Clears a VECTOR, without freeing its data (truncates length, preserving capacity) Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/db.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/db.h b/src/common/db.h
index d7d111c86..1c0955221 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -1395,6 +1395,16 @@ HPShared struct db_interface *DB;
} while(false)
/**
+ * Removes all values from the vector.
+ *
+ * Does not free the allocated data.
+ */
+#define VECTOR_TRUNCATE(_vec) \
+ do { \
+ VECTOR_LENGTH(_vec) = 0; \
+ } while (false)
+
+/**
* Clears the vector, freeing allocated data.
*
* @param _vec Vector.