<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diffcore-order.c, 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>2024-12-06T11:20:03Z</updated>
<entry>
<title>diff.h: fix index used to loop through unsigned integer</title>
<updated>2024-12-06T11:20:03Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=47d72a74a737f06791c282a75baf2c573cdf42f6'/>
<id>urn:sha1:47d72a74a737f06791c282a75baf2c573cdf42f6</id>
<content type='text'>
The `struct diff_flags` structure is essentially an array of flags, all
of which have the same type. We can thus use `sizeof()` to iterate
through all of the flags, which we do in `diff_flags_or()`. But while
the statement returns an unsigned integer, we used a signed integer to
iterate through the flags, which generates a warning.

Fix this by using `size_t` for the index instead.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: mark code units that generate warnings with `-Wsign-compare`</title>
<updated>2024-12-06T11:20:02Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41f43b8243f42b9df2e98be8460646d4c0100ad3'/>
<id>urn:sha1:41f43b8243f42b9df2e98be8460646d4c0100ad3</id>
<content type='text'>
Mark code units that generate warnings with `-Wsign-compare`. This
allows for a structured approach to get rid of all such warnings over
time in a way that can be easily measured.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diffcore-order: fix leaking buffer when parsing orderfiles</title>
<updated>2024-09-27T15:25:35Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-26T11:46:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6932ec81834003855486547cdc561cbbdd335389'/>
<id>urn:sha1:6932ec81834003855486547cdc561cbbdd335389</id>
<content type='text'>
In `prepare_order()` we parse an orderfile and assign it to a global
array. In order to save on some allocations, we replace newlines with
NUL characters and then assign pointers into the allocated buffer to
that array. This can cause the buffer to be completely unreferenced
though in some cases, e.g. because the order file is empty or because we
had to use `xmemdupz()` to copy the lines instead of NUL-terminating
them.

Refactor the code to always `xmemdupz()` the strings. This is a bit
simpler, and it is rather unlikely that saving a handful of allocations
really matters. This allows us to release the string buffer and thus
plug the memory leak.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-compat-util.h: remove unneccessary include of wildmatch.h</title>
<updated>2023-06-21T20:39:54Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-05-16T06:34:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dd77d587954bd798d0ea6b26f0815ed2d78d47b9'/>
<id>urn:sha1:dd77d587954bd798d0ea6b26f0815ed2d78d47b9</id>
<content type='text'>
The include of wildmatch.h in git-compat-util.h was added in cebcab189aa
(Makefile: add USE_WILDMATCH to use wildmatch as fnmatch, 2013-01-01) as
a way to be able to compile-time force any calls to fnmatch() to instead
invoke wildmatch().  The defines and inline function were removed in
70a8fc999d9 (stop using fnmatch (either native or compat), 2014-02-15),
and this include in git-compat-util.h has been unnecessary ever since.

Remove the include from git-compat-util.h, but add it to the .c files
that had omitted the direct #include they needed.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>treewide: replace cache.h with more direct headers, where possible</title>
<updated>2023-02-24T01:25:30Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-02-24T00:09:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fc7bd51b06424694c2e3dd97c11fa095d84d52b1'/>
<id>urn:sha1:fc7bd51b06424694c2e3dd97c11fa095d84d52b1</id>
<content type='text'>
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wildmatch: remove unused wildopts parameter</title>
<updated>2017-06-24T01:27:07Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-06-22T21:38:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=55d3426929d4d8c3dec402cabe6fb1bf27d6abad'/>
<id>urn:sha1:55d3426929d4d8c3dec402cabe6fb1bf27d6abad</id>
<content type='text'>
Remove the unused wildopts placeholder struct from being passed to all
wildmatch() invocations, or rather remove all the boilerplate NULL
parameters.

This parameter was added back in commit 9b3497cab9 ("wildmatch: rename
constants and update prototype", 2013-01-01) as a placeholder for
future use. Over 4 years later nothing has made use of it, let's just
remove it. It can be added in the future if we find some reason to
start using such a parameter.

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>use QSORT</title>
<updated>2016-09-29T22:42:18Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-09-29T15:27:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ed0d8d6e6de7737fe9a658446318b86e57c6fad'/>
<id>urn:sha1:9ed0d8d6e6de7737fe9a658446318b86e57c6fad</id>
<content type='text'>
Apply the semantic patch contrib/coccinelle/qsort.cocci to the code
base, replacing calls of qsort(3) with QSORT.  The resulting code is
shorter and supports empty arrays with NULL pointers.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>convert trivial cases to ALLOC_ARRAY</title>
<updated>2016-02-22T22:51:09Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:44:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b32fa95fd8293ebfecb2b7b6c8d460579318f9fe'/>
<id>urn:sha1:b32fa95fd8293ebfecb2b7b6c8d460579318f9fe</id>
<content type='text'>
Each of these cases can be converted to use ALLOC_ARRAY or
REALLOC_ARRAY, which has two advantages:

  1. It automatically checks the array-size multiplication
     for overflow.

  2. It always uses sizeof(*array) for the element-size,
     so that it can never go out of sync with the declared
     type of the array.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/no-more-fnmatch'</title>
<updated>2014-03-14T21:25:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-14T21:25:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=650c90a18506ce05e2be349d83fe1cef3dc7f8cb'/>
<id>urn:sha1:650c90a18506ce05e2be349d83fe1cef3dc7f8cb</id>
<content type='text'>
We started using wildmatch() in place of fnmatch(3); complete the
process and stop using fnmatch(3).

* nd/no-more-fnmatch:
  actually remove compat fnmatch source code
  stop using fnmatch (either native or compat)
  Revert "test-wildmatch: add "perf" command to compare wildmatch and fnmatch"
  use wildmatch() directly without fnmatch() wrapper
</content>
</entry>
<entry>
<title>diffcore-order: export generic ordering interface</title>
<updated>2014-02-24T22:44:57Z</updated>
<author>
<name>Kirill Smelkov</name>
<email>kirr@mns.spb.ru</email>
</author>
<published>2014-01-20T16:20:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1df4320fa25d3784b035936b35725460d46f1ca0'/>
<id>urn:sha1:1df4320fa25d3784b035936b35725460d46f1ca0</id>
<content type='text'>
diffcore_order() interface only accepts a queue of `struct
diff_filepair`.

In the next patches, we'll want to order `struct combine_diff_path`
by path, so let's first rework diffcore-order to also provide
generic low-level interface for ordering arbitrary objects, provided
they have path accessors.

The new interface is:

    - `struct obj_order`    for describing objects to ordering routine, and
    - order_objects()       for actually doing the ordering work.

Signed-off-by: Kirill Smelkov &lt;kirr@mns.spb.ru&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
