<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-compat-util.h, branch v2.4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.9</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-06-26T06:03:25Z</updated>
<entry>
<title>Merge branch 'cb/array-size' into maint</title>
<updated>2015-06-26T06:03:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-26T06:03:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b1f0802e9127b117bae7a4cfdc81495f7a9a09f3'/>
<id>urn:sha1:b1f0802e9127b117bae7a4cfdc81495f7a9a09f3</id>
<content type='text'>
* cb/array-size:
  Fix definition of ARRAY_SIZE for non-gcc builds
</content>
</entry>
<entry>
<title>Merge branch 'jk/diagnose-config-mmap-failure' into maint</title>
<updated>2015-06-25T18:02:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-25T18:02:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5baf18a404a9713e1b75161855cacbfec32fcf2'/>
<id>urn:sha1:c5baf18a404a9713e1b75161855cacbfec32fcf2</id>
<content type='text'>
The configuration reader/writer uses mmap(2) interface to access
the files; when we find a directory, it barfed with "Out of memory?".

* jk/diagnose-config-mmap-failure:
  xmmap(): drop "Out of memory?"
  config.c: rewrite ENODEV into EISDIR when mmap fails
  config.c: avoid xmmap error messages
  config.c: fix mmap leak when writing config
  read-cache.c: drop PROT_WRITE from mmap of index
</content>
</entry>
<entry>
<title>Fix definition of ARRAY_SIZE for non-gcc builds</title>
<updated>2015-06-25T00:14:00Z</updated>
<author>
<name>Charles Bailey</name>
<email>cbailey32@bloomberg.net</email>
</author>
<published>2015-06-24T22:12:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e2c6f7cd5a66ed0009662d2651e0cf3c655e83a9'/>
<id>urn:sha1:e2c6f7cd5a66ed0009662d2651e0cf3c655e83a9</id>
<content type='text'>
The improved ARRAY_SIZE macro uses BARF_UNLESS_AN_ARRAY which expands
to a valid check for recent gcc versions and to 0 for older gcc
versions but is not defined on non-gcc builds.

Non-gcc builds need this macro to expand to 0 as well. The current outer
test (defined(__GNUC__) &amp;&amp; (__GNUC__ &gt;= 3)) is a strictly weaker
condition than the inner test (GIT_GNUC_PREREQ(3, 1)) so we can omit the
outer test and cause the BARF_UNLESS_AN_ARRAY macro to be defined
correctly on non-gcc builds as well as gcc builds with older versions.

Signed-off-by: Charles Bailey &lt;cbailey32@bloomberg.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ep/do-not-feed-a-pointer-to-array-size' into maint</title>
<updated>2015-06-16T21:33:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-06-16T21:33:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=335f1a7eb2a08218301deae92244591a0ee9710c'/>
<id>urn:sha1:335f1a7eb2a08218301deae92244591a0ee9710c</id>
<content type='text'>
Catch a programmer mistake to feed a pointer not an array to
ARRAY_SIZE() macro, by using a couple of GCC extensions.

* ep/do-not-feed-a-pointer-to-array-size:
  git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array
</content>
</entry>
<entry>
<title>config.c: avoid xmmap error messages</title>
<updated>2015-05-28T18:33:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-05-28T07:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1570856b510e3722a3620063e7ba209106b75857'/>
<id>urn:sha1:1570856b510e3722a3620063e7ba209106b75857</id>
<content type='text'>
The config-writing code uses xmmap to map the existing
config file, which will die if the map fails. This has two
downsides:

  1. The error message is not very helpful, as it lacks any
     context about the file we are mapping:

       $ mkdir foo
       $ git config --file=foo some.key value
       fatal: Out of memory? mmap failed: No such device

  2. We normally do not die in this code path; instead, we'd
     rather report the error and return an appropriate exit
     status (which is part of the public interface
     documented in git-config.1).

This patch introduces a "gentle" form of xmmap which lets us
produce our own error message. We do not want to use mmap
directly, because we would like to use the other
compatibility elements of xmmap (e.g., handling 0-length
maps portably).

The end result is:

    $ git.compile config --file=foo some.key value
    error: unable to mmap 'foo': No such device
    $ echo $?
    3

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>git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array</title>
<updated>2015-05-05T22:26:48Z</updated>
<author>
<name>Elia Pinto</name>
<email>gitter.spiros@gmail.com</email>
</author>
<published>2015-04-30T12:44:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=89c855ed3cbe64bea93ea081d0e96077e9ee8517'/>
<id>urn:sha1:89c855ed3cbe64bea93ea081d0e96077e9ee8517</id>
<content type='text'>
To get number of elements in an array git use the ARRAY_SIZE macro
defined as:

       #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

The problem with it is a possibility of mistakenly passing to it a
pointer instead an array. The ARRAY_SIZE macro as conventionally
defined does not provide good type-safety and the open-coded
approach is more fragile, more verbose and provides no improvement in
type-safety.

Use instead a different but compatible ARRAY_SIZE() macro,
which will also break compile if you try to
use it on a pointer. This implemention revert to the original code
if the compiler doesn't know the typeof and __builtin_types_compatible_p
GCC extensions.

This can ensure our code is robust to changes, without
needing a gratuitous macro or constant. A similar
ARRAY_SIZE implementation also exists in the linux kernel.

Credits to Rusty Russell and his ccan library.

Signed-off-by: Elia Pinto &lt;gitter.spiros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'km/bsd-sysctl'</title>
<updated>2015-03-20T20:11:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-20T20:11:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=551fc7aec1a7efe868a59fbeea14582b41923f4d'/>
<id>urn:sha1:551fc7aec1a7efe868a59fbeea14582b41923f4d</id>
<content type='text'>
We now detect number of CPUs on older BSD-derived systems.

* km/bsd-sysctl:
  thread-utils.c: detect CPU count on older BSD-like systems
  configure: support HAVE_BSD_SYSCTL option
</content>
</entry>
<entry>
<title>Merge branch 'km/bsd-shells'</title>
<updated>2015-03-20T20:11:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-20T20:11:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec0465ade87996214959a393239eec520daf92ea'/>
<id>urn:sha1:ec0465ade87996214959a393239eec520daf92ea</id>
<content type='text'>
Portability fixes and workarounds for shell scripts have been added
to help BSD-derived systems.

* km/bsd-shells:
  t5528: do not fail with FreeBSD shell
  help.c: use SHELL_PATH instead of hard-coded "/bin/sh"
  git-compat-util.h: move SHELL_PATH default into header
  git-instaweb: use @SHELL_PATH@ instead of /bin/sh
  git-instaweb: allow running in a working tree subdirectory
</content>
</entry>
<entry>
<title>configure: support HAVE_BSD_SYSCTL option</title>
<updated>2015-03-10T22:13:25Z</updated>
<author>
<name>Kyle J. McKay</name>
<email>mackyle@gmail.com</email>
</author>
<published>2015-03-08T07:14:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9529080de253b89474402f323e10470656764b3a'/>
<id>urn:sha1:9529080de253b89474402f323e10470656764b3a</id>
<content type='text'>
On BSD-compatible systems some information such as the number
of available CPUs may only be available via the sysctl function.

Add support for a HAVE_BSD_SYSCTL option complete with autoconf
support and include the sys/syctl.h header when the option is
enabled to make the sysctl function available.

Signed-off-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-compat-util.h: move SHELL_PATH default into header</title>
<updated>2015-03-10T22:11:24Z</updated>
<author>
<name>Kyle J. McKay</name>
<email>mackyle@gmail.com</email>
</author>
<published>2015-03-08T05:07:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1b56cdf901f6e6a73d0edadf56afb1c878c7622a'/>
<id>urn:sha1:1b56cdf901f6e6a73d0edadf56afb1c878c7622a</id>
<content type='text'>
If SHELL_PATH is not defined we use "/bin/sh".  However,
run-command.c is not the only file that needs to use
the default value so move it into a common header.

Signed-off-by: Kyle J. McKay &lt;mackyle@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
