I have thousands of shells of functions that actually do the same logic, for example:
void API_Wrapper(hHandle, a, b, ..)
{
if (hHandle)
return remote_API(hHandle, a, b, ..);
else
return API(a, b, ..);
}
I want to use a macro to reuse if-else logic, so I can just implement a function like this:
void API_Wrapper(hHandle, a, b, ..)
{
API_CALL(api_name, hHandle, a, b, ..);
}
I did not come up with a good way. (Note: I could solve this with ... and __va_args__, but this extension is not supported by the compiler we are currently using)
Has anyone ever encountered the same problem and any idea?
source
share