From 1546db05bd9b9b2b47224f1e19a6b91d485ea8be Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 13 Jul 2018 16:09:51 +0200 Subject: [PATCH] shared/gsystem-local-alloc: remove unused "gs_fd_close" cleanup macro Drop unused "gs_fd_close" macro, now that we no longer care about keeping "gsystem-local-alloc.h" header in sync with (unmaintained) upstream. Also, our own "nm_auto_close" macro should be preferred, because - it preserves errno - it uses nm_close(), which asserts against EBADF. --- shared/nm-utils/gsystem-local-alloc.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/shared/nm-utils/gsystem-local-alloc.h b/shared/nm-utils/gsystem-local-alloc.h index 50a92c83a0..9e2174b1d7 100644 --- a/shared/nm-utils/gsystem-local-alloc.h +++ b/shared/nm-utils/gsystem-local-alloc.h @@ -21,10 +21,6 @@ #ifndef __GSYSTEM_LOCAL_ALLOC_H__ #define __GSYSTEM_LOCAL_ALLOC_H__ -#include - -G_BEGIN_DECLS - #define GS_DEFINE_CLEANUP_FUNCTION_VOID(CastType, name, func) \ static inline void name (void *v) \ { \ @@ -203,25 +199,4 @@ GS_DEFINE_CLEANUP_FUNCTION0 (GError *, gs_local_free_error, g_error_free) #define gs_unref_keyfile __attribute__ ((cleanup(gs_local_keyfile_unref))) GS_DEFINE_CLEANUP_FUNCTION0 (GKeyFile *, gs_local_keyfile_unref, g_key_file_unref) -static inline void -gs_cleanup_close_fdp (int *fdp) -{ - int fd; - - g_assert (fdp); - - fd = *fdp; - if (fd != -1) - (void) close (fd); -} - -/** - * gs_fd_close: - * - * Call close() on a variable location when it goes out of scope. - */ -#define gs_fd_close __attribute__((cleanup(gs_cleanup_close_fdp))) - -G_END_DECLS - #endif