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