Skip to content

Commit

Permalink
Ensure lwan_connection_get_fd() is always inlined
Browse files Browse the repository at this point in the history
  • Loading branch information
lpereira committed May 9, 2024
1 parent c26a398 commit c26a6ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/lib/lwan-request.c
Expand Up @@ -1788,12 +1788,6 @@ const char *lwan_request_get_host(struct lwan_request *request)
return helper->host.len ? helper->host.value : NULL;
}

ALWAYS_INLINE int
lwan_connection_get_fd(const struct lwan *lwan, const struct lwan_connection *conn)
{
return (int)(intptr_t)(conn - lwan->conns);
}

const char *
lwan_request_get_remote_address_and_port(struct lwan_request *request,
char buffer[static INET6_ADDRSTRLEN],
Expand Down
7 changes: 7 additions & 0 deletions src/lib/lwan.h
Expand Up @@ -686,6 +686,13 @@ ssize_t lwan_request_async_writev(struct lwan_request *request,

void lwan_straitjacket_enforce(const struct lwan_straitjacket *sj);

static ALWAYS_INLINE int
lwan_connection_get_fd(const struct lwan *lwan,
const struct lwan_connection *conn)
{
return (int)(intptr_t)(conn - lwan->conns);
}

#if defined(__cplusplus)
}
#endif

0 comments on commit c26a6ba

Please sign in to comment.