1 /*****************************************************************************
2 * debug.h: vlc debug macros
4 *****************************************************************************
5 * Copyright (C) 1999, 2000 VideoLAN
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.
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 GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
23 *****************************************************************************/
25 /*****************************************************************************
29 *****************************************************************************/
32 /*****************************************************************************
34 *****************************************************************************
35 * This macro is used to test that a pointer is not nul. It insert the needed
36 * code when the program is compiled with the debug option, but does nothing
38 *****************************************************************************/
40 #define ASSERT(p_Mem) \
42 intf_ErrMsg("Void pointer error: " \
43 "%s line %d (variable %s at address %p)\n", \
44 __FILE__, __LINE__, #p_Mem, &p_Mem);
52 /*****************************************************************************
54 *****************************************************************************
55 * This macro is used to initialise a variable to 0. It is very useful when
56 * used with the ASSERT macro. It also only insert the needed code when the
57 * program is compiled with the debug option.
58 *****************************************************************************/
60 #define RZERO(r_Var) \
61 bzero(&(r_Var), sizeof((r_Var)));
69 /*****************************************************************************
71 *****************************************************************************
72 * This macro is used to initiase the memory pointed out by a pointer to 0.
73 * It has the same purpose than RZERO, but for pointers.
74 *****************************************************************************/
76 #define PZERO(p_Mem) \
77 bzero((p_Mem), sizeof(*(p_Mem)));
85 /*****************************************************************************
87 *****************************************************************************
88 * This macro is used to initiase an array of variables to 0.
89 * It has the same purpose than RZERO or PZERO, but for array
90 *****************************************************************************/
92 #define AZERO(p_Array, i_Size) \
93 bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
96 #define ZERO(p_Array, i_Size)