------------------------------------------------------------
revno: 367
committer: Seif Lotfy <s...@lotfy.com>
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 ()

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to