From: Junio C Hamano <gitster@pobox•com>
To: "Dmitry S. Dolzhenko" <dmitrys.dolzhenko@yandex•ru>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v4 00/14] Use ALLOC_GROW() instead of inline code
Date: Mon, 03 Mar 2014 15:02:57 -0800 [thread overview]
Message-ID: <xmqqwqganavy.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1393885922-21616-1-git-send-email-dmitrys.dolzhenko@yandex.ru> (Dmitry S. Dolzhenko's message of "Tue, 4 Mar 2014 02:31:48 +0400")
> Dmitry S. Dolzhenko (14):
> builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path()
> bundle.c: use ALLOC_GROW() in add_to_ref_list()
> cache-tree.c: use ALLOC_GROW() in find_subtree()
> commit.c: use ALLOC_GROW() in register_commit_graft()
> diff.c: use ALLOC_GROW()
> diffcore-rename.c: use ALLOC_GROW()
> patch-ids.c: use ALLOC_GROW() in add_commit()
> replace_object.c: use ALLOC_GROW() in register_replace_object()
> reflog-walk.c: use ALLOC_GROW()
> dir.c: use ALLOC_GROW() in create_simplify()
> attr.c: use ALLOC_GROW() in handle_attr_line()
> builtin/mktree.c: use ALLOC_GROW() in append_to_tree()
> read-cache.c: use ALLOC_GROW() in add_index_entry()
> sha1_file.c: use ALLOC_GROW() in pretend_sha1_file()
All looked cleanly done.
The resulting code of 1, 3, 4, 6 and 8 share this pattern:
ALLOC_GROW(table, number + 1, alloc);
number++;
which may be easier to understand if done the other way around:
number++;
ALLOC_GROW(table, number, alloc);
That is, "we know we want one more, so make sure they fit in the
table".
But that is just a minor issue; I suspect many existing callsites to
ALLOC_GROW() already follow the former pattern, and if we decide to
to switch the former to the latter, we shouldn't be doing so within
this series (we should do that as a separate series on top of this).
Thanks; will queue.
prev parent reply other threads:[~2014-03-03 23:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 22:31 [PATCH v4 00/14] Use ALLOC_GROW() instead of inline code Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 01/14] builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 02/14] bundle.c: use ALLOC_GROW() in add_to_ref_list() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 03/14] cache-tree.c: use ALLOC_GROW() in find_subtree() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 04/14] commit.c: use ALLOC_GROW() in register_commit_graft() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 05/14] diff.c: use ALLOC_GROW() Dmitry S. Dolzhenko
2014-03-03 22:48 ` Junio C Hamano
2014-03-03 22:31 ` [PATCH v4 06/14] diffcore-rename.c: " Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 07/14] patch-ids.c: use ALLOC_GROW() in add_commit() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 08/14] replace_object.c: use ALLOC_GROW() in register_replace_object() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 09/14] reflog-walk.c: use ALLOC_GROW() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 10/14] dir.c: use ALLOC_GROW() in create_simplify() Dmitry S. Dolzhenko
2014-03-03 22:31 ` [PATCH v4 11/14] attr.c: use ALLOC_GROW() in handle_attr_line() Dmitry S. Dolzhenko
2014-03-03 22:32 ` [PATCH v4 12/14] builtin/mktree.c: use ALLOC_GROW() in append_to_tree() Dmitry S. Dolzhenko
2014-03-03 22:32 ` [PATCH v4 13/14] read-cache.c: use ALLOC_GROW() in add_index_entry() Dmitry S. Dolzhenko
2014-03-03 22:32 ` [PATCH v4 14/14] sha1_file.c: use ALLOC_GROW() in pretend_sha1_file() Dmitry S. Dolzhenko
2014-03-03 23:02 ` Junio C Hamano [this message]
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=xmqqwqganavy.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=dmitrys.dolzhenko@yandex$(echo .)ru \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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