1 /*******************************************************************************
2 * debug.h: vlc debug macros
4 *******************************************************************************
6 *******************************************************************************
10 *******************************************************************************/
13 /*******************************************************************************
15 *******************************************************************************
16 * This macro is used to test that a pointer is not nul. It insert the needed
17 * code when the program is compiled with the debug option, but does nothing
19 *******************************************************************************/
21 #define ASSERT(p_Mem) \
23 intf_ErrMsg("Void pointer error: %s line %d (variable %s at address %p)\n", \
24 __FILE__, __LINE__, #p_Mem, &p_Mem);
32 /*******************************************************************************
34 *******************************************************************************
35 * This macro is used to initialise a variable to 0. It is very useful when
36 * used with the ASSERT macro. It also only insert the needed code when the
37 * program is compiled with the debug option.
38 *******************************************************************************/
40 #define RZERO(r_Var) \
41 bzero(&(r_Var), sizeof((r_Var)));
49 /*******************************************************************************
51 *******************************************************************************
52 * This macro is used to initiase the memory pointed out by a pointer to 0.
53 * It has the same purpose than RZERO, but for pointers.
54 *******************************************************************************/
56 #define PZERO(p_Mem) \
57 bzero((p_Mem), sizeof(*(p_Mem)));
65 /*******************************************************************************
67 *******************************************************************************
68 * This macro is used to initiase an array of variables to 0.
69 * It has the same purpose than RZERO or PZERO, but for array
70 *******************************************************************************/
72 #define AZERO(p_Array, i_Size) \
73 bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
76 #define ZERO(p_Array, i_Size)