4bff0a
From d28abe1a4a38a8d0bd140fd19bde2f5f165a922e Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Tue, 24 Jul 2018 20:14:39 +0200
4bff0a
Subject: [PATCH] bus-message: rename function for clarity
4bff0a
4bff0a
There's already message_free_last_container(), so rename to match.
4bff0a
4bff0a
(cherry picked from commit 9c65778d614588d21645163dea97a5fe2c1c4ca5)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 src/libsystemd/sd-bus/bus-message.c | 44 ++++++++++++++---------------
4bff0a
 1 file changed, 22 insertions(+), 22 deletions(-)
4bff0a
4bff0a
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
4bff0a
index 83f17436a1..7392a43a19 100644
4bff0a
--- a/src/libsystemd/sd-bus/bus-message.c
4bff0a
+++ b/src/libsystemd/sd-bus/bus-message.c
4bff0a
@@ -77,7 +77,7 @@ static void message_reset_parts(sd_bus_message *m) {
4bff0a
         m->cached_rindex_part_begin = 0;
4bff0a
 }
4bff0a
 
4bff0a
-static struct bus_container *message_get_container(sd_bus_message *m) {
4bff0a
+static struct bus_container *message_get_last_container(sd_bus_message *m) {
4bff0a
         assert(m);
4bff0a
 
4bff0a
         if (m->n_containers == 0)
4bff0a
@@ -90,7 +90,7 @@ static struct bus_container *message_get_container(sd_bus_message *m) {
4bff0a
 static void message_free_last_container(sd_bus_message *m) {
4bff0a
         struct bus_container *c;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         free(c->signature);
4bff0a
         free(c->peeked_signature);
4bff0a
@@ -1220,7 +1220,7 @@ static int message_add_offset(sd_bus_message *m, size_t offset) {
4bff0a
         /* Add offset to current container, unless this is the first
4bff0a
          * item in it, which will have the 0 offset, which we can
4bff0a
          * ignore. */
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (!c->need_offsets)
4bff0a
                 return 0;
4bff0a
@@ -1392,7 +1392,7 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void
4bff0a
         assert_return(bus_type_is_basic(type), -EINVAL);
4bff0a
         assert_return(!m->poisoned, -ESTALE);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (c->signature && c->signature[c->index]) {
4bff0a
                 /* Container signature is already set */
4bff0a
@@ -1585,7 +1585,7 @@ _public_ int sd_bus_message_append_string_space(
4bff0a
         assert_return(!m->sealed, -EPERM);
4bff0a
         assert_return(!m->poisoned, -ESTALE);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (c->signature && c->signature[c->index]) {
4bff0a
                 /* Container signature is already set */
4bff0a
@@ -1974,7 +1974,7 @@ _public_ int sd_bus_message_open_container(
4bff0a
                 return -ENOMEM;
4bff0a
         }
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         signature = strdup(contents);
4bff0a
         if (!signature) {
4bff0a
@@ -2199,7 +2199,7 @@ _public_ int sd_bus_message_close_container(sd_bus_message *m) {
4bff0a
         assert_return(m->n_containers > 0, -EINVAL);
4bff0a
         assert_return(!m->poisoned, -ESTALE);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (c->enclosing != SD_BUS_TYPE_ARRAY)
4bff0a
                 if (c->signature && c->signature[c->index] != 0)
4bff0a
@@ -2703,7 +2703,7 @@ _public_ int sd_bus_message_append_string_memfd(
4bff0a
         if (size > (uint64_t) (uint32_t) -1)
4bff0a
                 return -EINVAL;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         if (c->signature && c->signature[c->index]) {
4bff0a
                 /* Container signature is already set */
4bff0a
 
4bff0a
@@ -3036,7 +3036,7 @@ static bool message_end_of_signature(sd_bus_message *m) {
4bff0a
 
4bff0a
         assert(m);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         return !c->signature || c->signature[c->index] == 0;
4bff0a
 }
4bff0a
 
4bff0a
@@ -3045,7 +3045,7 @@ static bool message_end_of_array(sd_bus_message *m, size_t index) {
4bff0a
 
4bff0a
         assert(m);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         if (c->enclosing != SD_BUS_TYPE_ARRAY)
4bff0a
                 return false;
4bff0a
 
4bff0a
@@ -3306,7 +3306,7 @@ _public_ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
4bff0a
         if (message_end_of_array(m, m->rindex))
4bff0a
                 return 0;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         if (c->signature[c->index] != type)
4bff0a
                 return -ENXIO;
4bff0a
 
4bff0a
@@ -4036,7 +4036,7 @@ _public_ int sd_bus_message_enter_container(sd_bus_message *m,
4bff0a
         if (message_end_of_array(m, m->rindex))
4bff0a
                 return 0;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         signature = strdup(contents);
4bff0a
         if (!signature)
4bff0a
@@ -4092,7 +4092,7 @@ _public_ int sd_bus_message_exit_container(sd_bus_message *m) {
4bff0a
         assert_return(m->sealed, -EPERM);
4bff0a
         assert_return(m->n_containers > 0, -ENXIO);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (c->enclosing != SD_BUS_TYPE_ARRAY) {
4bff0a
                 if (c->signature && c->signature[c->index] != 0)
4bff0a
@@ -4113,7 +4113,7 @@ _public_ int sd_bus_message_exit_container(sd_bus_message *m) {
4bff0a
 
4bff0a
         message_free_last_container(m);
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         saved = c->index;
4bff0a
         c->index = c->saved_index;
4bff0a
         r = container_next_item(m, c, &m->rindex);
4bff0a
@@ -4132,7 +4132,7 @@ static void message_quit_container(sd_bus_message *m) {
4bff0a
         assert(m->n_containers > 0);
4bff0a
 
4bff0a
         /* Undo seeks */
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         assert(m->rindex >= c->before);
4bff0a
         m->rindex = c->before;
4bff0a
 
4bff0a
@@ -4140,7 +4140,7 @@ static void message_quit_container(sd_bus_message *m) {
4bff0a
         message_free_last_container(m);
4bff0a
 
4bff0a
         /* Correct index of new top-level container */
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
         c->index = c->saved_index;
4bff0a
 }
4bff0a
 
4bff0a
@@ -4157,7 +4157,7 @@ _public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char
4bff0a
         if (message_end_of_array(m, m->rindex))
4bff0a
                 goto eof;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (bus_type_is_basic(c->signature[c->index])) {
4bff0a
                 if (contents)
4bff0a
@@ -4301,9 +4301,9 @@ _public_ int sd_bus_message_rewind(sd_bus_message *m, int complete) {
4bff0a
                 message_reset_containers(m);
4bff0a
                 m->rindex = 0;
4bff0a
 
4bff0a
-                c = message_get_container(m);
4bff0a
+                c = message_get_last_container(m);
4bff0a
         } else {
4bff0a
-                c = message_get_container(m);
4bff0a
+                c = message_get_last_container(m);
4bff0a
 
4bff0a
                 c->offset_index = 0;
4bff0a
                 c->index = 0;
4bff0a
@@ -4546,7 +4546,7 @@ _public_ int sd_bus_message_skip(sd_bus_message *m, const char *types) {
4bff0a
                 if (message_end_of_array(m, m->rindex))
4bff0a
                         return 0;
4bff0a
 
4bff0a
-                c = message_get_container(m);
4bff0a
+                c = message_get_last_container(m);
4bff0a
 
4bff0a
                 r = signature_element_length(c->signature + c->index, &l);
4bff0a
                 if (r < 0)
4bff0a
@@ -4712,7 +4712,7 @@ _public_ int sd_bus_message_read_array(
4bff0a
         if (r <= 0)
4bff0a
                 return r;
4bff0a
 
4bff0a
-        c = message_get_container(m);
4bff0a
+        c = message_get_last_container(m);
4bff0a
 
4bff0a
         if (BUS_MESSAGE_IS_GVARIANT(m)) {
4bff0a
                 align = bus_gvariant_get_alignment(CHAR_TO_STR(type));
4bff0a
@@ -5609,7 +5609,7 @@ _public_ const char* sd_bus_message_get_signature(sd_bus_message *m, int complet
4bff0a
 
4bff0a
         assert_return(m, NULL);
4bff0a
 
4bff0a
-        c = complete ? &m->root_container : message_get_container(m);
4bff0a
+        c = complete ? &m->root_container : message_get_last_container(m);
4bff0a
         return strempty(c->signature);
4bff0a
 }
4bff0a