Merge lp:~mc-return/unity/unity.merge-remove-assignment-of-values-never-used into lp:unity

Proposed by MC Return
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3027
Proposed branch: lp:~mc-return/unity/unity.merge-remove-assignment-of-values-never-used
Merge into: lp:unity
Diff against target: 203 lines (+13/-32)
8 files modified
launcher/QuicklistManager.cpp (+0/-2)
launcher/QuicklistView.cpp (+1/-2)
panel/PanelIndicatorEntryView.cpp (+2/-4)
panel/PanelMenuView.cpp (+0/-2)
plugins/unityshell/src/minimizedwindowhandler.cpp (+0/-1)
plugins/unityshell/src/nux-area-accessible.cpp (+2/-5)
plugins/unityshell/src/unityshell_glow.cpp (+1/-1)
unity-shared/DashStyle.cpp (+7/-15)
To merge this branch: bzr merge lp:~mc-return/unity/unity.merge-remove-assignment-of-values-never-used
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Marco Trevisan (Treviño) Approve
Review via email: mp+142527@code.launchpad.net

Commit message

Minor performance improvement:
Removed assignment of values that are never used to various variables.

Description of the change

Note:
This branch does not contain any logic changes.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, thanks.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

35 - gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
36 - pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
37 + gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);

45 - gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
46 - pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
47 + gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);

I missed these: could you please revert this (at least you can not set the pos on first time, but both the calls should be done as you're appending to a widget path)?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/QuicklistManager.cpp'
2--- launcher/QuicklistManager.cpp 2012-10-01 16:43:41 +0000
3+++ launcher/QuicklistManager.cpp 2013-01-09 18:15:26 +0000
4@@ -63,8 +63,6 @@
5
6 void QuicklistManager::RegisterQuicklist(QuicklistView* quicklist)
7 {
8- std::list<QuicklistView*>::iterator it;
9-
10 if (std::find(_quicklist_list.begin(), _quicklist_list.end(), quicklist) != _quicklist_list.end())
11 {
12 // quicklist has already been registered
13
14=== modified file 'launcher/QuicklistView.cpp'
15--- launcher/QuicklistView.cpp 2012-11-15 17:56:23 +0000
16+++ launcher/QuicklistView.cpp 2013-01-09 18:15:26 +0000
17@@ -916,8 +916,7 @@
18 gfloat padding = pad;
19 int ZEROPOINT5 = 0.0f;
20
21- gfloat HeightToAnchor = 0.0f;
22- HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
23+ gfloat HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
24 if (HeightToAnchor < 0.0f)
25 {
26 g_warning("Anchor-height and corner-radius a higher than whole texture!");
27
28=== modified file 'panel/PanelIndicatorEntryView.cpp'
29--- panel/PanelIndicatorEntryView.cpp 2012-12-13 20:10:58 +0000
30+++ panel/PanelIndicatorEntryView.cpp 2013-01-09 18:15:26 +0000
31@@ -260,8 +260,7 @@
32 gtk_style_context_save(style_context);
33
34 GtkWidgetPath* widget_path = gtk_widget_path_new();
35- gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
36- pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
37+ gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
38 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
39
40 gtk_style_context_set_path(style_context, widget_path);
41@@ -329,8 +328,7 @@
42 gtk_style_context_save(style_context);
43
44 GtkWidgetPath* widget_path = gtk_widget_path_new();
45- gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);
46- pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
47+ gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
48 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
49
50 gtk_style_context_set_path(style_context, widget_path);
51
52=== modified file 'panel/PanelMenuView.cpp'
53--- panel/PanelMenuView.cpp 2012-12-14 16:07:56 +0000
54+++ panel/PanelMenuView.cpp 2013-01-09 18:15:26 +0000
55@@ -775,8 +775,6 @@
56 gtk_render_layout(style_context, cr, x, y, layout);
57 }
58
59- x += text_width;
60-
61 gtk_style_context_restore(style_context);
62 }
63
64
65=== modified file 'plugins/unityshell/src/minimizedwindowhandler.cpp'
66--- plugins/unityshell/src/minimizedwindowhandler.cpp 2012-04-27 11:42:56 +0000
67+++ plugins/unityshell/src/minimizedwindowhandler.cpp 2013-01-09 18:15:26 +0000
68@@ -228,7 +228,6 @@
69
70 nextStateSize = nItems;
71
72- pbegin = nextState = (Atom *) malloc (sizeof (Atom) * nextStateSize);
73 pbegin = nextState = (Atom *) memcpy (nextState, data, sizeof (Atom) * nextStateSize);
74
75 /* Remove _NET_WM_STATE_HIDDEN */
76
77=== modified file 'plugins/unityshell/src/nux-area-accessible.cpp'
78--- plugins/unityshell/src/nux-area-accessible.cpp 2012-07-09 15:53:27 +0000
79+++ plugins/unityshell/src/nux-area-accessible.cpp 2013-01-09 18:15:26 +0000
80@@ -443,14 +443,13 @@
81 gboolean
82 nux_area_accessible_parent_window_active(NuxAreaAccessible* self)
83 {
84- gboolean active = FALSE;
85 AtkStateSet* state_set = NULL;
86
87 check_parent_window_connected(self);
88
89 state_set = atk_object_ref_state_set(ATK_OBJECT(self->priv->parent_window));
90
91- active = atk_state_set_contains_state(state_set, ATK_STATE_ACTIVE);
92+ gboolean active = atk_state_set_contains_state(state_set, ATK_STATE_ACTIVE);
93
94 g_object_unref(state_set);
95
96@@ -549,10 +548,8 @@
97
98 if (self->priv->focused != focus_in)
99 {
100- gboolean is_parent_window_active = FALSE;
101-
102 self->priv->focused = focus_in;
103- is_parent_window_active = nux_area_accessible_parent_window_active(self);
104+ gboolean is_parent_window_active = nux_area_accessible_parent_window_active(self);
105
106 /* we don't emit focus_in=TRUE events until the top level window
107 is active */
108
109=== modified file 'plugins/unityshell/src/unityshell_glow.cpp'
110--- plugins/unityshell/src/unityshell_glow.cpp 2012-10-18 15:28:18 +0000
111+++ plugins/unityshell/src/unityshell_glow.cpp 2013-01-09 18:15:26 +0000
112@@ -243,7 +243,7 @@
113 quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
114
115 y1 = std::max<int>(geo.y + geo.height - glow_offset, geo.y + (geo.height / 2));
116- x2 = std::min<int>(geo.x + glow_offset, geo.x + (geo.width / 2));
117+ x2 = std::min<int>(x2, geo.x + (geo.width / 2));
118
119 box->setGeometry(x1, y1, x2 - x1, y2 - y1);
120
121
122=== modified file 'unity-shared/DashStyle.cpp'
123--- unity-shared/DashStyle.cpp 2012-12-17 09:28:31 +0000
124+++ unity-shared/DashStyle.cpp 2013-01-09 18:15:26 +0000
125@@ -466,9 +466,7 @@
126 cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
127 return;
128
129- bool odd = true;
130-
131- odd = cairo_get_line_width (cr) == 2.0 ? false : true;
132+ bool odd = cairo_get_line_width (cr) == 2.0 ? false : true;
133
134 double radius = cornerRadius / aspect;
135
136@@ -830,8 +828,6 @@
137 double y = 2.0;
138 double w = cairo_image_surface_get_width(cairo_get_target(cr)) - 4.0;
139 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
140- double xt = 0.0;
141- double yt = 0.0;
142
143 // - these absolute values are the "cost" of getting only a SVG from design
144 // and not a generic formular how to approximate the curve-shape, thus
145@@ -839,8 +835,8 @@
146 double width = w - 22.18;
147 double height = h - 24.0;
148
149- xt = x + width + 22.18;
150- yt = y + 12.0;
151+ double xt = x + width + 22.18;
152+ double yt = y + 12.0;
153
154 if (align)
155 {
156@@ -974,9 +970,8 @@
157 double radius = cornerRadius / aspect;
158 double arrow_w = radius / 1.5;
159 double arrow_h = radius / 2.0;
160- bool odd = true;
161
162- odd = cairo_get_line_width (cr) == 2.0 ? false : true;
163+ bool odd = cairo_get_line_width (cr) == 2.0 ? false : true;
164
165 switch (segment)
166 {
167@@ -1100,8 +1095,6 @@
168 double y = 2.0;
169 double w = cairo_image_surface_get_width(cairo_get_target(cr));
170 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
171- double xt = 0.0;
172- double yt = 0.0;
173
174 // - these absolute values are the "cost" of getting only a SVG from design
175 // and not a generic formular how to approximate the curve-shape, thus
176@@ -1109,8 +1102,8 @@
177 double width = w - 22.18;
178 double height = h - 24.0;
179
180- xt = x + width + 22.18;
181- yt = y + 12.0;
182+ double xt = x + width + 22.18;
183+ double yt = y + 12.0;
184
185 switch (segment)
186 {
187@@ -1488,7 +1481,6 @@
188 int width = 0;
189 int height = 0;
190 int stride = 0;
191- cairo_format_t format = CAIRO_FORMAT_INVALID;
192 unsigned char* buffer = NULL;
193 cairo_surface_t* surface = NULL;
194 cairo_t* blurred_cr = NULL;
195@@ -1500,7 +1492,7 @@
196 width = cairo_image_surface_get_width(target);
197 height = cairo_image_surface_get_height(target);
198 stride = cairo_image_surface_get_stride(target);
199- format = cairo_image_surface_get_format(target);
200+ cairo_format_t format = cairo_image_surface_get_format(target);
201
202 // get buffer
203 buffer = (unsigned char*) calloc(1, height * stride);