From 57b62a1e49c21143fe977bbefc0a0090791d996d Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <calcurse@cryptocrack.de>
Date: Mon, 11 Apr 2011 17:01:47 +0200
Subject: 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>
---
 src/apoint.c | 7 +++++--
 1 file 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;
-- 
cgit v1.2.3-70-g09d2