]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/curses.priv.h
ncurses 6.1 - patch 20180616
[ncurses.git] / ncurses / curses.priv.h
index 46430e8acd109109adeb4ee8a71de25b76f526f8..9f309c862cbdb8d02e619dec100a3bdcaf16d8a1 100644 (file)
@@ -34,7 +34,7 @@
  ****************************************************************************/
 
 /*
- * $Id: curses.priv.h,v 1.599 2018/04/07 21:47:46 tom Exp $
+ * $Id: curses.priv.h,v 1.601 2018/05/20 19:21:56 tom Exp $
  *
  *     curses.priv.h
  *
@@ -1658,7 +1658,7 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
 /* FreeAndNull() is not a comma-separated expression because some compilers
  * do not accept a mixture of void with values.
  */
-#define FreeAndNull(p)   free(p); p = 0
+#define FreeAndNull(p)   do { free(p); p = 0; } while (0)
 
 #include <nc_alloc.h>
 
@@ -1667,14 +1667,18 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
  * tries to limp along after a failure.
  */
 #define TYPE_MALLOC(type, size, name) \
-       name = typeMalloc(type, size); \
-       if (name == 0) \
-           _nc_err_abort(MSG_NO_MEMORY)
+       do { \
+           name = typeMalloc(type, size); \
+           if (name == 0) \
+               _nc_err_abort(MSG_NO_MEMORY); \
+       } while (0)
 
 #define TYPE_REALLOC(type, size, name) \
-       name = typeRealloc(type, size, name); \
-       if (name == 0) \
-           _nc_err_abort(MSG_NO_MEMORY)
+       do { \
+           name = typeRealloc(type, size, name); \
+           if (name == 0) \
+               _nc_err_abort(MSG_NO_MEMORY); \
+       } while (0)
 
 /*
  * TTY bit definition for converting tabs to spaces.
@@ -1747,7 +1751,7 @@ extern NCURSES_EXPORT(void)       _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE
 typedef void VoidFunc(void);
 
 #define TR_FUNC(value)          ((const char*) (value))
-#define NonNull(s)             ((s) != 0 ? s : "<null>")
+#define NonNull(s)              ((s) != 0 ? s : "<null>")
 
 #define returnAttr(code)       TRACE_RETURN(code,attr_t)
 #define returnBits(code)       TRACE_RETURN(code,unsigned)
@@ -2209,11 +2213,9 @@ extern NCURSES_EXPORT(const TERMTYPE2 *) _nc_fallback2 (const char *);
 #if NCURSES_EXT_NUMBERS
 extern NCURSES_EXPORT(void) _nc_copy_termtype2 (TERMTYPE2 *, const TERMTYPE2 *);
 extern NCURSES_EXPORT(void) _nc_export_termtype2(TERMTYPE *, const TERMTYPE2 *);
-extern NCURSES_EXPORT(void) _nc_import_termtype2(TERMTYPE2 *, const TERMTYPE *);
 #else
 #define _nc_copy_termtype2(dst,src) _nc_copy_termtype((dst),(src))
 #define _nc_export_termtype2(dst,src) /* nothing */
-#define _nc_import_termtype2(dst,src) /* nothing */
 #define _nc_free_termtype2(t) _nc_free_termtype(t)
 /* also... */
 #define _nc_read_entry2 _nc_read_entry