xrealloc(): similar to xmalloc()

Replaced all calls to realloc by xrealloc. All `== NULL` tests can be removed
and the code within `!= NULL` tests can be unwrapped.