diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-02-13 14:45:51 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-13 14:45:51 +0100 |
commit | 955d98c9c1104d469c2989dbfb58f58ee6fe9bdc (patch) | |
tree | 6964487e69bfefbbb08b0de140c67c6f2a00d791 /src/udev | |
parent | 7e2270246b0906675c8f34bc278b1608b969e65c (diff) |
everywhere: make use of new0() and macro() macros, and stop using perror()
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-ctrl.c | 2 | ||||
-rw-r--r-- | src/udev/udev-event.c | 2 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 8 | ||||
-rw-r--r-- | src/udev/udevd.c | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index a65603b3cf..2633423352 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -75,7 +75,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) struct udev_ctrl *uctrl; const int on = 1; - uctrl = calloc(1, sizeof(struct udev_ctrl)); + uctrl = new0(struct udev_ctrl, 1); if (uctrl == NULL) return NULL; uctrl->refcount = 1; diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index c8e216c341..8eb1e2b7ec 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -39,7 +39,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) struct udev *udev = udev_device_get_udev(dev); struct udev_event *event; - event = calloc(1, sizeof(struct udev_event)); + event = new0(struct udev_event, 1); if (event == NULL) return NULL; event->dev = dev; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index e90829811b..0a32604412 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1615,7 +1615,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) char **files, **f; int r; - rules = calloc(1, sizeof(struct udev_rules)); + rules = new0(struct udev_rules, 1); if (rules == NULL) return NULL; rules->udev = udev; diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index a22de1da4d..16abbe8d2f 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -190,7 +190,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se continue; /* split node */ - new_child = calloc(sizeof(struct trie_node), 1); + new_child = new0(struct trie_node, 1); if (!new_child) return -ENOMEM; @@ -233,7 +233,7 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se ssize_t off; /* new child */ - child = calloc(sizeof(struct trie_node), 1); + child = new0(struct trie_node, 1); if (!child) return -ENOMEM; @@ -576,7 +576,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { char **files, **f; _cleanup_free_ char *hwdb_bin = NULL; - trie = calloc(sizeof(struct trie), 1); + trie = new0(struct trie, 1); if (!trie) { rc = EXIT_FAILURE; goto out; @@ -590,7 +590,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { } /* index */ - trie->root = calloc(sizeof(struct trie_node), 1); + trie->root = new0(struct trie_node, 1); if (!trie->root) { rc = EXIT_FAILURE; goto out; diff --git a/src/udev/udevd.c b/src/udev/udevd.c index dca62f2429..9d7fa033b6 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -200,7 +200,7 @@ static void worker_new(struct event *event) udev_monitor_allow_unicast_sender(worker_monitor, monitor); udev_monitor_enable_receiving(worker_monitor); - worker = calloc(1, sizeof(struct worker)); + worker = new0(struct worker, 1); if (worker == NULL) { udev_monitor_unref(worker_monitor); return; @@ -431,7 +431,7 @@ static int event_queue_insert(struct udev_device *dev) { struct event *event; - event = calloc(1, sizeof(struct event)); + event = new0(struct event, 1); if (event == NULL) return -1; |