The branch, master has been updated
       via  dfc98d7 messaging3: Remove an unnecessary variable
       via  f7fb9e2 messaging4: Simplify ping_message with server_id_str_buf()
       via  be2b891 messaging3: Simplify ping_message()
       via  7f623cb messaging3: Remove two procid_str_static calls
      from  3f6926d s3:smbd: remove unused client_get_tcp_info()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit dfc98d76b99c15404a3774790bee19e90f425ff7
Author: Volker Lendecke <[email protected]>
Date:   Wed Jul 9 13:34:59 2014 +0000

    messaging3: Remove an unnecessary variable
    
    We can inspect rec.buf with a debugger, no separate variable needed
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>
    
    Autobuild-User(master): Volker Lendecke <[email protected]>
    Autobuild-Date(master): Fri Jul 25 00:03:48 CEST 2014 on sn-devel-104

commit f7fb9e24b3d7e6506558c1fce900d954bcde608f
Author: Volker Lendecke <[email protected]>
Date:   Thu Jul 17 09:09:25 2014 +0000

    messaging4: Simplify ping_message with server_id_str_buf()
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit be2b89174087b570b61f1dbc321c46debc5f4f50
Author: Volker Lendecke <[email protected]>
Date:   Wed Jul 9 13:17:13 2014 +0000

    messaging3: Simplify ping_message()
    
    The talloc_strnup was only used to \0-terminate the data for printing. The
    same can be achieved by %.* in the printf format.
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

commit 7f623cbe7913d3a7572e8467d45b03b534f1534a
Author: Volker Lendecke <[email protected]>
Date:   Wed Jul 9 13:06:45 2014 +0000

    messaging3: Remove two procid_str_static calls
    
    ... and thus implicit talloc_tos() calls
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Stefan Metzmacher <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/messages.c            |   24 +++++++++---------------
 source4/lib/messaging/messaging.c |    5 ++---
 2 files changed, 11 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 9514392..bbc5183 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -90,17 +90,12 @@ static void ping_message(struct messaging_context *msg_ctx,
                         struct server_id src,
                         DATA_BLOB *data)
 {
-       const char *msg = "none";
-       char *free_me = NULL;
+       struct server_id_buf idbuf;
+
+       DEBUG(1, ("INFO: Received PING message from PID %s [%.*s]\n",
+                 server_id_str_buf(src, &idbuf), (int)data->length,
+                 data->data ? (char *)data->data : ""));
 
-       if (data->data != NULL) {
-               free_me = talloc_strndup(talloc_tos(), (char *)data->data,
-                                        data->length);
-               msg = free_me;
-       }
-       DEBUG(1,("INFO: Received PING message from PID %s [%s]\n",
-                procid_str_static(&src), msg));
-       TALLOC_FREE(free_me);
        messaging_send(msg_ctx, src, MSG_PONG, data);
 }
 
@@ -143,13 +138,15 @@ static int traverse_fn(struct db_record *rec, const 
struct server_id *id,
                                    (const uint8_t *)msg_all->buf, 
msg_all->len);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
+               struct server_id_buf idbuf;
 
                /*
                 * If the pid was not found delete the entry from
                 * serverid.tdb
                 */
 
-               DEBUG(2, ("pid %s doesn't exist\n", procid_str_static(id)));
+               DEBUG(2, ("pid %s doesn't exist\n",
+                         server_id_str_buf(*id, &idbuf)));
 
                dbwrap_record_delete(rec);
        }
@@ -431,20 +428,17 @@ NTSTATUS messaging_send_iov(struct messaging_context 
*msg_ctx,
        if (messaging_is_self_send(msg_ctx, &server)) {
                struct messaging_rec rec;
                uint8_t *buf;
-               DATA_BLOB data;
 
                buf = iov_buf(talloc_tos(), iov, iovlen);
                if (buf == NULL) {
                        return NT_STATUS_NO_MEMORY;
                }
 
-               data = data_blob_const(buf, talloc_get_size(buf));
-
                rec.msg_version = MESSAGE_VERSION;
                rec.msg_type = msg_type & MSG_TYPE_MASK;
                rec.dest = server;
                rec.src = msg_ctx->id;
-               rec.buf = data;
+               rec.buf = data_blob_const(buf, talloc_get_size(buf));
                messaging_dispatch_rec(msg_ctx, &rec);
                TALLOC_FREE(buf);
                return NT_STATUS_OK;
diff --git a/source4/lib/messaging/messaging.c 
b/source4/lib/messaging/messaging.c
index 4242b1c..ffa668a 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -113,11 +113,10 @@ static void irpc_handler(struct imessaging_context *, 
void *,
 static void ping_message(struct imessaging_context *msg, void *private_data,
                         uint32_t msg_type, struct server_id src, DATA_BLOB 
*data)
 {
-       char *task_id = server_id_str(NULL, &src);
+       struct server_id_buf idbuf;
        DEBUG(1,("INFO: Received PING message from server %s [%.*s]\n",
-                task_id, (int)data->length,
+                server_id_str_buf(src, &idbuf), (int)data->length,
                 data->data?(const char *)data->data:""));
-       talloc_free(task_id);
        imessaging_send(msg, src, MSG_PONG, data);
 }
 


-- 
Samba Shared Repository

Reply via email to