From: Guillaume Munch Date: Sat, 20 Aug 2016 15:05:41 +0000 (+0100) Subject: Remove unused variable warning and remove preprocessor switch. X-Git-Tag: 2.3.0alpha1~1111 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=193cda6e;p=lyx.git Remove unused variable warning and remove preprocessor switch. --- diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index e9b1d47202..e1a47e8439 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -92,24 +92,15 @@ lyx::Converter const * setConverter(string const & from) return ptr; } - // Show the error only once -#ifdef LYX_USE_STD_CALL_ONCE - // This is thread-safe. - static once_flag flag; - call_once(flag, [&](){ - LYXERR0("PreviewLoader::startLoading()\n" - << "No converter from \"" << from - << "\" format has been defined."); - }); -#else - // This is also thread-safe according to §6.7.4 of the C++11 standard. - static bool once = ([&]{ - LYXERR0("PreviewLoader::startLoading()\n" - << "No converter from \"" << from - << "\" format has been defined."); - } (), true); -#endif - return 0; + // Show the error only once. This is thread-safe. + static nullptr_t no_conv = [&]{ + LYXERR0("PreviewLoader::startLoading()\n" + << "No converter from \"" << from + << "\" format has been defined."); + return nullptr; + } (); + + return no_conv; }