This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
some more regex portability fixes
- From: Aharon Robbins <arnold at skeeve dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: beebe at math dot utah dot edu
- Date: Tue, 24 Feb 2004 12:15:23 +0200
- Subject: some more regex portability fixes
Hi. Here are some regex portability fixes, primarily from Nelson Beebe
who likes to compile gawk with over 40 system+compiler combinations.
Enjoy,
Arnold Robbins
--------------- cut here --------------
Tue Feb 24 12:11:34 2004 Arnold D. Robbins <arnold@skeeve.com>
* regex_internal.c (build_wcs_upper_buffer): Enclose `offsets_needed'
label in `#ifdef _LIBC' to silence `unused label' compiler warning.
Tue Feb 24 11:57:18 2004 Nelson H.F. Beebe <beebe@math.utah.edu>
* regcomp.c (parse_expression): Add cast to (unsigned char *) in calls to
`build_charclass_op'.
* regex_internal.c (build_wcs_buffer): Add cast to char* in call to `wcrtomb'.
* regex_internal.h (bitset_not, bitset_merge, bitset_not_merge, bitset_mask,
re_string_char_size_a, re_string_wchar_at, re_string_elem_size_at): Change to
use prototypes.
(re_string_char_size_at, re_string_wchar_at, re_string_elem_size_at): Declare
as `internal_function'.
--- regex_internal.c.save 2004-01-12 21:48:56.000000000 +0200
+++ regex_internal.c 2004-02-24 11:56:48.000000000 +0200
@@ -373,7 +373,9 @@
{
wchar_t wc;
const char *p;
+#ifdef _LIBC
offsets_needed:
+#endif
remain_len = end_idx - byte_idx;
prev_st = pstr->cur_state;
if (BE (pstr->trans != NULL, 0))
@@ -398,7 +400,7 @@
int mbcdlen;
wcu = towupper (wc);
- mbcdlen = wcrtomb (buf, wcu, &prev_st);
+ mbcdlen = wcrtomb ((char *)buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
else
--- regex_internal.h.save 2004-02-06 10:34:48.000000000 +0200
+++ regex_internal.h 2004-02-24 11:55:27.000000000 +0200
@@ -725,8 +725,7 @@
/* Inline functions for bitset operation. */
static inline void
-bitset_not (set)
- bitset set;
+bitset_not (bitset set)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
@@ -734,9 +733,7 @@
}
static inline void
-bitset_merge (dest, src)
- bitset dest;
- const bitset src;
+bitset_merge (bitset dest, const bitset src)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
@@ -744,9 +741,7 @@
}
static inline void
-bitset_not_merge (dest, src)
- bitset dest;
- const bitset src;
+bitset_not_merge (bitset dest, const bitset src)
{
int i;
for (i = 0; i < BITSET_UINTS; ++i)
@@ -754,9 +749,7 @@
}
static inline void
-bitset_mask (dest, src)
- bitset dest;
- const bitset src;
+bitset_mask (bitset dest, const bitset src)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
@@ -766,9 +759,8 @@
#if defined RE_ENABLE_I18N && !defined RE_NO_INTERNAL_PROTOTYPES
/* Inline functions for re_string. */
static inline int
-re_string_char_size_at (pstr, idx)
- const re_string_t *pstr;
- int idx;
+internal_function
+re_string_char_size_at (const re_string_t *pstr, int idx)
{
int byte_idx;
if (pstr->mb_cur_max == 1)
@@ -780,9 +772,8 @@
}
static inline wint_t
-re_string_wchar_at (pstr, idx)
- const re_string_t *pstr;
- int idx;
+internal_function
+re_string_wchar_at (const re_string_t *pstr, int idx)
{
if (pstr->mb_cur_max == 1)
return (wint_t) pstr->mbs[idx];
@@ -790,9 +781,8 @@
}
static int
-re_string_elem_size_at (pstr, idx)
- const re_string_t *pstr;
- int idx;
+internal_function
+re_string_elem_size_at (const re_string_t *pstr, int idx)
{
#ifdef _LIBC
const unsigned char *p, *extra;