ROHC compression/decompression library
rohc_debug.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010,2012 Didier Barvaux
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 /**
00020  * @file   rohc_debug.h
00021  * @brief  ROHC debug utils
00022  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00023  * @author Didier Barvaux <didier@barvaux.org>
00024  */
00025 
00026 #ifndef ROHC_DEBUG_H
00027 #define ROHC_DEBUG_H
00028 
00029 /*
00030  * Includes
00031  */
00032 
00033 #include <stdlib.h> /* for free(3) */
00034 #include "config.h" /* for ROHC_EXTRA_DEBUG definition */
00035 
00036 
00037 /*
00038  * Debug macros
00039  */
00040 
00041 #if ROHC_EXTRA_DEBUG == 1
00042 
00043 /** Free a pointer plus set it to NULL to avoid hidden bugs */
00044 #define zfree(pointer) \
00045         do { \
00046                 free(pointer); \
00047                 pointer = NULL; \
00048         } while(0)
00049 
00050 #else /* not ROHC_DEBUG */
00051 
00052 #define zfree(pointer) \
00053         do { \
00054                 free(pointer); \
00055         } while(0)
00056 
00057 #endif
00058 
00059 
00060 #endif
00061