diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 00:55:38 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-19 00:55:38 -0800 |
commit | 77511a82b1efe2ecde013b3f20ff71605aa61971 (patch) | |
tree | 9930e6fb2ef5c2e911d6b2effcb0113754a60a77 | |
parent | 3570de4c260cf45d202e3577d13385d722d043d1 (diff) |
Remove Malloc wrapper and its MallocFailed helper
Only two calls left, one of which was already checking for failure.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | misc.c | 21 | ||||
-rw-r--r-- | misc.h | 4 | ||||
-rw-r--r-- | xfwp.c | 6 |
3 files changed, 6 insertions, 25 deletions
@@ -72,13 +72,6 @@ Usage(void) } static void -MallocFailed(void) -{ - (void) fprintf(stderr, "Memory allocation failed, exiting\n"); - exit(1); -} - -static void BadMalloc( int line) { @@ -208,8 +201,7 @@ doInitNewRule( } } - if ((config_lineP = (struct config_line *) - Malloc (sizeof(struct config_line))) == NULL) + if ((config_lineP = malloc (sizeof(struct config_line))) == NULL) { (void) fprintf (stderr, "malloc - config_lineP\n"); return -1; @@ -480,17 +472,6 @@ doProcessLine( /* * Public functions */ -char* -Malloc( - int s) -{ - char *p = malloc(s); - - if (!p) - MallocFailed(); - - return p; -} int doConfigCheck( @@ -51,10 +51,6 @@ X Window System is a trademark of The Open Group. #define SEPARATOR2 '.' -extern char* -Malloc( - int s); - extern int doConfigCheck( struct sockaddr_in * source_sockaddr_in, @@ -77,7 +77,11 @@ main ( * without making everything global! See FWPprotocolSetupProc() for * the rest of what we are doing */ - config_info = (struct config *) Malloc(sizeof(struct config)); + if ((config_info = malloc(sizeof(struct config))) == NULL) + { + fprintf(stderr, "Memory allocation failed, exiting\n"); + exit(1); + } global_data.config_info = config_info; global_data.nfds = &nfds; |