Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2009 19:41:10 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192153 - head/usr.bin/truss
Message-ID:  <200905151941.n4FJfA4d032632@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri May 15 19:41:10 2009
New Revision: 192153
URL: http://svn.freebsd.org/changeset/base/192153

Log:
  Reduce diff against my local version: replace malloc+memset() cases to calloc().

Modified:
  head/usr.bin/truss/amd64-fbsd.c
  head/usr.bin/truss/amd64-fbsd32.c
  head/usr.bin/truss/amd64-linux32.c
  head/usr.bin/truss/i386-fbsd.c
  head/usr.bin/truss/i386-linux.c
  head/usr.bin/truss/ia64-fbsd.c
  head/usr.bin/truss/main.c
  head/usr.bin/truss/mips-fbsd.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/sparc64-fbsd.c

Modified: head/usr.bin/truss/amd64-fbsd.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/amd64-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -191,8 +191,7 @@ amd64_syscall_entry(struct trussinfo *tr
     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;
 
   /*

Modified: head/usr.bin/truss/amd64-fbsd32.c
==============================================================================
--- head/usr.bin/truss/amd64-fbsd32.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/amd64-fbsd32.c	Fri May 15 19:41:10 2009	(r192153)
@@ -194,8 +194,7 @@ amd64_fbsd32_syscall_entry(struct trussi
     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;
 
   /*

Modified: head/usr.bin/truss/amd64-linux32.c
==============================================================================
--- head/usr.bin/truss/amd64-linux32.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/amd64-linux32.c	Fri May 15 19:41:10 2009	(r192153)
@@ -164,8 +164,7 @@ amd64_linux32_syscall_entry(struct truss
     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;
 
   /*

Modified: head/usr.bin/truss/i386-fbsd.c
==============================================================================
--- head/usr.bin/truss/i386-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/i386-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -184,8 +184,7 @@ i386_syscall_entry(struct trussinfo *tru
     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;
 
   /*

Modified: head/usr.bin/truss/i386-linux.c
==============================================================================
--- head/usr.bin/truss/i386-linux.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/i386-linux.c	Fri May 15 19:41:10 2009	(r192153)
@@ -164,8 +164,7 @@ i386_linux_syscall_entry(struct trussinf
     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;
 
   /*

Modified: head/usr.bin/truss/ia64-fbsd.c
==============================================================================
--- head/usr.bin/truss/ia64-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/ia64-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -166,8 +166,7 @@ ia64_syscall_entry(struct trussinfo *tru
     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;
 
   /*

Modified: head/usr.bin/truss/main.c
==============================================================================
--- head/usr.bin/truss/main.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/main.c	Fri May 15 19:41:10 2009	(r192153)
@@ -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;

Modified: head/usr.bin/truss/mips-fbsd.c
==============================================================================
--- head/usr.bin/truss/mips-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/mips-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -211,8 +211,7 @@ mips_syscall_entry(struct trussinfo *tru
     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;
 
   /*

Modified: head/usr.bin/truss/powerpc-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/powerpc-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -193,8 +193,7 @@ powerpc_syscall_entry(struct trussinfo *
     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;
 
   /*

Modified: head/usr.bin/truss/sparc64-fbsd.c
==============================================================================
--- head/usr.bin/truss/sparc64-fbsd.c	Fri May 15 19:33:59 2009	(r192152)
+++ head/usr.bin/truss/sparc64-fbsd.c	Fri May 15 19:41:10 2009	(r192153)
@@ -209,8 +209,7 @@ sparc64_syscall_entry(struct trussinfo *
     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;
 
   /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905151941.n4FJfA4d032632>