From: Ondřej Surý Date: Tue, 21 Aug 2018 13:10:32 +0000 (+0200) Subject: memmove, strtoul, and strcasestr functions are part of ISO C90, remove the compatibil... X-Git-Tag: v9.13.3~30^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efd613e87443f0f0f906eab0a99e24732923a657;p=thirdparty%2Fbind9.git memmove, strtoul, and strcasestr functions are part of ISO C90, remove the compatibility shim --- diff --git a/bin/dig/host.c b/bin/dig/host.c index c134cbe079c..ce2442d94a4 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 45dc753c1c8..39ccb4e57d2 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index 009b1275850..4f09c0f9b62 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/tests/optional/serial_test.c b/bin/tests/optional/serial_test.c index 3ecb147c8b1..cf3443db91d 100644 --- a/bin/tests/optional/serial_test.c +++ b/bin/tests/optional/serial_test.c @@ -12,11 +12,11 @@ #include #include +#include #include #include #include -#include int main() { diff --git a/configure.in b/configure.in index 21f80c2120d..821b6589d7a 100644 --- a/configure.in +++ b/configure.in @@ -2014,20 +2014,6 @@ AC_SUBST(ISC_PLATFORM_HAVETFO) # # Check for some other useful functions that are not ever-present. # - -AC_CHECK_FUNC(memmove, - [ISC_PLATFORM_NEEDMEMMOVE="#undef ISC_PLATFORM_NEEDMEMMOVE"], - [ISC_PLATFORM_NEEDMEMMOVE="#define ISC_PLATFORM_NEEDMEMMOVE 1"]) -AC_SUBST(ISC_PLATFORM_NEEDMEMMOVE) - -AC_CHECK_FUNC(strtoul, - [ISC_PLATFORM_NEEDSTRTOUL="#undef ISC_PLATFORM_NEEDSTRTOUL" - GENRANDOMLIB=""], - [ISC_PLATFORM_NEEDSTRTOUL="#define ISC_PLATFORM_NEEDSTRTOUL 1" - GENRANDOMLIB='${ISCLIBS}']) -AC_SUBST(ISC_PLATFORM_NEEDSTRTOUL) -AC_SUBST(GENRANDOMLIB) - AC_CHECK_FUNC(strlcpy, [ISC_PLATFORM_NEEDSTRLCPY="#undef ISC_PLATFORM_NEEDSTRLCPY"], [ISC_PLATFORM_NEEDSTRLCPY="#define ISC_PLATFORM_NEEDSTRLCPY 1"]) @@ -2038,11 +2024,6 @@ AC_CHECK_FUNC(strlcat, [ISC_PLATFORM_NEEDSTRLCAT="#define ISC_PLATFORM_NEEDSTRLCAT 1"]) AC_SUBST(ISC_PLATFORM_NEEDSTRLCAT) -AC_CHECK_FUNC(strcasestr, - [ISC_PLATFORM_NEEDSTRCASESTR="#undef ISC_PLATFORM_NEEDSTRCASESTR"], - [ISC_PLATFORM_NEEDSTRCASESTR="#define ISC_PLATFORM_NEEDSTRCASESTR 1"]) -AC_SUBST(ISC_PLATFORM_NEEDSTRCASESTR) - AC_SUBST(READLINE_LIB) AC_ARG_WITH(readline, AS_HELP_STRING([--with-readline[=LIBSPEC]], diff --git a/lib/dns/dnsrps.c b/lib/dns/dnsrps.c index 71dc878cd00..a85e48ca693 100644 --- a/lib/dns/dnsrps.c +++ b/lib/dns/dnsrps.c @@ -19,7 +19,6 @@ #ifdef USE_DNSRPS #include -#include #include #include diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 47e2ef57171..914ac47864c 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 206528f23b9..c3175553d46 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 2010ca0a8b0..f5348b2f7b2 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 098467b4902..a9bfe1f8829 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -57,7 +57,7 @@ OBJS = pk11.@O@ pk11_result.@O@ \ ratelimiter.@O@ refcount.@O@ region.@O@ regex.@O@ result.@O@ \ rwlock.@O@ \ serial.@O@ sha1.@O@ sha2.@O@ sockaddr.@O@ stats.@O@ \ - string.@O@ strtoul.@O@ symtab.@O@ task.@O@ taskpool.@O@ \ + string.@O@ symtab.@O@ task.@O@ taskpool.@O@ \ tm.@O@ timer.@O@ version.@O@ \ ${UNIXOBJS} ${NLSOBJS} ${THREADOBJS} SYMTBLOBJS = backtrace-emptytbl.@O@ @@ -74,7 +74,7 @@ SRCS = pk11.c pk11_result.c \ parseint.c portset.c quota.c radix.c random.c \ ratelimiter.c refcount.c region.c regex.c result.c rwlock.c \ serial.c sha1.c sha2.c sockaddr.c stats.c string.c \ - strtoul.c symtab.c task.c taskpool.c timer.c \ + symtab.c task.c taskpool.c timer.c \ tm.c version.c LIBS = @OPENSSL_LIBS@ @LIBS@ diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index e2d3622ccce..e30c02c55be 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -91,21 +91,6 @@ */ @ISC_PLATFORM_NEEDSTRLCAT@ -/* - * Define if this system needs strtoul. - */ -@ISC_PLATFORM_NEEDSTRTOUL@ - -/* - * Define if this system needs memmove. - */ -@ISC_PLATFORM_NEEDMEMMOVE@ - -/* - * Define if this system needs strcasestr. - */ -@ISC_PLATFORM_NEEDSTRCASESTR@ - /*** *** Miscellaneous. ***/ diff --git a/lib/isc/include/isc/stdlib.h b/lib/isc/include/isc/stdlib.h deleted file mode 100644 index c44b0ea605f..00000000000 --- a/lib/isc/include/isc/stdlib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_STDLIB_H -#define ISC_STDLIB_H 1 - -/*! \file isc/stdlib.h */ - -#include - -#include -#include - -#ifdef ISC_PLATFORM_NEEDSTRTOUL -#define strtoul isc_strtoul -#endif - -ISC_LANG_BEGINDECLS - -unsigned long isc_strtoul(const char *, char **, int); - -ISC_LANG_ENDDECLS - -#endif diff --git a/lib/isc/parseint.c b/lib/isc/parseint.c index 58593695ad6..ced6911cc15 100644 --- a/lib/isc/parseint.c +++ b/lib/isc/parseint.c @@ -18,10 +18,10 @@ #include #include #include +#include #include #include -#include isc_result_t isc_parse_uint32(uint32_t *uip, const char *string, int base) { diff --git a/lib/isc/strtoul.c b/lib/isc/strtoul.c deleted file mode 100644 index 6f9bfd6e652..00000000000 --- a/lib/isc/strtoul.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#include - -/* - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*! \file */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -#include -#include - -/*! - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -unsigned long -isc_strtoul(const char *nptr, char **endptr, int base) { - const char *s = nptr; - unsigned long acc; - unsigned char c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) { - if (!isascii(c)) - break; - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) { - acc = ULONG_MAX; - errno = ERANGE; - } else if (neg) - acc = -acc; - if (endptr != 0) - DE_CONST(any ? s - 1 : nptr, *endptr); - return (acc); -} diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index a4caca5266a..960da655231 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -38,7 +38,6 @@ #include #include #include -#include #include diff --git a/util/copyrights b/util/copyrights index d490f0c32d9..a5a915e4579 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3438,7 +3438,6 @@ ./lib/isc/include/isc/socket.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2016,2018 ./lib/isc/include/isc/stats.h C 2009,2012,2016,2018 ./lib/isc/include/isc/stdio.h C 2000,2001,2004,2005,2006,2007,2013,2016,2018 -./lib/isc/include/isc/stdlib.h C 2003,2004,2005,2006,2007,2016,2018 ./lib/isc/include/isc/string.h C 2000,2001,2003,2004,2005,2006,2007,2014,2016,2018 ./lib/isc/include/isc/symtab.h C 1996,1997,1998,1999,2000,2001,2004,2005,2006,2007,2009,2011,2012,2013,2016,2018 ./lib/isc/include/isc/task.h C 1998,1999,2000,2001,2003,2004,2005,2006,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018