[gnome-builder/wip/gtk4-port: 1551/1774] libide/core: add ide_steal_fd() macro




commit 5b7d07c9904cdc5777f1f5ba2d2678eeafdfda35
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 16 14:28:51 2022 -0700

    libide/core: add ide_steal_fd() macro
    
    This is meant to cleanup some code where we swap fd values for -1.

 src/libide/core/ide-macros.h | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libide/core/ide-macros.h b/src/libide/core/ide-macros.h
index 3268066b7..8c20d858d 100644
--- a/src/libide/core/ide-macros.h
+++ b/src/libide/core/ide-macros.h
@@ -301,6 +301,14 @@ ide_strv_sort (char   **strv,
                      NULL);
 }
 
+static inline int
+ide_steal_fd (int *fd)
+{
+  int ret = *fd;
+  *fd = -1;
+  return ret;
+}
+
 G_END_DECLS
 
 #endif /* __GI_SCANNER__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]