[PATCH v4 00/14] Use ALLOC_GROW() instead of inline code

2014-03-03 Thread Dmitry S. Dolzhenko
This version differs from previous [1] the following changes:
  - added three new commits with similar changes in builtin/mktree.c,
cache-tree.c and sha1_file.c.
  - updated commit messages: use ALLOC_GROW() in function_name() instead of
change function_name() to use ALLOC_GROW()
  - updated [PATCH v2 01/11] [2] to keep code lines within 80 columns in 
builtin/pack-objects.c

Duy Nguyen, Michael Haggerty, Junio C Hamano, Eric Sunshine, and He Sun, 
thanks you very much for your remarks and advices

[1] http://thread.gmane.org/gmane.comp.version-control.git/242919
[2] http://thread.gmane.org/gmane.comp.version-control.git/242920

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()

 attr.c |  7 +--
 builtin/mktree.c   |  5 +
 builtin/pack-objects.c |  9 +++--
 bundle.c   |  6 +-
 cache-tree.c   |  6 +-
 commit.c   |  8 ++--
 diff.c | 12 ++--
 diffcore-rename.c  | 12 ++--
 dir.c  |  5 +
 patch-ids.c|  5 +
 read-cache.c   |  6 +-
 reflog-walk.c  | 12 ++--
 replace_object.c   |  8 ++--
 sha1_file.c|  7 +--
 14 files changed, 21 insertions(+), 87 deletions(-)

-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 00/14] Use ALLOC_GROW() instead of inline code

2014-03-03 Thread Junio C Hamano
 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.


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html