all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Change a while loop into do while
@ 2016-12-27  4:55 Chris Gregory
  2016-12-31 11:20 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Gregory @ 2016-12-27  4:55 UTC (permalink / raw)
  To: emacs-devel

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))
     {



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-12-31 20:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-27  4:55 Change a while loop into do while Chris Gregory
2016-12-31 11:20 ` Eli Zaretskii
2016-12-31 17:20   ` Paul Eggert
2016-12-31 18:00     ` Eli Zaretskii
2016-12-31 18:51       ` Paul Eggert
2016-12-31 19:18         ` Eli Zaretskii
2016-12-31 20:56           ` Paul Eggert
2016-12-31 20:59             ` Eli Zaretskii
2016-12-31 18:12     ` Eli Zaretskii
2016-12-31 18:31       ` Eli Zaretskii
2016-12-31 18:47         ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.