[ostree] core: Allow creating tempfile without associated output stream



commit ad956ff9e2f47139b89efd72e3cfb8d40d62e4c3
Author: Colin Walters <walters verbum org>
Date:   Thu Dec 20 20:49:19 2012 -0500

    core: Allow creating tempfile without associated output stream
    
    Just slightly more efficient, and we'll use this for spawning curl to
    a tempfile.

 src/libostree/ostree-core.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 0fb2b40..6e494d4 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -1367,9 +1367,12 @@ ostree_create_temp_regular_file (GFile            *dir,
                                            &ret_file, cancellable, error))
     goto out;
   
-  ret_stream = (GOutputStream*)g_file_append_to (ret_file, 0, cancellable, error);
-  if (ret_stream == NULL)
-    goto out;
+  if (out_stream)
+    {
+      ret_stream = (GOutputStream*)g_file_append_to (ret_file, 0, cancellable, error);
+      if (ret_stream == NULL)
+        goto out;
+    }
   
   ret = TRUE;
   ot_transfer_out_value(out_file, &ret_file);



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