emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Change a while loop into do while


From: Chris Gregory
Subject: Change a while loop into do while
Date: Mon, 26 Dec 2016 22:55:54 -0600

This patch changes string_from_display_spec (a static function in
xdisp.c) to use a do while loop instead of a while loop.  The
precondition is checked by the if statement and is redundant in the
first iteration.  This redundancy is now removed.

diff --git a/src/xdisp.c b/src/xdisp.c
index 5de5eca..ac7a1f3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1252,12 +1252,13 @@ string_from_display_spec (Lisp_Object spec)
 {
   if (CONSP (spec))
     {
-      while (CONSP (spec))
+      do
        {
          if (STRINGP (XCAR (spec)))
            return XCAR (spec);
          spec = XCDR (spec);
        }
+      while (CONSP (spec));
     }
   else if (VECTORP (spec))
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]