It would also be nice to do this with a single NULL check instead of two, mostly in the interest of code size.