aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog29
-rw-r--r--iconv/gconv_charset.h8
-rw-r--r--iconv/gconv_conf.c33
-rw-r--r--iconv/gconv_int.h2
-rw-r--r--iconv/gconv_open.c12
-rw-r--r--include/locale.h3
-rw-r--r--inet/inet_ntoa.c10
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/cancel.c9
-rw-r--r--linuxthreads/lockfile.c6
-rw-r--r--linuxthreads/pthread.c7
-rw-r--r--locale/Makefile3
-rw-r--r--locale/newlocale.c6
-rw-r--r--locale/xlocale.c55
-rw-r--r--resolv/gethnamaddr.c2
-rw-r--r--resolv/nss_dns/dns-host.c49
-rw-r--r--string/strsignal.c10
17 files changed, 198 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e768a2fb3..9f43dba6cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+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.
+
2001-08-14 Andreas Jaeger <aj@suse.de>
* sysdeps/ieee754/ldbl-128/w_expl.c: New file, copy from
diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
index 278bccc8d5..76a92a15ab 100644
--- a/iconv/gconv_charset.h
+++ b/iconv/gconv_charset.h
@@ -19,6 +19,7 @@
02111-1307 USA. */
#include <ctype.h>
+#include <locale.h>
static inline void
@@ -28,8 +29,9 @@ strip (char *wp, const char *s)
while (*s != '\0')
{
- if (isalnum (*s) || *s == '_' || *s == '-' || *s == '.')
- *wp++ = toupper (*s);
+ if (__isalnum_l (*s, &_nl_C_locobj)
+ || *s == '_' || *s == '-' || *s == '.')
+ *wp++ = __toupper_l (*s, &_nl_C_locobj);
else if (*s == '/')
{
if (++slash_count == 3)
@@ -50,7 +52,7 @@ static char * __attribute__ ((unused))
upstr (char *dst, const char *str)
{
char *cp = dst;
- while ((*cp++ = toupper (*str++)) != '\0')
+ while ((*cp++ = __toupper_l (*str++, &_nl_C_locobj)) != '\0')
/* nothing */;
return dst;
}
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index db5bb476fd..99519d09d2 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -22,6 +22,7 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
+#include <locale.h>
#include <search.h>
#include <stddef.h>
#include <stdio.h>
@@ -129,20 +130,20 @@ add_alias (char *rp, void *modules)
struct gconv_alias *new_alias;
char *from, *to, *wp;
- while (isspace (*rp))
+ while (__isspace_l (*rp, &_nl_C_locobj))
++rp;
from = wp = rp;
- while (*rp != '\0' && !isspace (*rp))
- *wp++ = toupper (*rp++);
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
+ *wp++ = __toupper_l (*rp++, &_nl_C_locobj);
if (*rp == '\0')
/* There is no `to' string on the line. Ignore it. */
return;
*wp++ = '\0';
to = ++rp;
- while (isspace (*rp))
+ while (__isspace_l (*rp, &_nl_C_locobj))
++rp;
- while (*rp != '\0' && !isspace (*rp))
- *wp++ = toupper (*rp++);
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
+ *wp++ = __toupper_l (*rp++, &_nl_C_locobj);
if (to == wp)
/* No `to' string, ignore the line. */
return;
@@ -250,30 +251,30 @@ add_module (char *rp, const char *directory, size_t dir_len, void **modules,
int need_ext;
int cost_hi;
- while (isspace (*rp))
+ while (__isspace_l (*rp, &_nl_C_locobj))
++rp;
from = rp;
- while (*rp != '\0' && !isspace (*rp))
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
{
- *rp = toupper (*rp);
+ *rp = __toupper_l (*rp, &_nl_C_locobj);
++rp;
}
if (*rp == '\0')
return;
*rp++ = '\0';
to = wp = rp;
- while (isspace (*rp))
+ while (__isspace_l (*rp, &_nl_C_locobj))
++rp;
- while (*rp != '\0' && !isspace (*rp))
- *wp++ = toupper (*rp++);
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
+ *wp++ = __toupper_l (*rp++, &_nl_C_locobj);
if (*rp == '\0')
return;
*wp++ = '\0';
do
++rp;
- while (isspace (*rp));
+ while (__isspace_l (*rp, &_nl_C_locobj));
module = wp;
- while (*rp != '\0' && !isspace (*rp))
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
*wp++ = *rp++;
if (*rp == '\0')
{
@@ -386,7 +387,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len,
if (rp[n - 1] == '\n')
rp[n - 1] = '\0';
- while (isspace (*rp))
+ while (__isspace_l (*rp, &_nl_C_locobj))
++rp;
/* If this is an empty line go on with the next one. */
@@ -394,7 +395,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len,
continue;
word = rp;
- while (*rp != '\0' && !isspace (*rp))
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
++rp;
if (rp - word == sizeof ("alias") - 1
diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h
index 3b5f195b04..d9edcb079f 100644
--- a/iconv/gconv_int.h
+++ b/iconv/gconv_int.h
@@ -141,7 +141,7 @@ extern const char *__gconv_path_envvar;
tmp = result = alloca (cp - (str) + 3 + suffix_len); \
cp = (str); \
while (*cp != '\0') \
- *tmp++ = _toupper (*cp++); \
+ *tmp++ = __toupper_l (*cp++, &_nl_C_locobj); \
if (cnt < 2) \
{ \
*tmp++ = '/'; \
diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c
index 0bf343d1b2..dfcd7b772f 100644
--- a/iconv/gconv_open.c
+++ b/iconv/gconv_open.c
@@ -19,6 +19,7 @@
02111-1307 USA. */
#include <errno.h>
+#include <locale.h>
#include <stdlib.h>
#include <string.h>
@@ -64,7 +65,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
tok = __strtok_r (tok, ",", &ptr);
while (tok != NULL)
{
- if (__strcasecmp (tok, "TRANSLIT") == 0)
+ if (__strcasecmp_l (tok, "TRANSLIT", &_nl_C_locobj) == 0)
{
/* It's the builtin transliteration handling. We only
support it for working on the internal encoding. */
@@ -97,7 +98,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
lastp->next = newp;
}
}
- else if (__strcasecmp (tok, "IGNORE") == 0)
+ else if (__strcasecmp_l (tok, "IGNORE", &_nl_C_locobj) == 0)
/* Set the flag to ignore all errors. */
conv_flags |= __GCONV_IGNORE_ERRORS;
else
@@ -110,7 +111,8 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
for (runp = trans; runp != NULL; runp = runp->next)
if (runp->name != NULL
- && __strcasecmp (tok, runp->name) == 0)
+ && __strcasecmp_l (tok, runp->name,
+ &_nl_C_locobj) == 0)
break;
else
lastp = runp;
@@ -205,8 +207,8 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
modules for this step. */
for (runp = trans; runp != NULL; runp = runp->next)
for (n = 0; n < runp->ncsnames; ++n)
- if (__strcasecmp (steps[cnt].__from_name,
- runp->csnames[n]) == 0)
+ if (__strcasecmp_l (steps[cnt].__from_name,
+ runp->csnames[n], &_nl_C_locobj) == 0)
{
void *data = NULL;
diff --git a/include/locale.h b/include/locale.h
index 47760b223c..4374792d14 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -1,6 +1,9 @@
#ifndef _LOCALE_H
#include <locale/locale.h>
+/* Locale object for C locale. */
+extern struct __locale_struct _nl_C_locobj;
+
/* Now define the internal interfaces. */
extern struct lconv *__localeconv (void);
diff --git a/inet/inet_ntoa.c b/inet/inet_ntoa.c
index 2193ef141f..889435dd10 100644
--- a/inet/inet_ntoa.c
+++ b/inet/inet_ntoa.c
@@ -1,5 +1,5 @@
/* Convert Inet number to ASCII representation.
- Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -96,11 +96,3 @@ free_key_mem (void *mem)
free (mem);
__libc_setspecific (key, NULL);
}
-
-
-static void __attribute__ ((unused))
-free_mem (void)
-{
- free (static_buf);
-}
-text_set_element (__libc_subfreeres, free_mem);
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 0969bd3abf..a3c0f77854 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-14 Jakub Jelinek <jakub@redhat.com>
+
+ * lockfile.c (__pthread_provide_lockfile): New variable.
+ * pthread.c (__pthread_require_lockfile): New variable.
+ * cancel.c (__pthread_require_lockfile): New variable.
+
2001-07-31 Ulrich Drepper <drepper@redhat.com>
* tst-context.c (threadfct): Initialize context before calling
diff --git a/linuxthreads/cancel.c b/linuxthreads/cancel.c
index 0d5298b742..5649bc41c6 100644
--- a/linuxthreads/cancel.c
+++ b/linuxthreads/cancel.c
@@ -207,9 +207,12 @@ void __pthread_perform_cleanup(char *currentframe)
}
#ifndef SHARED
-/* We need a hook to force the cancelation wrappers to be linked in when
- static libpthread is used. */
+/* We need a hook to force the cancelation wrappers and file locking
+ to be linked in when static libpthread is used. */
extern const int __pthread_provide_wrappers;
-static const int * const __pthread_require_wrappers =
+static const int *const __pthread_require_wrappers =
&__pthread_provide_wrappers;
+extern const int __pthread_provide_lockfile;
+static const int *const __pthread_require_lockfile =
+ &__pthread_provide_lockfile;
#endif
diff --git a/linuxthreads/lockfile.c b/linuxthreads/lockfile.c
index 38fa3fba86..2654cd577e 100644
--- a/linuxthreads/lockfile.c
+++ b/linuxthreads/lockfile.c
@@ -26,6 +26,12 @@
#include "../libio/libioP.h"
#endif
+#ifndef SHARED
+/* We need a hook to force this file to be linked in when static
+ libpthread is used. */
+const int __pthread_provide_lockfile = 0;
+#endif
+
void
__flockfile (FILE *stream)
{
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 1321bd488b..721da9b4e7 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -1158,9 +1158,12 @@ void __pthread_message(char * fmt, ...)
#ifndef SHARED
-/* We need a hook to force the cancelation wrappers to be linked in when
- static libpthread is used. */
+/* We need a hook to force the cancelation wrappers and file locking
+ to be linked in when static libpthread is used. */
extern const int __pthread_provide_wrappers;
static const int *const __pthread_require_wrappers =
&__pthread_provide_wrappers;
+extern const int __pthread_provide_lockfile;
+static const int *const __pthread_require_lockfile =
+ &__pthread_provide_lockfile;
#endif
diff --git a/locale/Makefile b/locale/Makefile
index aba8bcd94a..03ed1b66fa 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -40,7 +40,8 @@ routines = setlocale findlocale loadlocale localeconv nl_langinfo \
tests = tst-C-locale
categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
-aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name
+aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
+ xlocale
others = localedef locale
#others-static = localedef locale
install-bin = localedef locale
diff --git a/locale/newlocale.c b/locale/newlocale.c
index 19e65e29f2..4a785d0c0f 100644
--- a/locale/newlocale.c
+++ b/locale/newlocale.c
@@ -163,10 +163,12 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
if (result_ptr == NULL)
return NULL;
- *result_ptr = result;
}
else
- *(result_ptr = base) = result;
+ /* We modify the base structure. */
+ result_ptr = base;
+
+ *result_ptr = result;
/* Update the special members. */
update:
diff --git a/locale/xlocale.c b/locale/xlocale.c
new file mode 100644
index 0000000000..dd1dbbf508
--- /dev/null
+++ b/locale/xlocale.c
@@ -0,0 +1,55 @@
+/* C locale object.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <locale.h>
+#include "localeinfo.h"
+
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+extern struct locale_data _nl_C_##category;
+#include "categories.def"
+#undef DEFINE_CATEGORY
+
+/* Defined in locale/C-ctype.c. */
+extern const char _nl_C_LC_CTYPE_class[];
+extern const char _nl_C_LC_CTYPE_toupper[];
+extern const char _nl_C_LC_CTYPE_tolower[];
+
+
+struct __locale_struct _nl_C_locobj =
+ {
+ .__locales =
+ {
+ [LC_CTYPE] = &_nl_C_LC_CTYPE,
+ [LC_NUMERIC] = &_nl_C_LC_NUMERIC,
+ [LC_TIME] = &_nl_C_LC_TIME,
+ [LC_COLLATE] = &_nl_C_LC_COLLATE,
+ [LC_MONETARY] = &_nl_C_LC_MONETARY,
+ [LC_MESSAGES] = &_nl_C_LC_MESSAGES,
+ [LC_PAPER] = &_nl_C_LC_PAPER,
+ [LC_NAME] = &_nl_C_LC_NAME,
+ [LC_ADDRESS] = &_nl_C_LC_ADDRESS,
+ [LC_TELEPHONE] = &_nl_C_LC_TELEPHONE,
+ [LC_MEASUREMENT] = &_nl_C_LC_MEASUREMENT,
+ [LC_IDENTIFICATION] = &_nl_C_LC_IDENTIFICATION
+ },
+ .__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
+ .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
+ .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
+ };
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index c0e2f703df..25ae11987e 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -68,6 +68,8 @@ static char rcsid[] = "$Id$";
#include <errno.h>
#include <syslog.h>
+#define RESOLVSORT
+
#ifndef LOG_AUTH
# define LOG_AUTH 0
#endif
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 54645f1208..2102f63758 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -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,
diff --git a/string/strsignal.c b/string/strsignal.c
index db07caed0e..435ad78117 100644
--- a/string/strsignal.c
+++ b/string/strsignal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -130,11 +130,3 @@ getbuffer (void)
return result;
}
-
-
-static void
-free_mem (void)
-{
- free (static_buf);
-}
-text_set_element (__libc_subfreeres, free_mem);