diff options
| author | 2020-01-20 18:49:45 +0000 | |
|---|---|---|
| committer | 2020-01-20 18:49:45 +0000 | |
| commit | 855da32c6e5a8968082ab84ee46c8b38fbde74ba (patch) | |
| tree | c99d5941e500bbf4e4bea30ebdf6977740b96daf | |
| parent | Remove various unused lib/isc bits. (diff) | |
| download | wireguard-openbsd-855da32c6e5a8968082ab84ee46c8b38fbde74ba.tar.xz wireguard-openbsd-855da32c6e5a8968082ab84ee46c8b38fbde74ba.zip | |
As millert@ points out we can replace isc_string_touint64 with
strtoull(3) and then get rid of lib/isc/string.c
OK millert
62 files changed, 107 insertions, 529 deletions
diff --git a/usr.sbin/bind/bin/dig/dig.c b/usr.sbin/bind/bin/dig/dig.c index f6f5dc16c11..5acad94bb49 100644 --- a/usr.sbin/bind/bin/dig/dig.c +++ b/usr.sbin/bind/bin/dig/dig.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.c,v 1.37 2020/01/10 16:13:08 schwarze Exp $ */ +/* $Id: dig.c,v 1.38 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ #include <sys/cdefs.h> @@ -29,7 +29,7 @@ #include <isc/parseint.h> #include <isc/platform.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/util.h> diff --git a/usr.sbin/bind/bin/dig/dighost.c b/usr.sbin/bind/bin/dig/dighost.c index 79666179a3c..b4b0d72fb8d 100644 --- a/usr.sbin/bind/bin/dig/dighost.c +++ b/usr.sbin/bind/bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.31 2020/01/20 18:41:48 florian Exp $ */ +/* $Id: dighost.c,v 1.32 2020/01/20 18:49:45 florian Exp $ */ /*! \file * \note @@ -79,7 +79,7 @@ #include <isc/safe.h> #include <isc/serial.h> #include <isc/sockaddr.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/timer.h> #include <isc/types.h> diff --git a/usr.sbin/bind/bin/dig/host.c b/usr.sbin/bind/bin/dig/host.c index a0465530b2d..364924ba300 100644 --- a/usr.sbin/bind/bin/dig/host.c +++ b/usr.sbin/bind/bin/dig/host.c @@ -29,7 +29,7 @@ #include <isc/commandline.h> #include <isc/netaddr.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <isc/task.h> diff --git a/usr.sbin/bind/bin/dig/nslookup.c b/usr.sbin/bind/bin/dig/nslookup.c index 2acabc9b670..96687107b1b 100644 --- a/usr.sbin/bind/bin/dig/nslookup.c +++ b/usr.sbin/bind/bin/dig/nslookup.c @@ -25,7 +25,7 @@ #include <isc/event.h> #include <isc/parseint.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <isc/task.h> #include <isc/netaddr.h> diff --git a/usr.sbin/bind/lib/dns/byaddr.c b/usr.sbin/bind/lib/dns/byaddr.c index 3d174318e22..a93aa7bf4c2 100644 --- a/usr.sbin/bind/lib/dns/byaddr.c +++ b/usr.sbin/bind/lib/dns/byaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: byaddr.c,v 1.10 2020/01/18 16:55:00 florian Exp $ */ +/* $Id: byaddr.c,v 1.11 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -24,7 +24,7 @@ #include <isc/mem.h> #include <isc/netaddr.h> -#include <isc/string.h> /* Required for HP/UX (and others?) */ +#include <string.h> /* Required for HP/UX (and others?) */ #include <isc/task.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/compress.c b/usr.sbin/bind/lib/dns/compress.c index 9385f89a26a..d59eb61ca82 100644 --- a/usr.sbin/bind/lib/dns/compress.c +++ b/usr.sbin/bind/lib/dns/compress.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: compress.c,v 1.5 2020/01/20 18:40:55 florian Exp $ */ +/* $Id: compress.c,v 1.6 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -23,7 +23,7 @@ #include <config.h> #include <isc/mem.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/compress.h> diff --git a/usr.sbin/bind/lib/dns/dnssec.c b/usr.sbin/bind/lib/dns/dnssec.c index 7841330b6e7..ae1bc202228 100644 --- a/usr.sbin/bind/lib/dns/dnssec.c +++ b/usr.sbin/bind/lib/dns/dnssec.c @@ -15,7 +15,7 @@ */ /* - * $Id: dnssec.c,v 1.12 2020/01/18 16:55:00 florian Exp $ + * $Id: dnssec.c,v 1.13 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -28,7 +28,7 @@ #include <isc/dir.h> #include <isc/mem.h> #include <isc/serial.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/dst_api.c b/usr.sbin/bind/lib/dns/dst_api.c index ad9a0136af6..906cc0644f3 100644 --- a/usr.sbin/bind/lib/dns/dst_api.c +++ b/usr.sbin/bind/lib/dns/dst_api.c @@ -33,7 +33,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.15 2020/01/09 18:17:14 florian Exp $ + * $Id: dst_api.c,v 1.16 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -56,7 +56,7 @@ #include <isc/refcount.h> #include <isc/safe.h> -#include <isc/string.h> +#include <string.h> #include <isc/time.h> #include <isc/util.h> #include <isc/file.h> diff --git a/usr.sbin/bind/lib/dns/dst_parse.c b/usr.sbin/bind/lib/dns/dst_parse.c index af6758ac3c7..78a85648ea3 100644 --- a/usr.sbin/bind/lib/dns/dst_parse.c +++ b/usr.sbin/bind/lib/dns/dst_parse.c @@ -33,7 +33,7 @@ /*% * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.7 2020/01/09 18:17:15 florian Exp $ + * $Id: dst_parse.c,v 1.8 2020/01/20 18:49:45 florian Exp $ */ #include <config.h> @@ -46,7 +46,7 @@ #include <isc/mem.h> #include <isc/stdtime.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/hmac_link.c b/usr.sbin/bind/lib/dns/hmac_link.c index 62d1789985e..e422e3e7224 100644 --- a/usr.sbin/bind/lib/dns/hmac_link.c +++ b/usr.sbin/bind/lib/dns/hmac_link.c @@ -33,7 +33,7 @@ /* * Principal Author: Brian Wellington - * $Id: hmac_link.c,v 1.5 2020/01/09 14:24:07 florian Exp $ + * $Id: hmac_link.c,v 1.6 2020/01/20 18:49:45 florian Exp $ */ #include <config.h> @@ -45,7 +45,7 @@ #include <isc/sha1.h> #include <isc/mem.h> #include <isc/safe.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/keydata.c b/usr.sbin/bind/lib/dns/keydata.c index 7cf9a513094..9a58b6d89c3 100644 --- a/usr.sbin/bind/lib/dns/keydata.c +++ b/usr.sbin/bind/lib/dns/keydata.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: keydata.c,v 1.3 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: keydata.c,v 1.4 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -23,7 +23,7 @@ #include <isc/buffer.h> #include <isc/mem.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/rdata.h> diff --git a/usr.sbin/bind/lib/dns/master.c b/usr.sbin/bind/lib/dns/master.c index f4eabac9686..797d9f6214d 100644 --- a/usr.sbin/bind/lib/dns/master.c +++ b/usr.sbin/bind/lib/dns/master.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.10 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: master.c,v 1.11 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -28,7 +28,7 @@ #include <isc/serial.h> #include <isc/stdio.h> #include <isc/stdtime.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/masterdump.c b/usr.sbin/bind/lib/dns/masterdump.c index a1bcff94194..7f85f7d5f2e 100644 --- a/usr.sbin/bind/lib/dns/masterdump.c +++ b/usr.sbin/bind/lib/dns/masterdump.c @@ -26,7 +26,7 @@ #include <isc/mem.h> #include <isc/stdio.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/time.h> #include <isc/types.h> diff --git a/usr.sbin/bind/lib/dns/message.c b/usr.sbin/bind/lib/dns/message.c index 94b3cc2a269..38bbc9017eb 100644 --- a/usr.sbin/bind/lib/dns/message.c +++ b/usr.sbin/bind/lib/dns/message.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: message.c,v 1.12 2020/01/18 16:55:00 florian Exp $ */ +/* $Id: message.c,v 1.13 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -28,7 +28,7 @@ #include <isc/buffer.h> #include <isc/mem.h> -#include <isc/string.h> /* Required for HP/UX (and others?) */ +#include <string.h> /* Required for HP/UX (and others?) */ #include <isc/util.h> #include <dns/dnssec.h> diff --git a/usr.sbin/bind/lib/dns/name.c b/usr.sbin/bind/lib/dns/name.c index b7a2ac16368..992a19f58bb 100644 --- a/usr.sbin/bind/lib/dns/name.c +++ b/usr.sbin/bind/lib/dns/name.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.18 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: name.c,v 1.19 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -29,7 +29,7 @@ #include <isc/once.h> -#include <isc/string.h> +#include <string.h> #include <isc/thread.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/nsec.c b/usr.sbin/bind/lib/dns/nsec.c index bfe8866f55f..2b455776d8a 100644 --- a/usr.sbin/bind/lib/dns/nsec.c +++ b/usr.sbin/bind/lib/dns/nsec.c @@ -14,14 +14,14 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec.c,v 1.4 2020/01/18 16:55:00 florian Exp $ */ +/* $Id: nsec.c,v 1.5 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ #include <config.h> #include <isc/log.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/nsec3.c b/usr.sbin/bind/lib/dns/nsec3.c index 3602fa68712..f9e9c3fb6a6 100644 --- a/usr.sbin/bind/lib/dns/nsec3.c +++ b/usr.sbin/bind/lib/dns/nsec3.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3.c,v 1.4 2020/01/18 16:55:00 florian Exp $ */ +/* $Id: nsec3.c,v 1.5 2020/01/20 18:49:45 florian Exp $ */ #include <config.h> @@ -23,7 +23,7 @@ #include <isc/hex.h> #include <isc/iterated_hash.h> #include <isc/log.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <isc/safe.h> diff --git a/usr.sbin/bind/lib/dns/openssl_link.c b/usr.sbin/bind/lib/dns/openssl_link.c index 75c25920fa4..80ceba0a23e 100644 --- a/usr.sbin/bind/lib/dns/openssl_link.c +++ b/usr.sbin/bind/lib/dns/openssl_link.c @@ -41,7 +41,7 @@ #include <isc/mem.h> #include <isc/mutex.h> #include <isc/mutexblock.h> -#include <isc/string.h> +#include <string.h> #include <isc/thread.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/opensslecdsa_link.c b/usr.sbin/bind/lib/dns/opensslecdsa_link.c index 5d4efed5db5..9ba36086dc9 100644 --- a/usr.sbin/bind/lib/dns/opensslecdsa_link.c +++ b/usr.sbin/bind/lib/dns/opensslecdsa_link.c @@ -26,7 +26,7 @@ #include <isc/mem.h> #include <isc/safe.h> #include <isc/sha2.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/keyvalues.h> diff --git a/usr.sbin/bind/lib/dns/openssleddsa_link.c b/usr.sbin/bind/lib/dns/openssleddsa_link.c index 9bde5951a1a..821741a6d44 100644 --- a/usr.sbin/bind/lib/dns/openssleddsa_link.c +++ b/usr.sbin/bind/lib/dns/openssleddsa_link.c @@ -23,7 +23,7 @@ #include <isc/mem.h> #include <isc/safe.h> #include <isc/sha2.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/keyvalues.h> diff --git a/usr.sbin/bind/lib/dns/opensslgost_link.c b/usr.sbin/bind/lib/dns/opensslgost_link.c index 27ede9d9c13..76f907ec388 100644 --- a/usr.sbin/bind/lib/dns/opensslgost_link.c +++ b/usr.sbin/bind/lib/dns/opensslgost_link.c @@ -21,7 +21,7 @@ #include <isc/mem.h> #include <isc/safe.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dst/result.h> diff --git a/usr.sbin/bind/lib/dns/opensslrsa_link.c b/usr.sbin/bind/lib/dns/opensslrsa_link.c index 72f4c468b3e..e0cbb7e96fa 100644 --- a/usr.sbin/bind/lib/dns/opensslrsa_link.c +++ b/usr.sbin/bind/lib/dns/opensslrsa_link.c @@ -34,7 +34,7 @@ #include <isc/safe.h> #include <isc/sha1.h> #include <isc/sha2.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/rcode.c b/usr.sbin/bind/lib/dns/rcode.c index 3ec41ea84ee..905ca3dcea6 100644 --- a/usr.sbin/bind/lib/dns/rcode.c +++ b/usr.sbin/bind/lib/dns/rcode.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rcode.c,v 1.9 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: rcode.c,v 1.10 2020/01/20 18:49:45 florian Exp $ */ #include <config.h> #include <ctype.h> @@ -28,7 +28,7 @@ #include <isc/result.h> #include <isc/stdio.h> -#include <isc/string.h> +#include <string.h> #include <isc/types.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/rdata.c b/usr.sbin/bind/lib/dns/rdata.c index 23ae7da5940..d8b9e61ef3a 100644 --- a/usr.sbin/bind/lib/dns/rdata.c +++ b/usr.sbin/bind/lib/dns/rdata.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.16 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: rdata.c,v 1.17 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -27,7 +27,7 @@ #include <isc/mem.h> #include <isc/parseint.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/dns/rdata/any_255/tsig_250.c b/usr.sbin/bind/lib/dns/rdata/any_255/tsig_250.c index 05f357a879f..7894f54aaad 100644 --- a/usr.sbin/bind/lib/dns/rdata/any_255/tsig_250.c +++ b/usr.sbin/bind/lib/dns/rdata/any_255/tsig_250.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tsig_250.c,v 1.9 2020/01/09 18:17:16 florian Exp $ */ +/* $Id: tsig_250.c,v 1.10 2020/01/20 18:49:45 florian Exp $ */ /* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */ @@ -57,7 +57,7 @@ fromtext_any_tsig(ARGS_FROMTEXT) { */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); - sigtime = isc_string_touint64(DNS_AS_STR(token), &e, 10); + sigtime = strtoull(DNS_AS_STR(token), &e, 10); if (*e != 0) RETTOK(DNS_R_SYNTAX); if ((sigtime >> 48) != 0) diff --git a/usr.sbin/bind/lib/dns/time.c b/usr.sbin/bind/lib/dns/time.c index ddd330b8ea5..895c72f7777 100644 --- a/usr.sbin/bind/lib/dns/time.c +++ b/usr.sbin/bind/lib/dns/time.c @@ -14,14 +14,14 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.9 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: time.c,v 1.10 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ #include <config.h> #include <stdio.h> -#include <isc/string.h> /* Required for HP/UX (and others?) */ +#include <string.h> /* Required for HP/UX (and others?) */ #include <time.h> #include <ctype.h> diff --git a/usr.sbin/bind/lib/dns/tsig.c b/usr.sbin/bind/lib/dns/tsig.c index 437368e29ee..d3673b093c6 100644 --- a/usr.sbin/bind/lib/dns/tsig.c +++ b/usr.sbin/bind/lib/dns/tsig.c @@ -15,7 +15,7 @@ */ /* - * $Id: tsig.c,v 1.14 2020/01/20 18:40:55 florian Exp $ + * $Id: tsig.c,v 1.15 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ #include <config.h> @@ -26,7 +26,7 @@ #include <isc/refcount.h> #include <isc/serial.h> -#include <isc/string.h> /* Required for HP/UX (and others?) */ +#include <string.h> /* Required for HP/UX (and others?) */ #include <isc/util.h> #include <isc/time.h> diff --git a/usr.sbin/bind/lib/dns/ttl.c b/usr.sbin/bind/lib/dns/ttl.c index baeea69be7c..9b732adcd1b 100644 --- a/usr.sbin/bind/lib/dns/ttl.c +++ b/usr.sbin/bind/lib/dns/ttl.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ttl.c,v 1.10 2020/01/09 18:17:15 florian Exp $ */ +/* $Id: ttl.c,v 1.11 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -29,7 +29,7 @@ #include <isc/parseint.h> #include <isc/region.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/result.h> diff --git a/usr.sbin/bind/lib/isc/Makefile.in b/usr.sbin/bind/lib/isc/Makefile.in index ba5622c5a59..c578a0e3020 100644 --- a/usr.sbin/bind/lib/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/Makefile.in @@ -55,7 +55,7 @@ OBJS = @ISC_EXTRA_OBJS@ @ISC_PK11_O@ @ISC_PK11_RESULT_O@ \ refcount.@O@ region.@O@ regex.@O@ result.@O@ \ rwlock.@O@ \ safe.@O@ serial.@O@ sha1.@O@ sha2.@O@ sockaddr.@O@ \ - string.@O@ symtab.@O@ task.@O@ \ + symtab.@O@ task.@O@ \ timer.@O@ version.@O@ \ ${UNIXOBJS} ${THREADOBJS} @@ -70,7 +70,7 @@ SRCS = @ISC_EXTRA_SRCS@ @ISC_PK11_C@ @ISC_PK11_RESULT_C@ \ netaddr.c netscope.c ondestroy.c \ parseint.c \ refcount.c region.c regex.c result.c rwlock.c \ - safe.c serial.c sha1.c sha2.c sockaddr.c string.c \ + safe.c serial.c sha1.c sha2.c sockaddr.c \ symtab.c task.c timer.c \ version.c diff --git a/usr.sbin/bind/lib/isc/aes.c b/usr.sbin/bind/lib/isc/aes.c index c8a0b8c0bb6..97cc0eb76e2 100644 --- a/usr.sbin/bind/lib/isc/aes.c +++ b/usr.sbin/bind/lib/isc/aes.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: aes.c,v 1.4 2020/01/09 14:18:30 florian Exp $ */ +/* $Id: aes.c,v 1.5 2020/01/20 18:49:45 florian Exp $ */ /*! \file isc/aes.c */ @@ -23,7 +23,7 @@ #include <isc/assertions.h> #include <isc/aes.h> #include <isc/platform.h> -#include <isc/string.h> +#include <string.h> #include <isc/types.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/base32.c b/usr.sbin/bind/lib/isc/base32.c index e40e3c056f7..c38b01fcf54 100644 --- a/usr.sbin/bind/lib/isc/base32.c +++ b/usr.sbin/bind/lib/isc/base32.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base32.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: base32.c,v 1.4 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -24,7 +24,7 @@ #include <isc/buffer.h> #include <isc/lex.h> #include <isc/region.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #define RETERR(x) do { \ diff --git a/usr.sbin/bind/lib/isc/base64.c b/usr.sbin/bind/lib/isc/base64.c index 6906cf2c110..5e9ef296bbf 100644 --- a/usr.sbin/bind/lib/isc/base64.c +++ b/usr.sbin/bind/lib/isc/base64.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: base64.c,v 1.6 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: base64.c,v 1.7 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -23,7 +23,7 @@ #include <isc/base64.h> #include <isc/buffer.h> #include <isc/lex.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #define RETERR(x) do { \ diff --git a/usr.sbin/bind/lib/isc/buffer.c b/usr.sbin/bind/lib/isc/buffer.c index bfbac614a60..1c3af6afa7d 100644 --- a/usr.sbin/bind/lib/isc/buffer.c +++ b/usr.sbin/bind/lib/isc/buffer.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: buffer.c,v 1.4 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: buffer.c,v 1.5 2020/01/20 18:49:45 florian Exp $ */ /*! \file */ @@ -23,7 +23,7 @@ #include <isc/buffer.h> #include <isc/mem.h> #include <isc/region.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> void diff --git a/usr.sbin/bind/lib/isc/commandline.c b/usr.sbin/bind/lib/isc/commandline.c index 36a08744f8b..c97d6afb39c 100644 --- a/usr.sbin/bind/lib/isc/commandline.c +++ b/usr.sbin/bind/lib/isc/commandline.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. */ -/* $Id: commandline.c,v 1.10 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: commandline.c,v 1.11 2020/01/20 18:49:45 florian Exp $ */ /*! \file * This file was adapted from the NetBSD project's source tree, RCS ID: @@ -65,7 +65,7 @@ #include <isc/commandline.h> #include <isc/msgs.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> /*% Index into parent argv vector. */ diff --git a/usr.sbin/bind/lib/isc/hash.c b/usr.sbin/bind/lib/isc/hash.c index 911683c5678..857fdeba84d 100644 --- a/usr.sbin/bind/lib/isc/hash.c +++ b/usr.sbin/bind/lib/isc/hash.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hash.c,v 1.8 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: hash.c,v 1.9 2020/01/20 18:49:45 florian Exp $ */ /*! \file * Some portion of this code was derived from universal hash function @@ -65,7 +65,7 @@ if advised of the possibility of such damage. #include <isc/once.h> #include <isc/refcount.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #define HASH_MAGIC ISC_MAGIC('H', 'a', 's', 'h') diff --git a/usr.sbin/bind/lib/isc/heap.c b/usr.sbin/bind/lib/isc/heap.c index 88a27ce6337..4a4ae54df5a 100644 --- a/usr.sbin/bind/lib/isc/heap.c +++ b/usr.sbin/bind/lib/isc/heap.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: heap.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: heap.c,v 1.4 2020/01/20 18:49:46 florian Exp $ */ /*! \file * Heap implementation of priority queues adapted from the following: @@ -31,7 +31,7 @@ #include <isc/heap.h> #include <isc/magic.h> #include <isc/mem.h> -#include <isc/string.h> /* Required for memmove. */ +#include <string.h> /* Required for memmove. */ #include <isc/util.h> /*@{*/ diff --git a/usr.sbin/bind/lib/isc/hex.c b/usr.sbin/bind/lib/isc/hex.c index cc5e37e64bb..2305ee5fc4b 100644 --- a/usr.sbin/bind/lib/isc/hex.c +++ b/usr.sbin/bind/lib/isc/hex.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hex.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: hex.c,v 1.4 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -25,7 +25,7 @@ #include <isc/buffer.h> #include <isc/hex.h> #include <isc/lex.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #define RETERR(x) do { \ diff --git a/usr.sbin/bind/lib/isc/hmacsha.c b/usr.sbin/bind/lib/isc/hmacsha.c index 3644e889579..8991965beff 100644 --- a/usr.sbin/bind/lib/isc/hmacsha.c +++ b/usr.sbin/bind/lib/isc/hmacsha.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hmacsha.c,v 1.5 2020/01/09 13:52:23 florian Exp $ */ +/* $Id: hmacsha.c,v 1.6 2020/01/20 18:49:46 florian Exp $ */ /* * This code implements the HMAC-SHA1, HMAC-SHA224, HMAC-SHA256, HMAC-SHA384 @@ -30,7 +30,7 @@ #include <isc/safe.h> #include <isc/sha1.h> #include <isc/sha2.h> -#include <isc/string.h> +#include <string.h> #include <isc/types.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/include/isc/Makefile.in b/usr.sbin/bind/lib/isc/include/isc/Makefile.in index a07389f9896..aa50d98fecd 100644 --- a/usr.sbin/bind/lib/isc/include/isc/Makefile.in +++ b/usr.sbin/bind/lib/isc/include/isc/Makefile.in @@ -36,7 +36,7 @@ HEADERS = aes.h app.h assertions.h base32.h base64.h \ refcount.h regex.h \ region.h result.h resultclass.h rwlock.h \ safe.h serial.h sha1.h sha2.h sockaddr.h socket.h \ - stdio.h stdlib.h string.h symtab.h task.h \ + stdio.h stdlib.h symtab.h task.h \ timer.h types.h util.h version.h SUBDIRS = diff --git a/usr.sbin/bind/lib/isc/include/isc/string.h b/usr.sbin/bind/lib/isc/include/isc/string.h deleted file mode 100644 index 8b4cfbe491d..00000000000 --- a/usr.sbin/bind/lib/isc/include/isc/string.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: string.h,v 1.9 2020/01/09 18:17:19 florian Exp $ */ - -#ifndef ISC_STRING_H -#define ISC_STRING_H 1 - -/*! \file isc/string.h */ - -#include <isc/formatcheck.h> - -#include <isc/lang.h> -#include <isc/platform.h> -#include <isc/types.h> - -#include <string.h> - -#include <strings.h> - -#define ISC_STRING_MAGIC 0x5e - -ISC_LANG_BEGINDECLS - -uint64_t -isc_string_touint64(char *source, char **endp, int base); -/*%< - * Convert the string pointed to by 'source' to uint64_t. - * - * On successful conversion 'endp' points to the first character - * after conversion is complete. - * - * 'base': 0 or 2..36 - * - * If base is 0 the base is computed from the string type. - * - * On error 'endp' points to 'source'. - */ - -isc_result_t -isc_string_copy(char *target, size_t size, const char *source); -/* - * Copy the string pointed to by 'source' to 'target' which is a - * pointer to a string of at least 'size' bytes. - * - * Requires: - * 'target' is a pointer to a char[] of at least 'size' bytes. - * 'size' an integer > 0. - * 'source' == NULL or points to a NUL terminated string. - * - * Ensures: - * If result == ISC_R_SUCCESS - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - * - * If result == ISC_R_NOSPACE - * 'target' is undefined. - * - * Returns: - * ISC_R_SUCCESS -- 'source' was successfully copied to 'target'. - * ISC_R_NOSPACE -- 'source' could not be copied since 'target' - * is too small. - */ - -void -isc_string_copy_truncate(char *target, size_t size, const char *source); -/* - * Copy the string pointed to by 'source' to 'target' which is a - * pointer to a string of at least 'size' bytes. - * - * Requires: - * 'target' is a pointer to a char[] of at least 'size' bytes. - * 'size' an integer > 0. - * 'source' == NULL or points to a NUL terminated string. - * - * Ensures: - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - */ - -isc_result_t -isc_string_append(char *target, size_t size, const char *source); -/* - * Append the string pointed to by 'source' to 'target' which is a - * pointer to a NUL terminated string of at least 'size' bytes. - * - * Requires: - * 'target' is a pointer to a NUL terminated char[] of at - * least 'size' bytes. - * 'size' an integer > 0. - * 'source' == NULL or points to a NUL terminated string. - * - * Ensures: - * If result == ISC_R_SUCCESS - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - * - * If result == ISC_R_NOSPACE - * 'target' is undefined. - * - * Returns: - * ISC_R_SUCCESS -- 'source' was successfully appended to 'target'. - * ISC_R_NOSPACE -- 'source' could not be appended since 'target' - * is too small. - */ - -void -isc_string_append_truncate(char *target, size_t size, const char *source); -/* - * Append the string pointed to by 'source' to 'target' which is a - * pointer to a NUL terminated string of at least 'size' bytes. - * - * Requires: - * 'target' is a pointer to a NUL terminated char[] of at - * least 'size' bytes. - * 'size' an integer > 0. - * 'source' == NULL or points to a NUL terminated string. - * - * Ensures: - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - */ - -isc_result_t -isc_string_printf(char *target, size_t size, const char *format, ...) - ISC_FORMAT_PRINTF(3, 4); -/* - * Print 'format' to 'target' which is a pointer to a string of at least - * 'size' bytes. - * - * Requires: - * 'target' is a pointer to a char[] of at least 'size' bytes. - * 'size' an integer > 0. - * 'format' == NULL or points to a NUL terminated string. - * - * Ensures: - * If result == ISC_R_SUCCESS - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - * - * If result == ISC_R_NOSPACE - * 'target' is undefined. - * - * Returns: - * ISC_R_SUCCESS -- 'format' was successfully printed to 'target'. - * ISC_R_NOSPACE -- 'format' could not be printed to 'target' since it - * is too small. - */ - -void -isc_string_printf_truncate(char *target, size_t size, const char *format, ...) - ISC_FORMAT_PRINTF(3, 4); -/* - * Print 'format' to 'target' which is a pointer to a string of at least - * 'size' bytes. - * - * Requires: - * 'target' is a pointer to a char[] of at least 'size' bytes. - * 'size' an integer > 0. - * 'format' == NULL or points to a NUL terminated string. - * - * Ensures: - * 'target' will be a NUL terminated string of no more - * than 'size' bytes (including NUL). - */ - - -char * -isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source); -/* - * Copy the region pointed to by r to a NUL terminated string - * allocated from the memory context pointed to by mctx. - * - * The result should be deallocated using isc_mem_free() - * - * Requires: - * 'mctx' is a point to a valid memory context. - * 'source' is a pointer to a valid region. - * - * Returns: - * a pointer to a NUL terminated string or - * NULL if memory for the copy could not be allocated - * - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_STRING_H */ diff --git a/usr.sbin/bind/lib/isc/lex.c b/usr.sbin/bind/lib/isc/lex.c index 956ac51e848..a50a7420b17 100644 --- a/usr.sbin/bind/lib/isc/lex.c +++ b/usr.sbin/bind/lib/isc/lex.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.11 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: lex.c,v 1.12 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -32,7 +32,7 @@ #include <isc/parseint.h> #include <isc/stdio.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> typedef struct inputsource { diff --git a/usr.sbin/bind/lib/isc/log.c b/usr.sbin/bind/lib/isc/log.c index b9333b5d196..0506ea60e92 100644 --- a/usr.sbin/bind/lib/isc/log.c +++ b/usr.sbin/bind/lib/isc/log.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: log.c,v 1.16 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: log.c,v 1.17 2020/01/20 18:49:46 florian Exp $ */ /*! \file * \author Principal Authors: DCL */ @@ -37,7 +37,7 @@ #include <isc/stat.h> #include <isc/stdio.h> -#include <isc/string.h> +#include <string.h> #include <isc/time.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/mem.c b/usr.sbin/bind/lib/isc/mem.c index 47324f07f18..fc1197e0adc 100644 --- a/usr.sbin/bind/lib/isc/mem.c +++ b/usr.sbin/bind/lib/isc/mem.c @@ -31,7 +31,7 @@ #include <isc/msgs.h> #include <isc/once.h> #include <isc/ondestroy.h> -#include <isc/string.h> +#include <string.h> #include <isc/mutex.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/netaddr.c b/usr.sbin/bind/lib/isc/netaddr.c index bf4c5175b40..9c49d6c0507 100644 --- a/usr.sbin/bind/lib/isc/netaddr.c +++ b/usr.sbin/bind/lib/isc/netaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: netaddr.c,v 1.9 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: netaddr.c,v 1.10 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -28,7 +28,7 @@ #include <isc/netaddr.h> #include <isc/sockaddr.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> isc_boolean_t diff --git a/usr.sbin/bind/lib/isc/netscope.c b/usr.sbin/bind/lib/isc/netscope.c index 088542db7b6..0752b5e51c7 100644 --- a/usr.sbin/bind/lib/isc/netscope.c +++ b/usr.sbin/bind/lib/isc/netscope.c @@ -18,12 +18,12 @@ #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = - "$Id: netscope.c,v 1.5 2020/01/09 18:17:19 florian Exp $"; + "$Id: netscope.c,v 1.6 2020/01/20 18:49:46 florian Exp $"; #endif /* LIBC_SCCS and not lint */ #include <config.h> - -#include <isc/string.h> +#include <stdlib.h> +#include <string.h> #include <isc/net.h> #include <isc/netscope.h> #include <isc/result.h> @@ -53,7 +53,7 @@ isc_netscope_pton(int af, char *scopename, void *addr, uint32_t *zoneid) { (ifid = if_nametoindex((const char *)scopename)) != 0) zone = (uint32_t)ifid; else { - llz = isc_string_touint64(scopename, &ep, 10); + llz = strtoull(scopename, &ep, 10); if (ep == scopename) return (ISC_R_FAILURE); diff --git a/usr.sbin/bind/lib/isc/regex.c b/usr.sbin/bind/lib/isc/regex.c index a93fdd1d6d3..bd733042dcd 100644 --- a/usr.sbin/bind/lib/isc/regex.c +++ b/usr.sbin/bind/lib/isc/regex.c @@ -19,7 +19,7 @@ #include <isc/file.h> #include <isc/regex.h> -#include <isc/string.h> +#include <string.h> #if VALREGEX_REPORT_REASON #define FAIL(x) do { reason = (x); goto error; } while(0) diff --git a/usr.sbin/bind/lib/isc/safe.c b/usr.sbin/bind/lib/isc/safe.c index d9113812a0f..be657bb01e4 100644 --- a/usr.sbin/bind/lib/isc/safe.c +++ b/usr.sbin/bind/lib/isc/safe.c @@ -19,7 +19,7 @@ #include <config.h> #include <isc/safe.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #ifdef _MSC_VER diff --git a/usr.sbin/bind/lib/isc/sha1.c b/usr.sbin/bind/lib/isc/sha1.c index 8cbb44de140..02c7d6d59ee 100644 --- a/usr.sbin/bind/lib/isc/sha1.c +++ b/usr.sbin/bind/lib/isc/sha1.c @@ -14,10 +14,10 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha1.c,v 1.8 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: sha1.c,v 1.9 2020/01/20 18:49:46 florian Exp $ */ /* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */ -/* $OpenBSD: sha1.c,v 1.8 2020/01/09 18:17:19 florian Exp $ */ +/* $OpenBSD: sha1.c,v 1.9 2020/01/20 18:49:46 florian Exp $ */ /*! \file * SHA-1 in C @@ -40,7 +40,7 @@ #include <isc/platform.h> #include <isc/safe.h> #include <isc/sha1.h> -#include <isc/string.h> +#include <string.h> #include <isc/types.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/sha2.c b/usr.sbin/bind/lib/isc/sha2.c index 5a947692d66..2444f663848 100644 --- a/usr.sbin/bind/lib/isc/sha2.c +++ b/usr.sbin/bind/lib/isc/sha2.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sha2.c,v 1.7 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: sha2.c,v 1.8 2020/01/20 18:49:46 florian Exp $ */ /* $FreeBSD: src/sys/crypto/sha2/sha2.c,v 1.2.2.2 2002/03/05 08:36:47 ume Exp $ */ /* $KAME: sha2.c,v 1.8 2001/11/08 01:07:52 itojun Exp $ */ @@ -61,7 +61,7 @@ #include <isc/platform.h> #include <isc/safe.h> #include <isc/sha2.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #if defined(ISC_PLATFORM_OPENSSLHASH) && !defined(LIBRESSL_VERSION_NUMBER) diff --git a/usr.sbin/bind/lib/isc/sockaddr.c b/usr.sbin/bind/lib/isc/sockaddr.c index 108abb16434..1f200617930 100644 --- a/usr.sbin/bind/lib/isc/sockaddr.c +++ b/usr.sbin/bind/lib/isc/sockaddr.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sockaddr.c,v 1.13 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: sockaddr.c,v 1.14 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -29,7 +29,7 @@ #include <isc/region.h> #include <isc/sockaddr.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> isc_boolean_t diff --git a/usr.sbin/bind/lib/isc/string.c b/usr.sbin/bind/lib/isc/string.c deleted file mode 100644 index a0c49c67840..00000000000 --- a/usr.sbin/bind/lib/isc/string.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * 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 */ - -#include <config.h> - -#include <ctype.h> - -#include <isc/mem.h> - -#include <isc/region.h> -#include <isc/string.h> -#include <isc/util.h> - -static const char digits[] = "0123456789abcdefghijklmnoprstuvwxyz"; - -uint64_t -isc_string_touint64(char *source, char **end, int base) { - uint64_t tmp; - uint64_t overflow; - char *s = source; - const char *o; - char c; - - if ((base < 0) || (base == 1) || (base > 36)) { - *end = source; - return (0); - } - - while (*s != 0 && isascii(*s&0xff) && isspace(*s&0xff)) - s++; - if (*s == '+' /* || *s == '-' */) - s++; - if (base == 0) { - if (*s == '0' && (*(s+1) == 'X' || *(s+1) == 'x')) { - s += 2; - base = 16; - } else if (*s == '0') - base = 8; - else - base = 10; - } - if (*s == 0) { - *end = source; - return (0); - } - overflow = ~0; - overflow /= base; - tmp = 0; - - while ((c = *s) != 0) { - c = tolower(c&0xff); - /* end ? */ - if ((o = strchr(digits, c)) == NULL) { - *end = s; - return (tmp); - } - /* end ? */ - if ((o - digits) >= base) { - *end = s; - return (tmp); - } - /* overflow ? */ - if (tmp > overflow) { - *end = source; - return (0); - } - tmp *= base; - /* overflow ? */ - if ((tmp + (o - digits)) < tmp) { - *end = source; - return (0); - } - tmp += o - digits; - s++; - } - *end = s; - return (tmp); -} - -isc_result_t -isc_string_copy(char *target, size_t size, const char *source) { - REQUIRE(size > 0U); - - if (strlcpy(target, source, size) >= size) { - memset(target, ISC_STRING_MAGIC, size); - return (ISC_R_NOSPACE); - } - - ENSURE(strlen(target) < size); - - return (ISC_R_SUCCESS); -} - -void -isc_string_copy_truncate(char *target, size_t size, const char *source) { - REQUIRE(size > 0U); - - strlcpy(target, source, size); - - ENSURE(strlen(target) < size); -} - -isc_result_t -isc_string_append(char *target, size_t size, const char *source) { - REQUIRE(size > 0U); - REQUIRE(strlen(target) < size); - - if (strlcat(target, source, size) >= size) { - memset(target, ISC_STRING_MAGIC, size); - return (ISC_R_NOSPACE); - } - - ENSURE(strlen(target) < size); - - return (ISC_R_SUCCESS); -} - -void -isc_string_append_truncate(char *target, size_t size, const char *source) { - REQUIRE(size > 0U); - REQUIRE(strlen(target) < size); - - strlcat(target, source, size); - - ENSURE(strlen(target) < size); -} - -isc_result_t -isc_string_printf(char *target, size_t size, const char *format, ...) { - va_list args; - size_t n; - - REQUIRE(size > 0U); - - va_start(args, format); - n = vsnprintf(target, size, format, args); - va_end(args); - - if (n >= size) { - memset(target, ISC_STRING_MAGIC, size); - return (ISC_R_NOSPACE); - } - - ENSURE(strlen(target) < size); - - return (ISC_R_SUCCESS); -} - -void -isc_string_printf_truncate(char *target, size_t size, const char *format, ...) -{ - va_list args; - - REQUIRE(size > 0U); - - va_start(args, format); - /* check return code? */ - (void)vsnprintf(target, size, format, args); - va_end(args); - - ENSURE(strlen(target) < size); -} - -char * -isc_string_regiondup(isc_mem_t *mctx, const isc_region_t *source) { - char *target; - - REQUIRE(mctx != NULL); - REQUIRE(source != NULL); - - target = (char *) isc_mem_allocate(mctx, source->length + 1); - if (target != NULL) { - memmove(source->base, target, source->length); - target[source->length] = '\0'; - } - - return (target); -} diff --git a/usr.sbin/bind/lib/isc/symtab.c b/usr.sbin/bind/lib/isc/symtab.c index 1936c50f7a7..f6695ae3d6b 100644 --- a/usr.sbin/bind/lib/isc/symtab.c +++ b/usr.sbin/bind/lib/isc/symtab.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: symtab.c,v 1.3 2019/12/17 01:46:34 sthen Exp $ */ +/* $Id: symtab.c,v 1.4 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -24,7 +24,7 @@ #include <isc/magic.h> #include <isc/mem.h> -#include <isc/string.h> +#include <string.h> #include <isc/symtab.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/task.c b/usr.sbin/bind/lib/isc/task.c index 2aee4654565..6a23f5c9c02 100644 --- a/usr.sbin/bind/lib/isc/task.c +++ b/usr.sbin/bind/lib/isc/task.c @@ -35,7 +35,7 @@ #include <isc/once.h> #include <isc/platform.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/thread.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/unix/app.c b/usr.sbin/bind/lib/isc/unix/app.c index 52d64942054..27bdbeb2699 100644 --- a/usr.sbin/bind/lib/isc/unix/app.c +++ b/usr.sbin/bind/lib/isc/unix/app.c @@ -40,7 +40,7 @@ #include <isc/event.h> #include <isc/platform.h> #include <isc/strerror.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/time.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/unix/dir.c b/usr.sbin/bind/lib/isc/unix/dir.c index a757cc5dc9d..4f11b152389 100644 --- a/usr.sbin/bind/lib/isc/unix/dir.c +++ b/usr.sbin/bind/lib/isc/unix/dir.c @@ -30,7 +30,7 @@ #include <isc/magic.h> #include <isc/netdb.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include "errno2result.h" diff --git a/usr.sbin/bind/lib/isc/unix/file.c b/usr.sbin/bind/lib/isc/unix/file.c index 12c90b22fa0..5f18b75327f 100644 --- a/usr.sbin/bind/lib/isc/unix/file.c +++ b/usr.sbin/bind/lib/isc/unix/file.c @@ -43,7 +43,7 @@ * SUCH DAMAGE. */ -/* $Id: file.c,v 1.10 2020/01/09 18:17:19 florian Exp $ */ +/* $Id: file.c,v 1.11 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -69,7 +69,7 @@ #include <isc/log.h> #include <isc/mem.h> -#include <isc/string.h> +#include <string.h> #include <isc/time.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/unix/net.c b/usr.sbin/bind/lib/isc/unix/net.c index 5c0fb9c45ed..3441c9b3202 100644 --- a/usr.sbin/bind/lib/isc/unix/net.c +++ b/usr.sbin/bind/lib/isc/unix/net.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: net.c,v 1.11 2020/01/20 18:46:57 florian Exp $ */ +/* $Id: net.c,v 1.12 2020/01/20 18:49:46 florian Exp $ */ #include <config.h> @@ -38,7 +38,7 @@ #include <isc/netdb.h> #include <isc/once.h> #include <isc/strerror.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #ifndef ISC_SOCKADDR_LEN_T diff --git a/usr.sbin/bind/lib/isc/unix/socket.c b/usr.sbin/bind/lib/isc/unix/socket.c index cc9cd333c5a..7ccf5ff7505 100644 --- a/usr.sbin/bind/lib/isc/unix/socket.c +++ b/usr.sbin/bind/lib/isc/unix/socket.c @@ -58,7 +58,7 @@ #include <isc/socket.h> #include <isc/strerror.h> -#include <isc/string.h> +#include <string.h> #include <isc/task.h> #include <isc/thread.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/unix/syslog.c b/usr.sbin/bind/lib/isc/unix/syslog.c index 3400335b495..b267e898244 100644 --- a/usr.sbin/bind/lib/isc/unix/syslog.c +++ b/usr.sbin/bind/lib/isc/unix/syslog.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: syslog.c,v 1.3 2019/12/17 01:46:37 sthen Exp $ */ +/* $Id: syslog.c,v 1.4 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -24,7 +24,7 @@ #include <syslog.h> #include <isc/result.h> -#include <isc/string.h> +#include <string.h> #include <isc/syslog.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isc/unix/time.c b/usr.sbin/bind/lib/isc/unix/time.c index 2ebdcc450f2..a25537356f4 100644 --- a/usr.sbin/bind/lib/isc/unix/time.c +++ b/usr.sbin/bind/lib/isc/unix/time.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.10 2020/01/20 18:44:50 florian Exp $ */ +/* $Id: time.c,v 1.11 2020/01/20 18:49:46 florian Exp $ */ /*! \file */ @@ -32,7 +32,7 @@ #include <isc/platform.h> #include <isc/strerror.h> -#include <isc/string.h> +#include <string.h> #include <isc/time.h> #include <isc/util.h> diff --git a/usr.sbin/bind/lib/isccfg/namedconf.c b/usr.sbin/bind/lib/isccfg/namedconf.c index 6c59c0136dd..17aa8823155 100644 --- a/usr.sbin/bind/lib/isccfg/namedconf.c +++ b/usr.sbin/bind/lib/isccfg/namedconf.c @@ -19,12 +19,13 @@ #include <config.h> #include <stdint.h> +#include <stdlib.h> #include <string.h> #include <isc/lex.h> #include <isc/mem.h> #include <isc/result.h> -#include <isc/string.h> +#include <string.h> #include <isc/util.h> #include <dns/ttl.h> @@ -1999,7 +2000,7 @@ parse_unitstring(char *str, uint64_t *valuep) { uint64_t value; uint64_t unit; - value = isc_string_touint64(str, &endp, 10); + value = strtoull(str, &endp, 10); if (*endp == 0) { *valuep = value; return (ISC_R_SUCCESS); diff --git a/usr.sbin/bind/lib/isccfg/parser.c b/usr.sbin/bind/lib/isccfg/parser.c index 71998fad55d..af6444e8f49 100644 --- a/usr.sbin/bind/lib/isccfg/parser.c +++ b/usr.sbin/bind/lib/isccfg/parser.c @@ -30,7 +30,7 @@ #include <isc/netaddr.h> #include <isc/netscope.h> -#include <isc/string.h> +#include <string.h> #include <isc/sockaddr.h> #include <isc/symtab.h> #include <isc/util.h> |
