<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-compat-util.h, branch v2.12.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.12.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.12.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-02-28T19:54:21Z</updated>
<entry>
<title>wrapper.c: remove unused gitmkstemps() function</title>
<updated>2017-02-28T19:54:21Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsayjones.plus.com</email>
</author>
<published>2017-02-28T01:26:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b2d593a7797f4f9452e46f722e181604a5582897'/>
<id>urn:sha1:b2d593a7797f4f9452e46f722e181604a5582897</id>
<content type='text'>
The last call to the mkstemps() function was removed in commit 659488326
("wrapper.c: delete dead function git_mkstemps()", 22-04-2016). In order
to support platforms without mkstemps(), this functionality was provided,
along with a Makefile build variable (NO_MKSTEMPS), by the gitmkstemps()
function. Remove the dead code, along with the defunct build machinery.

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>Merge branch 'rs/swap'</title>
<updated>2017-02-15T20:54:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-15T20:54:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbf1860d73b782e7924e63361df485b31225a26a'/>
<id>urn:sha1:cbf1860d73b782e7924e63361df485b31225a26a</id>
<content type='text'>
Code clean-up.

* rs/swap:
  graph: use SWAP macro
  diff: use SWAP macro
  use SWAP macro
  apply: use SWAP macro
  add SWAP macro
</content>
</entry>
<entry>
<title>add SWAP macro</title>
<updated>2017-01-30T22:07:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-28T21:38:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=568edcb95a8b86ffd0d267b124896df8ea81307c'/>
<id>urn:sha1:568edcb95a8b86ffd0d267b124896df8ea81307c</id>
<content type='text'>
Add a macro for exchanging the values of variables.  It allows users
to avoid repetition and takes care of the temporary variable for them.
It also makes sure that the storage sizes of its two parameters are the
same.  Its memcpy(1) calls are optimized away by current compilers.

Also add a conservative semantic patch for transforming only swaps of
variables of the same type.

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>add QSORT_S</title>
<updated>2017-01-23T19:02:36Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-22T17:52:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ca869940994866796edf9e53e52d80f82c3c04c'/>
<id>urn:sha1:3ca869940994866796edf9e53e52d80f82c3c04c</id>
<content type='text'>
Add the macro QSORT_S, a convenient wrapper for qsort_s() that infers
the size of the array elements and dies on error.

Basically all possible errors are programming mistakes (passing NULL as
base of a non-empty array, passing NULL as comparison function,
out-of-bounds accesses), so terminating the program should be acceptable
for most callers.

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>compat: add qsort_s()</title>
<updated>2017-01-23T19:02:34Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-22T17:51:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=04ee8b875b96c096c479132adca02fa734c3fa96'/>
<id>urn:sha1:04ee8b875b96c096c479132adca02fa734c3fa96</id>
<content type='text'>
The function qsort_s() was introduced with C11 Annex K; it provides the
ability to pass a context pointer to the comparison function, supports
the convention of using a NULL pointer for an empty array and performs a
few safety checks.

Add an implementation based on compat/qsort.c for platforms that lack a
native standards-compliant qsort_s() (i.e. basically everyone).  It
doesn't perform the full range of possible checks: It uses size_t
instead of rsize_t and doesn't check nmemb and size against RSIZE_MAX
because we probably don't have the restricted size type defined.  For
the same reason it returns int instead of errno_t.

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>Merge branch 'jk/common-main'</title>
<updated>2016-10-31T20:15:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-31T20:15:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8171981fdea62f1f4c44f6d26f65b6324b31263'/>
<id>urn:sha1:b8171981fdea62f1f4c44f6d26f65b6324b31263</id>
<content type='text'>
A trivial clean-up to a recently graduated topic.

* jk/common-main:
  git-compat-util: move content inside ifdef/endif guards
</content>
</entry>
<entry>
<title>git-compat-util: move content inside ifdef/endif guards</title>
<updated>2016-10-27T17:36:45Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-10-27T17:30:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5c238e29a85dd109e42513c6a9d09008d8839bae'/>
<id>urn:sha1:5c238e29a85dd109e42513c6a9d09008d8839bae</id>
<content type='text'>
Commit 3f2e2297b9 (add an extra level of indirection to
main(), 2016-07-01) added a declaration to git-compat-util.h,
but it was accidentally placed after the final #endif that
guards against multiple inclusions.

This doesn't have any actual impact on the code, since it's
not incorrect to repeat a function declaration in C. But
it's a bad habit, and makes it more likely for somebody else
to make the same mistake. It also defeats gcc's optimization
to avoid opening header files whose contents are completely
guarded.

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 'jk/tighten-alloc'</title>
<updated>2016-10-26T20:14:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-26T20:14:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4d417fabaa0a8bcd8a9b39a88d870f07979e669e'/>
<id>urn:sha1:4d417fabaa0a8bcd8a9b39a88d870f07979e669e</id>
<content type='text'>
Protect our code from over-eager compilers.

* jk/tighten-alloc:
  inline xalloc_flex() into FLEXPTR_ALLOC_MEM
  avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM
</content>
</entry>
<entry>
<title>inline xalloc_flex() into FLEXPTR_ALLOC_MEM</title>
<updated>2016-10-17T21:42:56Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-10-16T10:06:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ac52a38e8008fa5bb243e150031681420c639fa'/>
<id>urn:sha1:0ac52a38e8008fa5bb243e150031681420c639fa</id>
<content type='text'>
Allocate and copy directly in FLEXPTR_ALLOC_MEM and remove the now
unused helper function xalloc_flex().  The resulting code is shorter
and the offset arithmetic is a bit simpler.

Suggested-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Reviewed-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM</title>
<updated>2016-10-17T21:42:31Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-10-15T16:23:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e9451782cfbe9fc9105bf63228bca3e2265af8f8'/>
<id>urn:sha1:e9451782cfbe9fc9105bf63228bca3e2265af8f8</id>
<content type='text'>
Calculating offsets involving a NULL pointer is undefined.  It works in
practice (for now?), but we should not rely on it.  Allocate first and
then simply refer to the flexible array member by its name instead of
performing pointer arithmetic up front.  The resulting code is slightly
shorter, easier to read and doesn't rely on undefined behaviour.

NB: The cast to a (non-const) void pointer is necessary to keep support
for flexible array members declared as const.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Reviewed-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
