+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
02111-1307 USA. */
#include <ctype.h>
+#include <locale.h>
static inline void
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)
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;
}
#include <ctype.h>
#include <errno.h>
#include <limits.h>
+#include <locale.h>
#include <search.h>
#include <stddef.h>
#include <stdio.h>
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;
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')
{
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. */
continue;
word = rp;
- while (*rp != '\0' && !isspace (*rp))
+ while (*rp != '\0' && !__isspace_l (*rp, &_nl_C_locobj))
++rp;
if (rp - word == sizeof ("alias") - 1
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++ = '/'; \
02111-1307 USA. */
#include <errno.h>
+#include <locale.h>
#include <stdlib.h>
#include <string.h>
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. */
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
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;
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;
#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);
/* 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.
free (mem);
__libc_setspecific (key, NULL);
}
-
-
-static void __attribute__ ((unused))
-free_mem (void)
-{
- free (static_buf);
-}
-text_set_element (__libc_subfreeres, free_mem);
+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
}
#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
#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)
{
#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
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
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:
--- /dev/null
+/* 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
+ };
#include <errno.h>
#include <syslog.h>
+#define RESOLVSORT
+
#ifndef LOG_AUTH
# define LOG_AUTH 0
#endif
-/* 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.
#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
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,
-/* 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
return result;
}
-
-
-static void
-free_mem (void)
-{
- free (static_buf);
-}
-text_set_element (__libc_subfreeres, free_mem);