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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
https://github.com/kkos/oniguruma/issues/312
https://github.com/kkos/oniguruma/commit/5f1408dee4a01dee60c4cd67f2e2e46484ef50a5
https://github.com/kkos/oniguruma/commit/b803288174dcef9b56836aee1ee78a4f3256d8f6
From 5f1408dee4a01dee60c4cd67f2e2e46484ef50a5 Mon Sep 17 00:00:00 2001
From: "K.Kosako" <kkosako0@gmail.com>
Date: Mon, 18 Nov 2024 00:18:12 +0900
Subject: [PATCH] fix #312: Build failure with GCC 15 (C23)
---
src/regparse.c | 44 ++++++++++++++++++++++++++++++++++++--------
src/st.h | 9 +--------
2 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/src/regparse.c b/src/regparse.c
index 24bcbaac..9acdd6e2 100644
--- a/src/regparse.c
+++ b/src/regparse.c
@@ -793,8 +793,13 @@ onig_print_names(FILE* fp, regex_t* reg)
#endif /* ONIG_DEBUG */
static int
-i_free_name_entry(UChar* key, NameEntry* e, void* arg ARG_UNUSED)
+i_free_name_entry(st_data_t akey, st_data_t ae, st_data_t arg ARG_UNUSED)
{
+ UChar* key;
+ NameEntry* e;
+
+ key = (UChar* )akey;
+ e = (NameEntry* )ae;
xfree(e->name);
if (IS_NOT_NULL(e->back_refs)) xfree(e->back_refs);
xfree(key);
@@ -850,8 +855,14 @@ typedef struct {
} INamesArg;
static int
-i_names(UChar* key ARG_UNUSED, NameEntry* e, INamesArg* arg)
+i_names(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t aarg)
{
+ NameEntry* e;
+ INamesArg* arg;
+
+ e = (NameEntry* )ae;
+ arg = (INamesArg* )aarg;
+
int r = (*(arg->func))(e->name,
e->name + e->name_len,
e->back_num,
@@ -883,9 +894,14 @@ onig_foreach_name(regex_t* reg,
}
static int
-i_renumber_name(UChar* key ARG_UNUSED, NameEntry* e, GroupNumMap* map)
+i_renumber_name(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t amap)
{
int i;
+ NameEntry* e;
+ GroupNumMap* map;
+
+ e = (NameEntry* )ae;
+ map = (GroupNumMap* )amap;
if (e->back_num > 1) {
for (i = 0; i < e->back_num; i++) {
@@ -1374,9 +1390,14 @@ static int CalloutNameIDCounter;
#ifdef USE_ST_LIBRARY
static int
-i_free_callout_name_entry(st_callout_name_key* key, CalloutNameEntry* e,
- void* arg ARG_UNUSED)
+i_free_callout_name_entry(st_data_t akey, st_data_t ae, st_data_t arg ARG_UNUSED)
{
+ st_callout_name_key* key;
+ CalloutNameEntry* e;
+
+ key = (st_callout_name_key* )akey;
+ e = (CalloutNameEntry* )ae;
+
if (IS_NOT_NULL(e)) {
xfree(e->name);
}
@@ -1870,10 +1891,14 @@ typedef intptr_t CalloutTagVal;
#define CALLOUT_TAG_LIST_FLAG_TAG_EXIST (1<<0)
static int
-i_callout_callout_list_set(UChar* key, CalloutTagVal e, void* arg)
+i_callout_callout_list_set(st_data_t key ARG_UNUSED, st_data_t ae, st_data_t arg)
{
int num;
- RegexExt* ext = (RegexExt* )arg;
+ CalloutTagVal e;
+ RegexExt* ext;
+
+ e = (CalloutTagVal )ae;
+ ext = (RegexExt* )arg;
num = (int )e - 1;
ext->callout_list[num].flag |= CALLOUT_TAG_LIST_FLAG_TAG_EXIST;
@@ -1926,8 +1951,11 @@ onig_callout_tag_is_exist_at_callout_num(regex_t* reg, int callout_num)
}
static int
-i_free_callout_tag_entry(UChar* key, CalloutTagVal e, void* arg ARG_UNUSED)
+i_free_callout_tag_entry(st_data_t akey, st_data_t e ARG_UNUSED, st_data_t arg ARG_UNUSED)
{
+ UChar* key;
+
+ key = (UChar* )akey;
xfree(key);
return ST_DELETE;
}
diff --git a/src/st.h b/src/st.h
index 5efee8bb..70798dc5 100644
--- a/src/st.h
+++ b/src/st.h
@@ -34,13 +34,6 @@ enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
#ifndef _
# define _(args) args
#endif
-#ifndef ANYARGS
-# ifdef __cplusplus
-# define ANYARGS ...
-# else
-# define ANYARGS
-# endif
-#endif
st_table *st_init_table _((struct st_hash_type *));
st_table *st_init_table_with_size _((struct st_hash_type *, int));
@@ -52,7 +45,7 @@ int st_delete _((st_table *, st_data_t *, st_data_t *));
int st_delete_safe _((st_table *, st_data_t *, st_data_t *, st_data_t));
int st_insert _((st_table *, st_data_t, st_data_t));
int st_lookup _((st_table *, st_data_t, st_data_t *));
-int st_foreach _((st_table *, int (*)(ANYARGS), st_data_t));
+int st_foreach _((st_table *, int (*)(st_data_t, st_data_t, st_data_t), st_data_t));
void st_add_direct _((st_table *, st_data_t, st_data_t));
void st_free_table _((st_table *));
void st_cleanup_safe _((st_table *, st_data_t));
From b803288174dcef9b56836aee1ee78a4f3256d8f6 Mon Sep 17 00:00:00 2001
From: "K.Kosako" <kkosako0@gmail.com>
Date: Tue, 19 Nov 2024 00:01:17 +0900
Subject: [PATCH] follow up previous fix
---
src/regparse.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/regparse.c b/src/regparse.c
index 9acdd6e2..1d00b82a 100644
--- a/src/regparse.c
+++ b/src/regparse.c
@@ -758,10 +758,14 @@ typedef st_data_t HashDataType; /* 1.6 st.h doesn't define st_data_t type */
#ifdef ONIG_DEBUG
static int
-i_print_name_entry(UChar* key, NameEntry* e, void* arg)
+i_print_name_entry(st_data_t akey, st_data_t ae, st_data_t arg)
{
int i;
- FILE* fp = (FILE* )arg;
+ FILE* fp;
+ NameEntry* e;
+
+ e = (NameEntry* )ae;
+ fp = (FILE* )arg;
fprintf(fp, "%s: ", e->name);
if (e->back_num == 0)
|