From: Elfyn McBratney <beu@gentoo.org>
To: git mailing list <git@vger.kernel.org>
Subject: [RFC] Cleaning up die() error messages
Date: Mon, 10 Oct 2005 11:50:08 +0100 [thread overview]
Message-ID: <20051010105008.GB30202@gentoo.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]
Hello git list,
I've started working on cleaning up the various die() error messages
found throughout git, and had a few thoughts along the way.
Currently, I've been adding missing program name prefixes, and quoting path
names (e.g., "%s" -> "'%s'"), but before I go any further, I'm wondering
if this is a) desired, or perhaps b) superfluous? This may be best
discussed with along-side the patch - which'll follow shortly. ;)
Also, I got to thinking whether it might be an idea to use the following
idiom in the code:
[shell scripts]
prog="`basename $0`"
..
foo || die "${prog}: foo failed"
[C sources]
static char *prog;
..
static inline void set_prog_name (char *argv0)
{
prog = strrchr(argv0, '/');
if (prog)
prog++;
else
prog = argv0;
}
..
int main (int argc, char **argv)
{
set_prog_name(argv[0]);
..
if (!do_bar())
die("%s: do_bar() failed", prog);
..
}
The idea behind this being that, if any of the git programs get renamed
(again :) there won't be a need for s/git-foo/git-bar/g just to fix-up
die() error messages, and it'll also shave a *bit* off of the size of the
compiled binaries. ;)
(Of course, the C parts (`prog' and `set_prog_name()') would go into a
header, and not in every single C source file. ;)
So, any thoughts/comments/flames? :)
Best,
Elfyn
--
Elfyn McBratney
Gentoo Developer/Perl Team Lead
beu/irc.freenode.net http://dev.gentoo.org/~beu/
+------------O.o--------------------- http://dev.gentoo.org/~beu/pubkey.asc
PGP Key ID: 0x69DF17AD
PGP Key Fingerprint:
DBD3 B756 ED58 B1B4 47B9 B3BD 8D41 E597 69DF 17AD
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-10-10 10:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-10 10:50 Elfyn McBratney [this message]
2005-10-10 19:04 ` [RFC] Cleaning up die() error messages Junio C Hamano
2005-10-11 19:48 ` Matthias Urlichs
2005-10-11 20:50 ` H. Peter Anvin
2005-10-12 1:20 ` Matthias Urlichs
2005-10-12 3:18 ` H. Peter Anvin
2005-10-12 4:25 ` Junio C Hamano
2005-10-12 4:40 ` H. Peter Anvin
2005-10-12 5:02 ` Junio C Hamano
2005-10-12 6:04 ` Matthias Urlichs
2005-10-10 20:14 ` Daniel Barkalow
2005-10-11 15:02 ` Alex Riesen
2005-10-11 16:11 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051010105008.GB30202@gentoo.org \
--to=beu@gentoo.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).