mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 06:55:30 +00:00
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.
This commit is contained in:
4
CHANGES
4
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] <isc/commandline.h>, <isc/mem.h>, <isc/print.h>
|
||||
<isc/serial.h>, <isc/string.h> and <isc/offset.h>
|
||||
made to conform to the same style for multiple
|
||||
|
@@ -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"
|
||||
|
@@ -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 <isc/str.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
#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;
|
||||
|
||||
|
@@ -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@
|
||||
|
@@ -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 =
|
||||
|
@@ -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 <isc/lang.h>
|
||||
#include <isc/types.h>
|
||||
|
||||
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 */
|
@@ -20,19 +20,36 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/platform.h>
|
||||
|
||||
#ifdef ISC_PLATFORM_NEEDSTRSEP
|
||||
#include <isc/int.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/platform.h>
|
||||
|
||||
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 */
|
||||
|
@@ -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 <config.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <isc/str.h>
|
||||
|
||||
#include <isc/string.h>
|
||||
|
||||
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);
|
||||
}
|
@@ -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 <config.h>
|
||||
#include <isc/string.h>
|
||||
|
||||
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);
|
||||
}
|
Reference in New Issue
Block a user