Skip to content

Instantly share code, notes, and snippets.

@kjkasi
Created December 25, 2015 13:54
Show Gist options
  • Save kjkasi/b4dab427caebcae542c2 to your computer and use it in GitHub Desktop.
Save kjkasi/b4dab427caebcae542c2 to your computer and use it in GitHub Desktop.
This macro for checking block nullability before executing them:
#define BLOCK_EXEC(block, ...) if (block) { block(__VA_ARGS__); };
Moves from this:
if (completionBlock)
{
completionBlock(arg1, arg2);
}
to:
BLOCK_EXEC(completionBlock, arg1, arg2);
source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment