From 63952b76ef6fce89854d0868d5337230c2ba4b38 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 21 Nov 2023 21:12:36 +0100 Subject: Constify some pointer references in locals No need to have pointers to mutables when not needed. This does not cover everything at all, and is limited to one file for the moment. origin commit was: https://github.com/mate-desktop/mate-panel/commit/b913762 --- mate-panel/panel-widget.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index ebaf74bf..1ba1d586 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -490,7 +490,7 @@ run_up_forbidden(PanelWidget *panel, g_return_if_fail(PANEL_IS_WIDGET(panel)); for(list = panel->applet_list;list!=NULL;list = g_list_next(list)) { - AppletData *ad = list->data; + const AppletData *ad = list->data; PanelWidget *p = g_object_get_data (G_OBJECT(ad->applet), MATE_PANEL_APPLET_ASSOC_PANEL_KEY); @@ -565,7 +565,7 @@ panel_widget_cadd (GtkContainer *container, static void panel_widget_cremove (GtkContainer *container, GtkWidget *widget) { - AppletData *ad; + const AppletData *ad; PanelWidget *p; PanelWidget *panel; @@ -611,7 +611,7 @@ get_applet_list_pos (PanelWidget *panel, g_return_val_if_fail (PANEL_IS_WIDGET (panel), NULL); for (l = panel->applet_list; l; l = l->next) { - AppletData *ad = l->data; + const AppletData *ad = l->data; if (ad->pos <= pos) { if (ad->pos + ad->cells > pos) @@ -683,7 +683,7 @@ panel_widget_jump_applet_right (PanelWidget *panel, int pos) { AppletData *ad; - AppletData *nad = NULL; + const AppletData *nad = NULL; ad = list->data; if (next) @@ -759,7 +759,7 @@ panel_widget_jump_applet_left (PanelWidget *panel, int pos) { AppletData *ad; - AppletData *pad = NULL; + const AppletData *pad = NULL; ad = list->data; if (prev) @@ -832,7 +832,7 @@ panel_widget_try_push_right (PanelWidget *panel, int push) { AppletData *ad; - AppletData *nad = NULL; + const AppletData *nad = NULL; g_assert (list != NULL); @@ -858,7 +858,7 @@ panel_widget_get_right_jump_pos (PanelWidget *panel, GList *next, int pos) { - AppletData *nad = NULL; + const AppletData *nad = NULL; if (next) nad = next->data; @@ -880,7 +880,7 @@ panel_widget_get_right_switch_pos (PanelWidget *panel, GList *list) { AppletData *ad; - AppletData *nad = NULL; + const AppletData *nad = NULL; g_assert (list != NULL); @@ -906,7 +906,7 @@ panel_widget_try_push_left (PanelWidget *panel, int push) { AppletData *ad; - AppletData *pad = NULL; + const AppletData *pad = NULL; g_assert (list != NULL); @@ -932,7 +932,7 @@ panel_widget_get_left_jump_pos (PanelWidget *panel, GList *prev, int pos) { - AppletData *pad = NULL; + const AppletData *pad = NULL; if (prev) pad = prev->data; @@ -954,7 +954,7 @@ panel_widget_get_left_switch_pos (PanelWidget *panel, GList *list) { AppletData *ad; - AppletData *pad = NULL; + const AppletData *pad = NULL; g_assert (list != NULL); @@ -995,7 +995,7 @@ panel_widget_switch_move (PanelWidget *panel, finalpos = ad->constrained + moveby; if (ad->constrained < finalpos) { - AppletData *pad; + const AppletData *pad; if (list->prev) { pad = list->prev->data; @@ -1021,7 +1021,7 @@ panel_widget_switch_move (PanelWidget *panel, } else { if (list->next) { - AppletData *nad = list->next->data; + const AppletData *nad = list->next->data; if (nad->expand_major) gtk_widget_queue_resize (GTK_WIDGET (panel)); } @@ -1044,7 +1044,7 @@ panel_widget_push_applet_right (PanelWidget *panel, int push) { AppletData *ad; - AppletData *nad = NULL; + const AppletData *nad = NULL; g_assert (list != NULL); @@ -1083,7 +1083,7 @@ panel_widget_push_applet_left (PanelWidget *panel, int push) { AppletData *ad; - AppletData *pad = NULL; + const AppletData *pad = NULL; g_assert (list != NULL); @@ -1141,7 +1141,7 @@ panel_widget_push_move (PanelWidget *panel, break; if (list->prev) { - AppletData *pad = list->prev->data; + const AppletData *pad = list->prev->data; if (pad->expand_major) gtk_widget_queue_resize (GTK_WIDGET (panel)); } @@ -1288,7 +1288,7 @@ panel_widget_get_preferred_size(GtkWidget *widget, for (list = ad_with_hints; list != NULL; list = g_list_next (list)) { - AppletData *ad = list->data; + const AppletData *ad = list->data; panel->applets_hints[i].hints = ad->size_hints; panel->applets_hints[i].len = ad->size_hints_len; @@ -1350,7 +1350,7 @@ queue_resize_on_all_applets(PanelWidget *panel) GList *li; for(li = panel->applet_list; li != NULL; li = g_list_next(li)) { - AppletData *ad = li->data; + const AppletData *ad = li->data; gtk_widget_queue_resize (ad->applet); } } @@ -1873,7 +1873,7 @@ panel_widget_get_moveby (PanelWidget *panel, int pos, int offset) static GList * walk_up_to (int pos, GList *list) { - AppletData *ad; + const AppletData *ad; g_return_val_if_fail (list != NULL, NULL); @@ -1896,7 +1896,7 @@ walk_up_to (int pos, GList *list) } static GtkWidget * -is_in_applet (int pos, AppletData *ad) +is_in_applet (int pos, const AppletData *ad) { g_return_val_if_fail (ad != NULL, NULL); @@ -1935,7 +1935,7 @@ panel_widget_get_free_spot (PanelWidget *panel, if (start < 0) start = 0; for (e = 0, i = start; i < panel->size; i++) { - GtkWidget *applet; + const GtkWidget *applet; list = walk_up_to (i, list); applet = is_in_applet (i, list->data); if (applet == NULL || @@ -1954,7 +1954,7 @@ panel_widget_get_free_spot (PanelWidget *panel, if (start >= panel->size) start = panel->size - 1; for (e = 0, i = start; i >= 0; i--) { - GtkWidget *applet; + const GtkWidget *applet; list = walk_up_to (i, list); applet = is_in_applet (i, list->data); if (applet == NULL || -- cgit v1.2.1