From: Christian Couder Date: Wed, 04 May 2016 12:21:31 GMT Subject: Re: [PATCH 2/2] bisect: rewrite `check_term_format` shell function in C Message-ID: In-Reply-To: On Wed, May 4, 2016 at 1:13 PM, Johannes Schindelin wrote: > 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); Yeah or maybe: while ((match = va_arg(matches, const char *)) != NULL) if (!strcmp(term, match)) { res = 1 break; } > va_end(matches); > > return res; > }