Re: [PATCH 6/6] quote: turn 'nodq' parameter into a set of flags

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

 



On Tue, Sep 08, 2020 at 01:52:24PM -0700, Junio C Hamano wrote:

> quote_c_style() and its friend quote_two_c_style() both take an
> optional "please omit the double quotes around the quoted body"
> parameter.  Turn it into a flag word, assign one bit out of it,
> and call it CQUOTE_NODQ bit.

Sounds reasonable.

If this shared the same "flags" namespace as quote_path(), then we
really could pass quote_path() flags along. And in fact, that could be
the first step to just teaching quote_c_style() the "if it has spaces,
then quote it" rule. Maybe not worth spending more time on, but just
thinking out loud after my earlier comments.

> @@ -272,6 +272,7 @@ static size_t quote_c_style_counted(const char *name, ssize_t maxlen,
>  		count += (l);                           \
>  	} while (0)
>  
> +	int no_dq = !!(flags & CQUOTE_NODQ);
>  	size_t len, count = 0;
>  	const char *p = name;

Looking at the context, I wondered how this was not adding a
decl-after-statement (and how we were not already complaining about the
existing ones). But the reason is that the code above it is part of a
macro.

-Peff



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

  Powered by Linux