From: "Kristian Høgsberg" <krh@redhat.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: config.c fixes
Date: Fri, 14 Dec 2007 14:28:52 -0500 [thread overview]
Message-ID: <20071214192852.GA24187@bitplanet.net> (raw)
Hi,
[ This should have gone out as a cover letter for the patch series
but some how I didn't manage to make that work ]
While strace'ing builtin-clone I saw this horror:
...
write(3, "remote", 6) = 6
write(3, " = ", 3) = 3
write(3, "o", 1) = 1
write(3, "r", 1) = 1
write(3, "i", 1) = 1
write(3, "g", 1) = 1
write(3, "i", 1) = 1
write(3, "n", 1) = 1
write(3, "\n", 1) = 1
munmap(0xb7f72000, 102) = 0
close(3) = 0
close(3) = -1 EBADF (Bad file descriptor)
...
That's just terrible. And hey, it turns out the code is terrible too.
I think the best solution is to just parse up the entire config file
up front and keep it in a data structure, make the changes and then
write it all out at the end. That makes it cheap to make a series of
changes too:
config = open_config(file);
set_key(config, key1, value1);
set_key(config, key2, value2);
set_key(config, key3, value3);
commit_config(config);
Or something. Anyway, for 1.5.4 I wrote the following two patches that
fixes the 1-bytes writes and the double close.
config.c | 113 +++++++++++++++++++++++--------------------------------------
1 files changed, 43 insertions(+), 70 deletions(-)
cheers,
Kristian
next reply other threads:[~2007-12-14 18:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 19:28 Kristian Høgsberg [this message]
2007-12-14 19:43 ` config.c fixes Junio C Hamano
2007-12-14 20:19 ` Kristian Høgsberg
-- strict thread matches above, loose matches on Subject: below --
2007-12-14 19:22 Kristian Høgsberg
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=20071214192852.GA24187@bitplanet.net \
--to=krh@redhat.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).