if(*(u_int32_t)cmdword == *(u_int32_t *)"EHLO") {
handle_ehlo();
}
The "extern inline" idiom for forcing inlining, which I picked up from Mike Stolarchuk.Passing and assigning trivial structures by value instead of fiddley pointers.
Arena allocators.
Not so much a trick, but: you can safely free() NULL, which saves a conditional. In the same vein: not only is there no point to casting malloc()'s return value, but there are (admittedly rare) circumstances where doing so can be harmful. So save yourself the typing.
assert(!"message") instead of assert(0).