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:
@@ -5,9 +5,13 @@
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
extern void *xrealloc(void *oldp, unsigned int size) MALLOC;
|
||||
/* change xalloc_err_handler to override the default fprintf(stderr... */
|
||||
extern message_fn xalloc_err_handler;
|
||||
|
||||
extern void *xcalloc(unsigned int size) MALLOC;
|
||||
extern void *xmalloc(unsigned int size) MALLOC;
|
||||
extern void *xcalloc(void *pointer, int size) MALLOC;
|
||||
extern void *xrealloc(void *oldp, unsigned int size) MALLOC;
|
||||
extern char *xstrdup(const char *str) MALLOC;
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
|
Reference in New Issue
Block a user