Skip to content

Commit 87081e1

Browse files
committed
Refactor: based: Drop redundant NULL checks
pcmk__drop_all_clients() returns immediately if its argument is NULL, and g_clear_pointer() is NULL-safe. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 1e7de54 commit 87081e1

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

daemons/based/based_callbacks.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -913,20 +913,14 @@ based_shutdown(int nsig)
913913

914914
cib_shutdown_flag = true;
915915

916-
if (ipcs_ro != NULL) {
917-
pcmk__drop_all_clients(ipcs_ro);
918-
g_clear_pointer(&ipcs_ro, qb_ipcs_destroy);
919-
}
916+
pcmk__drop_all_clients(ipcs_ro);
917+
g_clear_pointer(&ipcs_ro, qb_ipcs_destroy);
920918

921-
if (ipcs_rw != NULL) {
922-
pcmk__drop_all_clients(ipcs_rw);
923-
g_clear_pointer(&ipcs_rw, qb_ipcs_destroy);
924-
}
919+
pcmk__drop_all_clients(ipcs_rw);
920+
g_clear_pointer(&ipcs_rw, qb_ipcs_destroy);
925921

926-
if (ipcs_shm != NULL) {
927-
pcmk__drop_all_clients(ipcs_shm);
928-
g_clear_pointer(&ipcs_shm, qb_ipcs_destroy);
929-
}
922+
pcmk__drop_all_clients(ipcs_shm);
923+
g_clear_pointer(&ipcs_shm, qb_ipcs_destroy);
930924

931925
based_drop_remote_clients();
932926

0 commit comments

Comments
 (0)