aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK.Kosako <kkosako0@gmail.com>2023-08-08 21:18:54 +0900
committerK.Kosako <kkosako0@gmail.com>2023-08-08 21:18:54 +0900
commit0e766952e8fec7b8d516ce4f52f95e53b09ca4de (patch)
tree36797f620f5e044c814dd7f90e84b72365e3f129
parent7e94eaba0a0e2ae18c5345ed605443a840d7753e (diff)
downloadoniguruma-0e766952e8fec7b8d516ce4f52f95e53b09ca4de.zip
oniguruma-0e766952e8fec7b8d516ce4f52f95e53b09ca4de.tar.gz
oniguruma-0e766952e8fec7b8d516ce4f52f95e53b09ca4de.tar.bz2
escape compile time warnings by clang 14.0
-rw-r--r--src/regparse.c14
-rw-r--r--src/st.c29
-rw-r--r--src/st.h4
3 files changed, 31 insertions, 16 deletions
diff --git a/src/regparse.c b/src/regparse.c
index 88a6ca3..d7d188a 100644
--- a/src/regparse.c
+++ b/src/regparse.c
@@ -548,8 +548,10 @@ typedef struct {
} st_str_end_key;
static int
-str_end_cmp(st_str_end_key* x, st_str_end_key* y)
+str_end_cmp(st_data_t ax, st_data_t ay)
{
+ st_str_end_key* x = (st_str_end_key* )ax;
+ st_str_end_key* y = (st_str_end_key* )ay;
UChar *p, *q;
int c;
@@ -569,8 +571,9 @@ str_end_cmp(st_str_end_key* x, st_str_end_key* y)
}
static int
-str_end_hash(st_str_end_key* x)
+str_end_hash(st_data_t ax)
{
+ st_str_end_key* x = (st_str_end_key* )ax;
UChar *p;
unsigned val = 0;
@@ -635,8 +638,10 @@ typedef struct {
} st_callout_name_key;
static int
-callout_name_table_cmp(st_callout_name_key* x, st_callout_name_key* y)
+callout_name_table_cmp(st_data_t ax, st_data_t ay)
{
+ st_callout_name_key* x = (st_callout_name_key* )ax;
+ st_callout_name_key* y = (st_callout_name_key* )ay;
UChar *p, *q;
int c;
@@ -658,8 +663,9 @@ callout_name_table_cmp(st_callout_name_key* x, st_callout_name_key* y)
}
static int
-callout_name_table_hash(st_callout_name_key* x)
+callout_name_table_hash(st_data_t ax)
{
+ st_callout_name_key* x = (st_callout_name_key* )ax;
UChar *p;
unsigned int val = 0;
diff --git a/src/st.c b/src/st.c
index 0d9faab..64228e7 100644
--- a/src/st.c
+++ b/src/st.c
@@ -32,18 +32,18 @@ struct st_table_entry {
*
*/
-static int numcmp(long, long);
-static int numhash(long);
+static int numcmp(st_data_t, st_data_t);
+static int numhash(st_data_t);
static struct st_hash_type type_numhash = {
numcmp,
numhash,
};
-/* extern int strcmp(const char *, const char *); */
-static int strhash(const char *);
+static int str_cmp(st_data_t, st_data_t);
+static int str_hash(st_data_t);
static struct st_hash_type type_strhash = {
- strcmp,
- strhash,
+ str_cmp,
+ str_hash,
};
static void rehash(st_table *);
@@ -456,7 +456,7 @@ st_cleanup_safe(st_table* table, st_data_t never)
}
extern int
-st_foreach(st_table* table, int (*func)(), st_data_t arg)
+st_foreach(st_table* table, int (*func)(st_data_t, st_data_t, st_data_t), st_data_t arg)
{
st_table_entry *ptr, *last, *tmp;
enum st_retval retval;
@@ -503,8 +503,17 @@ st_foreach(st_table* table, int (*func)(), st_data_t arg)
}
static int
-strhash(register const char* string)
+str_cmp(st_data_t a1, st_data_t a2)
{
+ const char* s1 = (const char* )a1;
+ const char* s2 = (const char* )a2;
+ return strcmp(s1, s2);
+}
+
+static int
+str_hash(st_data_t astring)
+{
+ const char* string = (const char* )astring;
register int c;
#ifdef HASH_ELFHASH
@@ -541,13 +550,13 @@ strhash(register const char* string)
}
static int
-numcmp(long x, long y)
+numcmp(st_data_t x, st_data_t y)
{
return x != y;
}
static int
-numhash(long n)
+numhash(st_data_t n)
{
return n;
}
diff --git a/src/st.h b/src/st.h
index 7961c06..5efee8b 100644
--- a/src/st.h
+++ b/src/st.h
@@ -16,8 +16,8 @@ typedef unsigned long long st_data_t;
typedef struct st_table st_table;
struct st_hash_type {
- int (*compare)();
- int (*hash)();
+ int (*compare)(st_data_t, st_data_t);
+ int (*hash)(st_data_t);
};
struct st_table {