summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-08-28 22:44:28 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-08-28 22:44:28 +0200
commit32b13b2f58b916ea22626e89cdd8cdb70ca6b6c9 (patch)
tree03f5a7c8fc3b0b36c2f0d2fc126057ba4a46497d /src/libsystemd
parent9021bb9f935c93b516b10c88db2a212a9e3a8140 (diff)
sd-event: simplify sd_event_source_set_name()
free_and_strdup() does exactly the same as sd_event_source_set_name(), use it!
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-event/sd-event.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index c92e065c76..985ff2829b 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -1227,20 +1227,9 @@ _public_ sd_event_source* sd_event_source_unref(sd_event_source *s) {
}
_public_ int sd_event_source_set_name(sd_event_source *s, const char *name) {
- char *new_name = NULL;
-
assert_return(s, -EINVAL);
- if (name) {
- new_name = strdup(name);
- if (!new_name)
- return -ENOMEM;
- }
-
- free(s->name);
- s->name = new_name;
-
- return 0;
+ return free_and_strdup(&s->name, name);
}
_public_ int sd_event_source_get_name(sd_event_source *s, const char **name) {