Check for getc_unlocked() and fall back to getc() in richio if it's not available.

This commit is contained in:
Wayne Stambaugh 2012-10-09 10:31:36 -04:00
parent bb383e22b3
commit c11f3407b8
3 changed files with 14 additions and 0 deletions

View File

@ -78,6 +78,10 @@ macro(perform_feature_checks)
# HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC
check_symbol_exists(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_FUNC)
# Check for Posix getc_unlocked() for improved performance over getc(). Fall back to
# getc() on platforms where getc_unlocked() doesn't exist.
check_symbol_exists(getc_unlocked "stdio.h" HAVE_GETC_UNLOCKED)
# Generate config.h.
configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h)

View File

@ -50,6 +50,9 @@
#define strnicmp _strnicmp
#endif
/* Use Posix getc_unlocked() instead of getc() when it's available. */
#cmakedefine HAVE_GETC_UNLOCKED
/* Warning!!! Using wxGraphicContext for rendering is experimental. */
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1

View File

@ -28,6 +28,13 @@
#include <richio.h>
// Fall back to getc() when getc_unlocked() is not available on the target platform.
#if !defined( HAVE_GETC_UNLOCKED )
#define getc_unlocked getc
#endif
// This file defines 3 classes useful for working with DSN text files and is named
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.