From 09f0a4d580a774c977483c95ef828b7b1cd1075b Mon Sep 17 00:00:00 2001 From: delphij Date: Fri, 15 May 2009 19:41:10 +0000 Subject: Reduce diff against my local version: replace malloc+memset() cases to calloc(). --- usr.bin/truss/amd64-fbsd.c | 3 +-- usr.bin/truss/amd64-fbsd32.c | 3 +-- usr.bin/truss/amd64-linux32.c | 3 +-- usr.bin/truss/i386-fbsd.c | 3 +-- usr.bin/truss/i386-linux.c | 3 +-- usr.bin/truss/ia64-fbsd.c | 3 +-- usr.bin/truss/main.c | 7 +++---- usr.bin/truss/mips-fbsd.c | 3 +-- usr.bin/truss/powerpc-fbsd.c | 3 +-- usr.bin/truss/sparc64-fbsd.c | 3 +-- 10 files changed, 12 insertions(+), 22 deletions(-) diff --git a/usr.bin/truss/amd64-fbsd.c b/usr.bin/truss/amd64-fbsd.c index d43f929..f7c949a 100644 --- a/usr.bin/truss/amd64-fbsd.c +++ b/usr.bin/truss/amd64-fbsd.c @@ -191,8 +191,7 @@ amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/amd64-fbsd32.c b/usr.bin/truss/amd64-fbsd32.c index 4e6458a..9b0eb28 100644 --- a/usr.bin/truss/amd64-fbsd32.c +++ b/usr.bin/truss/amd64-fbsd32.c @@ -194,8 +194,7 @@ amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/amd64-linux32.c b/usr.bin/truss/amd64-linux32.c index 7f7390a..7d88c8d 100644 --- a/usr.bin/truss/amd64-linux32.c +++ b/usr.bin/truss/amd64-linux32.c @@ -164,8 +164,7 @@ amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/i386-fbsd.c b/usr.bin/truss/i386-fbsd.c index a65c7db..6f774b2 100644 --- a/usr.bin/truss/i386-fbsd.c +++ b/usr.bin/truss/i386-fbsd.c @@ -184,8 +184,7 @@ i386_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/i386-linux.c b/usr.bin/truss/i386-linux.c index de17628..2bd6e7b 100644 --- a/usr.bin/truss/i386-linux.c +++ b/usr.bin/truss/i386-linux.c @@ -164,8 +164,7 @@ i386_linux_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/ia64-fbsd.c b/usr.bin/truss/ia64-fbsd.c index cd8c69e..8c82218 100644 --- a/usr.bin/truss/ia64-fbsd.c +++ b/usr.bin/truss/ia64-fbsd.c @@ -166,8 +166,7 @@ ia64_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 4333f2d..d0dd073 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -179,11 +179,10 @@ main(int ac, char **av) initial_open = 1; /* Initialize the trussinfo struct */ - trussinfo = (struct trussinfo *)malloc(sizeof(struct trussinfo)); + trussinfo = (struct trussinfo *)calloc(1, sizeof(struct trussinfo)); if (trussinfo == NULL) - errx(1, "malloc() failed"); - bzero(trussinfo, sizeof(struct trussinfo)); - + errx(1, "calloc() failed"); + trussinfo->outfile = stderr; trussinfo->strsize = 32; trussinfo->pr_why = S_NONE; diff --git a/usr.bin/truss/mips-fbsd.c b/usr.bin/truss/mips-fbsd.c index bfefdd7..342883c 100644 --- a/usr.bin/truss/mips-fbsd.c +++ b/usr.bin/truss/mips-fbsd.c @@ -211,8 +211,7 @@ mips_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/powerpc-fbsd.c b/usr.bin/truss/powerpc-fbsd.c index 2316740..43f7c9e 100644 --- a/usr.bin/truss/powerpc-fbsd.c +++ b/usr.bin/truss/powerpc-fbsd.c @@ -193,8 +193,7 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* diff --git a/usr.bin/truss/sparc64-fbsd.c b/usr.bin/truss/sparc64-fbsd.c index 31e304a..7877743 100644 --- a/usr.bin/truss/sparc64-fbsd.c +++ b/usr.bin/truss/sparc64-fbsd.c @@ -209,8 +209,7 @@ sparc64_syscall_entry(struct trussinfo *trussinfo, int nargs) { fsc.nargs = nargs; } - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - memset(fsc.s_args, 0, fsc.nargs * sizeof(char*)); + fsc.s_args = calloc(1, (1+fsc.nargs) * sizeof(char*)); fsc.sc = sc; /* -- cgit v1.1