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
=== modified file 'launcher/QuicklistManager.cpp'
--- launcher/QuicklistManager.cpp 2012-10-01 16:43:41 +0000
+++ launcher/QuicklistManager.cpp 2013-01-09 18:15:26 +0000
@@ -63,8 +63,6 @@
6363
64void QuicklistManager::RegisterQuicklist(QuicklistView* quicklist)64void QuicklistManager::RegisterQuicklist(QuicklistView* quicklist)
65{65{
66 std::list<QuicklistView*>::iterator it;
67
68 if (std::find(_quicklist_list.begin(), _quicklist_list.end(), quicklist) != _quicklist_list.end())66 if (std::find(_quicklist_list.begin(), _quicklist_list.end(), quicklist) != _quicklist_list.end())
69 {67 {
70 // quicklist has already been registered68 // quicklist has already been registered
7169
=== modified file 'launcher/QuicklistView.cpp'
--- launcher/QuicklistView.cpp 2012-11-15 17:56:23 +0000
+++ launcher/QuicklistView.cpp 2013-01-09 18:15:26 +0000
@@ -916,8 +916,7 @@
916 gfloat padding = pad;916 gfloat padding = pad;
917 int ZEROPOINT5 = 0.0f;917 int ZEROPOINT5 = 0.0f;
918918
919 gfloat HeightToAnchor = 0.0f;919 gfloat HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
920 HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
921 if (HeightToAnchor < 0.0f)920 if (HeightToAnchor < 0.0f)
922 {921 {
923 g_warning("Anchor-height and corner-radius a higher than whole texture!");922 g_warning("Anchor-height and corner-radius a higher than whole texture!");
924923
=== modified file 'panel/PanelIndicatorEntryView.cpp'
--- panel/PanelIndicatorEntryView.cpp 2012-12-13 20:10:58 +0000
+++ panel/PanelIndicatorEntryView.cpp 2013-01-09 18:15:26 +0000
@@ -260,8 +260,7 @@
260 gtk_style_context_save(style_context);260 gtk_style_context_save(style_context);
261261
262 GtkWidgetPath* widget_path = gtk_widget_path_new();262 GtkWidgetPath* widget_path = gtk_widget_path_new();
263 gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);263 gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
264 pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
265 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");264 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
266265
267 gtk_style_context_set_path(style_context, widget_path);266 gtk_style_context_set_path(style_context, widget_path);
@@ -329,8 +328,7 @@
329 gtk_style_context_save(style_context);328 gtk_style_context_save(style_context);
330329
331 GtkWidgetPath* widget_path = gtk_widget_path_new();330 GtkWidgetPath* widget_path = gtk_widget_path_new();
332 gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_BAR);331 gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
333 pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_MENU_ITEM);
334 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");332 gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
335333
336 gtk_style_context_set_path(style_context, widget_path);334 gtk_style_context_set_path(style_context, widget_path);
337335
=== modified file 'panel/PanelMenuView.cpp'
--- panel/PanelMenuView.cpp 2012-12-14 16:07:56 +0000
+++ panel/PanelMenuView.cpp 2013-01-09 18:15:26 +0000
@@ -775,8 +775,6 @@
775 gtk_render_layout(style_context, cr, x, y, layout);775 gtk_render_layout(style_context, cr, x, y, layout);
776 }776 }
777777
778 x += text_width;
779
780 gtk_style_context_restore(style_context);778 gtk_style_context_restore(style_context);
781}779}
782780
783781
=== modified file 'plugins/unityshell/src/minimizedwindowhandler.cpp'
--- plugins/unityshell/src/minimizedwindowhandler.cpp 2012-04-27 11:42:56 +0000
+++ plugins/unityshell/src/minimizedwindowhandler.cpp 2013-01-09 18:15:26 +0000
@@ -228,7 +228,6 @@
228228
229 nextStateSize = nItems;229 nextStateSize = nItems;
230230
231 pbegin = nextState = (Atom *) malloc (sizeof (Atom) * nextStateSize);
232 pbegin = nextState = (Atom *) memcpy (nextState, data, sizeof (Atom) * nextStateSize);231 pbegin = nextState = (Atom *) memcpy (nextState, data, sizeof (Atom) * nextStateSize);
233232
234 /* Remove _NET_WM_STATE_HIDDEN */233 /* Remove _NET_WM_STATE_HIDDEN */
235234
=== modified file 'plugins/unityshell/src/nux-area-accessible.cpp'
--- plugins/unityshell/src/nux-area-accessible.cpp 2012-07-09 15:53:27 +0000
+++ plugins/unityshell/src/nux-area-accessible.cpp 2013-01-09 18:15:26 +0000
@@ -443,14 +443,13 @@
443gboolean443gboolean
444nux_area_accessible_parent_window_active(NuxAreaAccessible* self)444nux_area_accessible_parent_window_active(NuxAreaAccessible* self)
445{445{
446 gboolean active = FALSE;
447 AtkStateSet* state_set = NULL;446 AtkStateSet* state_set = NULL;
448447
449 check_parent_window_connected(self);448 check_parent_window_connected(self);
450449
451 state_set = atk_object_ref_state_set(ATK_OBJECT(self->priv->parent_window));450 state_set = atk_object_ref_state_set(ATK_OBJECT(self->priv->parent_window));
452451
453 active = atk_state_set_contains_state(state_set, ATK_STATE_ACTIVE);452 gboolean active = atk_state_set_contains_state(state_set, ATK_STATE_ACTIVE);
454453
455 g_object_unref(state_set);454 g_object_unref(state_set);
456455
@@ -549,10 +548,8 @@
549548
550 if (self->priv->focused != focus_in)549 if (self->priv->focused != focus_in)
551 {550 {
552 gboolean is_parent_window_active = FALSE;
553
554 self->priv->focused = focus_in;551 self->priv->focused = focus_in;
555 is_parent_window_active = nux_area_accessible_parent_window_active(self);552 gboolean is_parent_window_active = nux_area_accessible_parent_window_active(self);
556553
557 /* we don't emit focus_in=TRUE events until the top level window554 /* we don't emit focus_in=TRUE events until the top level window
558 is active */555 is active */
559556
=== modified file 'plugins/unityshell/src/unityshell_glow.cpp'
--- plugins/unityshell/src/unityshell_glow.cpp 2012-10-18 15:28:18 +0000
+++ plugins/unityshell/src/unityshell_glow.cpp 2013-01-09 18:15:26 +0000
@@ -243,7 +243,7 @@
243 quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);243 quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
244244
245 y1 = std::max<int>(geo.y + geo.height - glow_offset, geo.y + (geo.height / 2));245 y1 = std::max<int>(geo.y + geo.height - glow_offset, geo.y + (geo.height / 2));
246 x2 = std::min<int>(geo.x + glow_offset, geo.x + (geo.width / 2));246 x2 = std::min<int>(x2, geo.x + (geo.width / 2));
247247
248 box->setGeometry(x1, y1, x2 - x1, y2 - y1);248 box->setGeometry(x1, y1, x2 - x1, y2 - y1);
249249
250250
=== modified file 'unity-shared/DashStyle.cpp'
--- unity-shared/DashStyle.cpp 2012-12-17 09:28:31 +0000
+++ unity-shared/DashStyle.cpp 2013-01-09 18:15:26 +0000
@@ -466,9 +466,7 @@
466 cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)466 cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
467 return;467 return;
468468
469 bool odd = true;469 bool odd = cairo_get_line_width (cr) == 2.0 ? false : true;
470
471 odd = cairo_get_line_width (cr) == 2.0 ? false : true;
472470
473 double radius = cornerRadius / aspect;471 double radius = cornerRadius / aspect;
474472
@@ -830,8 +828,6 @@
830 double y = 2.0;828 double y = 2.0;
831 double w = cairo_image_surface_get_width(cairo_get_target(cr)) - 4.0;829 double w = cairo_image_surface_get_width(cairo_get_target(cr)) - 4.0;
832 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;830 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
833 double xt = 0.0;
834 double yt = 0.0;
835831
836 // - these absolute values are the "cost" of getting only a SVG from design832 // - these absolute values are the "cost" of getting only a SVG from design
837 // and not a generic formular how to approximate the curve-shape, thus833 // and not a generic formular how to approximate the curve-shape, thus
@@ -839,8 +835,8 @@
839 double width = w - 22.18;835 double width = w - 22.18;
840 double height = h - 24.0;836 double height = h - 24.0;
841837
842 xt = x + width + 22.18;838 double xt = x + width + 22.18;
843 yt = y + 12.0;839 double yt = y + 12.0;
844840
845 if (align)841 if (align)
846 {842 {
@@ -974,9 +970,8 @@
974 double radius = cornerRadius / aspect;970 double radius = cornerRadius / aspect;
975 double arrow_w = radius / 1.5;971 double arrow_w = radius / 1.5;
976 double arrow_h = radius / 2.0;972 double arrow_h = radius / 2.0;
977 bool odd = true;
978973
979 odd = cairo_get_line_width (cr) == 2.0 ? false : true;974 bool odd = cairo_get_line_width (cr) == 2.0 ? false : true;
980975
981 switch (segment)976 switch (segment)
982 {977 {
@@ -1100,8 +1095,6 @@
1100 double y = 2.0;1095 double y = 2.0;
1101 double w = cairo_image_surface_get_width(cairo_get_target(cr));1096 double w = cairo_image_surface_get_width(cairo_get_target(cr));
1102 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;1097 double h = cairo_image_surface_get_height(cairo_get_target(cr)) - 4.0;
1103 double xt = 0.0;
1104 double yt = 0.0;
11051098
1106 // - these absolute values are the "cost" of getting only a SVG from design1099 // - these absolute values are the "cost" of getting only a SVG from design
1107 // and not a generic formular how to approximate the curve-shape, thus1100 // and not a generic formular how to approximate the curve-shape, thus
@@ -1109,8 +1102,8 @@
1109 double width = w - 22.18;1102 double width = w - 22.18;
1110 double height = h - 24.0;1103 double height = h - 24.0;
11111104
1112 xt = x + width + 22.18;1105 double xt = x + width + 22.18;
1113 yt = y + 12.0;1106 double yt = y + 12.0;
11141107
1115 switch (segment)1108 switch (segment)
1116 {1109 {
@@ -1488,7 +1481,6 @@
1488 int width = 0;1481 int width = 0;
1489 int height = 0;1482 int height = 0;
1490 int stride = 0;1483 int stride = 0;
1491 cairo_format_t format = CAIRO_FORMAT_INVALID;
1492 unsigned char* buffer = NULL;1484 unsigned char* buffer = NULL;
1493 cairo_surface_t* surface = NULL;1485 cairo_surface_t* surface = NULL;
1494 cairo_t* blurred_cr = NULL;1486 cairo_t* blurred_cr = NULL;
@@ -1500,7 +1492,7 @@
1500 width = cairo_image_surface_get_width(target);1492 width = cairo_image_surface_get_width(target);
1501 height = cairo_image_surface_get_height(target);1493 height = cairo_image_surface_get_height(target);
1502 stride = cairo_image_surface_get_stride(target);1494 stride = cairo_image_surface_get_stride(target);
1503 format = cairo_image_surface_get_format(target);1495 cairo_format_t format = cairo_image_surface_get_format(target);
15041496
1505 // get buffer1497 // get buffer
1506 buffer = (unsigned char*) calloc(1, height * stride);1498 buffer = (unsigned char*) calloc(1, height * stride);