tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [patch] remove dead code
@ 2013-05-17  1:00 Ulrich Spörlein
  2013-05-18 17:12 ` Ingo Schwarze
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Spörlein @ 2013-05-17  1:00 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

Hey,

please see the following patch which removes a bit of dead code. With sz
being invariant 0, the loop will never do anything.

This is Coverity Scan CID 975717

Cheers,
Uli

[-- Attachment #2: tree.diff --]
[-- Type: text/x-diff, Size: 737 bytes --]

Index: tree.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v
retrieving revision 1.47
diff -u -p -r1.47 tree.c
--- tree.c	18 Sep 2011 14:14:15 -0000	1.47
+++ tree.c	17 May 2013 00:42:33 -0000
@@ -58,12 +58,12 @@ print_mdoc(const struct mdoc_node *n, in
 {
 	const char	 *p, *t;
 	int		  i, j;
-	size_t		  argc, sz;
+	size_t		  argc;
 	char		**params;
 	struct mdoc_argv *argv;
 
 	argv = NULL;
-	argc = sz = 0;
+	argc = 0;
 	params = NULL;
 	t = p = NULL;
 
@@ -162,9 +162,6 @@ print_mdoc(const struct mdoc_node *n, in
 				printf(" ]");
 		}
 		
-		for (i = 0; i < (int)sz; i++)
-			printf(" [%s]", params[i]);
-
 		printf(" %d:%d\n", n->line, n->pos);
 	}
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] remove dead code
  2013-05-17  1:00 [patch] remove dead code Ulrich Spörlein
@ 2013-05-18 17:12 ` Ingo Schwarze
  2013-05-18 19:21   ` Ulrich Spörlein
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Schwarze @ 2013-05-18 17:12 UTC (permalink / raw)
  To: tech; +Cc: uqs

Hi Ulrich,

Ulrich Spörlein wrote on Fri, May 17, 2013 at 03:00:50AM +0200:

> please see the following patch which removes a bit of dead code.
> With sz being invariant 0, the loop will never do anything.

Right, committed to both bsd.lv and openbsd.org.

> This is Coverity Scan CID 975717

Strangly enough, it seems that Coverity missed that **params is
unused as well.  Anyway, i removed **params, too.

Thanks,
  Ingo

> Index: tree.c
> ===================================================================
> RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tree.c,v
> retrieving revision 1.47
> diff -u -p -r1.47 tree.c
> --- tree.c	18 Sep 2011 14:14:15 -0000	1.47
> +++ tree.c	17 May 2013 00:42:33 -0000
> @@ -58,12 +58,12 @@ print_mdoc(const struct mdoc_node *n, in
>  {
>  	const char	 *p, *t;
>  	int		  i, j;
> -	size_t		  argc, sz;
> +	size_t		  argc;
>  	char		**params;
>  	struct mdoc_argv *argv;
>  
>  	argv = NULL;
> -	argc = sz = 0;
> +	argc = 0;
>  	params = NULL;
>  	t = p = NULL;
>  
> @@ -162,9 +162,6 @@ print_mdoc(const struct mdoc_node *n, in
>  				printf(" ]");
>  		}
>  		
> -		for (i = 0; i < (int)sz; i++)
> -			printf(" [%s]", params[i]);
> -
>  		printf(" %d:%d\n", n->line, n->pos);
>  	}
>  
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] remove dead code
  2013-05-18 17:12 ` Ingo Schwarze
@ 2013-05-18 19:21   ` Ulrich Spörlein
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Spörlein @ 2013-05-18 19:21 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: tech

On Sat, 2013-05-18 at 19:12:07 +0200, Ingo Schwarze wrote:
> Hi Ulrich,
> 
> Ulrich Spörlein wrote on Fri, May 17, 2013 at 03:00:50AM +0200:
> 
> > please see the following patch which removes a bit of dead code.
> > With sz being invariant 0, the loop will never do anything.
> 
> Right, committed to both bsd.lv and openbsd.org.
> 
> > This is Coverity Scan CID 975717
> 
> Strangly enough, it seems that Coverity missed that **params is
> unused as well.  Anyway, i removed **params, too.

It only reports dead "code", not unused vars :)

Cheers,
Uli
--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-18 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-17  1:00 [patch] remove dead code Ulrich Spörlein
2013-05-18 17:12 ` Ingo Schwarze
2013-05-18 19:21   ` Ulrich Spörlein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).