]> git.ipfire.org Git - thirdparty/git.git/commit - git-compat-util.h
git-compat-util: add fallbacks for unlocked stdio
authorJeff King <peff@peff.net>
Thu, 16 Apr 2015 08:48:45 +0000 (04:48 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Apr 2015 15:15:04 +0000 (08:15 -0700)
commitf43cce23adde58d44081e46279c7fd655d4246ec
treec8355ed36e91b1c36573eb5852cb2574f798b9b4
parent3446a59b3950d57960e27f8a2c7e41462bd2bcf4
git-compat-util: add fallbacks for unlocked stdio

POSIX.1-2001 specifies some functions for optimizing the
locking out of tight getc() loops. Not all systems are
POSIX, though, and even not all POSIX systems are required
to implement these functions. We can check for the
feature-test macro to see if they are available, and if not,
provide a noop implementation.

There's no Makefile knob here, because we should just detect
this automatically. If there are very bizarre systems, we
may need to add one, but it's not clear yet in which
direction:

  1. If a system defines _POSIX_THREAD_SAFE_FUNCTIONS but
     these functions are missing or broken, we would want a
     knob to manually turn them off.

  2. If a system has these functions but does not define
     _POSIX_THREAD_SAFE_FUNCTIONS, we would want a knob to
     manually turn them on.

We can add such a knob when we find a real-world system that
matches this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h