From 618c57d622f8be284f0e77022f1060dfe5d59446 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 22 Sep 2017 22:11:47 +0200 Subject: [PATCH] Fix naming convention --- m-core.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/m-core.h b/m-core.h index dfef7e8f..7545f48f 100644 --- a/m-core.h +++ b/m-core.h @@ -718,11 +718,10 @@ /* Map a macro to all given arguments with one additional fixed data (non recursive version) */ /* Example: M_MAP2(f, data, a, b, c) ==> f(data,a) f(data,b) f(data,c) */ -#define M_MAP2(f, d, ...) M_MAP20(M_C(M_MAP2B_, M_NARGS(__VA_ARGS__)), f, d, __VA_ARGS__) -#define M_MAP20(F,...) F (__VA_ARGS__) +#define M_MAP2(f, d, ...) M_MAP2I(M_C(M_MAP2B_, M_NARGS(__VA_ARGS__)), f, d, __VA_ARGS__) +#define M_MAP2I(F,...) F (__VA_ARGS__) - -/* Duplicate of macros for GET_METHOD as it may be called in context where a M_MAP2 is in progress. +/* Duplicate for GET_METHOD as it may be called in context where a M_MAP2 is in progress. NOTE: Increase number of arguments to 52 due to the number of available methods. NOTE: Rewrite with another approach much more verbose but also much faster for the compiler. This kind of approach seems ugly, but is in fact the fast one. @@ -730,8 +729,9 @@ Generated by the following command: for i in $(seq 1 52) ; do printf "#define M_MAP2B_%d(f, d" $i ; for j in $(seq 1 $i) ; do printf ", _%d" $j ; done ; printf ") " ; for j in $(seq 1 $i) ; do printf "f(d, _%d) " $j ; done ; printf "\n"; done */ -#define M_MAP2B(f, d, ...) M_MAP2B0(M_C(M_MAP2B_, M_NARGS(__VA_ARGS__)), f, d, __VA_ARGS__) -#define M_MAP2B0(F,...) F (__VA_ARGS__) +#define M_MAP2B(f, d, ...) M_MAP2BI(M_C(M_MAP2B_, M_NARGS(__VA_ARGS__)), f, d, __VA_ARGS__) +#define M_MAP2BI(F,...) F (__VA_ARGS__) + #define M_MAP2B_1(f, d, _1) f(d, _1) #define M_MAP2B_2(f, d, _1, _2) f(d, _1) f(d, _2) #define M_MAP2B_3(f, d, _1, _2, _3) f(d, _1) f(d, _2) f(d, _3)