+2017-10-09  Tom Tromey  <tom@tromey.com>
+
+       * tui/tui-win.c (tui_set_win_height, parse_scrolling_args): Use
+       std::string.
+       * tui/tui-layout.c (enum tui_status): Use std::string.
+
 2017-10-11  Tom Tromey  <tom@tromey.com>
 
        * gdbthread.h (thread_command): Constify.
 
   if (layout_name != (char *) NULL)
     {
       int i;
-      char *buf_ptr;
       enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
       enum tui_layout_type cur_layout = tui_current_layout ();
-      struct cleanup *old_chain;
 
-      buf_ptr = (char *) xstrdup (layout_name);
-      for (i = 0; (i < strlen (layout_name)); i++)
-       buf_ptr[i] = toupper (buf_ptr[i]);
-      old_chain = make_cleanup (xfree, buf_ptr);
+      std::string copy = layout_name;
+      for (i = 0; i < copy.size (); i++)
+       copy[i] = toupper (copy[i]);
+      const char *buf_ptr = copy.c_str ();
 
       /* First check for ambiguous input.  */
       if (strlen (buf_ptr) <= 1 && *buf_ptr == 'S')
              tui_set_layout (new_layout);
            }
        }
-      do_cleanups (old_chain);
     }
   else
     status = TUI_FAILURE;
 
   tui_enable ();
   if (arg != (char *) NULL)
     {
-      char *buf = xstrdup (arg);
+      std::string copy = arg;
+      char *buf = ©[0];
       char *buf_ptr = buf;
       char *wname = NULL;
       int new_height, i;
       struct tui_win_info *win_info;
-      struct cleanup *old_chain;
 
-      old_chain = make_cleanup (xfree, buf);
       wname = buf_ptr;
       buf_ptr = strchr (buf_ptr, ' ');
       if (buf_ptr != (char *) NULL)
        }
       else
        printf_filtered (WIN_HEIGHT_USAGE);
-
-      do_cleanups (old_chain);
     }
   else
     printf_filtered (WIN_HEIGHT_USAGE);
      window name arg.  */
   if (arg != (char *) NULL)
     {
-      char *buf, *buf_ptr;
-      struct cleanup *old_chain;
+      char *buf_ptr;
 
       /* Process the number of lines to scroll.  */
-      buf = buf_ptr = xstrdup (arg);
-      old_chain = make_cleanup (xfree, buf);
+      std::string copy = arg;
+      buf_ptr = ©[0];
       if (isdigit (*buf_ptr))
        {
          char *num_str;
          else if (*win_to_scroll == TUI_CMD_WIN)
            *win_to_scroll = (tui_source_windows ())->list[0];
        }
-      do_cleanups (old_chain);
     }
 }