9.2.1.2 Memory Management

A useful idiom common to many GNU projects is to wrap the memory
management functions to localise out of memory handling, naming
them with an `x' prefix. By doing this, the rest of the project is
relieved of having to remember to check for `NULL' returns from the
various memory functions. These wrappers use the error API
to report memory exhaustion and abort the program. I have placed the
implementation code in `xmalloc.c':

Notice in the code above, that xcalloc is implemented in terms of
xmalloc, since calloc itself is not available in some
older C libraries. Also, the bzero function is actually
deprecated in favour of memset in modern C libraries --
I'll explain how to take this into account later in 9.2.3 Beginnings of a `configure.in'.

Rather than create a separate `xmalloc.h' file, which would need to
be #included from almost everywhere else, the logical place to
declare these functions is in `common.h', since the wrappers will
be called from most everywhere else in the code: