summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cvec.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-01-17 08:32:08 +0100
committerTyge Løvset <[email protected]>2022-01-17 08:32:08 +0100
commitdf626f83dbf7789d622a1c5f4ff9fec3f61bc61b (patch)
tree211a38d07e9ea653f0a8deabe5a63f425036e508 /include/stc/cvec.h
parent7ab5c49a47de856ea58a979cdc086ea22d8eceff (diff)
downloadSTC-modified-df626f83dbf7789d622a1c5f4ff9fec3f61bc61b.tar.gz
STC-modified-df626f83dbf7789d622a1c5f4ff9fec3f61bc61b.zip
Fixed object linkage declarations/definitions.
Diffstat (limited to 'include/stc/cvec.h')
-rw-r--r--include/stc/cvec.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index d9f6b18d..9278eada 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -66,7 +66,6 @@ int main() {
struct cvec_rep { size_t size, cap; void* data[]; };
#define cvec_rep_(self) c_container_of((self)->data, struct cvec_rep, data)
-static struct cvec_rep _cvec_sentinel = {0, 0};
#endif // CVEC_H_INCLUDED
#ifndef _i_prefix
@@ -78,7 +77,7 @@ static struct cvec_rep _cvec_sentinel = {0, 0};
_cx_deftypes(_c_cvec_types, _cx_self, i_val);
#endif
typedef i_valraw _cx_raw;
-
+STC_API _cx_self _cx_memb(_init)(void);
STC_API void _cx_memb(_drop)(_cx_self* self);
STC_API void _cx_memb(_clear)(_cx_self* self);
STC_API bool _cx_memb(_reserve)(_cx_self* self, size_t cap);
@@ -150,12 +149,6 @@ STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t offs)
STC_INLINE size_t _cx_memb(_index)(_cx_self cx, _cx_iter it) { return it.ref - cx.data; }
STC_INLINE _cx_self
-_cx_memb(_init)(void) {
- _cx_self cx = {(_cx_value *) _cvec_sentinel.data};
- return cx;
-}
-
-STC_INLINE _cx_self
_cx_memb(_with_size)(const size_t size, i_val null) {
_cx_self cx = _cx_memb(_init)();
_cx_memb(_resize)(&cx, size, null);
@@ -241,6 +234,16 @@ _cx_memb(_sort)(_cx_self* self) {
/* -------------------------- IMPLEMENTATION ------------------------- */
#if defined(_i_implement)
+#ifndef CVEC_H_INCLUDED
+static struct cvec_rep _cvec_sentinel = {0, 0};
+#endif
+
+STC_DEF _cx_self
+_cx_memb(_init)(void) {
+ _cx_self cx = {(_cx_value *) _cvec_sentinel.data};
+ return cx;
+}
+
STC_DEF void
_cx_memb(_clear)(_cx_self* self) {
struct cvec_rep* rep = cvec_rep_(self);