library: expanded/generalized memory allocation provisions

A callback provision in the form of xalloc_err_handler
(of type message_fn) was added to the alloc module.

This change allowed a program like top, who alters the
termios structure, to override the default fprint(stderr...)
behavior in the event of an error.

The new function xstrdup was also added for symmetry.
This commit is contained in:
Jim Warner authored and Craig Small committed 2011-12-11 22:26:49 +11:00
1 parent f9ab2fec43
commit 7126cc4491
5 files changed
+60 -19

No files matched your search

+3
View File
@@ -109,4 +109,7 @@
#define HIDDEN_ALIAS(x) extern __typeof(x) x##_direct __attribute__((alias(#x)))
#endif
typedef void (*message_fn)(const char *restrict, ...) __attribute__((format(printf,1,2)));
#endif