summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-04-11 17:01:47 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-04-12 12:02:39 +0200
commit57b62a1e49c21143fe977bbefc0a0090791d996d (patch)
treea2229127da8dc1367c33501f0b2d5bbda7a9043f
parent3a4431e5687cc45e2f3a774c8ea782aaef47efdd (diff)
downloadcalcurse-57b62a1e49c21143fe977bbefc0a0090791d996d.zip
Use do-while loops when reading start time and duration in apoint_add().
Using do-while loops seems more appropriate here as "item_time" hasn't even been read when either of the loops are entered. Spotted by clang-analyzer. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--src/apoint.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/apoint.c b/src/apoint.c
index b349e84..bb8f00f 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -182,7 +182,7 @@ apoint_add (void)
int is_appointment = 1;
/* Get the starting time */
- while (check_time (item_time) != 1)
+ do
{
status_mesg (mesg_1, "");
if (getstring (win[STA].p, item_time, LTIME, 0, 1) != GETSTRING_ESC)
@@ -203,6 +203,8 @@ apoint_add (void)
else
return;
}
+ while (check_time (item_time) != 1);
+
/*
* Check if an event or appointment is entered,
* depending on the starting time, and record the
@@ -211,7 +213,7 @@ apoint_add (void)
if (is_appointment)
{ /* Get the appointment duration */
item_time[0] = '\0';
- while (check_time (item_time) == 0)
+ do
{
status_mesg (mesg_2, "");
if (getstring (win[STA].p, item_time, LTIME, 0, 1) != GETSTRING_VALID)
@@ -241,6 +243,7 @@ apoint_add (void)
}
}
}
+ while (check_time (item_time) == 0);
}
else /* Insert the event Id */
Id = 1;