<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/commit-slab.h, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-06-08T19:28:49Z</updated>
<entry>
<title>commit-slab: add a function to deep free entries on the slab</title>
<updated>2020-06-08T19:28:49Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2020-06-05T13:00:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1df15f8dee5c637c9013d11d5b8e72e189a04f06'/>
<id>urn:sha1:1df15f8dee5c637c9013d11d5b8e72e189a04f06</id>
<content type='text'>
clear_##slabname() frees only the memory allocated for a commit slab
itself, but entries in the commit slab might own additional memory
outside the slab that should be freed as well.  We already have (at
least) one such commit slab, and this patch series is about to add one
more.

To free all additional memory owned by entries on the commit slab the
user of such a slab could iterate over all commits it knows about,
peek whether there is a valid entry associated with each commit, and
free the additional memory, if any.  Or it could rely on intimate
knowledge about the internals of the commit slab implementation, and
could itself iterate directly through all entries in the slab, and
free the additional memory.  Or it could just leak the additional
memory...

Introduce deep_clear_##slabname() to allow releasing memory owned by
commit slab entries by invoking the 'void free_fn(elemtype *ptr)'
function specified as parameter for each entry in the slab.

Use it in get_shallow_commits() in 'shallow.c' to replace an
open-coded iteration over a commit slab's entries.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-slab: clarify slabname##_peek()'s return value</title>
<updated>2020-03-10T18:44:24Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2020-03-10T15:30:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7422b2a0a11749942db71d59e3e1221ccba5e7ce'/>
<id>urn:sha1:7422b2a0a11749942db71d59e3e1221ccba5e7ce</id>
<content type='text'>
Ever since 862e730ec1 (commit-slab: introduce slabname##_peek()
function, 2015-05-14) the slabname##_peek() function is documented as:

  This function is similar to indegree_at(), but it will return NULL
  until a call to indegree_at() was made for the commit.

This, however, is usually not the case.  If indegree_at() allocates
memory, then it will do so not only for the single commit it got as
parameter, but it will allocate a whole new, ~512kB slab.  Later on,
if any other commit's 'index' field happens to point into an already
allocated slab, then indegree_peek() for such a commit will return a
valid non-NULL pointer, pointing to a zero-initialized location in the
slab, even if no indegree_at() call has been made for that commit yet.

Update slabname##_peek()'s documentation to clarify this.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-slab: support shared commit-slab</title>
<updated>2018-05-21T05:07:19Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-05-19T05:28:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=878f0bb81990170cde5dba934fcd1ae4c2e698ee'/>
<id>urn:sha1:878f0bb81990170cde5dba934fcd1ae4c2e698ee</id>
<content type='text'>
define_shared_commit_slab() could be used in a header file to define a
commit-slab. One of these C files must include commit-slab-impl.h and
"call" implement_shared_commit_slab().

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-slab.h: code split</title>
<updated>2018-05-21T05:07:19Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-05-19T05:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a9f1f1f9f8b2873c43d6100717eb776ea288ed9e'/>
<id>urn:sha1:a9f1f1f9f8b2873c43d6100717eb776ea288ed9e</id>
<content type='text'>
The struct declaration and implementation macros are moved to
commit-slab-hdr.h and commit-slab-impl.h respectively.

This right now is not needed for current users but if we make a public
commit-slab type, we may want to avoid including the slab
implementation in a header file which gets replicated in every c file
that includes it.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-slab.h: avoid -Wsign-compare warnings</title>
<updated>2017-09-22T04:00:36Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsayjones.plus.com</email>
</author>
<published>2017-09-21T16:47:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fddfedc361b56195503d885874ed1162f66c773c'/>
<id>urn:sha1:fddfedc361b56195503d885874ed1162f66c773c</id>
<content type='text'>
Signed-off-by: Ramsay Jones &lt;ramsay@ramsayjones.plus.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>*.[ch] refactoring: make use of the FREE_AND_NULL() macro</title>
<updated>2017-06-16T19:44:09Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-06-15T23:15:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88ce3ef636b1385e861ec0e9e2155248b999b032'/>
<id>urn:sha1:88ce3ef636b1385e861ec0e9e2155248b999b032</id>
<content type='text'>
Replace occurrences of `free(ptr); ptr = NULL` which weren't caught by
the coccinelle rule. These fall into two categories:

 - free/NULL assignments one after the other which coccinelle all put
   on one line, which is functionally equivalent code, but very ugly.

 - manually spotted occurrences where the NULL assignment isn't right
   after the free() call.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'vs/typofix'</title>
<updated>2016-08-12T16:47:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-12T16:47:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e6b8f80653063cd41903c599ec9ca83be3d3afa5'/>
<id>urn:sha1:e6b8f80653063cd41903c599ec9ca83be3d3afa5</id>
<content type='text'>
* vs/typofix:
  Spelling fixes
</content>
</entry>
<entry>
<title>Spelling fixes</title>
<updated>2016-08-11T21:35:42Z</updated>
<author>
<name>Ville Skyttä</name>
<email>ville.skytta@iki.fi</email>
</author>
<published>2016-08-09T08:53:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2e3a16b279a9df2e498187871c67e623e12bc8a4'/>
<id>urn:sha1:2e3a16b279a9df2e498187871c67e623e12bc8a4</id>
<content type='text'>
    &lt;BAD&gt;                     &lt;CORRECTED&gt;
    accidently                accidentally
    commited                  committed
    dependancy                dependency
    emtpy                     empty
    existance                 existence
    explicitely               explicitly
    git-upload-achive         git-upload-archive
    hierachy                  hierarchy
    indegee                   indegree
    intial                    initial
    mulitple                  multiple
    non-existant              non-existent
    precendence.              precedence.
    priviledged               privileged
    programatically           programmatically
    psuedo-binary             pseudo-binary
    soemwhere                 somewhere
    successfull               successful
    transfering               transferring
    uncommited                uncommitted
    unkown                    unknown
    usefull                   useful
    writting                  writing

Signed-off-by: Ville Skyttä &lt;ville.skytta@iki.fi&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/commit-slab-decl-fix'</title>
<updated>2016-08-10T19:33:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-10T19:33:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a3ea666331cd6cf8d9a7a15aafc33459b8c571c'/>
<id>urn:sha1:7a3ea666331cd6cf8d9a7a15aafc33459b8c571c</id>
<content type='text'>
* js/commit-slab-decl-fix:
  commit-slab.h: avoid duplicated global static variables
  config.c: avoid duplicated global static variables
</content>
</entry>
<entry>
<title>commit-slab.h: avoid duplicated global static variables</title>
<updated>2016-08-09T17:20:06Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2016-08-09T14:17:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=af920e369778a4cc42519ef523131d29451bf79b'/>
<id>urn:sha1:af920e369778a4cc42519ef523131d29451bf79b</id>
<content type='text'>
The gigantic define_commit_slab() macro repeats the definition of a
static variable that occurs earlier in the macro text. The purpose of
the repeated definition at the end of the macro is that it takes the
semicolon that occurs where the macro is used.

We cannot just remove the first definition of the variable because it
is referenced elsewhere in the macro text, and defining the macro later
would produce undefined identifier errors. We cannot have a "forward"
declaration, either. (This works only with "extern" global variables.)

The solution is to use a declaration of a struct that is already defined
earlier. This language construct can serve the same purpose as the
duplicated static variable definition, but without the confusion.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
