summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/stc/cmap.h16
-rw-r--r--include/stc/coroutine.h5
-rw-r--r--include/stc/forward.h6
-rw-r--r--include/stc/priv/cqueue_hdr.h4
4 files changed, 15 insertions, 16 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index cd7430ba..e0134964 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -306,7 +306,7 @@ STC_INLINE void _cx_MEMB(_wipe_)(_cx_Self* self) {
if (self->size == 0)
return;
_cx_value* d = self->data, *_end = d + self->bucket_count;
- chash_slot* s = self->slot;
+ struct chash_slot* s = self->slot;
for (; d != _end; ++d)
if ((s++)->hashx)
_cx_MEMB(_value_drop)(d);
@@ -321,7 +321,7 @@ STC_DEF void _cx_MEMB(_drop)(_cx_Self* self) {
STC_DEF void _cx_MEMB(_clear)(_cx_Self* self) {
_cx_MEMB(_wipe_)(self);
self->size = 0;
- c_memset(self->slot, 0, c_sizeof(chash_slot)*self->bucket_count);
+ c_memset(self->slot, 0, c_sizeof(struct chash_slot)*self->bucket_count);
}
#ifdef _i_ismap
@@ -359,7 +359,7 @@ _cx_MEMB(_bucket_)(const _cx_Self* self, const _cx_keyraw* rkeyptr) {
intptr_t _cap = self->bucket_count;
intptr_t _idx = fastrange_2(_hash, _cap);
_cx_result b = {NULL, true, (uint8_t)(_hash | 0x80)};
- const chash_slot* s = self->slot;
+ const struct chash_slot* s = self->slot;
while (s[_idx].hashx) {
if (s[_idx].hashx == b.hashx) {
const _cx_keyraw _raw = i_keyto(_i_keyref(self->data + _idx));
@@ -394,8 +394,8 @@ _cx_MEMB(_clone)(_cx_Self m) {
if (m.data) {
_cx_value *d = (_cx_value *)i_malloc(c_sizeof(_cx_value)*m.bucket_count),
*_dst = d, *_end = m.data + m.bucket_count;
- const intptr_t _mem = c_sizeof(chash_slot)*(m.bucket_count + 1);
- chash_slot *s = (chash_slot *)c_memcpy(i_malloc(_mem), m.slot, _mem);
+ const intptr_t _mem = c_sizeof(struct chash_slot)*(m.bucket_count + 1);
+ struct chash_slot *s = (struct chash_slot *)c_memcpy(i_malloc(_mem), m.slot, _mem);
if (!(d && s))
{ i_free(d), i_free(s), d = 0, s = 0, m.bucket_count = 0; }
else
@@ -417,14 +417,14 @@ _cx_MEMB(_reserve)(_cx_Self* self, const intptr_t _newcap) {
_newbucks = cnextpow2(_newbucks);
_cx_Self m = {
(_cx_value *)i_malloc(_newbucks*c_sizeof(_cx_value)),
- (chash_slot *)i_calloc(_newbucks + 1, sizeof(chash_slot)),
+ (struct chash_slot *)i_calloc(_newbucks + 1, sizeof(struct chash_slot)),
self->size, _newbucks
};
bool ok = m.data && m.slot;
if (ok) { // Rehash:
m.slot[_newbucks].hashx = 0xff;
const _cx_value* d = self->data;
- const chash_slot* s = self->slot;
+ const struct chash_slot* s = self->slot;
for (intptr_t i = 0; i < _oldbucks; ++i, ++d) if ((s++)->hashx) {
_cx_keyraw r = i_keyto(_i_keyref(d));
_cx_result b = _cx_MEMB(_bucket_)(&m, &r);
@@ -441,7 +441,7 @@ _cx_MEMB(_reserve)(_cx_Self* self, const intptr_t _newcap) {
STC_DEF void
_cx_MEMB(_erase_entry)(_cx_Self* self, _cx_value* _val) {
_cx_value* d = self->data;
- chash_slot* s = self->slot;
+ struct chash_slot* s = self->slot;
intptr_t i = _val - d, j = i, k;
const intptr_t _cap = self->bucket_count;
_cx_MEMB(_value_drop)(_val);
diff --git a/include/stc/coroutine.h b/include/stc/coroutine.h
index 0e592bae..cecd4002 100644
--- a/include/stc/coroutine.h
+++ b/include/stc/coroutine.h
@@ -38,7 +38,7 @@ int iterpair(struct iterpair* I) {
for (I->y = 0; I->y < I->max_y; I->y++)
cco_yield();
- cco_cleanup: // required if there is cleanup code
+ cco_final: // required if there is cleanup code
puts("final");
}
return 0; // CCO_DONE
@@ -103,7 +103,8 @@ typedef enum {
/* cco_blocking_call(): assumes coroutine returns a cco_result value (int) */
#define cco_blocking_call(corocall) while ((corocall) != CCO_DONE)
-#define cco_cleanup \
+#define cco_cleanup cco_final // [deprecated]
+#define cco_final \
*_state = CCO_STATE_CLEANUP; case CCO_STATE_CLEANUP
#define cco_return \
diff --git a/include/stc/forward.h b/include/stc/forward.h
index 085205cf..572a319f 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -107,8 +107,6 @@ typedef union {
SELF##_node *last; \
} SELF
-typedef struct chash_slot chash_slot;
-
#define _c_chash_types(SELF, KEY, VAL, MAP_ONLY, SET_ONLY) \
typedef KEY SELF##_key; \
typedef VAL SELF##_mapped; \
@@ -125,12 +123,12 @@ typedef struct chash_slot chash_slot;
\
typedef struct { \
SELF##_value *ref, *_end; \
- chash_slot* sref; \
+ struct chash_slot* sref; \
} SELF##_iter; \
\
typedef struct SELF { \
SELF##_value* data; \
- chash_slot* slot; \
+ struct chash_slot* slot; \
intptr_t size, bucket_count; \
} SELF
diff --git a/include/stc/priv/cqueue_hdr.h b/include/stc/priv/cqueue_hdr.h
index 90539f36..1cad8684 100644
--- a/include/stc/priv/cqueue_hdr.h
+++ b/include/stc/priv/cqueue_hdr.h
@@ -96,8 +96,8 @@ STC_INLINE void _cx_MEMB(_copy)(_cx_Self* self, const _cx_Self* other) {
STC_INLINE _cx_iter _cx_MEMB(_begin)(const _cx_Self* self) {
return c_LITERAL(_cx_iter){
- _cx_MEMB(_empty)(self) ? NULL : self->data + self->start,
- self->start, self
+ .ref=_cx_MEMB(_empty)(self) ? NULL : self->data + self->start,
+ .pos=self->start, ._s=self
};
}