Re: [PATCH v2] help.c: help.autocorrect=prompt waits for user action

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

 



Hi,

On Sat, 14 Aug 2021, Junio C Hamano wrote:

> "Azeem Bande-Ali via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
>
> > @@ -618,7 +628,17 @@ const char *help_unknown_cmd(const char *cmd)
> >  				   _("Continuing under the assumption that "
> >  				     "you meant '%s'."),
> >  				   assumed);
> > -		else {
> > +		else if (autocorrect == AUTOCORRECT_PROMPT) {
> > +			char* answer;
>
> Some people seem to make an asterisk stick to types like this, but
> in our codebase written in C, an asterisk sticks to the identifier
> that it makes into a pointer, i.e.
>
> 			char *answer;
>
> This is because doing so differently would confuse novices with
> constructs like this:
>
> 			int* a, b;
>
> where only 'a' is a pointer, and 'b' is not.
>
> > +			struct strbuf msg = STRBUF_INIT;
> > +			strbuf_addf(&msg, _("Run '%s' instead? (y/N)"),
> > +				    assumed);
>
> I think these should be kept on a single line for readability, i.e.
>
> 			strbuf_addf(&msg, _("Run '%s' instead? (y/N)"), assumed);

It might even make sense to use the `xstrfmt()` function instead:

			char *msg = xstrfmt(_("Run '%s' instead? (y/N)"), assumed);
			[...]
			free(msg);

Ciao,
Dscho




[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