1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
Description: Update regex library internal prototypes with arguments and reorder type definitions and prototypes.
Needed to work with GCC15
Bug-Debian: https://bugs.debian.org/1097343
--- a/src/libraries/regex/regex.c
+++ b/src/libraries/regex/regex.c
@@ -839,13 +839,47 @@ static const char *re_error_msg[] =
"Unmatched ) or \\)", /* REG_ERPAREN */
};
+
+/* Since we have one byte reserved for the register number argument to
+ {start,stop}_memory, the maximum number of groups we can report
+ things about is what fits in that byte. */
+#define MAX_REGNUM 255
+
+/* But patterns can have more than `MAX_REGNUM' registers. We just
+ ignore the excess. */
+typedef unsigned regnum_t;
+
+
+/* Macros for the compile stack. */
+
+/* Since offsets can go either forwards or backwards, this type needs to
+ be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
+typedef int pattern_offset_t;
+
+typedef struct
+{
+ pattern_offset_t begalt_offset;
+ pattern_offset_t fixup_alt_jump;
+ pattern_offset_t inner_group_offset;
+ pattern_offset_t laststart_offset;
+ regnum_t regnum;
+} compile_stack_elt_t;
+
+
+typedef struct
+{
+ compile_stack_elt_t *stack;
+ unsigned size;
+ unsigned avail; /* Offset of next open position. */
+} compile_stack_type;
+
/* Subroutine declarations and macros for regex_compile. */
-static void store_op1 (), store_op2 ();
-static void insert_op1 (), insert_op2 ();
-static boolean at_begline_loc_p (), at_endline_loc_p ();
-static boolean group_in_compile_stack ();
-static reg_errcode_t compile_range ();
+static void store_op1 (re_opcode_t, unsigned char*, int), store_op2 (re_opcode_t, unsigned char*, int, int);
+static void insert_op1 (re_opcode_t, unsigned char*, int, unsigned char*), insert_op2 (re_opcode_t, unsigned char*, int, int, unsigned char*);
+static boolean at_begline_loc_p (const char *, const char *, reg_syntax_t), at_endline_loc_p (const char *, const char *, int);
+static boolean group_in_compile_stack (compile_stack_type, regnum_t);
+static reg_errcode_t compile_range (const char **, const char *, char *, reg_syntax_t, unsigned char*);
/* Fetch the next character in the uncompiled pattern---translating it
if necessary. Also cast from a signed character in the constant
@@ -966,39 +1000,6 @@ static reg_errcode_t compile_range ();
} while (0)
-/* Since we have one byte reserved for the register number argument to
- {start,stop}_memory, the maximum number of groups we can report
- things about is what fits in that byte. */
-#define MAX_REGNUM 255
-
-/* But patterns can have more than `MAX_REGNUM' registers. We just
- ignore the excess. */
-typedef unsigned regnum_t;
-
-
-/* Macros for the compile stack. */
-
-/* Since offsets can go either forwards or backwards, this type needs to
- be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-typedef int pattern_offset_t;
-
-typedef struct
-{
- pattern_offset_t begalt_offset;
- pattern_offset_t fixup_alt_jump;
- pattern_offset_t inner_group_offset;
- pattern_offset_t laststart_offset;
- regnum_t regnum;
-} compile_stack_elt_t;
-
-
-typedef struct
-{
- compile_stack_elt_t *stack;
- unsigned size;
- unsigned avail; /* Offset of next open position. */
-} compile_stack_type;
-
#define INIT_COMPILE_STACK_SIZE 32
@@ -2991,12 +2992,6 @@ re_search_2 (bufp, string1, size1, strin
return -1;
} /* re_search_2 */
-/* Declarations and macros for re_match_2. */
-
-static int bcmp_translate ();
-static boolean alt_match_null_string_p (),
- common_op_match_null_string_p (),
- group_match_null_string_p ();
/* Structure for per-register (a.k.a. per-group) information.
This must not be longer than one word, because we push this value
@@ -3024,6 +3019,13 @@ typedef union
} bits;
} register_info_type;
+/* Declarations and macros for re_match_2. */
+
+static int bcmp_translate (unsigned char *, unsigned char *, register int, char*);
+static boolean alt_match_null_string_p (unsigned char *, unsigned char *, register_info_type*),
+ common_op_match_null_string_p (unsigned char **, unsigned char *, register_info_type*),
+ group_match_null_string_p (unsigned char **, unsigned char *, register_info_type*);
+
#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
#define IS_ACTIVE(R) ((R).bits.is_active)
#define MATCHED_SOMETHING(R) ((R).bits.matched_something)
|