mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
resolv: Introduce is_sort_mask and call it from res_vinit
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-06-19 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
|
* resolv/res_init.c (sort_mask_chars, ISSORTMASK): Remove.
|
||||||
|
(is_sort_mask): New function.
|
||||||
|
(__res_vinit): Use it.
|
||||||
|
|
||||||
2017-06-19 Florian Weimer <fweimer@redhat.com>
|
2017-06-19 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
* resolv/res_init.c (res_setoptions): Remove DEBUG preprocessor
|
* resolv/res_init.c (res_setoptions): Remove DEBUG preprocessor
|
||||||
|
@ -85,9 +85,6 @@
|
|||||||
|
|
||||||
static void res_setoptions (res_state, const char *, const char *)
|
static void res_setoptions (res_state, const char *, const char *)
|
||||||
internal_function;
|
internal_function;
|
||||||
|
|
||||||
static const char sort_mask_chars[] = "/&";
|
|
||||||
#define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL)
|
|
||||||
static u_int32_t net_mask (struct in_addr) __THROW;
|
static u_int32_t net_mask (struct in_addr) __THROW;
|
||||||
|
|
||||||
unsigned long long int __res_initstamp attribute_hidden;
|
unsigned long long int __res_initstamp attribute_hidden;
|
||||||
@ -109,6 +106,14 @@ res_ninit(res_state statp) {
|
|||||||
}
|
}
|
||||||
libc_hidden_def (__res_ninit)
|
libc_hidden_def (__res_ninit)
|
||||||
|
|
||||||
|
/* Return true if CH separates the netmask in the "sortlist"
|
||||||
|
directive. */
|
||||||
|
static inline bool
|
||||||
|
is_sort_mask (char ch)
|
||||||
|
{
|
||||||
|
return ch == '/' || ch == '&';
|
||||||
|
}
|
||||||
|
|
||||||
/* This function has to be reachable by res_data.c but not publically. */
|
/* This function has to be reachable by res_data.c but not publically. */
|
||||||
int
|
int
|
||||||
__res_vinit(res_state statp, int preinit) {
|
__res_vinit(res_state statp, int preinit) {
|
||||||
@ -305,14 +310,14 @@ __res_vinit(res_state statp, int preinit) {
|
|||||||
if (*cp == '\0' || *cp == '\n' || *cp == ';')
|
if (*cp == '\0' || *cp == '\n' || *cp == ';')
|
||||||
break;
|
break;
|
||||||
net = cp;
|
net = cp;
|
||||||
while (*cp && !ISSORTMASK(*cp) && *cp != ';' &&
|
while (*cp && !is_sort_mask (*cp) && *cp != ';' &&
|
||||||
isascii(*cp) && !isspace(*cp))
|
isascii(*cp) && !isspace(*cp))
|
||||||
cp++;
|
cp++;
|
||||||
n = *cp;
|
n = *cp;
|
||||||
*cp = 0;
|
*cp = 0;
|
||||||
if (__inet_aton(net, &a)) {
|
if (__inet_aton(net, &a)) {
|
||||||
statp->sort_list[nsort].addr = a;
|
statp->sort_list[nsort].addr = a;
|
||||||
if (ISSORTMASK(n)) {
|
if (is_sort_mask (n)) {
|
||||||
*cp++ = n;
|
*cp++ = n;
|
||||||
net = cp;
|
net = cp;
|
||||||
while (*cp && *cp != ';' &&
|
while (*cp && *cp != ';' &&
|
||||||
|
Reference in New Issue
Block a user