Simplify the code by using new xalloc.h features.