Re: [PATCH 22/24] Let usage() take a printf-style format

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

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> merge-recursive and diff --no-index are not able to use usage()
> because their usage strings depend on the circumstances in which
> they are called.

Since die() and warn() are already printf-like, it may be tempting
to do this, but this is wrong.

I do not want to vet all the existing call sites to usage() of make sure
that all of them _happen_ to pass constant strings that do not have any
'%' in them.

Much more importantly, without a patch to future-proof all existing
callsites to modify from

	usage(blame_usage);

to

	usage("%s", blame_usage);

everybody needs to remember that some *_usage strings are special and have
to double % in it forever, which is a maintenance nightmare.

Besides, the majority of usage strings are _expected_ to be constant.
That is an important difference from die/warn whose purpose is to diagnose
and give appropriate message to the situation (hence they benefit from
formatting).

I've renamed this to usagef() and updated your two callers to use it in
the version I queued to 'pu'.

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