ncurses 6.0 - patch 20171118
[ncurses.git] / ncurses / tinfo / lib_data.c
index 06b6f88077e4ff93bcec556aebc6a7f8e448cf9e..3d9c20d285b3981ec0f80d071d1dbeae05845c00 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2013 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            *
@@ -42,7 +42,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_data.c,v 1.66 2013/08/24 17:28:24 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.75 2017/08/04 08:59:48 tom Exp $")
 
 /*
  * OS/2's native linker complains if we don't initialize public data when
@@ -94,7 +94,9 @@ _nc_screen(void)
 NCURSES_EXPORT(int)
 _nc_alloc_screen(void)
 {
-    return ((my_screen = _nc_alloc_screen_sp()) != 0);
+    my_screen = _nc_alloc_screen_sp();
+    T(("_nc_alloc_screen_sp %p", my_screen));
+    return (my_screen != 0);
 }
 
 NCURSES_EXPORT(void)
@@ -168,10 +170,11 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
 #endif
 
 #ifdef TRACE
-    FALSE,                     /* init_trace */
+    FALSE,                     /* trace_opened */
     CHARS_0s,                  /* trace_fname */
     0,                         /* trace_level */
     NULL,                      /* trace_fp */
+    -1,                                /* trace_fd */
 
     NULL,                      /* tracearg_buf */
     0,                         /* tracearg_used */
@@ -194,8 +197,14 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
     0,                         /* nested_tracef */
 #endif
 #endif /* TRACE */
+#if NO_LEAKS
+    FALSE,                     /* leak_checking */
+#endif
 #ifdef USE_PTHREADS
     PTHREAD_MUTEX_INITIALIZER, /* mutex_curses */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_prescreen */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_screen */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_update */
     PTHREAD_MUTEX_INITIALIZER, /* mutex_tst_tracef */
     PTHREAD_MUTEX_INITIALIZER, /* mutex_tracef */
     0,                         /* nested_tracef */
@@ -204,6 +213,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
 #if USE_PTHREADS_EINTR
     0,                         /* read_thread */
 #endif
+#if USE_WIDEC_SUPPORT
+    CHARS_0s,                  /* key_name */
+#endif
 };
 
 #define STACK_FRAME_0  { { 0 }, 0 }
@@ -214,6 +226,7 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
 #define RIPOFF_0s      { RIPOFF_0 }
 
 NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
+    NULL,                      /* allocated */
     TRUE,                      /* use_env */
     FALSE,                     /* filter_mode */
     A_NORMAL,                  /* previous_attr */
@@ -287,6 +300,9 @@ init_global_mutexes(void)
     if (!initialized) {
        initialized = TRUE;
        _nc_mutex_init(&_nc_globals.mutex_curses);
+       _nc_mutex_init(&_nc_globals.mutex_prescreen);
+       _nc_mutex_init(&_nc_globals.mutex_screen);
+       _nc_mutex_init(&_nc_globals.mutex_update);
        _nc_mutex_init(&_nc_globals.mutex_tst_tracef);
        _nc_mutex_init(&_nc_globals.mutex_tracef);
     }
@@ -371,7 +387,7 @@ _nc_sigprocmask(int how, const sigset_t * newmask, sigset_t * oldmask)
     if ((pthread_sigmask))
        return pthread_sigmask(how, newmask, oldmask);
     else
-       return sigprocmask(how, newmask, oldmask);
+       return (sigprocmask) (how, newmask, oldmask);
 }
 #endif
 #endif /* USE_PTHREADS */