projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a790ab
)
bus: use free_and_strdup()
author
David Herrmann
<dh.herrmann@gmail.com>
Tue, 7 Apr 2015 13:20:54 +0000
(15:20 +0200)
committer
David Herrmann
<dh.herrmann@gmail.com>
Thu, 9 Apr 2015 20:59:59 +0000
(22:59 +0200)
Save some LOCs by replacing strdup()+error-handling+free+assign with
free_and_strdup().
src/libsystemd/sd-bus/bus-util.c
patch
|
blob
|
history
diff --git
a/src/libsystemd/sd-bus/bus-util.c
b/src/libsystemd/sd-bus/bus-util.c
index
45882ab
..
ea2379d
100644
(file)
--- a/
src/libsystemd/sd-bus/bus-util.c
+++ b/
src/libsystemd/sd-bus/bus-util.c
@@
-946,7
+946,6
@@
static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_
switch (type) {
case SD_BUS_TYPE_STRING: {
const char *s;
- char *str;
char **p = userdata;
r = sd_bus_message_read_basic(m, type, &s);
@@
-956,14
+955,7
@@
static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_
if (isempty(s))
break;
- str = strdup(s);
- if (!str) {
- r = -ENOMEM;
- break;
- }
- free(*p);
- *p = str;
-
+ r = free_and_strdup(p, s);
break;
}