aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-07-13 06:43:51 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2026-07-21 17:03:38 +0000
commit07868145600dcb91dd0083fab36310fe5a5ef39d (patch)
treee632cec53c93dfffbdde6e8cb2560cfd567fd94d
parent98bfed530cbf860a5c729d97adf42628cefb55cb (diff)
libfetch: Make fetch_ref an inline
Make fetch_ref() an inline and provide a fetch_deref(). MFC after: 1 week Reviewed by: op Differential Revision: https://reviews.freebsd.org/D57944 (cherry picked from commit d4e0e1fbc237f0765b9f32b291c087348031c921)
-rw-r--r--lib/libfetch/common.c11
-rw-r--r--lib/libfetch/common.h13
-rw-r--r--lib/libfetch/ftp.c2
3 files changed, 13 insertions, 13 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index d1a897b98827..74748e5b7d17 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -301,17 +301,6 @@ fetch_reopen(int sd)
/*
- * Bump a connection's reference count.
- */
-conn_t *
-fetch_ref(conn_t *conn)
-{
- ++conn->ref;
- return (conn);
-}
-
-
-/*
* Resolve an address
*/
struct addrinfo *
diff --git a/lib/libfetch/common.h b/lib/libfetch/common.h
index 5ad9bde513a0..143d4fe82945 100644
--- a/lib/libfetch/common.h
+++ b/lib/libfetch/common.h
@@ -61,6 +61,18 @@ struct fetchconn {
int ref; /* reference count */
};
+static inline conn_t *fetch_ref(conn_t *conn)
+{
+ ++conn->ref;
+ return (conn);
+}
+
+static inline conn_t *fetch_deref(conn_t *conn)
+{
+ --conn->ref;
+ return (conn);
+}
+
/* Structure used for error message lists */
struct fetcherr {
const int num;
@@ -115,7 +127,6 @@ struct addrinfo *fetch_resolve(const char *, int, int);
int fetch_bind(int, int, const char *);
conn_t *fetch_connect(const char *, int, int, int);
conn_t *fetch_reopen(int);
-conn_t *fetch_ref(conn_t *);
#ifdef WITH_SSL
int fetch_ssl_cb_verify_crt(int, X509_STORE_CTX*);
#endif
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index fc096054c9a2..5e4148e0fa2c 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -1133,7 +1133,7 @@ ftp_request(struct url *url, const char *op, struct url_stat *us,
/* just a stat */
if (strcmp(op, "STAT") == 0) {
- --conn->ref;
+ fetch_deref(conn);
ftp_disconnect(conn);
return (FILE *)1; /* bogus return value */
}