mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 06:10:11 +01:00
nmtst: add nmtst_initialized()
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
86693d2378
commit
64d09e5afe
1 changed files with 12 additions and 2 deletions
|
|
@ -40,10 +40,18 @@ extern struct __nmtst_internal __nmtst_internal;
|
|||
#define NMTST_DEFINE() \
|
||||
struct __nmtst_internal __nmtst_internal = { 0 };
|
||||
|
||||
|
||||
inline static gboolean
|
||||
nmtst_initialized (void)
|
||||
{
|
||||
return !!__nmtst_internal.rand0;
|
||||
}
|
||||
|
||||
|
||||
inline static void
|
||||
nmtst_init (int *argc, char ***argv, const char *log_level, const char *log_domains)
|
||||
{
|
||||
g_assert (!__nmtst_internal.rand0);
|
||||
g_assert (!nmtst_initialized ());
|
||||
|
||||
g_assert (!((!!argc) ^ (!!argv)));
|
||||
if (argc) {
|
||||
|
|
@ -71,13 +79,15 @@ nmtst_init (int *argc, char ***argv, const char *log_level, const char *log_doma
|
|||
inline static GRand *
|
||||
nmtst_get_rand0 ()
|
||||
{
|
||||
g_assert (__nmtst_internal.rand0);
|
||||
g_assert (nmtst_initialized ());
|
||||
return __nmtst_internal.rand0;
|
||||
}
|
||||
|
||||
inline static GRand *
|
||||
nmtst_get_rand ()
|
||||
{
|
||||
g_assert (nmtst_initialized ());
|
||||
|
||||
if (G_UNLIKELY (!__nmtst_internal.rand)) {
|
||||
guint32 seed;
|
||||
const char *str;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue