summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cpque.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-21 20:49:22 +0200
committerTyge Løvset <[email protected]>2021-09-21 20:49:22 +0200
commitfbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b (patch)
tree31dea2b7af4298d211b99e50b903be5f39ddebfb /include/stc/cpque.h
parent32a3454eb463f86d7ace7b29c2e1574530499afc (diff)
downloadSTC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.tar.gz
STC-modified-fbfb57d46e4d042c2c5ae1c5a56dad00660d3e3b.zip
Added copy(self, other) function to all containers. Fixed some docs.
Diffstat (limited to 'include/stc/cpque.h')
-rw-r--r--include/stc/cpque.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/stc/cpque.h b/include/stc/cpque.h
index de509710..6819948f 100644
--- a/include/stc/cpque.h
+++ b/include/stc/cpque.h
@@ -60,6 +60,11 @@ STC_INLINE void cx_memb(_clear)(Self* self) {
STC_INLINE void cx_memb(_del)(Self* self)
{ cx_memb(_clear)(self); c_free(self->data); }
+STC_INLINE void cx_memb(_copy)(Self *self, Self other) {
+ if (self->data == other.data) return;
+ cx_memb(_del)(self); *self = cx_memb(_clone)(other);
+}
+
STC_INLINE size_t cx_memb(_size)(Self q)
{ return q.size; }