Skip to content

Instantly share code, notes, and snippets.

@MarcoSero
Forked from JaviSoto/gist:5986283
Created July 12, 2013 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcoSero/5987637 to your computer and use it in GitHub Desktop.
Save MarcoSero/5987637 to your computer and use it in GitHub Desktop.
#define ms_invoke_block_if_not_nil(BLOCK, ...) if ((BLOCK)) {(BLOCK)(__VA_ARGS__);}
// Usage:
void (^block)(id, id, id) = void(^)(id parameter1, id parameter2, id parameter3) {
// ...
};
ms_invoke_block_if_not_nil(block, parameter1, parameter2, parameter3);
// As opposed to:
if (block) {
block(parameter1, parameter2, parameter3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment