]> code.delx.au - gnu-emacs/blobdiff - src/term.c
(Fset_window_margins): Allow only integers as args.
[gnu-emacs] / src / term.c
index 506fc16ffb3bbd230937fe74fb7a687c42c4a472..5c25c7419dce216dd0a27f604d5fb2ffff71d8dc 100644 (file)
@@ -2066,6 +2066,10 @@ void
 tty_setup_colors (mode)
      int mode;
 {
+  /* Canonicalize all negative values of MODE.  */
+  if (mode < -1)
+    mode = -1;
+
   switch (mode)
     {
       case -1:  /* no colors at all */
@@ -2108,7 +2112,7 @@ set_tty_color_mode (f, val)
   tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"),
                                       Qnil);
 
-  if (NATNUMP (val))
+  if (INTEGERP (val))
     color_mode = val;
   else
     {
@@ -2116,22 +2120,24 @@ set_tty_color_mode (f, val)
        color_mode_spec = Qnil;
       else
        color_mode_spec = Fassq (val, XSYMBOL (tty_color_mode_alist)->value);
-      current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist);
 
       if (CONSP (color_mode_spec))
        color_mode = XCDR (color_mode_spec);
       else
        color_mode = Qnil;
     }
+
+  current_mode_spec = assq_no_quit (Qtty_color_mode, f->param_alist);
+
   if (CONSP (current_mode_spec))
     current_mode = XCDR (current_mode_spec);
   else
     current_mode = Qnil;
-  if (NATNUMP (color_mode))
+  if (INTEGERP (color_mode))
     mode = XINT (color_mode);
   else
     mode = 0;  /* meaning default */
-  if (NATNUMP (current_mode))
+  if (INTEGERP (current_mode))
     old_mode = XINT (current_mode);
   else
     old_mode = 0;
@@ -2160,7 +2166,7 @@ term_init (terminal_type)
   char *area;
   char **address = &area;
   char *buffer = NULL;
-  const int buffer_size = 4096;
+  int buffer_size = 4096;
   register char *p;
   int status;
   struct frame *sf = XFRAME (selected_frame);
@@ -2229,14 +2235,12 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
 #endif
     }
 
-#ifdef TERMINFO
-  area = (char *) xmalloc (buffer_size);
-#else
+#ifndef TERMINFO
   if (strlen (buffer) >= buffer_size)
     abort ();
-  
-  area = (char *) xmalloc (strlen (buffer));
+  buffer_size = strlen (buffer);
 #endif
+  area = (char *) xmalloc (buffer_size);
 
   TS_ins_line = tgetstr ("al", address);
   TS_ins_multi_lines = tgetstr ("AL", address);
@@ -2598,3 +2602,5 @@ The function should accept no arguments.  */);
   defsubr (&Stty_display_color_cells);
 }
 
+/* arch-tag: 498e7449-6f2e-45e2-91dd-b7d4ca488193
+   (do not change this comment) */