diff options
| author | Tyge Løvset <[email protected]> | 2020-09-03 11:25:07 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-03 11:25:07 +0200 |
| commit | aaa3d7f6a107a668b1f24d8ed061fe74237d9883 (patch) | |
| tree | 07568011ab5bb4975d672f456a6cf25961586533 | |
| parent | 1051f059d47d30e4b8c18608c62c62920f51bc58 (diff) | |
| download | STC-modified-aaa3d7f6a107a668b1f24d8ed061fe74237d9883.tar.gz STC-modified-aaa3d7f6a107a668b1f24d8ed061fe74237d9883.zip | |
Changed itval() taking iter instead of iter address as arg.
| -rw-r--r-- | examples/stack.c | 2 | ||||
| -rw-r--r-- | stc/clist.h | 2 | ||||
| -rw-r--r-- | stc/cmap.h | 2 | ||||
| -rw-r--r-- | stc/cqueue.h | 2 | ||||
| -rw-r--r-- | stc/cstack.h | 2 | ||||
| -rw-r--r-- | stc/cstr.h | 2 | ||||
| -rw-r--r-- | stc/cvec.h | 2 |
7 files changed, 8 insertions, 6 deletions
diff --git a/examples/stack.c b/examples/stack.c index 2aa8364b..321228a2 100644 --- a/examples/stack.c +++ b/examples/stack.c @@ -14,5 +14,7 @@ int main() { for (int i=0; i<90; ++i)
cstack_i_pop(&stack);
+ c_foreach (i, cstack_i, stack)
+ printf("%d\n", *cstack_i_itval(i));
printf("top: %d\n", *cstack_i_top(&stack));
}
\ No newline at end of file diff --git a/stc/clist.h b/stc/clist.h index bbf05201..39479a09 100644 --- a/stc/clist.h +++ b/stc/clist.h @@ -146,7 +146,7 @@ STC_API size_t _clist_size(const clist_void* self); it->item = it->item->next; \
} \
STC_INLINE clist_##tag##_value_t* \
- clist_##tag##_itval(clist_##tag##_iter_t* it) {return &it->item->value;} \
+ clist_##tag##_itval(clist_##tag##_iter_t it) {return &it.item->value;} \
\
STC_API clist_##tag##_iter_t \
clist_##tag##_insert_after_v(clist_##tag* self, clist_##tag##_iter_t pos, Value value); \
@@ -250,7 +250,7 @@ ctype##_##tag##_next(ctype##_##tag##_iter_t* it) { \ while ((++it->item, *++it->_hx == 0)) ; \
} \
CMAP_ONLY_##ctype( STC_INLINE ctype##_##tag##_value_t* \
-ctype##_##tag##_itval(ctype##_##tag##_iter_t* it) {return &it->item->value;} ) \
+ctype##_##tag##_itval(ctype##_##tag##_iter_t it) {return &it.item->value;} ) \
\
STC_API uint32_t c_default_hash16(const void *data, size_t len); \
STC_API uint32_t c_default_hash32(const void* data, size_t len); \
diff --git a/stc/cqueue.h b/stc/cqueue.h index b69092d6..824f70dc 100644 --- a/stc/cqueue.h +++ b/stc/cqueue.h @@ -97,7 +97,7 @@ cqueue_##tag##_begin(cqueue_##tag* self) {return ctype##_begin(self);} \ STC_INLINE void \
cqueue_##tag##_next(cqueue_##tag##_iter_t* it) {ctype##_next(it);} \
STC_INLINE cqueue_##tag##_value_t* \
-cqueue_##tag##_itval(cqueue_##tag##_iter_t* it) {return ctype##_itval(it);} \
+cqueue_##tag##_itval(cqueue_##tag##_iter_t it) {return ctype##_itval(it);} \
\
typedef int cqueue_##tag##_dud
diff --git a/stc/cstack.h b/stc/cstack.h index 1f8c8a4f..d90eee4e 100644 --- a/stc/cstack.h +++ b/stc/cstack.h @@ -84,7 +84,7 @@ cstack_##tag##_begin(cstack_##tag* self) {return ctype##_begin(self);} \ STC_INLINE void \
cstack_##tag##_next(cstack_##tag##_iter_t* it) {ctype##_next(it);} \
STC_INLINE cstack_##tag##_value_t* \
-cstack_##tag##_itval(cstack_##tag##_iter_t* it) {return ctype##_itval(it);} \
+cstack_##tag##_itval(cstack_##tag##_iter_t it) {return ctype##_itval(it);} \
\
typedef int cstack_##tag##_dud
@@ -111,7 +111,7 @@ cstr_begin(cstr_t* self) { cstr_iter_t it = {self->str, self->str + cstr_size(*self)}; return it;
}
STC_INLINE void cstr_next(cstr_iter_t* it) { ++it->item; }
-STC_INLINE char* cstr_itval(cstr_iter_t* it) {return it->item;}
+STC_INLINE char* cstr_itval(cstr_iter_t it) {return it.item;}
STC_INLINE cstr_t*
cstr_assign(cstr_t* self, const char* str) {
@@ -147,7 +147,7 @@ cvec_##tag##_begin(cvec_##tag* vec) { \ STC_INLINE void \
cvec_##tag##_next(cvec_##tag##_iter_t* it) { ++it->item; } \
STC_INLINE cvec_##tag##_value_t* \
-cvec_##tag##_itval(cvec_##tag##_iter_t* it) {return it->item;} \
+cvec_##tag##_itval(cvec_##tag##_iter_t it) {return it.item;} \
\
implement_cvec_7(tag, Value, valueDestroy, RawValue, valueCompareRaw, valueToRaw, valueFromRaw)
|
