diff --git a/src/defs.h b/src/defs.h index 4fc7fec..71749f7 100644 --- a/src/defs.h +++ b/src/defs.h @@ -23,8 +23,7 @@ #ifndef BOOKMARKFS_DEFS_H_ #define BOOKMARKFS_DEFS_H_ -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) \ - || (__STDC_HOSTED__ != 1) +#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) # error "unsupported compiler" #elif __STDC_VERSION__ >= 202311L # define HAVE_STDC_23 1 diff --git a/src/json.h b/src/json.h index f8a1e4d..21b25f1 100644 --- a/src/json.h +++ b/src/json.h @@ -25,6 +25,13 @@ #include +// No need for atomic json_incref()/json_decref(), +// since we're only using Jansson in a single thread. +#include +#undef JSON_HAVE_ATOMIC_BUILTINS +#define JSON_HAVE_ATOMIC_BUILTINS 0 +#undef JSON_HAVE_SYNC_BUILTINS +#define JSON_HAVE_SYNC_BUILTINS 0 #include // The following helper macros are useful with literal keys, diff --git a/src/prng.c b/src/prng.c index 53580a3..8cb41eb 100644 --- a/src/prng.c +++ b/src/prng.c @@ -39,10 +39,7 @@ static uint64_t rotl64 (uint64_t, unsigned); // Forward declaration end -#ifndef BOOKMARKFS_TLS -# error "compiler does not support thread-local storage" -#endif -static BOOKMARKFS_TLS uint64_t state[4]; +static uint64_t state[4]; static uint64_t rotl64 ( diff --git a/src/prng.h b/src/prng.h index 549dc18..fa8423d 100644 --- a/src/prng.h +++ b/src/prng.h @@ -31,7 +31,7 @@ * Returns a pseudo-random 64-bit unsigned integer. * The PRNG should be seeded before calling this function. * - * This function is MT-Safe. + * This function is MT-Unsafe. */ uint64_t prng_rand (void); @@ -40,9 +40,6 @@ prng_rand (void); * Seed the PRNG with the given values. * If `s` is NULL, the values will be read from /dev/urandom. * - * When used in a multi-threaded environment, - * each thread should seed the PRNG separately. - * * Returns 0 on success, -1 on failure. * If `s` is not NULL, this function never fails. */