summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-17 08:39:47 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-02-21 10:05:22 -0500
commit9fa108ac48c9b76111589967184436bf63109731 (patch)
treea17d913ab78fdb340c1b7ce13c83563937cc316c /src/udev
parentc1db5c60e38fa4b1cd2c590dbc8ce95c4fc3844b (diff)
everywhere: make use of new0() and macro() macros, and stop using perror()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-ctrl.c2
-rw-r--r--src/udev/udev-event.c2
-rw-r--r--src/udev/udev-rules.c2
-rw-r--r--src/udev/udevadm-hwdb.c8
-rw-r--r--src/udev/udevd.c4
5 files changed, 9 insertions, 9 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 2d315ea77f..7695404bca 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -76,7 +76,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 01d579b455..c4cb686821 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -41,7 +41,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 e5a15aa934..814e7dcaef 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1620,7 +1620,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 614c64789c..61662fb4ae 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -197,7 +197,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;
@@ -240,7 +240,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;
@@ -583,7 +583,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
char **files, **f;
_cleanup_free_ char *hwdb_bin = UDEV_HWDB_BIN;
- trie = calloc(sizeof(struct trie), 1);
+ trie = new0(struct trie, 1);
if (!trie) {
rc = EXIT_FAILURE;
goto out;
@@ -597,7 +597,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 ae2067cddf..d9d3d85f8b 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;