1 /* cleanup functions (from libguestfs)
2 * Copyright (C) 2010-2014 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifdef HAVE_ATTRIBUTE_CLEANUP
26 #define CLEANUP_FREE __attribute__((cleanup(cleanup_free)))
27 #define CLEANUP_FREE_STRING_LIST \
28 __attribute__((cleanup(cleanup_free_string_list)))
29 #define CLEANUP_FREE_STATNS \
30 __attribute__((cleanup(cleanup_free_statns)))
31 #define CLEANUP_FREE_XATTR_LIST \
32 __attribute__((cleanup(cleanup_free_xattr_list)))
33 #define CLEANUP_FREE_STAT_LIST \
34 __attribute__((cleanup(cleanup_free_stat_list)))
38 #define CLEANUP_FREE_STRING_LIST
39 #define CLEANUP_FREE_STATNS
40 #define CLEANUP_FREE_XATTR_LIST
41 #define CLEANUP_FREE_STAT_LIST
44 extern void cleanup_free (void *ptr);
45 extern void free_string_list (char **argv);
46 extern void cleanup_free_string_list (char ***ptr);
47 extern void cleanup_free_statns (void *ptr);
48 extern void cleanup_free_xattr_list (void *ptr);
49 extern void cleanup_free_stat_list (void *ptr);
51 #endif /* CLEANUPS_H */