diff options
| author | Tyge Løvset <[email protected]> | 2021-03-06 12:39:40 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-03-06 12:39:40 +0100 |
| commit | 15dcc16cac8f5353d657fe6511eb1a01be347fa0 (patch) | |
| tree | 4d50e2948c6f9bf18c95335feda7ae44147ebf1f | |
| parent | 7188a160ac084b65de07c26797fd74e29fd8b0b8 (diff) | |
| download | STC-modified-15dcc16cac8f5353d657fe6511eb1a01be347fa0.tar.gz STC-modified-15dcc16cac8f5353d657fe6511eb1a01be347fa0.zip | |
Fixed some const-ness with begin/end methods.
| -rw-r--r-- | docs/cmap_api.md | 4 | ||||
| -rw-r--r-- | docs/cqueue_api.md | 4 | ||||
| -rw-r--r-- | docs/csmap_api.md | 4 | ||||
| -rw-r--r-- | docs/cstack_api.md | 4 | ||||
| -rw-r--r-- | examples/csmap_v1.h | 4 | ||||
| -rw-r--r-- | stc/carray.h | 4 | ||||
| -rw-r--r-- | stc/cmap.h | 4 | ||||
| -rw-r--r-- | stc/cqueue.h | 4 | ||||
| -rw-r--r-- | stc/csmap.h | 4 | ||||
| -rw-r--r-- | stc/cstack.h | 4 |
10 files changed, 20 insertions, 20 deletions
diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 8311fc0f..ce5b310d 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -74,8 +74,8 @@ cmap_X_mapped_t* cmap_X_at(const cmap_X* self, RawKey rkey); size_t cmap_X_erase(cmap_X* self, RawKey rkey); cmap_X_iter_t cmap_X_erase_at(cmap_X* self, cmap_X_iter_t pos); -cmap_X_iter_t cmap_X_begin(cmap_X* self); -cmap_X_iter_t cmap_X_end(cmap_X* self); +cmap_X_iter_t cmap_X_begin(const cmap_X* self); +cmap_X_iter_t cmap_X_end(const cmap_X* self); void cmap_X_next(cmap_X_iter_t* it); cmap_X_mapped_t* cmap_X_itval(cmap_X_iter_t it); diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md index ef01b2c4..4890a4ea 100644 --- a/docs/cqueue_api.md +++ b/docs/cqueue_api.md @@ -40,8 +40,8 @@ void cqueue_X_emplace_n(cqueue_X *self, const cqueue_X_rawval void cqueue_X_pop(cqueue_X* self); -cqueue_X_iter_t cqueue_X_begin(cqueue_X* self); -cqueue_X_iter_t cqueue_X_end(cqueue_X* self); +cqueue_X_iter_t cqueue_X_begin(const cqueue_X* self); +cqueue_X_iter_t cqueue_X_end(const cqueue_X* self); void cqueue_X_next(cqueue_X_iter_t* it); cqueue_X_value_t* cqueue_X_itval(cqueue_X_iter_t it); diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 711d7e6a..8c3a31b5 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -70,8 +70,8 @@ csmap_X_mapped_t* csmap_X_at(const csmap_X* self, RawKey rkey); size_t csmap_X_erase(csmap_X* self, RawKey rkey); csmap_X_iter_t csmap_X_erase_at(csmap_X* self, csmap_X_iter_t pos); -csmap_X_iter_t csmap_X_begin(csmap_X* self); -csmap_X_iter_t csmap_X_end(csmap_X* self); +csmap_X_iter_t csmap_X_begin(const csmap_X* self); +csmap_X_iter_t csmap_X_end(const csmap_X* self); void csmap_X_next(csmap_X_iter_t* it); csmap_X_mapped_t* csmap_X_itval(csmap_X_iter_t it); diff --git a/docs/cstack_api.md b/docs/cstack_api.md index c953ef91..d1b3cb5f 100644 --- a/docs/cstack_api.md +++ b/docs/cstack_api.md @@ -40,8 +40,8 @@ void cstack_X_emplace_n(cstack_X *self, const cstack_X_rawval void cstack_X_pop(cstack_X* self); -cstack_X_iter_t cstack_X_begin(cstack_X* self); -cstack_X_iter_t cstack_X_end(cstack_X* self); +cstack_X_iter_t cstack_X_begin(const cstack_X* self); +cstack_X_iter_t cstack_X_end(const cstack_X* self); void cstack_X_next(cstack_X_iter_t* it); cstack_X_value_t* cstack_X_itval(cstack_X_iter_t it); diff --git a/examples/csmap_v1.h b/examples/csmap_v1.h index b209e25b..b9b70a02 100644 --- a/examples/csmap_v1.h +++ b/examples/csmap_v1.h @@ -286,12 +286,12 @@ int main(void) { C##_##X##_next(C##_##X##_iter_t* it); \
\
STC_INLINE C##_##X##_iter_t \
- C##_##X##_begin(C##_##X* self) { \
+ C##_##X##_begin(const C##_##X* self) { \
C##_##X##_iter_t it = {NULL, 0, self->root}; \
C##_##X##_next(&it); return it; \
} \
STC_INLINE C##_##X##_iter_t \
- C##_##X##_end(C##_##X* self) {\
+ C##_##X##_end(const C##_##X* self) {\
C##_##X##_iter_t it = {NULL}; return it; \
} \
STC_INLINE C##_##X##_mapped_t* \
diff --git a/stc/carray.h b/stc/carray.h index 28b6df94..d5735fc8 100644 --- a/stc/carray.h +++ b/stc/carray.h @@ -167,11 +167,11 @@ int main() typedef struct { Value *ref; } carray##D##X##_iter_t; \
\
STC_INLINE carray##D##X##_iter_t \
- carray##D##X##_begin(carray##D##X* a) { \
+ carray##D##X##_begin(const carray##D##X* a) { \
carray##D##X##_iter_t it = {a->data}; return it; \
} \
STC_INLINE carray##D##X##_iter_t \
- carray##D##X##_end(carray##D##X* a) { \
+ carray##D##X##_end(const carray##D##X* a) { \
carray##D##X##_iter_t it = {a->data + carray##D##X##_size(*a)}; return it; \
} \
STC_INLINE void \
@@ -302,13 +302,13 @@ typedef struct {size_t idx; uint_fast8_t hx;} chash_bucket_t; }) \
\
STC_INLINE C##_##X##_iter_t \
- C##_##X##_begin(C##_##X* self) { \
+ C##_##X##_begin(const C##_##X* self) { \
C##_##X##_iter_t it = {self->table, self->_hashx}; \
if (it._hx) while (*it._hx == 0) ++it.ref, ++it._hx; \
return it; \
} \
STC_INLINE C##_##X##_iter_t \
- C##_##X##_end(C##_##X* self) {\
+ C##_##X##_end(const C##_##X* self) {\
C##_##X##_iter_t it = {self->table + self->bucket_count}; return it; \
} \
STC_INLINE void \
diff --git a/stc/cqueue.h b/stc/cqueue.h index 50fe929a..d6959271 100644 --- a/stc/cqueue.h +++ b/stc/cqueue.h @@ -93,9 +93,9 @@ } \
typedef ctype##_iter_t cqueue_##X##_iter_t; \
STC_INLINE cqueue_##X##_iter_t \
- cqueue_##X##_begin(cqueue_##X* self) {return ctype##_begin(self);} \
+ cqueue_##X##_begin(const cqueue_##X* self) {return ctype##_begin(self);} \
STC_INLINE cqueue_##X##_iter_t \
- cqueue_##X##_end(cqueue_##X* self) {return ctype##_end(self);} \
+ cqueue_##X##_end(const cqueue_##X* self) {return ctype##_end(self);} \
STC_INLINE void \
cqueue_##X##_next(cqueue_##X##_iter_t* it) {ctype##_next(it);} \
STC_INLINE cqueue_##X##_value_t* \
diff --git a/stc/csmap.h b/stc/csmap.h index a788a8e4..4107c1a2 100644 --- a/stc/csmap.h +++ b/stc/csmap.h @@ -297,13 +297,13 @@ struct csmap_rep { size_t root, disp, head, size, cap; void* nodes[]; }; STC_API void C##_##X##_next(C##_##X##_iter_t* it); \
\
STC_INLINE C##_##X##_iter_t \
- C##_##X##_begin(C##_##X* self) { \
+ C##_##X##_begin(const C##_##X* self) { \
C##_##X##_iter_t it = {NULL, self->nodes, 0, (C##_##X##_size_t) _csmap_rep(self)->root}; \
if (it._tn) C##_##X##_next(&it); \
return it; \
} \
STC_INLINE C##_##X##_iter_t \
- C##_##X##_end(C##_##X* self) {\
+ C##_##X##_end(const C##_##X* self) {\
C##_##X##_iter_t it = {NULL}; return it; \
} \
STC_INLINE C##_##X##_mapped_t* \
diff --git a/stc/cstack.h b/stc/cstack.h index d093ddcf..bc76cda2 100644 --- a/stc/cstack.h +++ b/stc/cstack.h @@ -80,9 +80,9 @@ } \
typedef ctype##_iter_t cstack_##X##_iter_t; \
STC_INLINE cstack_##X##_iter_t \
- cstack_##X##_begin(cstack_##X* self) {return ctype##_begin(self);} \
+ cstack_##X##_begin(const cstack_##X* self) {return ctype##_begin(self);} \
STC_INLINE cstack_##X##_iter_t \
- cstack_##X##_end(cstack_##X* self) {return ctype##_end(self);} \
+ cstack_##X##_end(const cstack_##X* self) {return ctype##_end(self);} \
STC_INLINE void \
cstack_##X##_next(cstack_##X##_iter_t* it) {ctype##_next(it);} \
STC_INLINE cstack_##X##_value_t* \
|
