tree-wide: use ASSERT_PTR more

This commit is contained in:
David Tardon
2022-09-13 08:13:27 +02:00
parent 6d64cb0625
commit 995340074e
220 changed files with 1071 additions and 2323 deletions
+3 -6
View File
@@ -213,12 +213,11 @@ static int connection_shovel(
static int connection_enable_event_sources(Connection *c);
static int traffic_cb(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
Connection *c = userdata;
Connection *c = ASSERT_PTR(userdata);
int r;
assert(s);
assert(fd >= 0);
assert(c);
r = connection_shovel(c,
&c->server_fd, c->server_to_client_buffer, &c->client_fd,
@@ -321,13 +320,12 @@ fail:
}
static int connect_cb(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
Connection *c = userdata;
Connection *c = ASSERT_PTR(userdata);
socklen_t solen;
int error, r;
assert(s);
assert(fd >= 0);
assert(c);
solen = sizeof(error);
r = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &solen);
@@ -505,13 +503,12 @@ static int add_connection_socket(Context *context, int fd) {
static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
_cleanup_free_ char *peer = NULL;
Context *context = userdata;
Context *context = ASSERT_PTR(userdata);
int nfd = -1, r;
assert(s);
assert(fd >= 0);
assert(revents & EPOLLIN);
assert(context);
nfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
if (nfd < 0) {