Mercurial > audlegacy
annotate src/audacious/debug.h @ 2873:7a0ca380c843 trunk
BSD relicensing (pass 13).
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Sat, 23 Jun 2007 23:20:05 -0500 |
| parents | 3149d4b1a9a9 |
| children | 4e39304e238b |
| rev | line source |
|---|---|
|
2873
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
1 /* |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
2 * audacious: Cross-platform multimedia player. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
3 * debug.h: Debugging macros. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
4 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
5 * Copyright (c) 2005-2007 Audacious development team. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
6 * Copyright (c) 2003-2005 BMP development team. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
7 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
8 * Redistribution and use in source and binary forms, with or without |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
9 * modification, are permitted provided that the following conditions are |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
10 * met: |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
11 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
12 * 1. Redistributions of source code must retain the above copyright notice, |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
13 * this list of conditions and the following disclaimer. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
14 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
15 * 2. Redistributions in binary form must reproduce the above copyright |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
16 * notice, this list of conditions and the following disclaimer in the |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
17 * documentation and/or other materials provided with the distribution. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
18 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
19 * 3. The name of the author may not be used to endorse or promote products |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
20 * derived from this software without specific prior written permission. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
21 * |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
31 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
32 * POSSIBILITY OF SUCH DAMAGE. |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
33 */ |
|
7a0ca380c843
BSD relicensing (pass 13).
William Pitcock <nenolod@atheme.org>
parents:
2313
diff
changeset
|
34 |
| 2313 | 35 #ifndef DEBUG_H |
| 36 #define DEBUG_H | |
| 37 | |
| 38 #include <glib.h> | |
| 39 | |
| 40 #ifdef NDEBUG | |
| 41 | |
| 42 /* void REQUIRE_LOCK(GMutex *m); */ | |
| 43 # define REQUIRE_LOCK(m) | |
| 44 | |
| 45 /* void REQUIRE_STR_UTF8(const gchar *str); */ | |
| 46 # define REQUIRE_STR_UTF8(str) | |
| 47 | |
| 48 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */ | |
| 49 # define REQUIRE_STATIC_LOCK(m) | |
| 50 | |
| 51 #else /* !NDEBUG */ | |
| 52 | |
| 53 /* void REQUIRE_LOCK(GMutex *m); */ | |
| 54 # define REQUIRE_LOCK(m) G_STMT_START { \ | |
| 55 if (g_mutex_trylock(m)) { \ | |
| 56 g_critical(G_STRLOC ": Mutex not locked!"); \ | |
| 57 g_mutex_unlock(m); \ | |
| 58 } \ | |
| 59 } G_STMT_END | |
| 60 | |
| 61 /* void REQUIRE_STATIC_LOCK(GStaticMutex *m); */ | |
| 62 # define REQUIRE_STATIC_LOCK(m) G_STMT_START { \ | |
| 63 if (G_TRYLOCK(m)) { \ | |
| 64 g_critical(G_STRLOC ": Mutex not locked!"); \ | |
| 65 G_UNLOCK(m); \ | |
| 66 } \ | |
| 67 } G_STMT_END | |
| 68 | |
| 69 /* void REQUIRE_STR_UTF8(const gchar *str); */ | |
| 70 # define REQUIRE_STR_UTF8(str) G_STMT_START { \ | |
| 71 if (!g_utf_validate(str, -1, NULL)) \ | |
| 72 g_warning(G_STRLOC ": String is not UTF-8!"); \ | |
| 73 } G_STMT_END | |
| 74 | |
| 75 #endif /* NDEBUG */ | |
| 76 | |
| 77 | |
| 78 #endif |
