diff options
| author | Tyge Løvset <[email protected]> | 2022-03-25 07:35:21 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-03-25 07:35:21 +0100 |
| commit | f943c8b7a6e46dc002ffc63c9fbcc111f6dca55d (patch) | |
| tree | 32a315540d058ca5968f05caa973411c13f8226d /include/stc | |
| parent | fb1f2f3dcec3acf10fcd9f6674fbddb3fd682b3c (diff) | |
| download | STC-modified-f943c8b7a6e46dc002ffc63c9fbcc111f6dca55d.tar.gz STC-modified-f943c8b7a6e46dc002ffc63c9fbcc111f6dca55d.zip | |
Modified (more) rarely used macros c_apply_cnt(v, ..) and c_apply_arr(v, ..) so that v is a reference that may modify the container items.
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/ccommon.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 4034c0ce..4ee6cad0 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -200,14 +200,14 @@ STC_INLINE char* c_strnstrn(const char *s, const char *needle, size_t slen, cons } while (0)
#define c_apply_arr(v, action, T, arr, n) do { \
typedef T _c_T; \
- const _c_T* _c_arr = arr; size_t _n = n; \
- for (size_t index = 0; index < _n; ++index) \
- { const _c_T v = _c_arr[index]; action; } \
+ _c_T *_c_arr = arr; \
+ for (size_t index = 0, _c_n = n; index < _c_n; ++index) \
+ { _c_T *v = _c_arr + index; action; } \
} while (0)
#define c_apply_cnt(v, action, C, ...) do { \
size_t index = 0; \
c_foreach (_it, C, __VA_ARGS__) \
- { const C##_value v = *_it.ref; action; ++index; } \
+ { C##_value* v = _it.ref; action; ++index; } \
} while (0)
#define c_pair(v) (v).first, (v).second
|
