1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

lib: Move generate_unique_u64_state into generate_unique_u64()

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>
This commit is contained in:
Volker Lendecke 2020-10-26 11:51:44 +01:00 committed by Jeremy Allison
parent 6598e00e12
commit 5ac44b83ee

View 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)) {