tree-wide: use ASSERT_PTR more
This commit is contained in:
@@ -27,11 +27,10 @@ static void curl_glue_check_finished(CurlGlue *g) {
|
||||
}
|
||||
|
||||
static int curl_glue_on_io(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
||||
CurlGlue *g = userdata;
|
||||
CurlGlue *g = ASSERT_PTR(userdata);
|
||||
int action, k = 0;
|
||||
|
||||
assert(s);
|
||||
assert(g);
|
||||
|
||||
if (FLAGS_SET(revents, EPOLLIN | EPOLLOUT))
|
||||
action = CURL_POLL_INOUT;
|
||||
@@ -52,12 +51,11 @@ static int curl_glue_on_io(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
|
||||
static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, void *userdata, void *socketp) {
|
||||
sd_event_source *io = socketp;
|
||||
CurlGlue *g = userdata;
|
||||
CurlGlue *g = ASSERT_PTR(userdata);
|
||||
uint32_t events = 0;
|
||||
int r;
|
||||
|
||||
assert(curl);
|
||||
assert(g);
|
||||
|
||||
if (action == CURL_POLL_REMOVE) {
|
||||
if (io) {
|
||||
@@ -109,11 +107,10 @@ static int curl_glue_socket_callback(CURL *curl, curl_socket_t s, int action, vo
|
||||
}
|
||||
|
||||
static int curl_glue_on_timer(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
CurlGlue *g = userdata;
|
||||
CurlGlue *g = ASSERT_PTR(userdata);
|
||||
int k = 0;
|
||||
|
||||
assert(s);
|
||||
assert(g);
|
||||
|
||||
if (curl_multi_socket_action(g->curl, CURL_SOCKET_TIMEOUT, 0, &k) != CURLM_OK)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
@@ -124,11 +121,10 @@ static int curl_glue_on_timer(sd_event_source *s, uint64_t usec, void *userdata)
|
||||
}
|
||||
|
||||
static int curl_glue_timer_callback(CURLM *curl, long timeout_ms, void *userdata) {
|
||||
CurlGlue *g = userdata;
|
||||
CurlGlue *g = ASSERT_PTR(userdata);
|
||||
usec_t usec;
|
||||
|
||||
assert(curl);
|
||||
assert(g);
|
||||
|
||||
if (timeout_ms < 0) {
|
||||
if (g->timer) {
|
||||
|
||||
@@ -70,11 +70,9 @@ static void progress_show(ProgressInfo *p) {
|
||||
}
|
||||
|
||||
static int progress_path(const char *path, const struct stat *st, void *userdata) {
|
||||
ProgressInfo *p = userdata;
|
||||
ProgressInfo *p = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
|
||||
r = free_and_strdup(&p->path, path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -86,9 +84,8 @@ static int progress_path(const char *path, const struct stat *st, void *userdata
|
||||
}
|
||||
|
||||
static int progress_bytes(uint64_t nbytes, void *userdata) {
|
||||
ProgressInfo *p = userdata;
|
||||
ProgressInfo *p = ASSERT_PTR(userdata);
|
||||
|
||||
assert(p);
|
||||
assert(p->size != UINT64_MAX);
|
||||
|
||||
p->size += nbytes;
|
||||
|
||||
@@ -345,11 +345,10 @@ static int raw_import_try_reflink(RawImport *i) {
|
||||
}
|
||||
|
||||
static int raw_import_write(const void *p, size_t sz, void *userdata) {
|
||||
RawImport *i = userdata;
|
||||
RawImport *i = ASSERT_PTR(userdata);
|
||||
bool too_much = false;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
assert(p);
|
||||
assert(sz > 0);
|
||||
|
||||
|
||||
+11
-22
@@ -306,11 +306,10 @@ static int transfer_cancel(Transfer *t) {
|
||||
}
|
||||
|
||||
static int transfer_on_pid(sd_event_source *s, const siginfo_t *si, void *userdata) {
|
||||
Transfer *t = userdata;
|
||||
Transfer *t = ASSERT_PTR(userdata);
|
||||
bool success = false;
|
||||
|
||||
assert(s);
|
||||
assert(t);
|
||||
|
||||
if (si->si_code == CLD_EXITED) {
|
||||
if (si->si_status != 0)
|
||||
@@ -331,11 +330,10 @@ static int transfer_on_pid(sd_event_source *s, const siginfo_t *si, void *userda
|
||||
}
|
||||
|
||||
static int transfer_on_log(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
||||
Transfer *t = userdata;
|
||||
Transfer *t = ASSERT_PTR(userdata);
|
||||
ssize_t l;
|
||||
|
||||
assert(s);
|
||||
assert(t);
|
||||
|
||||
l = read(fd, t->log_message + t->log_message_size, sizeof(t->log_message) - t->log_message_size);
|
||||
if (l < 0)
|
||||
@@ -687,13 +685,12 @@ static int method_import_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
|
||||
_cleanup_(transfer_unrefp) Transfer *t = NULL;
|
||||
int fd, force, read_only, r;
|
||||
const char *local, *object;
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
TransferType type;
|
||||
struct stat st;
|
||||
uint32_t id;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -761,11 +758,10 @@ static int method_import_fs(sd_bus_message *msg, void *userdata, sd_bus_error *e
|
||||
_cleanup_(transfer_unrefp) Transfer *t = NULL;
|
||||
int fd, force, read_only, r;
|
||||
const char *local, *object;
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
uint32_t id;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -828,13 +824,12 @@ static int method_export_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
|
||||
_cleanup_(transfer_unrefp) Transfer *t = NULL;
|
||||
int fd, r;
|
||||
const char *local, *object, *format;
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
TransferType type;
|
||||
struct stat st;
|
||||
uint32_t id;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -901,14 +896,13 @@ static int method_export_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
|
||||
static int method_pull_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_error *error) {
|
||||
_cleanup_(transfer_unrefp) Transfer *t = NULL;
|
||||
const char *remote, *local, *verify, *object;
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
ImportVerify v;
|
||||
TransferType type;
|
||||
int force, r;
|
||||
uint32_t id;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -988,12 +982,11 @@ static int method_pull_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_er
|
||||
|
||||
static int method_list_transfers(sd_bus_message *msg, void *userdata, sd_bus_error *error) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
Transfer *t;
|
||||
int r;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = sd_bus_message_new_method_return(msg, &reply);
|
||||
if (r < 0)
|
||||
@@ -1026,11 +1019,10 @@ static int method_list_transfers(sd_bus_message *msg, void *userdata, sd_bus_err
|
||||
}
|
||||
|
||||
static int method_cancel(sd_bus_message *msg, void *userdata, sd_bus_error *error) {
|
||||
Transfer *t = userdata;
|
||||
Transfer *t = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(msg);
|
||||
assert(t);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -1054,13 +1046,12 @@ static int method_cancel(sd_bus_message *msg, void *userdata, sd_bus_error *erro
|
||||
}
|
||||
|
||||
static int method_cancel_transfer(sd_bus_message *msg, void *userdata, sd_bus_error *error) {
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
Transfer *t;
|
||||
uint32_t id;
|
||||
int r;
|
||||
|
||||
assert(msg);
|
||||
assert(m);
|
||||
|
||||
r = bus_verify_polkit_async(
|
||||
msg,
|
||||
@@ -1102,11 +1093,10 @@ static int property_get_progress(
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
Transfer *t = userdata;
|
||||
Transfer *t = ASSERT_PTR(userdata);
|
||||
|
||||
assert(bus);
|
||||
assert(reply);
|
||||
assert(t);
|
||||
|
||||
return sd_bus_message_append(reply, "d", transfer_percent_as_double(t));
|
||||
}
|
||||
@@ -1122,7 +1112,7 @@ static int transfer_object_find(
|
||||
void **found,
|
||||
sd_bus_error *error) {
|
||||
|
||||
Manager *m = userdata;
|
||||
Manager *m = ASSERT_PTR(userdata);
|
||||
Transfer *t;
|
||||
const char *p;
|
||||
uint32_t id;
|
||||
@@ -1132,7 +1122,6 @@ static int transfer_object_find(
|
||||
assert(path);
|
||||
assert(interface);
|
||||
assert(found);
|
||||
assert(m);
|
||||
|
||||
p = startswith(path, "/org/freedesktop/import1/transfer/_");
|
||||
if (!p)
|
||||
|
||||
@@ -303,11 +303,10 @@ finish:
|
||||
}
|
||||
|
||||
static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata) {
|
||||
PullJob *j = userdata;
|
||||
PullJob *j = ASSERT_PTR(userdata);
|
||||
bool too_much = false;
|
||||
int r;
|
||||
|
||||
assert(j);
|
||||
assert(p);
|
||||
assert(sz > 0);
|
||||
|
||||
@@ -480,12 +479,11 @@ static int pull_job_detect_compression(PullJob *j) {
|
||||
}
|
||||
|
||||
static size_t pull_job_write_callback(void *contents, size_t size, size_t nmemb, void *userdata) {
|
||||
PullJob *j = userdata;
|
||||
PullJob *j = ASSERT_PTR(userdata);
|
||||
size_t sz = size * nmemb;
|
||||
int r;
|
||||
|
||||
assert(contents);
|
||||
assert(j);
|
||||
|
||||
switch (j->state) {
|
||||
|
||||
@@ -543,13 +541,12 @@ static int http_status_etag_exists(CURLcode status) {
|
||||
static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb, void *userdata) {
|
||||
_cleanup_free_ char *length = NULL, *last_modified = NULL, *etag = NULL;
|
||||
size_t sz = size * nmemb;
|
||||
PullJob *j = userdata;
|
||||
PullJob *j = ASSERT_PTR(userdata);
|
||||
CURLcode code;
|
||||
long status;
|
||||
int r;
|
||||
|
||||
assert(contents);
|
||||
assert(j);
|
||||
|
||||
if (IN_SET(j->state, PULL_JOB_DONE, PULL_JOB_FAILED)) {
|
||||
r = -ESTALE;
|
||||
@@ -634,12 +631,10 @@ fail:
|
||||
}
|
||||
|
||||
static int pull_job_progress_callback(void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) {
|
||||
PullJob *j = userdata;
|
||||
PullJob *j = ASSERT_PTR(userdata);
|
||||
unsigned percent;
|
||||
usec_t n;
|
||||
|
||||
assert(j);
|
||||
|
||||
if (dltotal <= 0)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user