diff --git a/frontend/src/main.c b/frontend/src/main.c index c12bbd9..e555cbc 100644 --- a/frontend/src/main.c +++ b/frontend/src/main.c @@ -154,7 +154,8 @@ int MAIN(const int argc, CHR *const argv[]) setup_signal_handler(SIGINT, sigint_handler); FPRINTF(stderr, T("SlunkCrypt Utility (%") T(PRIstr) T("-%") T(PRIstr) T("), by LoRd_MuldeR \n"), OS_TYPE_NAME, CPU_ARCH); - FPRINTF(stderr, T("Using libSlunkCrypt v%u.%u.%u [%") T(PRIstr) T("]\n\n"), SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD); + FPRINTF(stderr, T("Using libSlunkCrypt-%") T(PRIstr) T(" v%u.%u.%u [%") T(PRIstr) T("]\n\n"), + SLUNKCRYPT_HAVE_THREADS ? "MT" : "ST", SLUNKCRYPT_VERSION_MAJOR, SLUNKCRYPT_VERSION_MINOR, SLUNKCRYPT_VERSION_PATCH, SLUNKCRYPT_BUILD); fflush(stderr); diff --git a/libslunkcrypt/include/slunkcrypt.h b/libslunkcrypt/include/slunkcrypt.h index fc57c87..45c857e 100644 --- a/libslunkcrypt/include/slunkcrypt.h +++ b/libslunkcrypt/include/slunkcrypt.h @@ -98,6 +98,11 @@ SLUNKCRYPT_API extern const uint16_t SLUNKCRYPT_VERSION_PATCH; */ SLUNKCRYPT_API extern const char *const SLUNKCRYPT_BUILD; +/* + * Configuration + */ +SLUNKCRYPT_API extern const int SLUNKCRYPT_HAVE_THREADS; + /* * Abort flag */ diff --git a/libslunkcrypt/src/slunkcrypt.c b/libslunkcrypt/src/slunkcrypt.c index 2cc5a35..2a5c91f 100644 --- a/libslunkcrypt/src/slunkcrypt.c +++ b/libslunkcrypt/src/slunkcrypt.c @@ -24,6 +24,9 @@ const char *const SLUNKCRYPT_BUILD = __DATE__ ", " __TIME__; #define BOOLIFY(X) (!!(X)) #define THREAD_COUNT(X) (((X)->thread_pool) ? slunkcrypt_thrdpl_count((X)->thread_pool) : 1U) +/* Configuration */ +const int SLUNKCRYPT_HAVE_THREADS = BOOLIFY(MAX_THREADS > 1U); + // ========================================================================== // Data structures // ========================================================================== diff --git a/libslunkcrypt/src/thread.c b/libslunkcrypt/src/thread.c index 9e6c114..7a73329 100644 --- a/libslunkcrypt/src/thread.c +++ b/libslunkcrypt/src/thread.c @@ -3,13 +3,7 @@ /* This work has been released under the CC0 1.0 Universal license! */ /******************************************************************************/ -#ifdef SLUNKBUILD_NOTHREADS - -#ifdef __GNUC__ -# pragma GCC diagnostic ignored "-Wpedantic" -#endif - -#else /*SLUNKBUILD_NOTHREADS*/ +#ifndef SLUNKBUILD_NOTHREADS #ifdef _WIN32 # define _CRT_SECURE_NO_WARNINGS 1 diff --git a/libslunkcrypt/src/thread.h b/libslunkcrypt/src/thread.h index c59742a..4961de2 100644 --- a/libslunkcrypt/src/thread.h +++ b/libslunkcrypt/src/thread.h @@ -15,7 +15,6 @@ typedef void(*thrdpl_worker_t)(const size_t thread_count, void *const context, u #ifndef SLUNKBUILD_NOTHREADS #define MAX_THREADS 32U - thrdpl_t *slunkcrypt_thrdpl_create(const size_t count, const thrdpl_worker_t worker); size_t slunkcrypt_thrdpl_count(const thrdpl_t *const thrdpl); void slunkcrypt_thrdpl_init(thrdpl_t *const thrdpl, const size_t index, void *const context); @@ -25,7 +24,6 @@ void slunkcrypt_thrdpl_destroy(thrdpl_t *const thrdpl); #else #define MAX_THREADS 1U - #define slunkcrypt_thrdpl_create(X,Y) NULL #define slunkcrypt_thrdpl_count(X) 0U #define slunkcrypt_thrdpl_init(X,Y,Z) do { abort(); } while(0)