[libgsystem] Add gs_transfer_out_value() macro



commit e270f5379bd794391e9a8f1be7f9aa17f0d7dd97
Author: Colin Walters <walters verbum org>
Date:   Fri Jul 5 11:48:09 2013 -0400

    Add gs_transfer_out_value() macro
    
    A simple macro to help with out parameters.

 libgsystem.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libgsystem.h b/libgsystem.h
index c7aea6c..60884b6 100644
--- a/libgsystem.h
+++ b/libgsystem.h
@@ -25,6 +25,14 @@
 
 G_BEGIN_DECLS
 
+#define gs_transfer_out_value(outp, srcp) G_STMT_START {   \
+  if (outp)                                                \
+    {                                                      \
+      *(outp) = *(srcp);                                   \
+      *(srcp) = NULL;                                      \
+    }                                                      \
+  } G_STMT_END;
+
 #include <gsystem-console.h>
 #include <gsystem-file-utils.h>
 #include <gsystem-shutil.h>


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