Merge lp:~mhr3/libunity/no-string-array-copies into lp:~kamstrup/libunity/keywords-index

Proposed by Michal Hruby
Status: Merged
Approved by: Mikkel Kamstrup Erlandsen
Approved revision: 83
Merged at revision: 83
Proposed branch: lp:~mhr3/libunity/no-string-array-copies
Merge into: lp:~kamstrup/libunity/keywords-index
Diff against target: 32 lines (+7/-2)
1 file modified
src/unity-appinfo-manager.vala (+7/-2)
To merge this branch: bzr merge lp:~mhr3/libunity/no-string-array-copies
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen Pending
Review via email: mp+77137@code.launchpad.net

Description of the change

Avoids copying of string arrays.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-appinfo-manager.vala'
2--- src/unity-appinfo-manager.vala 2011-09-27 09:48:39 +0000
3+++ src/unity-appinfo-manager.vala 2011-09-27 10:42:22 +0000
4@@ -37,6 +37,11 @@
5 private class StringArrayWrapper
6 {
7 public string[] strings;
8+
9+ public void take_strings (owned string[] str_arr)
10+ {
11+ strings = (owned) str_arr;
12+ }
13 }
14
15 /**
16@@ -367,7 +372,7 @@
17 "Categories");
18
19 var wrapper = new StringArrayWrapper();
20- wrapper.strings = categories;
21+ wrapper.take_strings ((owned) categories);
22 categories_by_id.insert (id, wrapper);
23 } catch (KeyFileError eee) {
24 /* Unknown key or group. This app has no XDG Catories */
25@@ -405,7 +410,7 @@
26 }
27
28 var wrapper = new StringArrayWrapper();
29- wrapper.strings = keywords;
30+ wrapper.take_strings ((owned) keywords);
31 keywords_by_id.insert (id, wrapper);
32 }
33

Subscribers

People subscribed via source and target branches