Module Name: src Committed By: christos Date: Thu Feb 25 13:41:58 UTC 2021
Modified Files: src/tools/compat: Makefile compat_defs.h configure configure.ac nbtool_config.h.in Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/tools/compat/Makefile cvs rdiff -u -r1.117 -r1.118 src/tools/compat/compat_defs.h cvs rdiff -u -r1.98 -r1.99 src/tools/compat/configure \ src/tools/compat/configure.ac cvs rdiff -u -r1.52 -r1.53 src/tools/compat/nbtool_config.h.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tools/compat/Makefile diff -u src/tools/compat/Makefile:1.88 src/tools/compat/Makefile:1.89 --- src/tools/compat/Makefile:1.88 Sat Jun 13 06:49:17 2020 +++ src/tools/compat/Makefile Thu Feb 25 08:41:58 2021 @@ -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 @@ SRCS= atoll.c basename.c cdbr.c cdbw.c 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 \ Index: src/tools/compat/compat_defs.h diff -u src/tools/compat/compat_defs.h:1.117 src/tools/compat/compat_defs.h:1.118 --- src/tools/compat/compat_defs.h:1.117 Tue Feb 23 11:03:00 2021 +++ src/tools/compat/compat_defs.h Thu Feb 25 08:41:58 2021 @@ -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 raise_default_signal(int); 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 Index: src/tools/compat/configure diff -u src/tools/compat/configure:1.98 src/tools/compat/configure:1.99 --- src/tools/compat/configure:1.98 Wed Jun 24 10:44:44 2020 +++ src/tools/compat/configure Thu Feb 25 08:41:58 2021 @@ -4832,6 +4832,19 @@ fi 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 @@ for ac_func in atoll asprintf asnprintf 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 \ Index: src/tools/compat/configure.ac diff -u src/tools/compat/configure.ac:1.98 src/tools/compat/configure.ac:1.99 --- src/tools/compat/configure.ac:1.98 Wed Jun 24 10:39:01 2020 +++ src/tools/compat/configure.ac Thu Feb 25 08:41:58 2021 @@ -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 @@ AC_CHECK_DECLS([asprintf, asnprintf, vas #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 @@ AC_CHECK_FUNCS(atoll asprintf asnprintf 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 \ Index: src/tools/compat/nbtool_config.h.in diff -u src/tools/compat/nbtool_config.h.in:1.52 src/tools/compat/nbtool_config.h.in:1.53 --- src/tools/compat/nbtool_config.h.in:1.52 Sat Jun 22 09:42:53 2019 +++ src/tools/compat/nbtool_config.h.in Thu Feb 25 08:41:58 2021 @@ -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