Mercurial > audlegacy
annotate src/audacious/debug.h @ 4667:2079f04c19e2
Use new Interface API.
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Sun, 29 Jun 2008 00:45:55 -0500 |
| parents | 2eee464379dc |
| children |
| rev | line source |
|---|---|
|
4557
2eee464379dc
Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents:
2313
diff
changeset
|
1 #ifndef AUDACIOUS_DEBUG_H |
|
2eee464379dc
Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents:
2313
diff
changeset
|
2 #define AUDACIOUS_DEBUG_H |
| 2313 | 3 |
| 4 #include <glib.h> | |
| 5 | |
| 6 #ifdef NDEBUG | |
| 7 | |
| 8 /* void REQUIRE_LOCK(GMutex *m); */ | |
| 9 # define REQUIRE_LOCK(m) | |
| 10 | |
| 11 /* void REQUIRE_STR_UTF8(const gchar *str); */ | |
| 12 # define REQUIRE_STR_UTF8(str) | |
| 13 | |
| 14 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */ | |
| 15 # define REQUIRE_STATIC_LOCK(m) | |
| 16 | |
| 17 #else /* !NDEBUG */ | |
| 18 | |
| 19 /* void REQUIRE_LOCK(GMutex *m); */ | |
| 20 # define REQUIRE_LOCK(m) G_STMT_START { \ | |
| 21 if (g_mutex_trylock(m)) { \ | |
| 22 g_critical(G_STRLOC ": Mutex not locked!"); \ | |
| 23 g_mutex_unlock(m); \ | |
| 24 } \ | |
| 25 } G_STMT_END | |
| 26 | |
| 27 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */ | |
| 28 # define REQUIRE_STATIC_LOCK(m) G_STMT_START { \ | |
| 29 if (G_TRYLOCK(m)) { \ | |
| 30 g_critical(G_STRLOC ": Mutex not locked!"); \ | |
| 31 G_UNLOCK(m); \ | |
| 32 } \ | |
| 33 } G_STMT_END | |
| 34 | |
| 35 /* void REQUIRE_STR_UTF8(const gchar *str); */ | |
| 36 # define REQUIRE_STR_UTF8(str) G_STMT_START { \ | |
| 37 if (!g_utf_validate(str, -1, NULL)) \ | |
| 38 g_warning(G_STRLOC ": String is not UTF-8!"); \ | |
| 39 } G_STMT_END | |
| 40 | |
| 41 #endif /* NDEBUG */ | |
| 42 | |
| 43 | |
|
4557
2eee464379dc
Clean up header multiple inclusion guards (e.g. #ifndef FOO_H/#define FOO_H)
Matti Hamalainen <ccr@tnsp.org>
parents:
2313
diff
changeset
|
44 #endif /* AUDACIOUS_DEBUG_H */ |
