DragonFly BSD
DragonFly submit List (threaded) for 2004-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: style(9) sweep on config(8)


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Thu, 4 Mar 2004 15:36:51 -0800

On Thu, 4 Mar 2004 21:53:07 +0100
Eirik Nygaard <eirikn@xxxxxxxxxxxx> wrote:

> On Thu, Mar 04, 2004 at 12:19:38PM -0800, Chris Pressey wrote:
> > [of patches to config]
> 
> The patches are commited, thanks.

Thanks!  Another small one:

	o  Use memset(ptr, 0, size) instead of bzero(ptr, size)
	o  Get rid of useless char * assignment in config.y

-Chris
Index: config.y
===================================================================
RCS file: /home/dcvs/src/usr.sbin/config/config.y,v
retrieving revision 1.7
diff -u -r1.7 config.y
--- config.y	4 Mar 2004 20:44:49 -0000	1.7
+++ config.y	4 Mar 2004 15:04:24 -0000
@@ -233,7 +233,6 @@
 	Save_id
 	      = {
 		struct opt *op;
-		char *s;
 		
 		op = (struct opt *)malloc(sizeof(struct opt));
 		memset(op, 0, sizeof(*op));
@@ -246,7 +245,7 @@
 		 */
 		op->op_line = yyline;
 		opt = op;
-		if ((s = strchr(op->op_name, '=')))
+		if (strchr(op->op_name, '=') != NULL)
 			errx(1, "line %d: The `=' in options should not be quoted", yyline);
 	      } |
 	Save_id EQUALS Opt_value
Index: mkheaders.c
===================================================================
RCS file: /home/dcvs/src/usr.sbin/config/mkheaders.c,v
retrieving revision 1.9
diff -u -r1.9 mkheaders.c
--- mkheaders.c	4 Mar 2004 20:52:27 -0000	1.9
+++ mkheaders.c	4 Mar 2004 15:05:15 -0000
@@ -174,7 +174,7 @@
 		if (cp == (char *)EOF)
 			break;
 		fl = (struct file_list *)malloc(sizeof(*fl));
-		bzero(fl, sizeof(*fl));
+		memset(fl, 0, sizeof(*fl));
 		fl->f_fn = inw;		/* malloced */
 		fl->f_type = inc;
 		fl->f_next = fl_head;
@@ -191,7 +191,7 @@
 	}
 	if (oldcount == -1) {
 		fl = (struct file_list *)malloc(sizeof(*fl));
-		bzero(fl, sizeof(*fl));
+		memset(fl, 0, sizeof(*fl));
 		fl->f_fn = ns(name);
 		fl->f_type = count;
 		fl->f_next = fl_head;
Index: mkmakefile.c
===================================================================
RCS file: /home/dcvs/src/usr.sbin/config/mkmakefile.c,v
retrieving revision 1.8
diff -u -r1.8 mkmakefile.c
--- mkmakefile.c	4 Mar 2004 20:50:58 -0000	1.8
+++ mkmakefile.c	4 Mar 2004 15:05:36 -0000
@@ -123,7 +123,7 @@
 	struct file_list *fp;
 
 	fp = (struct file_list *)malloc(sizeof(*fp));
-	bzero(fp, sizeof(*fp));
+	memset(fp, 0, sizeof(*fp));
 	if (fcur == NULL)
 		fcur = ftab = fp;
 	else
@@ -437,7 +437,7 @@
 	}
 	if (std) {
 		dp = (struct device *)malloc(sizeof(*dp));
-		bzero(dp, sizeof(*dp));
+		memset(dp, 0, sizeof(*dp));
 		init_dev(dp);
 		dp->d_name = ns(wd);
 		dp->d_type = PSEUDO_DEVICE;
Index: mkoptions.c
===================================================================
RCS file: /home/dcvs/src/usr.sbin/config/mkoptions.c,v
retrieving revision 1.8
diff -u -r1.8 mkoptions.c
--- mkoptions.c	4 Mar 2004 20:44:49 -0000	1.8
+++ mkoptions.c	4 Mar 2004 15:06:00 -0000
@@ -196,7 +196,7 @@
 			tidy++;
 		} else {
 			op = (struct opt *)malloc(sizeof(*op));
-			bzero(op, sizeof(*op));
+			memset(op, 0, sizeof(*op));
 			op->op_name = inw;
 			op->op_value = invalue;
 			op->op_next = op_head;
@@ -223,7 +223,7 @@
 	if (value != NULL && !seen) {
 		/* New option appears */
 		op = (struct opt *)malloc(sizeof(*op));
-		bzero(op, sizeof(*op));
+		memset(op, 0, sizeof(*op));
 		op->op_name = ns(name);
 		op->op_value = value != NULL ? ns(value) : NULL;
 		op->op_next = op_head;
@@ -348,7 +348,7 @@
 	}
 	
 	po = (struct opt_list *)malloc(sizeof(*po));
-	bzero(po, sizeof(*po));
+	memset(po, 0, sizeof(*po));
 	po->o_name = this;
 	po->o_file = val;
 	po->o_next = otab;


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]