summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-09-23 13:17:22 +0200
committerTyge Løvset <[email protected]>2022-09-23 13:17:22 +0200
commit2c83996f1ad7ac7176833d1ecb76f59120bf52cd (patch)
tree495527c129d630b67aed0d8528c70ef5aa418106 /include
parent0ec40a5819a619b6b2777f24c555a8953e99ea9b (diff)
downloadSTC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.tar.gz
STC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.zip
Reverted c_forrange() macro with 3 or more args: swapped 1st and 2nd arg again.
Diffstat (limited to 'include')
-rw-r--r--include/stc/ccommon.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 59056905..08445dae 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -191,11 +191,12 @@ STC_INLINE char* c_strnstrn(const char *s, const char *needle,
; C##_next(&_._it))
#define c_forrange(...) c_MACRO_OVERLOAD(c_forrange, __VA_ARGS__)
-#define c_forrange1(stop) c_forrange4(size_t, _c_i, 0, stop)
-#define c_forrange2(i, stop) c_forrange4(size_t, i, 0, stop)
-#define c_forrange3(itype, i, stop) c_forrange4(itype, i, 0, stop)
-#define c_forrange4(itype, i, start, stop) for (itype i=start, _end=stop; i < _end; ++i)
-#define c_forrange5(itype, i, start, stop, step) \
+#define c_forrange1(stop) c_forrange4(_c_i, size_t, 0, stop)
+#define c_forrange2(i, stop) c_forrange4(i, size_t, 0, stop)
+#define c_forrange3(i, itype, stop) c_forrange4(i, itype, 0, stop)
+#define c_forrange4(i, itype, start, stop) \
+ for (itype i=start, _end=stop; i < _end; ++i)
+#define c_forrange5(i, itype, start, stop, step) \
for (itype i=start, _inc=step, _end=(stop) - (0 < _inc) \
; (i <= _end) == (0 < _inc); i += _inc)