1 /*****************************************************************************
2 * debug.h: vlc debug macros
4 *****************************************************************************
5 * Copyright (C) 1999, 2000 VideoLAN
7 * Authors: BenoƮt Steiner <benny@via.ecp.fr>
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
17 * GNU General Public License for more details.
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 *****************************************************************************/
24 /*****************************************************************************
28 *****************************************************************************/
31 /*****************************************************************************
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
37 *****************************************************************************/
39 #define ASSERT(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);
51 /*****************************************************************************
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 *****************************************************************************/
59 #define RZERO(r_Var) \
60 bzero(&(r_Var), sizeof((r_Var)));
68 /*****************************************************************************
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 /* It is already defined on BSD */
77 #define PZERO(p_Mem) \
78 bzero((p_Mem), sizeof(*(p_Mem)));
87 /*****************************************************************************
89 *****************************************************************************
90 * This macro is used to initiase an array of variables to 0.
91 * It has the same purpose than RZERO or PZERO, but for array
92 *****************************************************************************/
94 #define AZERO(p_Array, i_Size) \
95 bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
98 #define ZERO(p_Array, i_Size)