Re: [PATCH v2] bisect--helper: convert a function in shell to C

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

 



Hi,

On Tue, 22 Mar 2016, Johannes Schindelin wrote:

> On Tue, 22 Mar 2016, Pranit Bauva wrote:
> 
> > +	if (!strcmp(term, "bad") || !strcmp(term, "new"))
> > +		if(strcmp(revision, "bad"))
> > +			die("can't change the meaning of term '%s'", term);
> > +
> > +	if (!strcmp(term, "good") || !strcmp(term, "old"))
> > +		if (strcmp(revision, "good"))
> > +			die("can't change the meaning of term '%s'", term);
> 
> These two can be combined. Actually, these *four* can easily be combined:
> 
> 	if ((one_of(term, "bad", "new", NULL) && strcmp(orig, "bad")) ||
> 	    (one_of(term, "good", "old", NULL) && strcmp(orig, "good")))
> 		die("can't change the meaning of term '%s'", term);

Completely forgot to mention: This conversion skipped the comment

	# In theory, nothing prevents swapping
	# completely good and bad, but this situation
	# could be confusing and hasn't been tested
	# enough. Forbid it for now.

Let's port that comment over, too?

Ciao,
Johannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]