From c75fd8e4e49a245b58678c5d92abfa0823ab3eed Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 15 Apr 2022 22:57:56 +0200 Subject: Adding comment to #endif's. --- include/stc/cdeq.h | 10 ++++------ include/stc/clist.h | 4 ++-- include/stc/cmap.h | 12 +++++------- include/stc/cpque.h | 4 ++-- include/stc/csmap.h | 16 +++++++--------- include/stc/cstack.h | 4 ++-- include/stc/cvec.h | 5 ++--- 7 files changed, 24 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index e562eaee..baa7cb04 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -80,7 +80,7 @@ STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) { if (self->data == other.data) return; _cx_memb(_drop)(self); *self = _cx_memb(_clone)(other); } -#endif +#endif // !_i_no_clone STC_INLINE bool _cx_memb(_empty)(_cx_self cx) { return !cdeq_rep_(&cx)->size; } STC_INLINE size_t _cx_memb(_size)(_cx_self cx) { return cdeq_rep_(&cx)->size; } STC_INLINE size_t _cx_memb(_capacity)(_cx_self cx) { return cdeq_rep_(&cx)->cap; } @@ -141,8 +141,7 @@ _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx_iter it2) { return _cx_memb(_erase_range_p)(self, it1.ref, it2.ref); } -#if !defined _i_no_clone -#if !defined _i_no_emplace +#if !defined _i_no_clone && !defined _i_no_emplace STC_INLINE _cx_iter _cx_memb(_emplace_range)(_cx_self* self, _cx_iter it, _cx_iter it1, _cx_iter it2) { return _cx_memb(_clone_range_p)(self, it.ref, it1.ref, it2.ref); @@ -160,8 +159,7 @@ STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, i_valraw raw) { return _cx_memb(_emplace_range_p)(self, it.ref, &raw, &raw + 1); } -#endif // _i_no_emplace -#endif // !_i_no_clone +#endif // !_i_no_clone && !_i_no_emplace #if !c_option(c_no_cmp) @@ -382,7 +380,7 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, co for (; p1 != p2; ++p1) *pos++ = i_valfrom((*p1)); return it; } -#endif +#endif // !_i_no_emplace STC_DEF _cx_iter _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos, diff --git a/include/stc/clist.h b/include/stc/clist.h index eec795cf..88f41f4e 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -122,8 +122,8 @@ STC_INLINE _cx_value* _cx_memb(_emplace_front)(_cx_self* self, i_valraw raw) { return _cx_memb(_push_front)(self, i_valfrom(raw)); } STC_INLINE _cx_iter _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, i_valraw raw) { return _cx_memb(_insert_at)(self, it, i_valfrom(raw)); } -#endif -#endif +#endif // !_i_no_emplace +#endif // !_i_no_clone STC_INLINE _cx_self _cx_memb(_init)(void) { return c_make(_cx_self){NULL}; } STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return true; } diff --git a/include/stc/cmap.h b/include/stc/cmap.h index 340cba87..af14cd1e 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -125,7 +125,7 @@ STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, i_keyraw rkey) assert(self->_hashx[b.idx]); return &self->table[b.idx].second; } -#endif +#endif // !_i_isset #if !defined _i_no_clone STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) { @@ -264,7 +264,7 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) { memset(self->_hashx, 0, self->bucket_count); } -#if !defined _i_isset +#ifndef _i_isset STC_DEF _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key _key, i_val _mapped) { _cx_result _res = _cx_memb(_insert_entry_)(self, i_keyto((&_key))); @@ -273,8 +273,7 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) { _res.ref->second = _mapped; return _res; } - #if !defined _i_no_clone - #if !defined _i_no_emplace + #if !defined _i_no_clone && !defined _i_no_emplace STC_DEF _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, i_keyraw rkey, i_valraw rmapped) { _cx_result _res = _cx_memb(_insert_entry_)(self, rkey); @@ -282,9 +281,8 @@ STC_DEF void _cx_memb(_clear)(_cx_self* self) { else { i_valdrop((&_res.ref->second)); } _res.ref->second = i_valfrom(rmapped); return _res; } - #endif - #endif -#endif + #endif // !_i_no_clone && !_i_no_emplace +#endif // !_i_isset STC_DEF chash_bucket_t _cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr) { diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 1b247a9f..794c73ce 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -101,8 +101,8 @@ STC_INLINE i_val _cx_memb(_value_clone)(_cx_value val) #if !defined _i_no_emplace STC_INLINE void _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { _cx_memb(_push)(self, i_valfrom(raw)); } -#endif -#endif +#endif // !_i_no_emplace +#endif // !_i_no_clone /* -------------------------- IMPLEMENTATION ------------------------- */ #if defined(_i_implement) diff --git a/include/stc/csmap.h b/include/stc/csmap.h index be726723..48dc053a 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -99,8 +99,8 @@ STC_API void _cx_memb(_copy)(_cx_self *self, _cx_self other); STC_API _cx_value _cx_memb(_value_clone)(_cx_value _val); #if !defined _i_no_emplace STC_API _cx_result _cx_memb(_emplace)(_cx_self* self, i_keyraw rkey _i_MAP_ONLY(, i_valraw rmapped)); -#endif -#endif +#endif // !_i_no_emplace +#endif // !_i_no_clone STC_API _cx_self _cx_memb(_init)(void); STC_API _cx_result _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)); STC_API void _cx_memb(_drop)(_cx_self* self); @@ -168,7 +168,7 @@ _cx_memb(_value_drop)(_cx_value* val) { STC_INLINE const _cx_mapped* _cx_memb(_at)(const _cx_self* self, i_keyraw rkey) { _cx_iter it; return &_cx_memb(_find_it)(self, rkey, &it)->second; } -#endif +#endif // !_i_isset STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, i_keyraw rkey) { @@ -268,7 +268,7 @@ _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)) { return res; } -#if !defined _i_isset +#ifndef _i_isset STC_DEF _cx_result _cx_memb(_insert_or_assign)(_cx_self* self, i_key key, i_val mapped) { _cx_result res = _cx_memb(_insert_entry_)(self, i_keyto((&key))); @@ -277,8 +277,7 @@ _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)) { res.ref->second = mapped; return res; } - #if !defined _i_no_clone - #if !defined _i_no_emplace + #if !defined _i_no_clone && !defined _i_no_emplace STC_DEF _cx_result _cx_memb(_emplace_or_assign)(_cx_self* self, i_keyraw rkey, i_valraw rmapped) { _cx_result res = _cx_memb(_insert_entry_)(self, rkey); @@ -286,9 +285,8 @@ _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped)) { else { i_valdrop((&res.ref->second)); } res.ref->second = i_valfrom(rmapped); return res; } - #endif - #endif -#endif + #endif // !_i_no_clone && !_i_no_emplace +#endif // !_i_isset STC_DEF _cx_value* _cx_memb(_find_it)(const _cx_self* self, i_keyraw rkey, _cx_iter* out) { diff --git a/include/stc/cstack.h b/include/stc/cstack.h index b3f5d5e2..079d9bd0 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -104,7 +104,8 @@ STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push)(self, i_valfrom(raw)); } STC_INLINE _cx_value* _cx_memb(_emplace_back)(_cx_self* self, _cx_raw raw) { return _cx_memb(_push)(self, i_valfrom(raw)); } -#endif +#endif // !_i_no_emplace + STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) { _cx_self out = {(_cx_value *) c_malloc(v.size*sizeof(_cx_value)), v.size, v.size}; i_valraw r; @@ -112,7 +113,6 @@ STC_INLINE _cx_self _cx_memb(_clone)(_cx_self v) { r = i_valto(v.data), out.data[i++] = i_valfrom(r); return out; } - STC_INLINE void _cx_memb(_copy)(_cx_self *self, _cx_self other) { if (self->data == other.data) return; _cx_memb(_drop)(self); *self = _cx_memb(_clone)(other); diff --git a/include/stc/cvec.h b/include/stc/cvec.h index b671413b..56b0742f 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -347,7 +347,6 @@ _cx_memb(_erase_range_p)(_cx_self* self, _cx_value* p1, _cx_value* p2) { } #if !defined _i_no_clone - STC_DEF _cx_self _cx_memb(_clone)(_cx_self cx) { const size_t len = cvec_rep_(&cx)->size; @@ -366,6 +365,7 @@ _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos, r = i_valto(p1), *pos++ = i_valfrom(r); return it; } + #if !defined _i_no_emplace STC_DEF _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, @@ -375,11 +375,10 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, for (; p1 != p2; ++p1) *pos++ = i_valfrom((*p1)); return it; } -#endif +#endif // !_i_no_emplace #endif // !_i_no_clone #if !c_option(c_no_cmp) - STC_DEF _cx_iter _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, i_valraw raw) { for (; i1.ref != i2.ref; ++i1.ref) { -- cgit v1.2.3