(Fdelete_terminal): Clean up the `force' path.
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 11 Feb 2008 03:51:39 +0000 (03:51 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 11 Feb 2008 03:51:39 +0000 (03:51 +0000)
src/ChangeLog
src/terminal.c

index 782b2de..eec8239 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * terminal.c (Fdelete_terminal): Clean up the `force' path.
+
 2008-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * frame.c (Qnoelisp): New symbol.
index 2e0bcbb..bbc2fd7 100644 (file)
@@ -305,19 +305,20 @@ but if the second argument FORCE is non-nil, you may do so. */)
   (terminal, force)
      Lisp_Object terminal, force;
 {
-  struct terminal *t, *p;
-
-  t = get_terminal (terminal, 0);
+  struct terminal *t = get_terminal (terminal, 0);
 
   if (!t)
     return Qnil;
 
-  p = terminal_list;
-  while (p && (p == t || !TERMINAL_ACTIVE_P (p)))
-    p = p->next_terminal;
-  
-  if (NILP (force) && !p)
-    error ("Attempt to delete the sole active display terminal");
+  if (NILP (force))
+    {
+      struct terminal *p = terminal_list;
+      while (p && (p == t || !TERMINAL_ACTIVE_P (p)))
+       p = p->next_terminal;
+      
+      if (!p)
+       error ("Attempt to delete the sole active display terminal");
+    }
 
   if (t->delete_terminal_hook)
     (*t->delete_terminal_hook) (t);