summaryrefslogtreecommitdiffstats
path: root/src/portable
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2022-08-09 14:35:15 +0200
committerDavid Tardon <dtardon@redhat.com>2022-09-13 08:13:27 +0200
commit995340074e554b4bf4a0fdb0cb7436692c5a4ffd (patch)
treeca3ee001db3e608ee80478f42fea9c3b409f1b7b /src/portable
parentMerge pull request #23087 from yuwata/udev-watch (diff)
downloadsystemd-995340074e554b4bf4a0fdb0cb7436692c5a4ffd.tar.xz
systemd-995340074e554b4bf4a0fdb0cb7436692c5a4ffd.zip
tree-wide: use ASSERT_PTR more
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/portabled-bus.c9
-rw-r--r--src/portable/portabled-image-bus.c9
-rw-r--r--src/portable/portabled-image.c3
-rw-r--r--src/portable/portabled-operation.c3
4 files changed, 8 insertions, 16 deletions
diff --git a/src/portable/portabled-bus.c b/src/portable/portabled-bus.c
index 8f8a8fbdcf..be321b8f03 100644
--- a/src/portable/portabled-bus.c
+++ b/src/portable/portabled-bus.c
@@ -108,13 +108,12 @@ static int property_get_profiles(
static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
- Manager *m = userdata;
+ Manager *m = ASSERT_PTR(userdata);
const char *name;
Image *image;
int r;
assert(message);
- assert(m);
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
@@ -134,12 +133,11 @@ static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_erro
static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_hashmap_free_ Hashmap *images = NULL;
- Manager *m = userdata;
+ Manager *m = ASSERT_PTR(userdata);
Image *image;
int r;
assert(message);
- assert(m);
images = hashmap_new(&image_hash_ops);
if (!images)
@@ -276,13 +274,12 @@ static int method_detach_image(sd_bus_message *message, void *userdata, sd_bus_e
_cleanup_strv_free_ char **extension_images = NULL;
PortableChange *changes = NULL;
PortableFlags flags = 0;
- Manager *m = userdata;
+ Manager *m = ASSERT_PTR(userdata);
size_t n_changes = 0;
const char *name_or_path;
int r;
assert(message);
- assert(m);
/* Note that we do not redirect detaching to the image object here, because we want to allow that users can
* detach already deleted images too, in case the user already deleted an image before properly detaching
diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c
index 55f09d6285..7d393476a0 100644
--- a/src/portable/portabled-image-bus.c
+++ b/src/portable/portabled-image-bus.c
@@ -259,12 +259,11 @@ static int bus_image_method_get_state(
sd_bus_error *error) {
_cleanup_strv_free_ char **extension_images = NULL;
- Image *image = userdata;
+ Image *image = ASSERT_PTR(userdata);
PortableState state;
int r;
assert(message);
- assert(image);
if (sd_bus_message_is_method_call(message, NULL, "GetStateWithExtensions")) {
uint64_t input_flags = 0;
@@ -408,15 +407,13 @@ static int bus_image_method_detach(
_cleanup_strv_free_ char **extension_images = NULL;
PortableChange *changes = NULL;
- Image *image = userdata;
- Manager *m = image->userdata;
+ Image *image = ASSERT_PTR(userdata);
+ Manager *m = ASSERT_PTR(image->userdata);
PortableFlags flags = 0;
size_t n_changes = 0;
int r;
assert(message);
- assert(image);
- assert(m);
if (sd_bus_message_is_method_call(message, NULL, "DetachWithExtensions")) {
r = sd_bus_message_read_strv(message, &extension_images);
diff --git a/src/portable/portabled-image.c b/src/portable/portabled-image.c
index 40548fb655..6d2839125f 100644
--- a/src/portable/portabled-image.c
+++ b/src/portable/portabled-image.c
@@ -11,10 +11,9 @@ Image *manager_image_cache_get(Manager *m, const char *name_or_path) {
}
static int image_cache_flush(sd_event_source *s, void *userdata) {
- Manager *m = userdata;
+ Manager *m = ASSERT_PTR(userdata);
assert(s);
- assert(m);
hashmap_clear(m->image_cache);
return 0;
diff --git a/src/portable/portabled-operation.c b/src/portable/portabled-operation.c
index e4b737ae8c..26adb9091a 100644
--- a/src/portable/portabled-operation.c
+++ b/src/portable/portabled-operation.c
@@ -9,10 +9,9 @@
static int operation_done(sd_event_source *s, const siginfo_t *si, void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- Operation *o = userdata;
+ Operation *o = ASSERT_PTR(userdata);
int r;
- assert(o);
assert(si);
log_debug("Operating " PID_FMT " is now complete with code=%s status=%i",