From 0f13cb4a11110152b3245ed743fd1a5250fff9a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Tue, 20 Jan 2015 01:08:55 -0500 Subject: [PATCH] month-view: optimize days_delay update No need of memory allocation and releasing which is costly. --- src/gcal-month-view.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index ddcc7d05..56e5dd52 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -1692,19 +1692,12 @@ void gcal_month_view_set_first_weekday (GcalMonthView *view, gint day_nr) { - GcalMonthViewPrivate *priv; - icaltimetype *date; + GcalMonthViewPrivate *priv = gcal_month_view_get_instance_private (view); - priv = gcal_month_view_get_instance_private (view); priv->first_weekday = day_nr; - /* update days_delay */ if (priv->date != NULL) - { - date = gcal_month_view_get_initial_date (GCAL_VIEW (view)); - priv->days_delay = (icaltime_day_of_week (*date) - priv->first_weekday + 6) % 7; - g_free (date); - } + priv->days_delay = (time_day_of_week (1, priv->date->month - 1, priv->date->year) - priv->first_weekday + 7) % 7; } /**