commit ac2ee05: [Fix] Do not pollute public headers with libev internals
Vsevolod Stakhov
vsevolod at rspamd.com
Wed Sep 13 13:14:03 UTC 2023
Author: Vsevolod Stakhov
Date: 2023-09-13 14:13:30 +0100
URL: https://github.com/rspamd/rspamd/commit/ac2ee05594e41cdfe1e1d4efdeade3a028376e1e (HEAD -> master)
[Fix] Do not pollute public headers with libev internals
---
src/libserver/dns.c | 1 +
src/libserver/dns.h | 9 +++++----
src/libutil/upstream.c | 7 ++++---
src/libutil/upstream.h | 19 +++++++++++++++++++
src/libutil/util.c | 1 +
src/libutil/util.h | 17 ++++++++++++++++-
6 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index abe47dfdc..be2d5a3dd 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -20,6 +20,7 @@
#include "dns.h"
#include "rspamd.h"
#include "utlist.h"
+#include "contrib/libev/ev.h"
#include "contrib/librdns/rdns.h"
#include "contrib/librdns/dns_private.h"
#include "contrib/librdns/rdns_ev.h"
diff --git a/src/libserver/dns.h b/src/libserver/dns.h
index d6977d0c0..acf8d0908 100644
--- a/src/libserver/dns.h
+++ b/src/libserver/dns.h
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -31,13 +31,14 @@ extern "C" {
struct rspamd_config;
struct rspamd_task;
+struct event_loop;
struct rspamd_dns_resolver {
struct rdns_resolver *r;
struct ev_loop *event_loop;
rspamd_lru_hash_t *fails_cache;
void *uidna;
- ev_tstamp fails_cache_time;
+ double fails_cache_time;
struct upstream_list *ups;
struct rspamd_config *cfg;
gdouble request_timeout;
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index a62bf293d..f536a2c6d 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2016 Vsevolod Stakhov
+/*
+ * Copyright 2023 Vsevolod Stakhov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -21,6 +21,7 @@
#include "rdns.h"
#include "cryptobox.h"
#include "utlist.h"
+#include "contrib/libev/ev.h"
#include "logger.h"
#include "contrib/librdns/rdns.h"
#include "contrib/mumhash/mum.h"
diff --git a/src/libutil/upstream.h b/src/libutil/upstream.h
index 08796a1f9..22a020c9c 100644
--- a/src/libutil/upstream.h
+++ b/src/libutil/upstream.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2023 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef UPSTREAM_H
#define UPSTREAM_H
@@ -10,6 +26,9 @@
extern "C" {
#endif
+/* Forward declaration */
+struct ev_loop;
+
enum rspamd_upstream_rotation {
RSPAMD_UPSTREAM_RANDOM = 0,
RSPAMD_UPSTREAM_HASHED,
diff --git a/src/libutil/util.c b/src/libutil/util.c
index d3c4721bd..f7e22e1bd 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -19,6 +19,7 @@
#include "ottery.h"
#include "cryptobox.h"
+#include "contrib/libev/ev.h"
#ifdef HAVE_TERMIOS_H
#include <termios.h>
diff --git a/src/libutil/util.h b/src/libutil/util.h
index 662f4e819..4842b890e 100644
--- a/src/libutil/util.h
+++ b/src/libutil/util.h
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2023 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef RSPAMD_UTIL_H
#define RSPAMD_UTIL_H
@@ -12,7 +28,6 @@
#include <netdb.h>
#endif
-#include "contrib/libev/ev.h"
#include <time.h>
#ifdef __cplusplus
More information about the Commits
mailing list