← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 367: optimize allocations of variants

 

------------------------------------------------------------
revno: 367
committer: Seif Lotfy <seif@xxxxxxxxx>
branch nick: memory
timestamp: Sun 2012-01-15 15:43:43 +0100
message:
  optimize allocations of variants
modified:
  src/datamodel.vala


--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'src/datamodel.vala'
--- src/datamodel.vala	2011-12-13 01:23:49 +0000
+++ src/datamodel.vala	2012-01-15 14:43:43 +0000
@@ -411,7 +411,16 @@
                 vb.close ();
             }
 
-            return vb.end ();
+            Variant event_variant = vb.end ().get_normal_form ();
+            // FIXME: this uses g_new0, we dont need the mem to be zero-filled
+            uchar[] data = new uchar[event_variant.get_size ()];
+            event_variant.store (data);
+            unowned uchar[] data_copy = data;
+ 
+            Variant ret = Variant.new_from_data (
+                new VariantType ("("+Utils.SIG_EVENT+")"),
+                data_copy, true, (owned) data);
+            return ret;
         }
 
         public void debug_print ()