Re: [PATCH 2/2] bisect: rewrite `check_term_format` shell function in C

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

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> Maybe something like instead?
>
> 	static int one_of(const char *term, ...)
> 	{
> 		int res = 0;
> 		va_list matches;
> 		const char *match;
>
> 		va_start(matches, term);
> 		while (!res && (match = va_arg(matches, const char *)))
> 			res = !strcmp(term, match);
> 		va_end(matches);
>
> 		return res;
> 	}
> Ciao,
> Dscho

This looks good (even though we try to avoid assignment in
conditionals as much as possible).

--
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]