summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-19 00:55:38 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-19 00:55:38 -0800
commit77511a82b1efe2ecde013b3f20ff71605aa61971 (patch)
tree9930e6fb2ef5c2e911d6b2effcb0113754a60a77
parent3570de4c260cf45d202e3577d13385d722d043d1 (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.c21
-rw-r--r--misc.h4
-rw-r--r--xfwp.c6
3 files changed, 6 insertions, 25 deletions
diff --git a/misc.c b/misc.c
index d178ae7..5167a1c 100644
--- a/misc.c
+++ b/misc.c
@@ -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(
diff --git a/misc.h b/misc.h
index 314ceb2..3b27221 100644
--- a/misc.h
+++ b/misc.h
@@ -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,
diff --git a/xfwp.c b/xfwp.c
index b11760f..ca1bcb5 100644
--- a/xfwp.c
+++ b/xfwp.c
@@ -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;