mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
all: relax compiler requirements
- Do not check __STDC_HOSTED__. - Do not use atomic builtins. - Do not use thread-local storage for PRNG state.
This commit is contained in:
parent
56fa90397d
commit
50f05d2bd3
4 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
// No need for atomic json_incref()/json_decref(),
|
||||
// since we're only using Jansson in a single thread.
|
||||
#include <jansson_config.h>
|
||||
#undef JSON_HAVE_ATOMIC_BUILTINS
|
||||
#define JSON_HAVE_ATOMIC_BUILTINS 0
|
||||
#undef JSON_HAVE_SYNC_BUILTINS
|
||||
#define JSON_HAVE_SYNC_BUILTINS 0
|
||||
#include <jansson.h>
|
||||
|
||||
// The following helper macros are useful with literal keys,
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue