]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Move generate_unique_u64_state into generate_unique_u64()
authorVolker Lendecke <vl@samba.org>
Mon, 26 Oct 2020 10:51:44 +0000 (11:51 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 10 Nov 2020 19:49:33 +0000 (19:49 +0000)
Make clear that generate_unique_u64() is the only function referencing
it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/genrand_util.c

index 26b52a1c8140f8fa3d75dbffebba9ac638211af0..82085184e82249920f774c97a367bf419e26cd9f 100644 (file)
@@ -47,13 +47,13 @@ _PUBLIC_ uint64_t generate_random_u64(void)
        return BVAL(v, 0);
 }
 
-static struct generate_unique_u64_state {
-       uint64_t next_value;
-       int pid;
-} generate_unique_u64_state;
-
 _PUBLIC_ uint64_t generate_unique_u64(uint64_t veto_value)
 {
+       static struct generate_unique_u64_state {
+               uint64_t next_value;
+               int pid;
+       } generate_unique_u64_state;
+
        int pid = getpid();
 
        if (unlikely(pid != generate_unique_u64_state.pid)) {