Commit c11f3407 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

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

parent bb383e22
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,10 @@ macro(perform_feature_checks)
    # HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC
    # 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_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.
    # Generate config.h.
    configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
    configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
                   ${CMAKE_BINARY_DIR}/config.h)
                   ${CMAKE_BINARY_DIR}/config.h)
+3 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,9 @@
#define strnicmp _strnicmp
#define strnicmp _strnicmp
#endif
#endif


/* Use Posix getc_unlocked() instead of getc() when it's available. */
#cmakedefine HAVE_GETC_UNLOCKED

/* Warning!!!  Using wxGraphicContext for rendering is experimental. */
/* Warning!!!  Using wxGraphicContext for rendering is experimental. */
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1


+7 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,13 @@


#include <richio.h>
#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
// This file defines 3 classes useful for working with DSN text files and is named
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.