git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v6] generalizing sorted-array handling

From
Yann Dirson <ydirson@altern.org>
Date
Dec 8, 2010, 22:51 UTC
Message-ID
<1291848695-24601-1-git-send-email-ydirson@altern.org>

I hope the improvements to the usage syntax in this version would help to get more feedback. I don't plan to do much more structural work on this, unless reviewers complain. I want to get my focus back to bulk-rename/builk-rm patches, which will make heavy use of this API.

Changes from v5:
* moved doc to Documentation/api-sorted-array.txt as suggested by
  Jonathan Nieder, made it a bit more comprehensive as well.
* changed API with:
  * renamed low-level wrapper-decl macros with a leading underscore
  * provide high-level wrapper-decl macros for everyday use, which
    declare the required generic funcs for use (as static funcs)

Those high-level macros make the entry points more numerousas previously noted, but we gain much in usage clarity, as well as consistent API (no more argument differences between macros of a single level)

By using those macros we lose the control we had on all the intermediate funcs, but that should not be much of a problem.

Notes on current API:
* The macro names are a bit heavy-weight.  Better ideas welcome.
* could gain a dealloc API, to minimize the explicit use of the _nr
  and _alloc vars
The following binary-search occurences were not converted:
* read-cache.c::index_name_pos has widely-used API with 2 low-coupled
  cmp/init params: sorted-array could be generalized at the cost of
  using stdarg, but is it worth it ?
* pack-revindex.c::find_pack_revindex is a bit special and needs more
  thought
* cache-tree.c::subtree_pos and sha1_file::find_pack_entry_one too
* sha1_lookup.c stuff probably too special
Next: Yann Dirson
Message 1 of 15 in “generalizing sorted-array handling”
  1. generalizing sorted-array handlingYann Dirson, Dec 8, 2010
  2. 1/6 Introduce sorted-array binary-search function.Yann Dirson, Dec 8, 2010
  3. Junio C HamanoDec 10, 2010
  4. Yann DirsonDec 30, 2010
  5. Erik Faye-LundDec 30, 2010
  6. Yann DirsonDec 30, 2010
  7. 2/6 Convert diffcore-rename's rename_dst to the new sorted-array API.Yann Dirson, Dec 8, 2010
  8. Junio C HamanoDec 10, 2010
  9. 3/6 Convert diffcore-rename's rename_src to the new sorted-array API.Yann Dirson, Dec 8, 2010
  10. 4/6 Convert pack-objects.c to the new sorted-array API.Yann Dirson, Dec 8, 2010
  11. 5/6 Use sorted-array API for commit.c's commit_graft.Yann Dirson, Dec 8, 2010
  12. 6/6 [RFC] subvert sorted-array to replace binary-search in unpack-objects.Yann Dirson, Dec 8, 2010
  13. Junio C HamanoDec 10, 2010
  14. Junio C HamanoDec 10, 2010
  15. Yann DirsonDec 30, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.