]> git.sesse.net Git - vlc/blob - include/debug.h
Remplissure du champ AUTHORS des sources.
[vlc] / include / debug.h
1 /*****************************************************************************
2  * debug.h: vlc debug macros
3  * Stand alone file
4  *****************************************************************************
5  * Copyright (C) 1999, 2000 VideoLAN
6  *
7  * Authors: BenoĆ®t Steiner <benny@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Required headers:
26  * - <string.h>
27  * - intf_msg.h
28  *****************************************************************************/
29
30
31 /*****************************************************************************
32  * ASSERT
33  *****************************************************************************
34  * This macro is used to test that a pointer is not nul. It insert the needed
35  * code when the program is compiled with the debug option, but does nothing
36  * in release program.
37  *****************************************************************************/
38 #ifdef DEBUG
39 #define ASSERT(p_Mem)                                                         \
40 if (!(p_Mem))                                                                 \
41     intf_ErrMsg("Void pointer error: "                                        \
42                 "%s line %d (variable %s at address %p)\n",                   \
43                  __FILE__, __LINE__, #p_Mem, &p_Mem);
44
45 #else
46 #define ASSERT(p_Mem)
47
48 #endif
49
50
51 /*****************************************************************************
52  * RZERO
53  *****************************************************************************
54  * This macro is used to initialise a variable to 0. It is very useful when
55  * used with the ASSERT macro. It also only insert the needed code when the
56  * program is compiled with the debug option.
57  *****************************************************************************/
58 #ifdef DEBUG
59 #define RZERO(r_Var)                                                          \
60 bzero(&(r_Var), sizeof((r_Var)));
61
62 #else
63 #define RZERO(r_Var)
64
65 #endif
66
67
68 /*****************************************************************************
69  * PZERO
70  *****************************************************************************
71  * This macro is used to initiase the memory pointed out by a pointer to 0.
72  * It has the same purpose than RZERO, but for pointers.
73  *****************************************************************************/
74 #ifdef DEBUG
75 #define PZERO(p_Mem)                                                          \
76 bzero((p_Mem), sizeof(*(p_Mem)));
77
78 #else
79 #define PZERO(p_Mem)
80
81 #endif
82
83
84 /*****************************************************************************
85  * AZERO
86  *****************************************************************************
87  * This macro is used to initiase an array of variables to 0.
88  * It has the same purpose than RZERO or PZERO, but for array
89  *****************************************************************************/
90 #ifdef DEBUG
91 #define AZERO(p_Array, i_Size)                                                \
92 bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
93
94 #else
95 #define ZERO(p_Array, i_Size)
96
97 #endif