1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
/* structs_gmutex.c generated by valac, the Vala compiler
* generated from structs_gmutex.vala, do not modify */
#include <glib.h>
#include <string.h>
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
static void _vala_main (void);
static void _vala_clear_GMutex (GMutex * mutex);
static void _vala_clear_GRecMutex (GRecMutex * mutex);
static void _vala_clear_GRWLock (GRWLock * mutex);
static void _vala_clear_GCond (GCond * mutex);
static void
_vala_main (void)
{
{
GMutex mutex = {0};
g_mutex_init (&mutex);
g_mutex_lock (&mutex);
_vala_assert (!g_mutex_trylock (&mutex), "!mutex.trylock ()");
g_mutex_unlock (&mutex);
_vala_clear_GMutex (&mutex);
}
{
GRecMutex mutex = {0};
g_rec_mutex_init (&mutex);
g_rec_mutex_lock (&mutex);
_vala_assert (g_rec_mutex_trylock (&mutex), "mutex.trylock ()");
g_rec_mutex_unlock (&mutex);
g_rec_mutex_unlock (&mutex);
_vala_clear_GRecMutex (&mutex);
}
}
int
main (int argc,
char ** argv)
{
_vala_main ();
return 0;
}
static void
_vala_clear_GMutex (GMutex * mutex)
{
GMutex zero_mutex = { 0 };
if (memcmp (mutex, &zero_mutex, sizeof (GMutex))) {
g_mutex_clear (mutex);
memset (mutex, 0, sizeof (GMutex));
}
}
static void
_vala_clear_GRecMutex (GRecMutex * mutex)
{
GRecMutex zero_mutex = { 0 };
if (memcmp (mutex, &zero_mutex, sizeof (GRecMutex))) {
g_rec_mutex_clear (mutex);
memset (mutex, 0, sizeof (GRecMutex));
}
}
static void
_vala_clear_GRWLock (GRWLock * mutex)
{
GRWLock zero_mutex = { 0 };
if (memcmp (mutex, &zero_mutex, sizeof (GRWLock))) {
g_rw_lock_clear (mutex);
memset (mutex, 0, sizeof (GRWLock));
}
}
static void
_vala_clear_GCond (GCond * mutex)
{
GCond zero_mutex = { 0 };
if (memcmp (mutex, &zero_mutex, sizeof (GCond))) {
g_cond_clear (mutex);
memset (mutex, 0, sizeof (GCond));
}
}
|