[systemd-commits] 4 commits - src/libsystemd src/libsystemd-terminal
David Herrmann
dvdhrm at kemper.freedesktop.org
Thu Apr 9 14:05:51 PDT 2015
src/libsystemd-terminal/idev-keyboard.c | 1 +
src/libsystemd-terminal/term-page.c | 4 ----
src/libsystemd/sd-bus/bus-message.c | 13 ++++---------
src/libsystemd/sd-bus/bus-util.c | 10 +---------
4 files changed, 6 insertions(+), 22 deletions(-)
New commits:
commit 7757517220a320eccde47b3fb342e86663d5e105
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Thu Apr 9 22:19:26 2015 +0200
terminal/page: drop unneeded DISABLE_WARNING_*
The macros in shared/macro.h have been updated to no longer use fixed
variable names. This will silence any shadowing-warnings, so drop the
DISABLE_WARNING_* annotations.
diff --git a/src/libsystemd-terminal/term-page.c b/src/libsystemd-terminal/term-page.c
index cbd8006..bac8520 100644
--- a/src/libsystemd-terminal/term-page.c
+++ b/src/libsystemd-terminal/term-page.c
@@ -798,11 +798,9 @@ static inline void line_insert(term_line *line, unsigned int from, unsigned int
age);
/* adjust fill-state */
- DISABLE_WARNING_SHADOW;
line->fill = MIN(line->width,
MAX(line->fill + num,
from + num));
- REENABLE_WARNING;
} else {
/* modify head-cell */
term_cell_set(line->cells + from,
@@ -871,11 +869,9 @@ void term_line_write(term_line *line, unsigned int pos_x, term_char_t ch, unsign
age);
/* adjust fill-state */
- DISABLE_WARNING_SHADOW;
line->fill = MIN(line->width,
MAX(line->fill,
pos_x + len));
- REENABLE_WARNING;
}
}
commit 43ef76037696cb238ef0e2a0fb84f982f41c31d8
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Wed Apr 8 11:20:10 2015 +0200
bus: simplify bus_message_read_strv_extend()
Avoid unbound for(;;) loop and use the established coding-style:
while ((r = sd_bus_message_read*(...)) > 0) {
}
if (r < 0)
return r;
This is much easier to read and used all over the code base.
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 70c38cf..6ee209d 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -5550,6 +5550,7 @@ int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz) {
}
int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
+ const char *s;
int r;
assert(m);
@@ -5559,19 +5560,13 @@ int bus_message_read_strv_extend(sd_bus_message *m, char ***l) {
if (r <= 0)
return r;
- for (;;) {
- const char *s;
-
- r = sd_bus_message_read_basic(m, 's', &s);
- if (r < 0)
- return r;
- if (r == 0)
- break;
-
+ while ((r = sd_bus_message_read_basic(m, 's', &s)) > 0) {
r = strv_extend(l, s);
if (r < 0)
return r;
}
+ if (r < 0)
+ return r;
r = sd_bus_message_exit_container(m);
if (r < 0)
commit 0704ea57b7ed3f9c46f30afea3329a4e5a9d0ea9
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Apr 7 15:20:54 2015 +0200
bus: use free_and_strdup()
Save some LOCs by replacing strdup()+error-handling+free+assign with
free_and_strdup().
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 45882ab..ea2379d 100644
--- 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;
}
commit 0a790ab540b7669cc9711dc9bf22e09ac8dcff5a
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Tue Apr 7 15:06:01 2015 +0200
terminal/idev: fix NULL terminator for bus-property mapping
We require a NULL entry as sentinal in bus_properties_map. Fix this!
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c
index f90f1b5..05f5e0c 100644
--- a/src/libsystemd-terminal/idev-keyboard.c
+++ b/src/libsystemd-terminal/idev-keyboard.c
@@ -384,6 +384,7 @@ static const struct bus_properties_map kbdctx_locale_map[] = {
{ "X11Layout", "s", NULL, offsetof(kbdctx, locale_x11_layout) },
{ "X11Variant", "s", NULL, offsetof(kbdctx, locale_x11_variant) },
{ "X11Options", "s", NULL, offsetof(kbdctx, locale_x11_options) },
+ { },
};
static int kbdctx_locale_get_all_fn(sd_bus *bus,
More information about the systemd-commits
mailing list