aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/dl-cache.c41
-rw-r--r--sysdeps/generic/dl-cache.h42
-rw-r--r--sysdeps/generic/ifreq.c80
-rw-r--r--sysdeps/generic/ifreq.h61
-rw-r--r--sysdeps/generic/ldsodefs.h2
-rw-r--r--sysdeps/generic/strtol.c8
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c19
-rw-r--r--sysdeps/generic/wordexp.c9
8 files changed, 146 insertions, 116 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index bf2e98c543..b17c18baf9 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
- Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003 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
@@ -133,6 +133,45 @@ do \
while (0)
+int
+internal_function
+_dl_cache_libcmp (const char *p1, const char *p2)
+{
+ while (*p1 != '\0')
+ {
+ if (*p1 >= '0' && *p1 <= '9')
+ {
+ if (*p2 >= '0' && *p2 <= '9')
+ {
+ /* Must compare this numerically. */
+ int val1;
+ int val2;
+
+ val1 = *p1++ - '0';
+ val2 = *p2++ - '0';
+ while (*p1 >= '0' && *p1 <= '9')
+ val1 = val1 * 10 + *p1++ - '0';
+ while (*p2 >= '0' && *p2 <= '9')
+ val2 = val2 * 10 + *p2++ - '0';
+ if (val1 != val2)
+ return val1 - val2;
+ }
+ else
+ return 1;
+ }
+ else if (*p2 >= '0' && *p2 <= '9')
+ return -1;
+ else if (*p1 != *p2)
+ return *p1 - *p2;
+ else
+ {
+ ++p1;
+ ++p2;
+ }
+ }
+ return *p1 - *p2;
+}
+
/* Look up NAME in ld.so.cache and return the file name stored there,
or null if none is found. */
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 93bf0be6f4..946e5a9713 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003 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
@@ -97,41 +97,5 @@ struct cache_file_new
(((addr) + __alignof__ (struct cache_file_new) -1) \
& (~(__alignof__ (struct cache_file_new) - 1)))
-static inline int
-__attribute__ ((__unused__))
-_dl_cache_libcmp (const char *p1, const char *p2)
-{
- while (*p1 != '\0')
- {
- if (*p1 >= '0' && *p1 <= '9')
- {
- if (*p2 >= '0' && *p2 <= '9')
- {
- /* Must compare this numerically. */
- int val1;
- int val2;
-
- val1 = *p1++ - '0';
- val2 = *p2++ - '0';
- while (*p1 >= '0' && *p1 <= '9')
- val1 = val1 * 10 + *p1++ - '0';
- while (*p2 >= '0' && *p2 <= '9')
- val2 = val2 * 10 + *p2++ - '0';
- if (val1 != val2)
- return val1 - val2;
- }
- else
- return 1;
- }
- else if (*p2 >= '0' && *p2 <= '9')
- return -1;
- else if (*p1 != *p2)
- return *p1 - *p2;
- else
- {
- ++p1;
- ++p2;
- }
- }
- return *p1 - *p2;
-}
+extern int _dl_cache_libcmp (const char *p1, const char *p2)
+ internal_function;
diff --git a/sysdeps/generic/ifreq.c b/sysdeps/generic/ifreq.c
new file mode 100644
index 0000000000..be7c03cf08
--- /dev/null
+++ b/sysdeps/generic/ifreq.c
@@ -0,0 +1,80 @@
+/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>.
+
+ 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 "ifreq.h"
+
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+ int fd = sockfd;
+ struct ifconf ifc;
+ int rq_len;
+ int nifs;
+# define RQ_IFS 4
+
+ if (fd < 0)
+ fd = __opensock ();
+ if (fd < 0)
+ {
+ *num_ifs = 0;
+ *ifreqs = NULL;
+ return;
+ }
+
+ ifc.ifc_buf = NULL;
+ rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */
+ do
+ {
+ ifc.ifc_len = rq_len *= 2;
+ ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len);
+ if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
+ {
+ if (ifc.ifc_buf)
+ free (ifc.ifc_buf);
+
+ if (fd != sockfd)
+ __close (fd);
+ *num_ifs = 0;
+ *ifreqs = NULL;
+ return;
+ }
+ }
+ while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);
+
+ if (fd != sockfd)
+ __close (fd);
+
+#ifdef _HAVE_SA_LEN
+ struct ifreq *ifr = ifreqs;
+ nifs = 0;
+ while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len)
+ {
+ ++nifs;
+ ifr = __if_nextreq (ifr);
+ if (ifr == NULL)
+ break;
+ }
+#else
+ nifs = ifc.ifc_len / sizeof (struct ifreq);
+#endif
+
+ *num_ifs = nifs;
+ *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
+}
diff --git a/sysdeps/generic/ifreq.h b/sysdeps/generic/ifreq.h
index 4871c8d1d8..6e01fb463e 100644
--- a/sysdeps/generic/ifreq.h
+++ b/sysdeps/generic/ifreq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>.
@@ -34,64 +34,7 @@ __if_nextreq (struct ifreq *ifr)
return ifr + 1;
}
-static inline void
-__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
-{
- int fd = sockfd;
- struct ifconf ifc;
- int rq_len;
- int nifs;
-# define RQ_IFS 4
-
- if (fd < 0)
- fd = __opensock ();
- if (fd < 0)
- {
- *num_ifs = 0;
- *ifreqs = NULL;
- return;
- }
-
- ifc.ifc_buf = NULL;
- rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */
- do
- {
- ifc.ifc_len = rq_len *= 2;
- ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len);
- if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
- {
- if (ifc.ifc_buf)
- free (ifc.ifc_buf);
-
- if (fd != sockfd)
- __close (fd);
- *num_ifs = 0;
- *ifreqs = NULL;
- return;
- }
- }
- while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);
-
- if (fd != sockfd)
- __close (fd);
-
-#ifdef _HAVE_SA_LEN
- struct ifreq *ifr = ifreqs;
- nifs = 0;
- while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len)
- {
- ++nifs;
- ifr = __if_nextreq (ifr);
- if (ifr == NULL)
- break;
- }
-#else
- nifs = ifc.ifc_len / sizeof (struct ifreq);
-#endif
-
- *num_ifs = nifs;
- *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
-}
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
static inline void
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 4b75f4672e..2a3cf2bd09 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -173,7 +173,7 @@ struct libname_list
/* Test whether given NAME matches any of the names of the given object. */
static __inline int
-__attribute__ ((unused))
+__attribute__ ((unused, always_inline))
_dl_name_match_p (const char *__name, struct link_map *__map)
{
int __found = strcmp (__name, __map->l_name) == 0;
diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c
index 1b267753d9..953c6c4a90 100644
--- a/sysdeps/generic/strtol.c
+++ b/sysdeps/generic/strtol.c
@@ -1,5 +1,5 @@
/* Convert string representation of a number into an integer value.
- Copyright (C) 1991,92,94,95,96,97,98,99,2000,01,02
+ Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001,2002,2003
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -374,7 +374,11 @@ INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)
|| (int) (TOUPPER (c) - L_('A') + 10) >= base))
break;
- end = correctly_grouped_prefix (s, end, thousands, grouping);
+# ifdef USE_WIDE_CHAR
+ end = __correctly_grouped_prefixwc (s, end, thousands, grouping);
+# else
+ end = __correctly_grouped_prefixmb (s, end, thousands, grouping);
+# endif
}
}
else
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 64c0846ccb..024ffd01c5 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -1,5 +1,6 @@
/* Subroutines needed for unwinding stack frames for exception handling. */
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of GCC.
@@ -423,7 +424,7 @@ struct fde_accumulator
struct fde_vector *erratic;
};
-static inline int
+static int
start_fde_sort (struct fde_accumulator *accu, size_t count)
{
size_t size;
@@ -461,7 +462,7 @@ fde_insert (struct fde_accumulator *accu, fde *this_fde)
chain to determine what should be placed in the ERRATIC array, and
what is the linear sequence. This overlay is safe from aliasing. */
-static inline void
+static void
fde_split (struct object *ob, fde_compare_t fde_compare,
struct fde_vector *linear, struct fde_vector *erratic)
{
@@ -571,7 +572,7 @@ frame_heapsort (struct object *ob, fde_compare_t fde_compare,
}
/* Merge V1 and V2, both sorted, and put the result into V1. */
-static inline void
+static void
fde_merge (struct object *ob, fde_compare_t fde_compare,
struct fde_vector *v1, struct fde_vector *v2)
{
@@ -598,7 +599,7 @@ fde_merge (struct object *ob, fde_compare_t fde_compare,
}
}
-static inline void
+static void
end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
{
fde_compare_t fde_compare;
@@ -753,7 +754,7 @@ add_fdes (struct object *ob, struct fde_accumulator *accu, fde *this_fde)
be faster. We can be called multiple times, should we have failed to
allocate a sorted fde array on a previous occasion. */
-static inline void
+static void
init_object (struct object* ob)
{
struct fde_accumulator accu;
@@ -876,7 +877,7 @@ linear_search_fdes (struct object *ob, fde *this_fde, void *pc)
/* Binary search for an FDE containing the given PC. Here are three
implementations of increasing complexity. */
-static inline fde *
+static fde *
binary_search_unencoded_fdes (struct object *ob, void *pc)
{
struct fde_vector *vec = ob->u.sort;
@@ -903,7 +904,7 @@ binary_search_unencoded_fdes (struct object *ob, void *pc)
return NULL;
}
-static inline fde *
+static fde *
binary_search_single_encoding_fdes (struct object *ob, void *pc)
{
struct fde_vector *vec = ob->u.sort;
@@ -933,7 +934,7 @@ binary_search_single_encoding_fdes (struct object *ob, void *pc)
return NULL;
}
-static inline fde *
+static fde *
binary_search_mixed_encoding_fdes (struct object *ob, void *pc)
{
struct fde_vector *vec = ob->u.sort;
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
index 09f4e942d5..bb870c967d 100644
--- a/sysdeps/generic/wordexp.c
+++ b/sysdeps/generic/wordexp.c
@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
- Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -89,19 +89,18 @@ w_newword (size_t *actlen, size_t *maxlen)
return NULL;
}
-static inline char *
+static char *
w_addchar (char *buffer, size_t *actlen, size_t *maxlen, char ch)
/* (lengths exclude trailing zero) */
{
- /* Add a character to the buffer, allocating room for it if needed.
- */
+ /* Add a character to the buffer, allocating room for it if needed. */
if (*actlen == *maxlen)
{
char *old_buffer = buffer;
assert (buffer == NULL || *maxlen != 0);
*maxlen += W_CHUNK;
- buffer = realloc (buffer, 1 + *maxlen);
+ buffer = (char *) realloc (buffer, 1 + *maxlen);
if (buffer == NULL)
free (old_buffer);