summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-04-20 13:49:39 +0000
committerFrederic Culot <calcurse@culot.org>2008-04-20 13:49:39 +0000
commitcb3919c59ff62acbb425c37861a997b66d5de028 (patch)
tree54757b4b89fb7f67c4a56b74dae86c7e2669fcbc
parent8ba04b5220b0b741b2b58366320c3a9f23f844d2 (diff)
downloadcalcurse-cb3919c59ff62acbb425c37861a997b66d5de028.zip
no need to allocate tmp_app on heap in notify_thread_app
-rwxr-xr-xsrc/notify.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/notify.c b/src/notify.c
index 6bc0ddf..422ce09 100755
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,4 +1,4 @@
-/* $calcurse: notify.c,v 1.26 2008/04/19 21:05:15 culot Exp $ */
+/* $calcurse: notify.c,v 1.27 2008/04/20 13:49:39 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -267,27 +267,26 @@ notify_main_thread (void *arg)
static void *
notify_thread_app (void *arg)
{
- struct notify_app_s *tmp_app;
+ struct notify_app_s tmp_app;
time_t current_time;
current_time = time (NULL);
/* Use a temporary structure not to lock the mutex for a too
* long time while looking for next appointment. */
- tmp_app = (struct notify_app_s *) malloc (sizeof (struct notify_app_s));
- tmp_app->time = current_time + DAYINSEC;
- tmp_app->got_app = 0;
- tmp_app->txt = NULL;
- tmp_app = recur_apoint_check_next (tmp_app, current_time, get_today ());
- tmp_app = apoint_check_next (tmp_app, current_time);
+ tmp_app.time = current_time + DAYINSEC;
+ tmp_app.got_app = 0;
+ tmp_app.txt = NULL;
+ tmp_app = *recur_apoint_check_next (&tmp_app, current_time, get_today ());
+ tmp_app = *apoint_check_next (&tmp_app, current_time);
pthread_mutex_lock (&notify_app->mutex);
- if (tmp_app->got_app)
+ if (tmp_app.got_app)
{
notify_app->got_app = 1;
- notify_app->time = tmp_app->time;
- notify_app->txt = mycpy (tmp_app->txt);
- notify_app->state = tmp_app->state;
+ notify_app->time = tmp_app.time;
+ notify_app->txt = mycpy (tmp_app.txt);
+ notify_app->state = tmp_app.state;
}
else
{
@@ -295,9 +294,8 @@ notify_thread_app (void *arg)
}
pthread_mutex_unlock (&notify_app->mutex);
- if (tmp_app->txt != NULL)
- free (tmp_app->txt);
- free (tmp_app);
+ if (tmp_app.txt != NULL)
+ free (tmp_app.txt);
notify_update_bar ();
pthread_exit ((void *) 0);