ctdb:protocol_util: remove 'const' from allocated strings
authorStefan Metzmacher <metze@samba.org>
Mon, 27 May 2019 10:31:51 +0000 (12:31 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 4 Jun 2019 22:13:07 +0000 (22:13 +0000)
The caller should be able to call TALLOC_FREE() on the returned
strings.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/protocol/protocol_util.c
ctdb/protocol/protocol_util.h

index d120213b70a90a1effb65963ebe64c1aa4e018de..f43afbc58d00b30453387a71c0b995ecc866203b 100644 (file)
@@ -155,8 +155,9 @@ int ctdb_sock_addr_to_buf(char *buf, socklen_t buflen,
        return 0;
 }
 
-const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx,
-                                    ctdb_sock_addr *addr, bool with_port)
+char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx,
+                              ctdb_sock_addr *addr,
+                              bool with_port)
 {
        size_t len = 64;
        char *cip;
@@ -493,9 +494,9 @@ int ctdb_connection_to_buf(char *buf, size_t buflen,
        return 0;
 }
 
-const char *ctdb_connection_to_string(TALLOC_CTX *mem_ctx,
-                                     struct ctdb_connection *conn,
-                                     bool client_first)
+char *ctdb_connection_to_string(TALLOC_CTX *mem_ctx,
+                               struct ctdb_connection *conn,
+                               bool client_first)
 {
        const size_t len = 128;
        char *out;
@@ -612,7 +613,7 @@ int ctdb_connection_list_sort(struct ctdb_connection_list *conn_list)
        return 0;
 }
 
-const char *ctdb_connection_list_to_string(
+char *ctdb_connection_list_to_string(
        TALLOC_CTX *mem_ctx,
        struct ctdb_connection_list *conn_list, bool client_first)
 {
index a51cbcdda98b7f5ec4bdf34906766655060ff51a..b01db8e99340b0c3d767cd51b27e10dcde71a060 100644 (file)
@@ -37,7 +37,7 @@ enum ctdb_event ctdb_event_from_string(const char *event_str);
  */
 int ctdb_sock_addr_to_buf(char *buf, socklen_t buflen,
                          ctdb_sock_addr *addr, bool with_port);
-const char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx,
+char *ctdb_sock_addr_to_string(TALLOC_CTX *mem_ctx,
                                     ctdb_sock_addr *addr, bool with_port);
 int ctdb_sock_addr_from_string(const char *str,
                               ctdb_sock_addr *addr, bool with_port);
@@ -57,16 +57,16 @@ bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1,
 
 int ctdb_connection_to_buf(char *buf, size_t buflen,
                           struct ctdb_connection * conn, bool client_first);
-const char *ctdb_connection_to_string(TALLOC_CTX *mem_ctx,
-                                     struct ctdb_connection * conn,
-                                     bool client_first);
+char *ctdb_connection_to_string(TALLOC_CTX *mem_ctx,
+                               struct ctdb_connection * conn,
+                               bool client_first);
 int ctdb_connection_from_string(const char *str, bool client_first,
                                struct ctdb_connection *conn);
 
 int ctdb_connection_list_add(struct ctdb_connection_list *conn_list,
                             struct ctdb_connection *conn);
 int ctdb_connection_list_sort(struct ctdb_connection_list *conn_list);
-const char *ctdb_connection_list_to_string(
+char *ctdb_connection_list_to_string(
        TALLOC_CTX *mem_ctx,
        struct ctdb_connection_list *conn_list, bool client_first);
 int ctdb_connection_list_read(TALLOC_CTX *mem_ctx,