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.
This commit is contained in:
David Herrmann
2015-04-09 22:59:59 +02:00
parent 0704ea57b7
commit 43ef760376
+4 -9
View File
@@ -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)