library: eliminate all dependencies on alloc.h/alloc.c
While that old master branch library may utilize those memory allocation functions found in the alloc module, it was inappropriate for this newlib branch to subject callers to a stderr message followed by an early exit. Of course, the old libprocps offered a message handler override provision (xalloc_err_handler) but that, too, would seem to be inappropriate for our modern library. [ remember the battles fought with that damn libnuma ] So, this commit will tweak those old inherited sources setting the stage for standardized return values/errno settings in connection with a memory allocation error. ------------------------------------------------------ Along the way, we'll address the following miscellany: . Completely eliminate usage of anything from alloc.h. This, of course, entails our own error checking of the alternative allocation calls from stdlib.h & string.h. . Eliminate use of the strdup function where possible, as with 'procps_uptime' and 'procps_loadavg' routines. . Whack some obsolete code (getslabinfo) in sysinfo.c. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <unistd.h>
|
||||
#include "version.h"
|
||||
#include "devname.h"
|
||||
#include "alloc.h"
|
||||
|
||||
// This is the buffer size for a tty name. Any path is legal,
|
||||
// which makes PAGE_SIZE appropriate (see kernel source), but
|
||||
@@ -83,7 +82,8 @@ static void load_drivers(void){
|
||||
end = strchr(p, ' ');
|
||||
if(!end) continue;
|
||||
len = end - p;
|
||||
tmn = xcalloc(sizeof(tty_map_node));
|
||||
if (!(tmn = calloc(1, sizeof(tty_map_node))))
|
||||
goto fail;
|
||||
tmn->next = tty_map;
|
||||
tty_map = tmn;
|
||||
/* if we have a devfs type name such as /dev/tts/%d then strip the %d but
|
||||
|
||||
Reference in New Issue
Block a user