annotate audacious/debug.h @ 897:eeed0ddebdfc trunk

[svn] - icons woohoo
author nhjm449
date Wed, 29 Mar 2006 22:17:26 -0800
parents cb178e5ad177
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 #ifndef DEBUG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 #define DEBUG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 #ifdef NDEBUG
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 /* void REQUIRE_LOCK(GMutex *m); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 # define REQUIRE_LOCK(m)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 /* void REQUIRE_STR_UTF8(const gchar *str); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 # define REQUIRE_STR_UTF8(str)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 # define REQUIRE_STATIC_LOCK(m)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 #else /* !NDEBUG */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 /* void REQUIRE_LOCK(GMutex *m); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 # define REQUIRE_LOCK(m) G_STMT_START { \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 if (g_mutex_trylock(m)) { \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 g_critical(G_STRLOC ": Mutex not locked!"); \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 g_mutex_unlock(m); \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 } \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25 } G_STMT_END
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 # define REQUIRE_STATIC_LOCK(m) G_STMT_START { \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 if (G_TRYLOCK(m)) { \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 g_critical(G_STRLOC ": Mutex not locked!"); \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 G_UNLOCK(m); \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 } \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 } G_STMT_END
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35 /* void REQUIRE_STR_UTF8(const gchar *str); */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 # define REQUIRE_STR_UTF8(str) G_STMT_START { \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 if (!g_utf_validate(str, -1, NULL)) \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 g_warning(G_STRLOC ": String is not UTF-8!"); \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 } G_STMT_END
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 #endif /* NDEBUG */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 #endif