diff --git a/CHANGES b/CHANGES index b7ebb409d1..aa07bfa5fd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ + 138. [cleanup] isc_strtouq moved from str.[ch] to string.[ch] and + renamed isc_string_touint64. isc_strsep moved from + strsep.c to string.c and renamed isc_string_separate. + 137. [cleanup] , , , and made to conform to the same style for multiple diff --git a/configure.in b/configure.in index 7545e3273d..106344cb88 100644 --- a/configure.in +++ b/configure.in @@ -13,7 +13,7 @@ dnl PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS dnl ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS dnl SOFTWARE. -AC_REVISION($Revision: 1.123 $) +AC_REVISION($Revision: 1.124 $) AC_PREREQ(2.13) @@ -741,9 +741,7 @@ AC_SUBST(ISC_PLATFORM_NEEDATON) # Check for some other useful functions that are not ever-present. AC_CHECK_FUNC(strsep, [ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"], - [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS strsep.$O" - ISC_EXTRA_SRCS="$ISC_EXTRA_SRCS strsep.c" - ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"]) + [ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"]) AC_CHECK_FUNC(vsnprintf, [ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"], [ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O" diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c index 31ca75da03..2d0156b4a1 100644 --- a/lib/dns/rdata/any_255/tsig_250.c +++ b/lib/dns/rdata/any_255/tsig_250.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: tsig_250.c,v 1.30 2000/04/28 01:23:58 gson Exp $ */ +/* $Id: tsig_250.c,v 1.31 2000/04/28 22:40:08 tale Exp $ */ /* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */ @@ -24,9 +24,10 @@ #ifndef RDATA_ANY_255_TSIG_250_C #define RDATA_ANY_255_TSIG_250_C -#include +#include -#define RRTYPE_TSIG_ATTRIBUTES (DNS_RDATATYPEATTR_META | DNS_RDATATYPEATTR_NOTQUESTION) +#define RRTYPE_TSIG_ATTRIBUTES \ + (DNS_RDATATYPEATTR_META | DNS_RDATATYPEATTR_NOTQUESTION) static inline isc_result_t fromtext_any_tsig(dns_rdataclass_t rdclass, dns_rdatatype_t type, @@ -51,7 +52,7 @@ fromtext_any_tsig(dns_rdataclass_t rdclass, dns_rdatatype_t type, /* Time Signed: 48 bits */ RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); - sigtime = isc_strtouq(token.value.as_pointer, &e, 10); + sigtime = isc_string_touint64(token.value.as_pointer, &e, 10); if (*e != 0) return (DNS_R_SYNTAX); if ((sigtime >> 48) != 0) @@ -245,7 +246,9 @@ fromwire_any_tsig(dns_rdataclass_t rdclass, dns_rdatatype_t type, } static inline isc_result_t -towire_any_tsig(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { +towire_any_tsig(dns_rdata_t *rdata, dns_compress_t *cctx, + isc_buffer_t *target) +{ isc_region_t sr; dns_name_t name; diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 19e16fb733..8b08334f78 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -51,7 +51,7 @@ OBJS = @ISC_EXTRA_OBJS@ \ mem.@O@ mutexblock.@O@ netaddr.@O@ ondestroy.@O@ \ quota.@O@ random.@O@ \ ratelimiter.@O@ result.@O@ rwlock.@O@ \ - serial.@O@ sockaddr.@O@ str.@O@ symtab.@O@ \ + serial.@O@ sockaddr.@O@ string.@O@ symtab.@O@ \ task.@O@ taskpool.@O@ timer.@O@ version.@O@ \ ${UNIXOBJS} ${NLSOBJS} ${PTHREADOBJS} @@ -63,7 +63,7 @@ SRCS = @ISC_EXTRA_SRCS@ \ mem.c mutexblock.c netaddr.c ondestroy.c \ quota.c random.c \ ratelimiter.c result.c rwlock.c \ - serial.c sockaddr.c str.c symtab.c \ + serial.c sockaddr.c string.c symtab.c \ task.c taskpool.c timer.c version.c LIBS = @LIBS@ diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 797c6f75d0..9fc498ca76 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -29,7 +29,7 @@ HEADERS = assertions.h base64.h bitstring.h boolean.h buffer.h \ mutexblock.h netaddr.h ondestroy.h platform.h \ print.h quota.h random.h ratelimiter.h region.h \ result.h resultclass.h rwlock.h serial.h sockaddr.h \ - socket.h str.h symtab.h task.h taskpool.h timer.h \ + socket.h string.h symtab.h task.h taskpool.h timer.h \ types.h util.h SUBDIRS = diff --git a/lib/isc/include/isc/str.h b/lib/isc/include/isc/str.h deleted file mode 100644 index 6abe5c7e1b..0000000000 --- a/lib/isc/include/isc/str.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 1999, 2000 Internet Software Consortium. - * - * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM 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: str.h,v 1.4 2000/03/21 00:37:36 gson Exp $ */ - -#ifndef ISC_STR_H -#define ISC_STR_H 1 - -#include -#include - -ISC_LANG_BEGINDECLS - -isc_uint64_t isc_strtouq(char *source, char **endp, int base); -/* - * Convert the string pointed to by 'source' to isc_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_LANG_ENDDECLS - -#endif /* ISC_INT_H */ diff --git a/lib/isc/include/isc/string.h b/lib/isc/include/isc/string.h index 54ba569464..53aca4a7bc 100644 --- a/lib/isc/include/isc/string.h +++ b/lib/isc/include/isc/string.h @@ -20,19 +20,36 @@ #include -#include - -#ifdef ISC_PLATFORM_NEEDSTRSEP +#include #include +#include ISC_LANG_BEGINDECLS +isc_uint64_t +isc_string_touint64(char *source, char **endp, int base); +/* + * Convert the string pointed to by 'source' to isc_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'. + */ + +#ifdef ISC_PLATFORM_NEEDSTRSEP + char * -isc_strsep(char **stringp, const char *delim); +isc_string_separate(char **stringp, const char *delim); -#define strsep isc_strsep - -ISC_LANG_ENDDECLS +#define strsep isc_string_separate #endif /* ISC_PLATFORM_NEEDSTRSEP */ +ISC_LANG_ENDDECLS + + #endif /* ISC_STRING_H */ diff --git a/lib/isc/str.c b/lib/isc/string.c similarity index 77% rename from lib/isc/str.c rename to lib/isc/string.c index a7b48a2da8..6e3e587c4a 100644 --- a/lib/isc/str.c +++ b/lib/isc/string.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999, 2000 Internet Software Consortium. + * Copyright (C) 2000 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,14 +15,16 @@ * SOFTWARE. */ +#include + #include -#include -#include + +#include static char digits[] = "0123456789abcdefghijklmnoprstuvwxyz"; isc_uint64_t -isc_strtouq(char *source, char **end, int base) { +isc_string_touint64(char *source, char **end, int base) { isc_uint64_t tmp; isc_uint64_t overflow; char *s = source; @@ -84,3 +86,24 @@ isc_strtouq(char *source, char **end, int base) { *end = s; return (tmp); } + +char * +isc_string_separate(char **stringp, const char *delim) { + char *string = *stringp; + char *s; + const char *d; + char sc, dc; + + if (string == NULL) + return (NULL); + + for (s = string; (sc = *s) != '\0'; s++) + for (d = delim; (dc = *d) != '\0'; d++) + if (sc == dc) { + *s++ = '\0'; + *stringp = s; + return (string); + } + *stringp = NULL; + return (string); +} diff --git a/lib/isc/strsep.c b/lib/isc/strsep.c deleted file mode 100644 index 5c71c711b9..0000000000 --- a/lib/isc/strsep.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2000 Internet Software Consortium. - * - * Permission to use, copy, modify, and 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM 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. - */ - -#include -#include - -char * -isc_strsep(char **stringp, const char *delim) { - char *string = *stringp; - char *s; - const char *d; - char sc, dc; - - if (string == NULL) - return (NULL); - - for (s = string; (sc = *s) != '\0'; s++) - for (d = delim; (dc = *d) != '\0'; d++) - if (sc == dc) { - *s++ = '\0'; - *stringp = s; - return (string); - } - *stringp = NULL; - return (string); -}