Move NULL_HANDLE & friends to q_common.h. Fix warnings by using
NULL_HANDLE instead of NULL.