summaryrefslogtreecommitdiff
path: root/lib/libcurses/nc_alloc.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2023-10-17 09:52:12 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2023-10-17 09:52:12 +0000
commit4dd5152bda3754d6c8238063f70a240feb2e0e01 (patch)
tree6761e0e8227c4b726ec8793dfd89d53fcf7c2e8a /lib/libcurses/nc_alloc.h
parent19c1736b607cf07af1e272ef5638ff0d90b4faff (diff)
Update ncurses and associated libraries (form, panel, menu) to
6.4-20230826 (from 5.7-20081102). Based on result from Thomas Dickey's ncu2openbsd script and then modified. Switches to the upstream tput. Major bump for the ncurses libraries and for libedit and libreadline. Help from tb, millert. ok deraadt sthen
Diffstat (limited to 'lib/libcurses/nc_alloc.h')
-rw-r--r--lib/libcurses/nc_alloc.h51
1 files changed, 36 insertions, 15 deletions
diff --git a/lib/libcurses/nc_alloc.h b/lib/libcurses/nc_alloc.h
index 93a12b3cdf6..77fade59ec8 100644
--- a/lib/libcurses/nc_alloc.h
+++ b/lib/libcurses/nc_alloc.h
@@ -1,7 +1,8 @@
-/* $OpenBSD: nc_alloc.h,v 1.7 2010/01/12 23:21:59 nicm Exp $ */
+/* $OpenBSD: nc_alloc.h,v 1.8 2023/10/17 09:52:08 nicm Exp $ */
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright 2019-2020,2021 Thomas E. Dickey *
+ * Copyright 1998-2013,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 *
@@ -31,16 +32,20 @@
/****************************************************************************
* Author: Thomas E. Dickey 1996-on *
****************************************************************************/
-/* $Id: nc_alloc.h,v 1.7 2010/01/12 23:21:59 nicm Exp $ */
+/* $Id: nc_alloc.h,v 1.8 2023/10/17 09:52:08 nicm Exp $ */
#ifndef NC_ALLOC_included
#define NC_ALLOC_included 1
+/* *INDENT-OFF* */
+
+#include <ncurses_cfg.h>
+#include <curses.h>
#ifdef __cplusplus
extern "C" {
#endif
-#if HAVE_LIBDMALLOC
+#if defined(HAVE_LIBDMALLOC) && HAVE_LIBDMALLOC
#include <string.h>
#undef strndup /* workaround for #define in GLIBC 2.7 */
#include <dmalloc.h> /* Gray Watson's library */
@@ -49,14 +54,14 @@ extern "C" {
#define HAVE_LIBDMALLOC 0
#endif
-#if HAVE_LIBDBMALLOC
+#if defined(HAVE_LIBDBMALLOC) && HAVE_LIBDBMALLOC
#include <dbmalloc.h> /* Conor Cahill's library */
#else
#undef HAVE_LIBDBMALLOC
#define HAVE_LIBDBMALLOC 0
#endif
-#if HAVE_LIBMPATROL
+#if defined(HAVE_LIBMPATROL) && HAVE_LIBMPATROL
#include <mpatrol.h> /* Memory-Patrol library */
#else
#undef HAVE_LIBMPATROL
@@ -70,15 +75,28 @@ extern "C" {
#if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS
#define HAVE_NC_FREEALL 1
struct termtype;
-extern NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_NORETURN;
-extern NCURSES_EXPORT(void) _nc_free_tinfo(int) GCC_NORETURN;
-extern NCURSES_EXPORT(void) _nc_free_tic(int) GCC_NORETURN;
-extern NCURSES_EXPORT(void) _nc_free_tparm(void);
-extern NCURSES_EXPORT(void) _nc_leaks_dump_entry(void);
+extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_tinfo(int) GCC_DEPRECATED("use exit_terminfo");
+
+#ifdef NCURSES_INTERNALS
+extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_tic(int);
+extern void _nc_leaks_dump_entry(void);
extern NCURSES_EXPORT(void) _nc_leaks_tic(void);
-#define ExitProgram(code) _nc_free_and_exit(code)
+
+#if NCURSES_SP_FUNCS
+extern GCC_NORETURN NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_free_and_exit)(SCREEN*, int);
+#endif
+extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int);
+
+#else /* !NCURSES_INTERNALS */
+extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_DEPRECATED("use exit_curses");
#endif
+#define ExitProgram(code) exit_curses(code)
+
+#else
+extern GCC_NORETURN NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_DEPRECATED("use exit_curses");
+#endif /* NO_LEAKS, etc */
+
#ifndef HAVE_NC_FREEALL
#define HAVE_NC_FREEALL 0
#endif
@@ -90,6 +108,7 @@ extern NCURSES_EXPORT(void) _nc_leaks_tic(void);
/* doalloc.c */
extern NCURSES_EXPORT(void *) _nc_doalloc(void *, size_t);
#if !HAVE_STRDUP
+#undef strdup
#define strdup _nc_strdup
extern NCURSES_EXPORT(char *) _nc_strdup(const char *);
#endif
@@ -97,12 +116,14 @@ extern NCURSES_EXPORT(char *) _nc_strdup(const char *);
/* entries.c */
extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void);
-#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type))
-#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type))
-#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type))
+#define typeMalloc(type,elts) (type *)malloc((size_t)(elts)*sizeof(type))
+#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type))
+#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type))
#ifdef __cplusplus
}
#endif
+/* *INDENT-ON* */
+
#endif /* NC_ALLOC_included */