1 /* misc-macros.h 2 * 3 * Copyright (C) 2011-2013 Thien-Thi Nguyen 4 * Copyright (C) 2001 Stefan Jahn <stefan@lkcc.org> 5 * Copyright (C) 2001 Raimund Jacob <raimi@cs.tu-berlin.de> 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3, or (at your option) 10 * any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this package. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef __MISC_MACROS_H__ 22 #define __MISC_MACROS_H__ 1 23 24 /* 25 * Free the memory block pointed to by @var{lval} 26 * and set it to @code{NULL} afterwards. 27 */ 28 #define svz_free_and_zero(lval) do \ 29 { \ 30 svz_free (lval); \ 31 (lval) = NULL; \ 32 } \ 33 while (0) 34 35 /* 36 * Convert the integer value @var{n} into a pointer. 37 */ 38 #define SVZ_NUM2PTR(n) ((void *) ((unsigned long) (n))) 39 40 /* 41 * Convert the pointer @var{p} into a integer value. 42 */ 43 #define SVZ_PTR2NUM(p) ((unsigned long) ((void *) (p))) 44 45 #endif /* !defined __MISC_MACROS_H__ */ 46