]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-ctrl: fix coding style isuues
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 23 Nov 2018 19:46:27 +0000 (04:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 26 Nov 2018 02:10:46 +0000 (11:10 +0900)
src/udev/udev-ctrl.c

index 2dd0f2e39df47e59ba74bead7a548b4f5c2e8718..3ba945c99b7c6122f5c239bfdaa23b9fb0f23535 100644 (file)
@@ -76,7 +76,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(int fd) {
         int r;
 
         uctrl = new0(struct udev_ctrl, 1);
-        if (uctrl == NULL)
+        if (!uctrl)
                 return NULL;
         uctrl->n_ref = 1;
 
@@ -147,7 +147,7 @@ DEFINE_PRIVATE_TRIVIAL_REF_FUNC(struct udev_ctrl, udev_ctrl);
 DEFINE_TRIVIAL_UNREF_FUNC(struct udev_ctrl, udev_ctrl, udev_ctrl_free);
 
 int udev_ctrl_cleanup(struct udev_ctrl *uctrl) {
-        if (uctrl == NULL)
+        if (!uctrl)
                 return 0;
         if (uctrl->cleanup_socket)
                 sockaddr_un_unlink(&uctrl->saddr.un);
@@ -155,7 +155,7 @@ int udev_ctrl_cleanup(struct udev_ctrl *uctrl) {
 }
 
 int udev_ctrl_get_fd(struct udev_ctrl *uctrl) {
-        if (uctrl == NULL)
+        if (!uctrl)
                 return -EINVAL;
         return uctrl->sock;
 }
@@ -166,7 +166,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) {
         int r;
 
         conn = new(struct udev_ctrl_connection, 1);
-        if (conn == NULL)
+        if (!conn)
                 return NULL;
         conn->n_ref = 1;
         conn->uctrl = uctrl;
@@ -220,7 +220,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int
         ctrl_msg_wire.magic = UDEV_CTRL_MAGIC;
         ctrl_msg_wire.type = type;
 
-        if (buf != NULL)
+        if (buf)
                 strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf);
         else
                 ctrl_msg_wire.intval = intval;
@@ -312,7 +312,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) {
         struct ucred *cred;
 
         uctrl_msg = new0(struct udev_ctrl_msg, 1);
-        if (uctrl_msg == NULL)
+        if (!uctrl_msg)
                 return NULL;
         uctrl_msg->n_ref = 1;
         uctrl_msg->conn = conn;
@@ -357,7 +357,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) {
 
         cmsg = CMSG_FIRSTHDR(&smsg);
 
-        if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
+        if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
                 log_error("no sender credentials received, message ignored");
                 goto err;
         }