]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/tinfo/lib_cur_term.c
ncurses 6.0 - patch 20170401
[ncurses.git] / ncurses / tinfo / lib_cur_term.c
index 9941d1390629fe16dd067c21a663acd39359992b..c583aa7edaf5afc14b143114637bf357c9c368e6 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 #include <curses.priv.h>
 #include <termcap.h>           /* ospeed */
 
-MODULE_ID("$Id: lib_cur_term.c,v 1.33 2014/03/08 20:32:59 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.36 2017/04/01 17:19:03 tom Exp $")
 
 #undef CUR
 #define CUR termp->type.
@@ -104,6 +104,11 @@ NCURSES_SP_NAME(set_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
        if (termp->type.Strings) {
            PC = (char) ((pad_char != NULL) ? pad_char[0] : 0);
        }
+#endif
+#if !USE_REENTRANT
+#define MY_SIZE (size_t) (NAMESIZE - 1)
+       _nc_STRNCPY(ttytype, termp->type.term_names, MY_SIZE);
+       ttytype[MY_SIZE] = '\0';
 #endif
     }
     _nc_unlock_global(curses);
@@ -154,6 +159,10 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
            TCB->drv->td_release(TCB);
 #endif
        free(termp);
+#if NO_LEAKS
+       /* discard memory used in tgetent's cache for this terminal */
+       _nc_tgetent_leak(termp);
+#endif
 
        rc = OK;
     }
@@ -164,7 +173,7 @@ NCURSES_SP_NAME(del_curterm) (NCURSES_SP_DCLx TERMINAL * termp)
 NCURSES_EXPORT(int)
 del_curterm(TERMINAL * termp)
 {
-    int rc = ERR;
+    int rc;
 
     _nc_lock_global(curses);
     rc = NCURSES_SP_NAME(del_curterm) (CURRENT_SCREEN, termp);