Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/compat Add reallocarray; this is used by the new regex...



details:   https://anonhg.NetBSD.org/src/rev/77c3576200d3
branches:  trunk
changeset: 953071:77c3576200d3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 25 13:41:58 2021 +0000

description:
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.

diffstat:

 tools/compat/Makefile           |   5 +++--
 tools/compat/compat_defs.h      |   6 +++++-
 tools/compat/configure          |  15 ++++++++++++++-
 tools/compat/configure.ac       |   9 +++++----
 tools/compat/nbtool_config.h.in |   9 ++++++++-
 5 files changed, 35 insertions(+), 9 deletions(-)

diffs (133 lines):

diff -r bb18579bb5ce -r 77c3576200d3 tools/compat/Makefile
--- a/tools/compat/Makefile     Thu Feb 25 07:58:39 2021 +0000
+++ b/tools/compat/Makefile     Thu Feb 25 13:41:58 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.88 2020/06/13 10:49:17 lukem Exp $
+#      $NetBSD: Makefile,v 1.89 2021/02/25 13:41:58 christos Exp $
 
 HOSTLIB=       nbcompat
 
@@ -13,7 +13,8 @@
                mi_vector_hash.c mkdtemp.c \
                mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
                pw_scan.c \
-               raise_default_signal.c rb.c reallocarr.c rmd160.c rmd160hl.c \
+               raise_default_signal.c rb.c reallocarr.c reallocarray.c \
+               rmd160.c rmd160hl.c \
                regcomp.c regerror.c regexec.c regfree.c \
                setenv.c setgroupent.c \
                setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
diff -r bb18579bb5ce -r 77c3576200d3 tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h        Thu Feb 25 07:58:39 2021 +0000
+++ b/tools/compat/compat_defs.h        Thu Feb 25 13:41:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_defs.h,v 1.117 2021/02/23 16:03:00 rin Exp $    */
+/*     $NetBSD: compat_defs.h,v 1.118 2021/02/25 13:41:58 christos Exp $       */
 
 #ifndef        __NETBSD_COMPAT_DEFS_H__
 #define        __NETBSD_COMPAT_DEFS_H__
@@ -556,6 +556,10 @@
 int reallocarr(void *, size_t, size_t);
 #endif
 
+#if !HAVE_DECL_REALLOCARRAY
+void *reallocarray(void *, size_t, size_t);
+#endif
+
 #if !HAVE_DECL_SETENV
 int setenv(const char *, const char *, int);
 #endif
diff -r bb18579bb5ce -r 77c3576200d3 tools/compat/configure
--- a/tools/compat/configure    Thu Feb 25 07:58:39 2021 +0000
+++ b/tools/compat/configure    Thu Feb 25 13:41:58 2021 +0000
@@ -4832,6 +4832,19 @@
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_REALLOCARR $ac_have_decl
 _ACEOF
+ac_fn_c_check_decl "$LINENO" "reallocarray" "ac_cv_have_decl_reallocarray" "
+#include <stdlib.h>
+
+"
+if test "x$ac_cv_have_decl_reallocarray" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_REALLOCARRAY $ac_have_decl
+_ACEOF
 ac_fn_c_check_decl "$LINENO" "getsubopt" "ac_cv_have_decl_getsubopt" "
 #include <stdlib.h>
 
@@ -5285,7 +5298,7 @@
        getopt getopt_long group_from_gid gid_from_group \
        heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
        mkdtemp poll pread putc_unlocked pwcache_userdb pwcache_groupdb \
-       pwrite raise_default_signal random reallocarr setenv \
+       pwrite raise_default_signal random reallocarr reallocarray setenv \
        setgroupent setprogname setpassent \
        snprintb_m snprintf strlcat strlcpy strmode \
        strcasecmp strncasecmp strndup strnlen strsep strsuftoll strtoi \
diff -r bb18579bb5ce -r 77c3576200d3 tools/compat/configure.ac
--- a/tools/compat/configure.ac Thu Feb 25 07:58:39 2021 +0000
+++ b/tools/compat/configure.ac Thu Feb 25 13:41:58 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: configure.ac,v 1.98 2020/06/24 14:39:01 uwe Exp $
+#      $NetBSD: configure.ac,v 1.99 2021/02/25 13:41:58 christos Exp $
 #
 # Autoconf definition file for libnbcompat.
 #
@@ -179,8 +179,9 @@
 #include <stdio.h>
 ])
 
-AC_CHECK_DECLS([atoll, heapsort, mkdtemp, mkstemp, reallocarr, getsubopt,
-       setenv, strtoi, strtoll, strtou, setprogname, getprogname],,, [
+AC_CHECK_DECLS([atoll, heapsort, mkdtemp, mkstemp, reallocarr, reallocarray,
+       getsubopt, setenv, strtoi, strtoll, strtou, setprogname,
+       getprogname],,, [
 #include <stdlib.h>
 ])
 
@@ -223,7 +224,7 @@
        getopt getopt_long group_from_gid gid_from_group \
        heapsort isblank issetugid lchflags lchmod lchown lutimes mkstemp \
        mkdtemp poll pread putc_unlocked pwcache_userdb pwcache_groupdb \
-       pwrite raise_default_signal random reallocarr setenv \
+       pwrite raise_default_signal random reallocarr reallocarray setenv \
        setgroupent setprogname setpassent \
        snprintb_m snprintf strlcat strlcpy strmode \
        strcasecmp strncasecmp strndup strnlen strsep strsuftoll strtoi \
diff -r bb18579bb5ce -r 77c3576200d3 tools/compat/nbtool_config.h.in
--- a/tools/compat/nbtool_config.h.in   Thu Feb 25 07:58:39 2021 +0000
+++ b/tools/compat/nbtool_config.h.in   Thu Feb 25 13:41:58 2021 +0000
@@ -1,6 +1,6 @@
 /* nbtool_config.h.in.  Generated from configure.ac by autoheader.  */
 
-/*      $NetBSD: nbtool_config.h.in,v 1.52 2019/06/22 13:42:53 hannken Exp $    */
+/*      $NetBSD: nbtool_config.h.in,v 1.53 2021/02/25 13:41:58 christos Exp $    */
  
 #ifndef __NETBSD_NBTOOL_CONFIG_H__
 #define __NETBSD_NBTOOL_CONFIG_H__
@@ -294,6 +294,10 @@
    don't. */
 #undef HAVE_DECL_REALLOCARR
 
+/* Define to 1 if you have the declaration of `reallocarray', and to 0 if you
+   don't. */
+#undef HAVE_DECL_REALLOCARRAY
+
 /* Define to 1 if you have the declaration of `setenv', and to 0 if you don't.
    */
 #undef HAVE_DECL_SETENV
@@ -604,6 +608,9 @@
 /* Define to 1 if you have the `reallocarr' function. */
 #undef HAVE_REALLOCARR
 
+/* Define to 1 if you have the `reallocarray' function. */
+#undef HAVE_REALLOCARRAY
+
 /* Define to 1 if you have the <resolv.h> header file. */
 #undef HAVE_RESOLV_H
 



Home | Main Index | Thread Index | Old Index