mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
Update.
2001-08-14 Jakub Jelinek <jakub@redhat.com> * resolv/nss_dns/dns-host.c (RESOLVSORT): Define. (addrsort): New function. * resolv/gethnamaddr.c (RESOLVSORT): Define. 2001-08-14 Jakub Jelinek <jakub@redhat.com> * string/strsignal.c (free_mem): Remove. 2001-08-14 Andreas Jaeger <aj@suse.de> * inet/inet_ntoa.c (free_mem): Remove, it's not used anymore. Closes PR libc/2477, reported by Dylan Alex Simon <dylan@dylex.caltech.edu>. 2001-08-14 Ulrich Drepper <drepper@redhat.com> * locale/Makefile (aux): Add xlocale. * locale/xlocale.c: New file. * include/locale.c (_nl_C_locobj): Declare. * iconv/gconv_charset.h: Use __tolower_l, __isdigit_l, __isspace_l with _nl_C_locobj instead of tolower, isdigit, isspace. * iconv/gconv_conf.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_open.c: Likewise. * locale/newlocale.c: Minor cleanups.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
@ -86,6 +86,8 @@
|
||||
#include <resolv/mapv4v6addr.h>
|
||||
#include <resolv/mapv4v6hostent.h>
|
||||
|
||||
#define RESOLVSORT
|
||||
|
||||
/* Maximum number of aliases we allow. */
|
||||
#define MAX_NR_ALIASES 48
|
||||
#define MAX_NR_ADDRS 48
|
||||
@ -330,6 +332,51 @@ _nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef RESOLVSORT
|
||||
static void addrsort (char **ap, int num);
|
||||
|
||||
static void
|
||||
addrsort (char **ap, int num)
|
||||
{
|
||||
int i, j;
|
||||
char **p;
|
||||
short aval[MAX_NR_ADDRS];
|
||||
int needsort = 0;
|
||||
|
||||
p = ap;
|
||||
if (num > MAX_NR_ADDRS)
|
||||
num = MAX_NR_ADDRS;
|
||||
for (i = 0; i < num; i++, p++)
|
||||
{
|
||||
for (j = 0 ; (unsigned)j < _res.nsort; j++)
|
||||
if (_res.sort_list[j].addr.s_addr ==
|
||||
(((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
|
||||
break;
|
||||
aval[i] = j;
|
||||
if (needsort == 0 && i > 0 && j < aval[i-1])
|
||||
needsort = i;
|
||||
}
|
||||
if (!needsort)
|
||||
return;
|
||||
|
||||
while (needsort++ < num)
|
||||
for (j = needsort - 2; j >= 0; j--)
|
||||
if (aval[j] > aval[j+1])
|
||||
{
|
||||
char *hp;
|
||||
|
||||
i = aval[j];
|
||||
aval[j] = aval[j+1];
|
||||
aval[j+1] = i;
|
||||
|
||||
hp = ap[j];
|
||||
ap[j] = ap[j+1];
|
||||
ap[j+1] = hp;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
static enum nss_status
|
||||
getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
|
||||
|
Reference in New Issue
Block a user