aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-04-03 21:54:58 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-04-03 22:09:00 +0200
commit5b12c236cf68a182fb8075c7ec0797c4c64fd60c (patch)
tree26d6b771bf4e764b9beb3ac056acad89f28200b0 /src
parent1473145d10a0ba529526897c08eab2fb176dac01 (diff)
downloadcalcurse-5b12c236cf68a182fb8075c7ec0797c4c64fd60c.tar.gz
calcurse-5b12c236cf68a182fb8075c7ec0797c4c64fd60c.zip
Remove dead assignments spotted by clang-analyzer.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r--src/args.c9
-rw-r--r--src/calendar.c3
-rw-r--r--src/day.c18
-rw-r--r--src/help.c2
-rw-r--r--src/mem.c1
-rw-r--r--src/notify.c6
-rw-r--r--src/recur.c14
-rw-r--r--src/todo.c4
8 files changed, 17 insertions, 40 deletions
diff --git a/src/args.c b/src/args.c
index c1d3dba..4ac2fd5 100644
--- a/src/args.c
+++ b/src/args.c
@@ -545,7 +545,7 @@ date_arg (char *ddate, int add_line, int print_note, struct conf *conf,
int i;
struct date day;
int numdays = 0, num_digit = 0;
- int arg_len = 0, app_found = 0;
+ int arg_len = 0;
static struct tm t;
time_t timer;
@@ -578,7 +578,7 @@ date_arg (char *ddate, int add_line, int print_note, struct conf *conf,
if (parse_date (ddate, conf->input_datefmt, (int *)&day.yyyy,
(int *)&day.mm, (int *)&day.dd, NULL))
{
- app_found = app_arg (add_line, &day, 0, print_note, conf, regex);
+ (void)app_arg (add_line, &day, 0, print_note, conf, regex);
}
else
{
@@ -665,7 +665,7 @@ int
parse_args (int argc, char **argv, struct conf *conf)
{
int ch, add_line = 0;
- int unknown_flag = 0, app_found = 0;
+ int unknown_flag = 0;
/* Command-line flags */
int aflag = 0; /* -a: print appointments for current day */
int cflag = 0; /* -c: specify the calendar file to use */
@@ -834,7 +834,6 @@ parse_args (int argc, char **argv, struct conf *conf)
}
}
argc -= optind;
- argv += optind;
if (argc >= 1)
{
@@ -947,7 +946,7 @@ parse_args (int argc, char **argv, struct conf *conf)
custom_load_conf (conf, 0); /* To get output date format. */
io_load_app ();
day.dd = day.mm = day.yyyy = 0;
- app_found = app_arg (add_line, &day, 0, Nflag, conf, preg);
+ (void)app_arg (add_line, &day, 0, Nflag, conf, preg);
non_interactive = 1;
}
}
diff --git a/src/calendar.c b/src/calendar.c
index e480b00..45b99c3 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -675,7 +675,6 @@ calendar_move (enum move move)
t.tm_mon = slctd_day.mm - 1;
t.tm_year = slctd_day.yyyy - 1900;
- ret = 1;
switch (move)
{
case UP:
@@ -886,9 +885,7 @@ pom (time_t tmpt)
struct tm *GMT;
double days;
int cnt;
- enum pom pom;
- pom = NO_POM;
GMT = gmtime (&tmpt);
days = (GMT->tm_yday + 1) + ((GMT->tm_hour + (GMT->tm_min / 60.0) +
(GMT->tm_sec / 3600.0)) / 24.0);
diff --git a/src/day.c b/src/day.c
index e63c6df..8561123 100644
--- a/src/day.c
+++ b/src/day.c
@@ -151,7 +151,6 @@ static int
day_store_events (long date)
{
struct event *j;
- struct day_item *ptr;
int e_nb = 0;
for (j = eventlist; j != 0; j = j->next)
@@ -159,7 +158,7 @@ day_store_events (long date)
if (event_inday (j, date))
{
e_nb++;
- ptr = day_add_event (EVNT, j->mesg, j->note, j->day, j->id);
+ (void)day_add_event (EVNT, j->mesg, j->note, j->day, j->id);
}
}
@@ -177,7 +176,6 @@ static int
day_store_recur_events (long date)
{
struct recur_event *j;
- struct day_item *ptr;
int e_nb = 0;
for (j = recur_elist; j != 0; j = j->next)
@@ -186,7 +184,7 @@ day_store_recur_events (long date)
j->rpt->until, date))
{
e_nb++;
- ptr = day_add_event (RECUR_EVNT, j->mesg, j->note, j->day, j->id);
+ (void)day_add_event (RECUR_EVNT, j->mesg, j->note, j->day, j->id);
}
}
@@ -204,7 +202,6 @@ static int
day_store_apoints (long date)
{
struct apoint *j;
- struct day_item *ptr;
int a_nb = 0;
pthread_mutex_lock (&(alist_p->mutex));
@@ -213,7 +210,7 @@ day_store_apoints (long date)
if (apoint_inday (j, date))
{
a_nb++;
- ptr = day_add_apoint (APPT, j->mesg, j->note, j->start,
+ (void)day_add_apoint (APPT, j->mesg, j->note, j->start,
j->dur, j->state, 0);
}
}
@@ -233,7 +230,6 @@ static int
day_store_recur_apoints (long date)
{
struct recur_apoint *j;
- struct day_item *ptr;
long real_start;
int a_nb = 0, n = 0;
@@ -245,7 +241,7 @@ day_store_recur_apoints (long date)
j->rpt->until, date)))
{
a_nb++;
- ptr = day_add_apoint (RECUR_APPT, j->mesg, j->note,
+ (void)day_add_apoint (RECUR_APPT, j->mesg, j->note,
real_start, j->dur, j->state, n);
n++;
}
@@ -270,9 +266,6 @@ day_store_items (long date, unsigned *pnb_events, unsigned *pnb_apoints)
int nb_events, nb_recur_events;
int nb_apoints, nb_recur_apoints;
- pad_length = nb_events = nb_apoints = 0;
- nb_recur_events = nb_recur_apoints = 0;
-
if (day_items_ptr != 0)
day_free_list ();
nb_recur_events = day_store_recur_events (date);
@@ -406,12 +399,11 @@ day_write_pad (long date, int width, int length, int incolor)
{
struct day_item *p;
struct apoint a;
- int line, item_number, max_pos, recur;
+ int line, item_number, recur;
const int x_pos = 0;
unsigned draw_line = 0;
line = item_number = 0;
- max_pos = length;
for (p = day_items_ptr; p != 0; p = p->next)
{
diff --git a/src/help.c b/src/help.c
index fdc2c66..2b341fe 100644
--- a/src/help.c
+++ b/src/help.c
@@ -735,7 +735,7 @@ help_screen (void)
"Calcurse home page : http://calcurse.org"));
help_wins_init (&hwin, 0, 0, (notify_bar ()) ? row - 3 : row - 2, col);
- page = oldpage = HELP_MAIN;
+ oldpage = HELP_MAIN;
need_resize = 0;
/* Display the help screen related to user input. */
diff --git a/src/mem.c b/src/mem.c
index 4d40e96..f719f36 100644
--- a/src/mem.c
+++ b/src/mem.c
@@ -82,7 +82,6 @@ stats_add_blk (size_t size, const char *pos)
o->size = (unsigned)size;
o->next = 0;
- i = &mstats.blk;
for (i = &mstats.blk; *i; i = &(*i)->next)
;
o->id = mstats.ncall;
diff --git a/src/notify.c b/src/notify.c
index eaa8224..4ae4dd5 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -63,12 +63,10 @@ static pthread_t notify_t_main;
int
notify_time_left (void)
{
- struct tm *ntime;
time_t ntimer;
int left;
ntimer = time (NULL);
- ntime = localtime (&ntimer);
left = notify_app.time - ntimer;
return left > 0 ? left : 0;
@@ -328,12 +326,12 @@ notify_main_thread (void *arg)
{
const unsigned thread_sleep = 1;
const unsigned check_app = MININSEC;
- int elapse = 0, got_app = 0;
+ int elapse = 0;
+ int got_app;
struct tm *ntime;
time_t ntimer;
elapse = 0;
- got_app = 0;
for (;;)
{
diff --git a/src/recur.c b/src/recur.c
index e9e5ac3..a4932a1 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -400,12 +400,8 @@ recur_apoint_scan (FILE *f, struct tm start, struct tm end, char type,
int freq, struct tm until, char *note, struct days **exc,
char state)
{
- struct tm *lt;
char buf[BUFSIZ], *nl;
- time_t tstart, tend, t, tuntil;
-
- t = time (NULL);
- lt = localtime (&t);
+ time_t tstart, tend, tuntil;
/* Read the appointment description */
(void)fgets (buf, sizeof buf, f);
@@ -908,7 +904,6 @@ recur_repeat_item (struct conf *conf)
int item_nb;
struct day_item *p;
struct recur_apoint *ra;
- struct recur_event *re;
long until, date;
item_nb = apoint_hilt ();
@@ -916,7 +911,7 @@ recur_repeat_item (struct conf *conf)
if (p->type != APPT && p->type != EVNT)
{
status_mesg (wrong_type_1, wrong_type_2);
- ch = wgetch (win[STA].p);
+ (void)wgetch (win[STA].p);
return;
}
@@ -934,7 +929,6 @@ recur_repeat_item (struct conf *conf)
else
{
type = recur_char2def (ch);
- ch = 0;
}
while (freq == 0)
@@ -1005,8 +999,8 @@ recur_repeat_item (struct conf *conf)
date = calendar_get_slctd_day_sec ();
if (p->type == EVNT)
{
- re = recur_event_new (p->mesg, p->note, p->start, p->evnt_id,
- type, freq, until, NULL);
+ (void)recur_event_new (p->mesg, p->note, p->start, p->evnt_id,
+ type, freq, until, NULL);
}
else if (p->type == APPT)
{
diff --git a/src/todo.c b/src/todo.c
index 8b03fce..8d7a4d5 100644
--- a/src/todo.c
+++ b/src/todo.c
@@ -198,10 +198,9 @@ static void
todo_delete_note_bynum (unsigned num)
{
unsigned n;
- struct todo *i, **iptr;
+ struct todo *i;
n = 0;
- iptr = &todolist;
for (i = todolist; i != 0; i = i->next)
{
if (n == num)
@@ -211,7 +210,6 @@ todo_delete_note_bynum (unsigned num)
erase_note (&i->note, ERASE_FORCE_ONLY_NOTE);
return;
}
- iptr = &i->next;
n++;
}
/* NOTREACHED */