gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: MESSENGER: adjust code in service to red


From: gnunet
Subject: [gnunet] branch master updated: MESSENGER: adjust code in service to reduce warnings
Date: Mon, 02 Sep 2024 17:32:52 +0200

This is an automated email from the git hooks/post-receive script.

thejackimonster pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 64a43b8b5 MESSENGER: adjust code in service to reduce warnings
64a43b8b5 is described below

commit 64a43b8b58ff34b40bcc24aba051fdb559c2cd05
Author: Jacki <jacki@thejackimonster.de>
AuthorDate: Mon Sep 2 17:32:18 2024 +0200

    MESSENGER: adjust code in service to reduce warnings
    
    Signed-off-by: Jacki <jacki@thejackimonster.de>
---
 src/service/messenger/gnunet-service-messenger.c   | 277 +++++----
 .../messenger/gnunet-service-messenger_basement.c  |   8 +-
 .../messenger/gnunet-service-messenger_handle.c    | 227 +++++---
 .../gnunet-service-messenger_list_handles.c        |  18 +-
 .../gnunet-service-messenger_list_messages.c       |  55 +-
 .../messenger/gnunet-service-messenger_member.c    | 199 +++++--
 .../gnunet-service-messenger_member_session.c      | 256 +++++----
 .../gnunet-service-messenger_member_store.c        |  67 ++-
 .../gnunet-service-messenger_message_handle.c      |  86 +--
 .../gnunet-service-messenger_message_kind.c        |  25 +-
 .../gnunet-service-messenger_message_recv.c        |  97 ++--
 .../gnunet-service-messenger_message_send.c        |  68 ++-
 .../gnunet-service-messenger_message_state.c       |   8 +-
 .../gnunet-service-messenger_message_store.c       | 263 +++++----
 .../messenger/gnunet-service-messenger_operation.c |  73 ++-
 .../gnunet-service-messenger_operation_store.c     |  53 +-
 .../gnunet-service-messenger_peer_store.c          | 154 +++--
 .../messenger/gnunet-service-messenger_room.c      | 632 +++++++++++++--------
 .../messenger/gnunet-service-messenger_service.c   | 106 ++--
 .../gnunet-service-messenger_subscription.c        |  28 +-
 .../messenger/gnunet-service-messenger_tunnel.c    | 230 +++++---
 21 files changed, 1813 insertions(+), 1117 deletions(-)

diff --git a/src/service/messenger/gnunet-service-messenger.c 
b/src/service/messenger/gnunet-service-messenger.c
index 06f9384aa..b8e114235 100644
--- a/src/service/messenger/gnunet-service-messenger.c
+++ b/src/service/messenger/gnunet-service-messenger.c
@@ -43,7 +43,11 @@ static void
 handle_create (void *cls,
                const struct GNUNET_MESSENGER_CreateMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert (cls);
+  
+  msg_client = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handle created\n");
 
@@ -55,7 +59,11 @@ static void
 handle_destroy (void *cls,
                 const struct GNUNET_MESSENGER_DestroyMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert (cls);
+  
+  msg_client = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handle destroyed\n");
 
@@ -66,26 +74,34 @@ handle_destroy (void *cls,
 static enum GNUNET_GenericReturnValue
 check_room_initial_key (const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  const uint16_t full_length = ntohs (msg->header.size);
+  uint16_t full_length;
+  uint16_t msg_length;
+  const char *msg_buffer;
+
+  GNUNET_assert (msg);
+
+  full_length = ntohs (msg->header.size);
 
   if (full_length < sizeof(*msg))
     return GNUNET_NO;
 
-  const uint16_t msg_length = full_length - sizeof(*msg);
-  const char *msg_buffer = ((const char*) msg) + sizeof(*msg);
+  msg_length = full_length - sizeof(*msg);
+  msg_buffer = ((const char*) msg) + sizeof(*msg);
 
   if (0 == msg_length)
     return GNUNET_OK;
 
-  struct GNUNET_CRYPTO_PublicKey key;
-  size_t key_len;
+  {
+    struct GNUNET_CRYPTO_PublicKey key;
+    size_t key_len;
 
-  if (GNUNET_OK != GNUNET_CRYPTO_read_public_key_from_buffer (msg_buffer,
-                                                              msg_length,
-                                                              &key, &key_len))
-    return GNUNET_NO;
+    if (GNUNET_OK != GNUNET_CRYPTO_read_public_key_from_buffer (msg_buffer,
+                                                                msg_length,
+                                                                &key, 
&key_len))
+      return GNUNET_NO;
 
-  return key_len == msg_length ? GNUNET_OK : GNUNET_NO;
+    return key_len == msg_length ? GNUNET_OK : GNUNET_NO;
+  }
 }
 
 
@@ -93,11 +109,15 @@ static void
 initialize_handle_via_key (struct GNUNET_MESSENGER_SrvHandle *handle,
                            const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  GNUNET_assert (handle);
+  uint16_t full_length;
+  uint16_t msg_length;
+  const char *msg_buffer;
+
+  GNUNET_assert ((handle) && (msg));
 
-  const uint16_t full_length = ntohs (msg->header.size);
-  const uint16_t msg_length = full_length - sizeof(*msg);
-  const char *msg_buffer = ((const char*) msg) + sizeof(*msg);
+  full_length = ntohs (msg->header.size);
+  msg_length = full_length - sizeof(*msg);
+  msg_buffer = ((const char*) msg) + sizeof(*msg);
 
   if (msg_length > 0)
   {
@@ -130,7 +150,11 @@ static void
 handle_room_open (void *cls,
                   const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert ((cls) && (msg));
+
+  msg_client = cls;
 
   initialize_handle_via_key (msg_client->handle, msg);
 
@@ -140,18 +164,18 @@ handle_room_open (void *cls,
   if (GNUNET_YES == open_srv_handle_room (msg_client->handle, &(msg->key)))
   {
     struct GNUNET_HashCode prev;
+    const struct GNUNET_ShortHashCode *member_id;
+    struct GNUNET_MESSENGER_RoomMessage *response;
+    struct GNUNET_MQ_Envelope *env;
+
     sync_srv_handle_messages (msg_client->handle, &(msg->key), 
&(msg->previous),
                               &prev);
 
-    const struct GNUNET_ShortHashCode *member_id = get_srv_handle_member_id (
-      msg_client->handle, &(msg->key));
+    member_id = get_srv_handle_member_id (msg_client->handle, &(msg->key));
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opening room with member id: %s\n",
                 GNUNET_sh2s (member_id));
 
-    struct GNUNET_MESSENGER_RoomMessage *response;
-    struct GNUNET_MQ_Envelope *env;
-
     env = GNUNET_MQ_msg (response, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN);
     GNUNET_memcpy (&(response->key), &(msg->key), sizeof(response->key));
     GNUNET_memcpy (&(response->previous), &prev, sizeof(response->previous));
@@ -177,29 +201,33 @@ static void
 handle_room_entry (void *cls,
                    const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert ((cls) && (msg));
+
+  msg_client = cls;
 
   initialize_handle_via_key (msg_client->handle, msg);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Entering room: %s, %s\n", GNUNET_h2s (
-                &(msg->key)), GNUNET_i2s (&(msg->door)));
+              &(msg->key)), GNUNET_i2s (&(msg->door)));
 
   if (GNUNET_YES == entry_srv_handle_room (msg_client->handle, &(msg->door),
                                            &(msg->key)))
   {
     struct GNUNET_HashCode prev;
+    const struct GNUNET_ShortHashCode *member_id;
+    struct GNUNET_MESSENGER_RoomMessage *response;
+    struct GNUNET_MQ_Envelope *env;
+
     sync_srv_handle_messages (msg_client->handle, &(msg->key), 
&(msg->previous),
                               &prev);
 
-    const struct GNUNET_ShortHashCode *member_id = get_srv_handle_member_id (
-      msg_client->handle, &(msg->key));
+    member_id = get_srv_handle_member_id (msg_client->handle, &(msg->key));
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Entering room with member id: %s\n",
                 GNUNET_sh2s (member_id));
 
-    struct GNUNET_MESSENGER_RoomMessage *response;
-    struct GNUNET_MQ_Envelope *env;
-
     env = GNUNET_MQ_msg (response, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY);
     GNUNET_memcpy (&(response->door), &(msg->door), sizeof(response->door));
     GNUNET_memcpy (&(response->key), &(msg->key), sizeof(response->key));
@@ -219,19 +247,23 @@ static void
 handle_room_close (void *cls,
                    const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert (cls);
+
+  msg_client = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Closing room: %s\n", GNUNET_h2s (
                 &(msg->key)));
 
   if (GNUNET_YES == close_srv_handle_room (msg_client->handle, &(msg->key)))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Closing room succeeded: %s\n",
-                GNUNET_h2s (&(msg->key)));
-
     struct GNUNET_MESSENGER_RoomMessage *response;
     struct GNUNET_MQ_Envelope *env;
 
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Closing room succeeded: %s\n",
+                GNUNET_h2s (&(msg->key)));
+
     env = GNUNET_MQ_msg (response, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE);
     GNUNET_memcpy (&(response->key), &(msg->key), sizeof(response->key));
     GNUNET_memcpy (&(response->previous), &(msg->previous),
@@ -250,22 +282,28 @@ static void
 handle_room_sync (void *cls,
                   const struct GNUNET_MESSENGER_RoomMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert (cls);
+
+  msg_client = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Syncing room: %s\n", GNUNET_h2s (
                 &(msg->key)));
+  
+  {
+    struct GNUNET_HashCode prev;
+    struct GNUNET_MESSENGER_RoomMessage *response;
+    struct GNUNET_MQ_Envelope *env;
 
-  struct GNUNET_HashCode prev;
-  sync_srv_handle_messages (msg_client->handle, &(msg->key), &(msg->previous),
-                            &prev);
-
-  struct GNUNET_MESSENGER_RoomMessage *response;
-  struct GNUNET_MQ_Envelope *env;
+    sync_srv_handle_messages (msg_client->handle, &(msg->key), 
&(msg->previous),
+                              &prev);
 
-  env = GNUNET_MQ_msg (response, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SYNC);
-  GNUNET_memcpy (&(response->key), &(msg->key), sizeof(response->key));
-  GNUNET_memcpy (&(response->previous), &prev, sizeof(response->previous));
-  GNUNET_MQ_send (msg_client->handle->mq, env);
+    env = GNUNET_MQ_msg (response, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SYNC);
+    GNUNET_memcpy (&(response->key), &(msg->key), sizeof(response->key));
+    GNUNET_memcpy (&(response->previous), &prev, sizeof(response->previous));
+    GNUNET_MQ_send (msg_client->handle->mq, env);
+  }
 
   GNUNET_SERVICE_client_continue (msg_client->client);
 }
@@ -275,15 +313,20 @@ static enum GNUNET_GenericReturnValue
 check_send_message (void *cls,
                     const struct GNUNET_MESSENGER_SendMessage *msg)
 {
-  const uint16_t full_length = ntohs (msg->header.size);
+  uint16_t full_length;
+  uint16_t msg_length;
+  const char *msg_buffer;
+  struct GNUNET_MESSENGER_Message message;
+
+  GNUNET_assert (msg);
+
+  full_length = ntohs (msg->header.size);
 
   if (full_length < sizeof(*msg))
     return GNUNET_NO;
 
-  const uint16_t msg_length = full_length - sizeof(*msg);
-  const char *msg_buffer = ((const char*) msg) + sizeof(*msg);
-
-  struct GNUNET_MESSENGER_Message message;
+  msg_length = full_length - sizeof(*msg);
+  msg_buffer = ((const char*) msg) + sizeof(*msg);
 
   if (msg_length < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN,
                                           GNUNET_YES))
@@ -303,17 +346,19 @@ check_send_message (void *cls,
     return GNUNET_NO;
   }
 
-  enum GNUNET_GenericReturnValue allowed;
-  allowed = filter_message_sending (&message);
+  {
+    enum GNUNET_GenericReturnValue allowed;
+    allowed = filter_message_sending (&message);
 
-  if (GNUNET_SYSERR == allowed)
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Sending message not allowed: %s to %s\n",
-                GNUNET_MESSENGER_name_of_kind (message.header.kind),
-                GNUNET_h2s (&(msg->key)));
+    if (GNUNET_SYSERR == allowed)
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Sending message not allowed: %s to %s\n",
+                  GNUNET_MESSENGER_name_of_kind (message.header.kind),
+                  GNUNET_h2s (&(msg->key)));
 
-  cleanup_message (&message);
-  return GNUNET_SYSERR != allowed? GNUNET_OK : GNUNET_NO;
+    cleanup_message (&message);
+    return GNUNET_SYSERR != allowed? GNUNET_OK : GNUNET_NO;
+  }
 }
 
 
@@ -321,26 +366,35 @@ static void
 handle_send_message (void *cls,
                      const struct GNUNET_MESSENGER_SendMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+  const struct GNUNET_HashCode *key;
+  const char *msg_buffer;
+  uint16_t msg_length;
 
-  const struct GNUNET_HashCode *key = &(msg->key);
-  const char *msg_buffer = ((const char*) msg) + sizeof(*msg);
-  const uint16_t msg_length = ntohs (msg->header.size) - sizeof(*msg);
+  GNUNET_assert ((cls) && (msg));
+  
+  msg_client = cls;
 
-  struct GNUNET_MESSENGER_Message message;
-  decode_message (&message, msg_length, msg_buffer, GNUNET_YES, NULL);
+  key = &(msg->key);
+  msg_buffer = ((const char*) msg) + sizeof(*msg);
+  msg_length = ntohs (msg->header.size) - sizeof(*msg);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message: %s to %s (by %s)\n",
-              GNUNET_MESSENGER_name_of_kind (message.header.kind),
-              GNUNET_h2s (key),
-              GNUNET_sh2s (&(message.header.sender_id)));
+  {
+    struct GNUNET_MESSENGER_Message message;
+    decode_message (&message, msg_length, msg_buffer, GNUNET_YES, NULL);
 
-  if (GNUNET_YES != send_srv_handle_message (msg_client->handle, key, 
&message))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending message failed: %s to %s\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message: %s to %s (by %s)\n",
                 GNUNET_MESSENGER_name_of_kind (message.header.kind),
-                GNUNET_h2s (key));
+                GNUNET_h2s (key),
+                GNUNET_sh2s (&(message.header.sender_id)));
 
-  cleanup_message (&message);
+    if (GNUNET_YES != send_srv_handle_message (msg_client->handle, key, 
&message))
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending message failed: %s to 
%s\n",
+                  GNUNET_MESSENGER_name_of_kind (message.header.kind),
+                  GNUNET_h2s (key));
+
+    cleanup_message (&message);
+  }
 
   GNUNET_SERVICE_client_continue (msg_client->client);
 }
@@ -352,17 +406,22 @@ callback_found_message (void *cls,
                         const struct GNUNET_MESSENGER_Message *message,
                         const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+  struct GNUNET_MESSENGER_SenderSession session;
+
+  GNUNET_assert ((cls) && (room) && (hash));
+  
+  msg_client = cls;
 
   if (! message)
   {
+    struct GNUNET_MESSENGER_GetMessage *response;
+    struct GNUNET_MQ_Envelope *env;
+
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Notifying client about missing message: %s\n",
                 GNUNET_h2s (hash));
 
-    struct GNUNET_MESSENGER_GetMessage *response;
-    struct GNUNET_MQ_Envelope *env;
-
     env = GNUNET_MQ_msg (response,
                          GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE);
     GNUNET_memcpy (&(response->key), &(room->key), sizeof(room->key));
@@ -371,12 +430,11 @@ callback_found_message (void *cls,
     return;
   }
 
-  struct GNUNET_MESSENGER_SenderSession session;
-
   if (GNUNET_YES == is_peer_message (message))
   {
-    struct GNUNET_MESSENGER_PeerStore *store = get_srv_room_peer_store (room);
-
+    struct GNUNET_MESSENGER_PeerStore *store;
+    
+    store = get_srv_room_peer_store (room);
     session.peer = get_store_peer_of (store, message, hash);
 
     if (! session.peer)
@@ -389,10 +447,11 @@ callback_found_message (void *cls,
   }
   else
   {
-    struct GNUNET_MESSENGER_MemberStore *store = get_srv_room_member_store (
-      room);
-    struct GNUNET_MESSENGER_Member *member = get_store_member_of (store,
-                                                                  message);
+    struct GNUNET_MESSENGER_MemberStore *store;
+    struct GNUNET_MESSENGER_Member *member;
+    
+    store = get_srv_room_member_store (room);
+    member = get_store_member_of (store, message);
 
     if (! member)
     {
@@ -421,15 +480,23 @@ static void
 handle_get_message (void *cls,
                     const struct GNUNET_MESSENGER_GetMessage *msg)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+  const struct GNUNET_ShortHashCode *member_id;
+  struct GNUNET_MESSENGER_Member *member;
+  const struct GNUNET_CRYPTO_PublicKey *pubkey;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert ((cls) && (msg));
+  
+  msg_client = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting message from room: %s\n",
               GNUNET_h2s (&(msg->key)));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requested message: %s\n",
               GNUNET_h2s (&(msg->hash)));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (messenger,
-                                                            &(msg->key));
+  room = get_service_room (messenger, &(msg->key));
 
   if (! room)
   {
@@ -438,15 +505,16 @@ handle_get_message (void *cls,
     goto end_handling;
   }
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
+  {
+    struct GNUNET_MESSENGER_MemberStore *member_store;
+    member_store = get_srv_room_member_store (room);
 
-  const struct GNUNET_ShortHashCode *member_id;
-  member_id = get_srv_handle_member_id (msg_client->handle,
-                                        &(msg->key));
+    
+    member_id = get_srv_handle_member_id (msg_client->handle,
+                                          &(msg->key));
 
-  struct GNUNET_MESSENGER_Member *member = get_store_member (member_store,
-                                                             member_id);
+    member = get_store_member (member_store, member_id);
+  }
 
   if (! member)
   {
@@ -456,8 +524,7 @@ handle_get_message (void *cls,
     goto end_handling;
   }
 
-  const struct GNUNET_CRYPTO_PublicKey *pubkey = get_srv_handle_key (
-    msg_client->handle);
+  pubkey = get_srv_handle_key (msg_client->handle);
 
   if (! pubkey)
   {
@@ -467,8 +534,7 @@ handle_get_message (void *cls,
     goto end_handling;
   }
 
-  struct GNUNET_MESSENGER_MemberSession *session = get_member_session (member,
-                                                                       pubkey);
+  session = get_member_session (member, pubkey);
 
   if (! session)
   {
@@ -491,8 +557,11 @@ callback_client_connect (void *cls,
                          struct GNUNET_SERVICE_Client *client,
                          struct GNUNET_MQ_Handle *mq)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new (struct
-                                                           
GNUNET_MESSENGER_Client);
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert ((client) && (mq));
+  
+  msg_client = GNUNET_new (struct GNUNET_MESSENGER_Client);
 
   msg_client->client = client;
   msg_client->handle = add_service_handle (messenger, mq);
@@ -506,7 +575,11 @@ callback_client_disconnect (void *cls,
                             struct GNUNET_SERVICE_Client *client,
                             void *internal_cls)
 {
-  struct GNUNET_MESSENGER_Client *msg_client = internal_cls;
+  struct GNUNET_MESSENGER_Client *msg_client;
+
+  GNUNET_assert (internal_cls);
+  
+  msg_client = internal_cls;
 
   remove_service_handle (messenger, msg_client->handle);
 
@@ -526,6 +599,8 @@ run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *config,
      struct GNUNET_SERVICE_Handle *service)
 {
+  GNUNET_assert ((config) && (service));
+  
   messenger = create_service (config, service);
 
   if (! messenger)
diff --git a/src/service/messenger/gnunet-service-messenger_basement.c 
b/src/service/messenger/gnunet-service-messenger_basement.c
index 5d1d475e9..3ad88f62a 100644
--- a/src/service/messenger/gnunet-service-messenger_basement.c
+++ b/src/service/messenger/gnunet-service-messenger_basement.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2020--2023 GNUnet e.V.
+   Copyright (C) 2020--2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -28,10 +28,12 @@
 size_t
 count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels)
 {
+  const struct GNUNET_MESSENGER_ListTunnel *element;
+  size_t count;
+
   GNUNET_assert (tunnels);
 
-  const struct GNUNET_MESSENGER_ListTunnel *element;
-  size_t count = 0;
+  count = 0;
 
   for (element = tunnels->head; element; element = element->next)
     count++;
diff --git a/src/service/messenger/gnunet-service-messenger_handle.c 
b/src/service/messenger/gnunet-service-messenger_handle.c
index 97414d129..39a49149a 100644
--- a/src/service/messenger/gnunet-service-messenger_handle.c
+++ b/src/service/messenger/gnunet-service-messenger_handle.c
@@ -42,10 +42,11 @@ struct GNUNET_MESSENGER_SrvHandle*
 create_srv_handle (struct GNUNET_MESSENGER_Service *service,
                    struct GNUNET_MQ_Handle *mq)
 {
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+
   GNUNET_assert ((service) && (mq));
 
-  struct GNUNET_MESSENGER_SrvHandle *handle = GNUNET_new (struct
-                                                          
GNUNET_MESSENGER_SrvHandle);
+  handle = GNUNET_new (struct GNUNET_MESSENGER_SrvHandle);
 
   handle->service = service;
   handle->mq = mq;
@@ -65,7 +66,12 @@ iterate_close_rooms (void *cls,
                      const struct GNUNET_HashCode *key,
                      void *value)
 {
-  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+
+  GNUNET_assert ((cls) && (key));
+
+  handle = cls;
+
   close_service_room (handle->service, handle, key, GNUNET_NO);
   return GNUNET_YES;
 }
@@ -76,6 +82,8 @@ iterate_free_values (void *cls,
                      const struct GNUNET_HashCode *key,
                      void *value)
 {
+  GNUNET_assert (value);
+
   GNUNET_free (value);
   return GNUNET_YES;
 }
@@ -153,10 +161,11 @@ static enum GNUNET_GenericReturnValue
 create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
                          const struct GNUNET_HashCode *key)
 {
+  struct GNUNET_ShortHashCode *random_id;
+
   GNUNET_assert ((handle) && (key));
 
-  struct GNUNET_ShortHashCode *random_id = GNUNET_new (struct
-                                                       GNUNET_ShortHashCode);
+  random_id = GNUNET_new (struct GNUNET_ShortHashCode);
 
   if (! random_id)
     return GNUNET_NO;
@@ -195,10 +204,11 @@ change_srv_handle_member_id (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                              const struct GNUNET_HashCode *key,
                              const struct GNUNET_ShortHashCode *unique_id)
 {
+  struct GNUNET_ShortHashCode *member_id;
+
   GNUNET_assert ((handle) && (key) && (unique_id));
 
-  struct GNUNET_ShortHashCode *member_id = GNUNET_CONTAINER_multihashmap_get (
-    handle->member_ids, key);
+  member_id = GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key);
 
   if (! member_id)
   {
@@ -288,14 +298,16 @@ close_srv_handle_room (struct GNUNET_MESSENGER_SrvHandle 
*handle,
   if (! get_srv_handle_member_id (handle, key))
     return GNUNET_NO;
 
-  enum GNUNET_GenericReturnValue result;
-  result = close_service_room (handle->service, handle, key, GNUNET_YES);
+  {
+    enum GNUNET_GenericReturnValue result;
+    result = close_service_room (handle->service, handle, key, GNUNET_YES);
 
-  if (GNUNET_YES != result)
-    return result;
+    if (GNUNET_YES != result)
+      return result;
 
-  GNUNET_CONTAINER_multihashmap_remove_all (handle->routing, key);
-  return result;
+    GNUNET_CONTAINER_multihashmap_remove_all (handle->routing, key);
+    return result;
+  }
 }
 
 
@@ -315,10 +327,11 @@ sync_srv_handle_messages (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                           const struct GNUNET_HashCode *prev,
                           struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((handle) && (key) && (prev) && (hash));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (handle->service,
-                                                            key);
+  room = get_service_room (handle->service, key);
 
   if ((! room) || (! get_srv_handle_member_id (handle, key)))
   {
@@ -336,10 +349,12 @@ send_srv_handle_message (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                          const struct GNUNET_HashCode *key,
                          const struct GNUNET_MESSENGER_Message *message)
 {
+  const struct GNUNET_ShortHashCode *id;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((handle) && (key) && (message));
 
-  const struct GNUNET_ShortHashCode *id = get_srv_handle_member_id (handle,
-                                                                    key);
+  id = get_srv_handle_member_id (handle, key);
 
   if (! id)
   {
@@ -358,8 +373,7 @@ send_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle 
*handle,
     return GNUNET_NO;
   }
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (handle->service,
-                                                            key);
+  room = get_service_room (handle->service, key);
 
   if (! room)
   {
@@ -368,8 +382,18 @@ send_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle 
*handle,
     return GNUNET_NO;
   }
 
-  struct GNUNET_MESSENGER_Message *msg = copy_message (message);
-  return send_srv_room_message (room, handle, msg);
+  {
+    struct GNUNET_MESSENGER_Message *msg;
+    msg = copy_message (message);
+
+    if (! msg)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Copying message failed!\n");
+      return GNUNET_NO;
+    }
+    
+    return send_srv_room_message (room, handle, msg);
+  }
 }
 
 
@@ -377,6 +401,8 @@ static const struct GNUNET_HashCode*
 get_next_member_session_context (const struct
                                  GNUNET_MESSENGER_MemberSession *session)
 {
+  GNUNET_assert (session);
+
   if (session->next)
     return get_next_member_session_context (session->next);
   else
@@ -389,10 +415,12 @@ get_handle_member_session (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                            struct GNUNET_MESSENGER_SrvRoom *room,
                            const struct GNUNET_HashCode *key)
 {
+  const struct GNUNET_ShortHashCode *id;
+  const struct GNUNET_CRYPTO_PublicKey *pubkey;
+
   GNUNET_assert ((handle) && (room) && (key) && (handle->service));
 
-  const struct GNUNET_ShortHashCode *id = get_srv_handle_member_id (handle,
-                                                                    key);
+  id = get_srv_handle_member_id (handle, key);
 
   if (! id)
   {
@@ -402,10 +430,7 @@ get_handle_member_session (struct 
GNUNET_MESSENGER_SrvHandle *handle,
     return NULL;
   }
 
-  struct GNUNET_MESSENGER_MemberStore *store = get_srv_room_member_store 
(room);
-  struct GNUNET_MESSENGER_Member *member = get_store_member (store, id);
-
-  const struct GNUNET_CRYPTO_PublicKey *pubkey = get_srv_handle_key (handle);
+  pubkey = get_srv_handle_key (handle);
 
   if (! pubkey)
   {
@@ -415,7 +440,15 @@ get_handle_member_session (struct 
GNUNET_MESSENGER_SrvHandle *handle,
     return NULL;
   }
 
-  return get_member_session (member, pubkey);
+  {
+    struct GNUNET_MESSENGER_MemberStore *store;
+    struct GNUNET_MESSENGER_Member *member;
+    
+    store = get_srv_room_member_store (room);
+    member = get_store_member (store, id);
+
+    return get_member_session (member, pubkey);
+  }
 }
 
 
@@ -427,11 +460,18 @@ notify_srv_handle_message (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                            const struct GNUNET_HashCode *hash,
                            enum GNUNET_GenericReturnValue recent)
 {
+  const struct GNUNET_HashCode *key;
+  const struct GNUNET_ShortHashCode *id;
+  const struct GNUNET_HashCode *context;
+  struct GNUNET_TIME_Absolute timestamp;
+  const struct GNUNET_ShortHashCode *discourse;
+  struct GNUNET_MESSENGER_Subscription *subscription;
+  struct GNUNET_HashCode sender;
+
   GNUNET_assert ((handle) && (room) && (session) && (message) && (hash));
 
-  const struct GNUNET_HashCode *key = get_srv_room_key (room);
-  const struct GNUNET_ShortHashCode *id = get_srv_handle_member_id (handle, 
-                                                                    key);
+  key = get_srv_room_key (room);
+  id = get_srv_handle_member_id (handle, key);
 
   if ((! handle->mq) || (! id))
   {
@@ -440,31 +480,30 @@ notify_srv_handle_message (struct 
GNUNET_MESSENGER_SrvHandle *handle,
     return;
   }
 
-  struct GNUNET_HashCode sender;
-  const struct GNUNET_HashCode *context = NULL;
+  context = NULL;
 
   if (GNUNET_MESSENGER_KIND_TALK != message->header.kind)
     goto skip_message_filter;
 
-  struct GNUNET_TIME_Absolute timestamp =
-    GNUNET_TIME_absolute_ntoh(message->header.timestamp);
-  const struct GNUNET_ShortHashCode *discourse =
-    &(message->body.talk.discourse);
+  timestamp = GNUNET_TIME_absolute_ntoh(message->header.timestamp);
+  discourse = &(message->body.talk.discourse);
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  
-  if (! member_store)
-    return;
+  {
+    struct GNUNET_MESSENGER_MemberStore *member_store;
+    struct GNUNET_MESSENGER_Member *member;
 
-  struct GNUNET_MESSENGER_Member *member =
-    get_store_member (member_store, id);
-  
-  if (! member)
-    return;
+    member_store = get_srv_room_member_store (room);
+
+    if (! member_store)
+      return;
+
+    member = get_store_member (member_store, id);
 
-  struct GNUNET_MESSENGER_Subscription *subscription =
-    get_member_subscription(member, discourse);
+    if (! member)
+      return;
+
+    subscription = get_member_subscription(member, discourse);
+  }
   
   if ((! subscription) ||
       (GNUNET_YES != has_subscription_of_timestamp(subscription, timestamp)))
@@ -497,33 +536,35 @@ skip_message_filter:
               GNUNET_h2s (hash), GNUNET_MESSENGER_name_of_kind (
                 message->header.kind));
 
-  struct GNUNET_MESSENGER_RecvMessage *msg;
-  struct GNUNET_MQ_Envelope *env;
+  {
+    struct GNUNET_MESSENGER_RecvMessage *msg;
+    struct GNUNET_MQ_Envelope *env;
 
-  uint16_t length = get_message_size (message, GNUNET_YES);
+    uint16_t length = get_message_size (message, GNUNET_YES);
 
-  env = GNUNET_MQ_msg_extra (msg, length,
-                             GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE);
+    env = GNUNET_MQ_msg_extra (msg, length,
+                              GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE);
 
-  GNUNET_memcpy (&(msg->key), key, sizeof(msg->key));
-  GNUNET_memcpy (&(msg->sender), &sender, sizeof(msg->sender));
-  GNUNET_memcpy (&(msg->context), context, sizeof(msg->context));
-  GNUNET_memcpy (&(msg->hash), hash, sizeof(msg->hash));
+    GNUNET_memcpy (&(msg->key), key, sizeof(msg->key));
+    GNUNET_memcpy (&(msg->sender), &sender, sizeof(msg->sender));
+    GNUNET_memcpy (&(msg->context), context, sizeof(msg->context));
+    GNUNET_memcpy (&(msg->hash), hash, sizeof(msg->hash));
 
-  msg->flags = (uint32_t) GNUNET_MESSENGER_FLAG_NONE;
+    msg->flags = (uint32_t) GNUNET_MESSENGER_FLAG_NONE;
 
-  if (GNUNET_YES == is_peer_message (message))
-    msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_PEER;
-  else if (get_handle_member_session (handle, room, key) == session->member)
-    msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_SENT;
+    if (GNUNET_YES == is_peer_message (message))
+      msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_PEER;
+    else if (get_handle_member_session (handle, room, key) == session->member)
+      msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_SENT;
 
-  if (GNUNET_YES == recent)
-    msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_RECENT;
+    if (GNUNET_YES == recent)
+      msg->flags |= (uint32_t) GNUNET_MESSENGER_FLAG_RECENT;
 
-  char *buffer = ((char*) msg) + sizeof(*msg);
-  encode_message (message, length, buffer, GNUNET_YES);
+    char *buffer = ((char*) msg) + sizeof(*msg);
+    encode_message (message, length, buffer, GNUNET_YES);
 
-  GNUNET_MQ_send (handle->mq, env);
+    GNUNET_MQ_send (handle->mq, env);
+  }
 }
 
 
@@ -532,23 +573,30 @@ iterate_next_member_ids (void *cls,
                          const struct GNUNET_HashCode *key,
                          void *value)
 {
-  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
-  struct GNUNET_MESSENGER_NextMemberId *next = value;
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+  struct GNUNET_MESSENGER_NextMemberId *next;
+
+  GNUNET_assert ((cls) && (value));
+
+  handle = cls;
+  next = value;
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Notifying client about next member id: %s (%s)\n",
               GNUNET_sh2s (&(next->id)), GNUNET_h2s (key));
 
-  struct GNUNET_MESSENGER_MemberMessage *msg;
-  struct GNUNET_MQ_Envelope *env;
+  {
+    struct GNUNET_MESSENGER_MemberMessage *msg;
+    struct GNUNET_MQ_Envelope *env;
 
-  env = GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID);
+    env = GNUNET_MQ_msg (msg, 
GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID);
 
-  GNUNET_memcpy (&(msg->key), key, sizeof(*key));
-  GNUNET_memcpy (&(msg->id), &(next->id), sizeof(next->id));
-  msg->reset = (uint32_t) next->reset;
+    GNUNET_memcpy (&(msg->key), key, sizeof(*key));
+    GNUNET_memcpy (&(msg->id), &(next->id), sizeof(next->id));
+    msg->reset = (uint32_t) next->reset;
 
-  GNUNET_MQ_send (handle->mq, env);
+    GNUNET_MQ_send (handle->mq, env);
+  }
 
   GNUNET_free (next);
   return GNUNET_YES;
@@ -558,7 +606,11 @@ iterate_next_member_ids (void *cls,
 static void
 task_notify_srv_handle_member_id (void *cls)
 {
-  struct GNUNET_MESSENGER_SrvHandle *handle = cls;
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+
+  GNUNET_assert (cls);
+
+  handle = cls;
   handle->notify = NULL;
 
   GNUNET_CONTAINER_multihashmap_iterate (handle->next_ids,
@@ -573,26 +625,35 @@ notify_srv_handle_member_id (struct 
GNUNET_MESSENGER_SrvHandle *handle,
                              const struct GNUNET_ShortHashCode *member_id,
                              enum GNUNET_GenericReturnValue reset)
 {
+  struct GNUNET_MESSENGER_NextMemberId *next;
+  struct GNUNET_MESSENGER_NextMemberId *prev;
+  const struct GNUNET_HashCode *key;
+
   GNUNET_assert ((handle) && (room) && (member_id));
 
-  struct GNUNET_MESSENGER_NextMemberId *next = GNUNET_new (struct
-                                                           
GNUNET_MESSENGER_NextMemberId);
+  next = GNUNET_new (struct GNUNET_MESSENGER_NextMemberId);
+  key = get_srv_room_key (room);
+  
   if (! next)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Allocation of next member id failed: %s (%s)\n",
+                GNUNET_sh2s (member_id), GNUNET_h2s (key));
     return;
   }
 
   GNUNET_memcpy (&(next->id), member_id, sizeof(next->id));
   next->reset = reset;
 
-  const struct GNUNET_HashCode *key = get_srv_room_key (room);
+  prev = GNUNET_CONTAINER_multihashmap_get (handle->next_ids, key);
 
-  struct GNUNET_MESSENGER_NextMemberId *prev =
-    GNUNET_CONTAINER_multihashmap_get (handle->next_ids, key);
   if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_put (handle->next_ids, key,
                                                        next,
                                                        
GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Update of next member id failed: %s (%s)\n",
+                GNUNET_sh2s (member_id), GNUNET_h2s (key));
     return;
   }
 
diff --git a/src/service/messenger/gnunet-service-messenger_list_handles.c 
b/src/service/messenger/gnunet-service-messenger_list_handles.c
index 6002dfe7b..846f3427b 100644
--- a/src/service/messenger/gnunet-service-messenger_list_handles.c
+++ b/src/service/messenger/gnunet-service-messenger_list_handles.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2020--2023 GNUnet e.V.
+   Copyright (C) 2020--2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -60,11 +60,11 @@ void
 add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
                  struct GNUNET_MESSENGER_SrvHandle *handle)
 {
-  GNUNET_assert ((handles) && (handle));
+  struct GNUNET_MESSENGER_ListHandle *element;
 
-  struct GNUNET_MESSENGER_ListHandle *element = GNUNET_new (struct
-                                                            
GNUNET_MESSENGER_ListHandle);
+  GNUNET_assert ((handles) && (handle));
 
+  element = GNUNET_new (struct GNUNET_MESSENGER_ListHandle);
   element->handle = handle;
 
   GNUNET_CONTAINER_DLL_insert_tail (handles->head, handles->tail, element);
@@ -75,10 +75,10 @@ enum GNUNET_GenericReturnValue
 remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
                     struct GNUNET_MESSENGER_SrvHandle *handle)
 {
-  GNUNET_assert ((handles) && (handle));
-
   struct GNUNET_MESSENGER_ListHandle *element;
 
+  GNUNET_assert ((handles) && (handle));
+
   for (element = handles->head; element; element = element->next)
     if (element->handle == handle)
       break;
@@ -97,10 +97,12 @@ struct GNUNET_MESSENGER_SrvHandle*
 find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles,
                             const struct GNUNET_HashCode *key)
 {
+  struct GNUNET_MESSENGER_ListHandle *element;
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+
   GNUNET_assert ((handles) && (key));
 
-  struct GNUNET_MESSENGER_ListHandle *element;
-  struct GNUNET_MESSENGER_SrvHandle *handle = NULL;
+  handle = NULL;
 
   for (element = handles->head; element; element = element->next)
   {
diff --git a/src/service/messenger/gnunet-service-messenger_list_messages.c 
b/src/service/messenger/gnunet-service-messenger_list_messages.c
index cd59c8aec..29cf91f7c 100644
--- a/src/service/messenger/gnunet-service-messenger_list_messages.c
+++ b/src/service/messenger/gnunet-service-messenger_list_messages.c
@@ -59,10 +59,11 @@ void
 add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
                       const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_ListMessage *element;
+
   GNUNET_assert ((messages) && (hash));
 
-  struct GNUNET_MESSENGER_ListMessage *element = GNUNET_new (struct
-                                                             
GNUNET_MESSENGER_ListMessage);
+  element = GNUNET_new (struct GNUNET_MESSENGER_ListMessage);
 
   GNUNET_memcpy (&(element->hash), hash, sizeof(struct GNUNET_HashCode));
 
@@ -74,10 +75,10 @@ void
 copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
                     const struct GNUNET_MESSENGER_ListMessages *origin)
 {
-  GNUNET_assert ((messages) && (origin));
-
   struct GNUNET_MESSENGER_ListMessage *element;
 
+  GNUNET_assert ((messages) && (origin));
+
   for (element = origin->head; element; element = element->next)
     add_to_list_messages (messages, &(element->hash));
 }
@@ -87,10 +88,10 @@ void
 remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
                            const struct GNUNET_HashCode *hash)
 {
-  GNUNET_assert ((messages) && (hash));
-
   struct GNUNET_MESSENGER_ListMessage *element;
 
+  GNUNET_assert ((messages) && (hash));
+
   for (element = messages->head; element; element = element->next)
     if (0 == GNUNET_CRYPTO_hash_cmp (&(element->hash), hash))
     {
@@ -105,27 +106,28 @@ void
 load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
                     const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+  struct GNUNET_HashCode hash;
+  ssize_t len;
+
   GNUNET_assert ((messages) && (path));
 
   if (GNUNET_YES != GNUNET_DISK_file_test (path))
     return;
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
+
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
 
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_READ, permission
-    );
+    handle = GNUNET_DISK_file_open (path, GNUNET_DISK_OPEN_READ, permission);
+  }
 
   if (! handle)
     return;
 
   GNUNET_DISK_file_seek (handle, 0, GNUNET_DISK_SEEK_SET);
 
-  struct GNUNET_HashCode hash;
-  ssize_t len;
-
   do {
     len = GNUNET_DISK_file_read (handle, &hash, sizeof(hash));
 
@@ -143,25 +145,30 @@ void
 save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
                     const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+
   GNUNET_assert ((messages) && (path));
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
 
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
-    );
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
+    
+    handle = GNUNET_DISK_file_open (
+      path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission);
+  }
 
   if (! handle)
     return;
 
   GNUNET_DISK_file_seek (handle, 0, GNUNET_DISK_SEEK_SET);
 
-  struct GNUNET_MESSENGER_ListMessage *element;
+  {
+    struct GNUNET_MESSENGER_ListMessage *element;
 
-  for (element = messages->head; element; element = element->next)
-    GNUNET_DISK_file_write (handle, &(element->hash), sizeof(element->hash));
+    for (element = messages->head; element; element = element->next)
+      GNUNET_DISK_file_write (handle, &(element->hash), sizeof(element->hash));
+  }
 
   GNUNET_DISK_file_sync (handle);
   GNUNET_DISK_file_close (handle);
diff --git a/src/service/messenger/gnunet-service-messenger_member.c 
b/src/service/messenger/gnunet-service-messenger_member.c
index 552fab859..29e770f9c 100644
--- a/src/service/messenger/gnunet-service-messenger_member.c
+++ b/src/service/messenger/gnunet-service-messenger_member.c
@@ -34,11 +34,11 @@ struct GNUNET_MESSENGER_Member*
 create_member (struct GNUNET_MESSENGER_MemberStore *store,
                const struct GNUNET_ShortHashCode *id)
 {
-  GNUNET_assert (store);
+  struct GNUNET_MESSENGER_Member *member;
 
-  struct GNUNET_MESSENGER_Member *member = GNUNET_new (struct
-                                                       
GNUNET_MESSENGER_Member);
+  GNUNET_assert (store);
 
+  member = GNUNET_new (struct GNUNET_MESSENGER_Member);
   member->store = store;
 
   if (id)
@@ -62,7 +62,12 @@ iterate_destroy_session (void *cls,
                          const struct GNUNET_HashCode *key,
                          void *value)
 {
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert (value);
+
+  session = value;
+
   destroy_member_session (session);
   return GNUNET_YES;
 }
@@ -73,7 +78,12 @@ iterate_destroy_subscription (void *cls,
                               const struct GNUNET_ShortHashCode *key,
                               void *value)
 {
-  struct GNUNET_MESSENGER_Subscription *subscription = value;
+  struct GNUNET_MESSENGER_Subscription *subscription;
+
+  GNUNET_assert (value);
+  
+  subscription = value;
+
   destroy_subscription (subscription);
   return GNUNET_YES;
 }
@@ -109,7 +119,11 @@ static enum GNUNET_GenericReturnValue
 callback_scan_for_sessions (void *cls,
                             const char *filename)
 {
-  struct GNUNET_MESSENGER_Member *member = cls;
+  struct GNUNET_MESSENGER_Member *member;
+
+  GNUNET_assert ((cls) && (filename));
+  
+  member = cls;
 
   if (GNUNET_YES == GNUNET_DISK_directory_test (filename, GNUNET_YES))
   {
@@ -129,12 +143,15 @@ void
 load_member (struct GNUNET_MESSENGER_MemberStore *store,
              const char *directory)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  struct GNUNET_MESSENGER_Member *member;
+  char *config_file;
+
   GNUNET_assert ((store) && (directory));
 
-  char *config_file;
   GNUNET_asprintf (&config_file, "%s%s", directory, "member.cfg");
 
-  struct GNUNET_MESSENGER_Member *member = NULL;
+  member = NULL;
 
   if (GNUNET_YES != GNUNET_DISK_file_test (config_file))
     goto free_config;
@@ -142,7 +159,10 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load member configuration: %s\n",
               config_file);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    goto free_config;
 
   if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file))
   {
@@ -156,7 +176,6 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store,
   }
 
 destroy_config:
-
   GNUNET_CONFIGURATION_destroy (cfg);
 
 free_config:
@@ -165,13 +184,15 @@ free_config:
   if (! member)
     return;
 
-  char *scan_dir;
-  GNUNET_asprintf (&scan_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR);
+  {
+    char *scan_dir;
+    GNUNET_asprintf (&scan_dir, "%s%s%c", directory, "sessions", 
DIR_SEPARATOR);
 
-  if (GNUNET_OK == GNUNET_DISK_directory_test (scan_dir, GNUNET_YES))
-    GNUNET_DISK_directory_scan (scan_dir, callback_scan_for_sessions, member);
+    if (GNUNET_OK == GNUNET_DISK_directory_test (scan_dir, GNUNET_YES))
+      GNUNET_DISK_directory_scan (scan_dir, callback_scan_for_sessions, 
member);
 
-  GNUNET_free (scan_dir);
+    GNUNET_free (scan_dir);
+  }
 }
 
 
@@ -180,16 +201,26 @@ iterate_load_next_session (void *cls,
                            const struct GNUNET_HashCode *key,
                            void *value)
 {
-  const char *sessions_directory = cls;
-
+  const char *sessions_directory;
   char *load_dir;
+
+  GNUNET_assert ((cls) && (key));
+  
+  sessions_directory = cls;
+
   GNUNET_asprintf (&load_dir, "%s%s%c", sessions_directory, GNUNET_h2s (key),
                    DIR_SEPARATOR);
 
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  {
+    struct GNUNET_MESSENGER_MemberSession *session;
+
+    GNUNET_assert (value);
+    
+    session = value;
 
-  if (GNUNET_YES == GNUNET_DISK_directory_test (load_dir, GNUNET_YES))
-    load_member_session_next (session, load_dir);
+    if (GNUNET_YES == GNUNET_DISK_directory_test (load_dir, GNUNET_YES))
+      load_member_session_next (session, load_dir);
+  }
 
   GNUNET_free (load_dir);
   return GNUNET_YES;
@@ -200,9 +231,10 @@ void
 load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member,
                            const char *directory)
 {
+  char *load_dir;
+
   GNUNET_assert ((member) && (directory));
 
-  char *load_dir;
   GNUNET_asprintf (&load_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR);
 
   GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
@@ -217,17 +249,27 @@ iterate_save_session (void *cls,
                       const struct GNUNET_HashCode *key,
                       void *value)
 {
-  const char *sessions_directory = cls;
-
+  const char *sessions_directory;
   char *save_dir;
+
+  GNUNET_assert ((cls) && (key));
+  
+  sessions_directory = cls;
+
   GNUNET_asprintf (&save_dir, "%s%s%c", sessions_directory, GNUNET_h2s (key),
                    DIR_SEPARATOR);
 
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  {
+    struct GNUNET_MESSENGER_MemberSession *session;
 
-  if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
-      (GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
-    save_member_session (session, save_dir);
+    GNUNET_assert (value);
+    
+    session = value;
+
+    if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
+        (GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
+      save_member_session (session, save_dir);
+  }
 
   GNUNET_free (save_dir);
   return GNUNET_YES;
@@ -238,18 +280,24 @@ void
 save_member (struct GNUNET_MESSENGER_Member *member,
              const char *directory)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  char *config_file;
+  char *id_data;
+
   GNUNET_assert ((member) && (directory));
 
-  char *config_file;
   GNUNET_asprintf (&config_file, "%s%s", directory, "member.cfg");
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save member configuration: %s\n",
               config_file);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
 
-  char *id_data = GNUNET_STRINGS_data_to_string_alloc (&(member->id),
-                                                       sizeof(member->id));
+  if (! cfg)
+    goto free_config;
+
+  id_data = GNUNET_STRINGS_data_to_string_alloc (&(member->id),
+                                                 sizeof(member->id));
 
   if (id_data)
   {
@@ -261,17 +309,20 @@ save_member (struct GNUNET_MESSENGER_Member *member,
   GNUNET_CONFIGURATION_write (cfg, config_file);
   GNUNET_CONFIGURATION_destroy (cfg);
 
+free_config:
   GNUNET_free (config_file);
 
-  char *save_dir;
-  GNUNET_asprintf (&save_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR);
+  {
+    char *save_dir;
+    GNUNET_asprintf (&save_dir, "%s%s%c", directory, "sessions", 
DIR_SEPARATOR);
 
-  if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
-      (GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
-    GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
-                                           iterate_save_session, save_dir);
+    if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
+        (GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
+      GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
+                                            iterate_save_session, save_dir);
 
-  GNUNET_free (save_dir);
+    GNUNET_free (save_dir);
+  }
 }
 
 
@@ -296,7 +347,11 @@ iterate_sync_session_contact (void *cls,
                               const struct GNUNET_HashCode *key,
                               void *value)
 {
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert (value);
+  
+  session = value;
 
   if (session->next)
     sync_session_contact_from_next (session, session->next);
@@ -319,9 +374,10 @@ struct GNUNET_MESSENGER_MemberSession*
 get_member_session (const struct GNUNET_MESSENGER_Member *member,
                     const struct GNUNET_CRYPTO_PublicKey *public_key)
 {
+  struct GNUNET_HashCode hash;
+
   GNUNET_assert ((member) && (public_key));
 
-  struct GNUNET_HashCode hash;
   GNUNET_CRYPTO_hash (public_key, sizeof(*public_key), &hash);
 
   return GNUNET_CONTAINER_multihashmap_get (member->sessions, &hash);
@@ -341,8 +397,13 @@ iterate_search_session (void *cls,
                         const struct GNUNET_HashCode *key,
                         void *value)
 {
-  struct GNUNET_MESSENGER_ClosureSearchSession *search = cls;
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  struct GNUNET_MESSENGER_ClosureSearchSession *search;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert ((cls) && (value));
+
+  search = cls;
+  session = value;
 
   if (GNUNET_OK != verify_member_session_as_sender (session, search->message,
                                                     search->hash))
@@ -357,8 +418,11 @@ static struct GNUNET_MESSENGER_MemberSession*
 try_member_session (struct GNUNET_MESSENGER_Member *member,
                     const struct GNUNET_CRYPTO_PublicKey *public_key)
 {
-  struct GNUNET_MESSENGER_MemberSession *session = get_member_session (member,
-                                                                       
public_key);
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert ((member) && (public_key));
+  
+  session = get_member_session (member, public_key);
 
   if (session)
     return session;
@@ -384,16 +448,18 @@ get_member_session_of (struct GNUNET_MESSENGER_Member 
*member,
   if (GNUNET_MESSENGER_KIND_JOIN == message->header.kind)
     return try_member_session (member, &(message->body.join.key));
 
-  struct GNUNET_MESSENGER_ClosureSearchSession search;
+  {
+    struct GNUNET_MESSENGER_ClosureSearchSession search;
 
-  search.message = message;
-  search.hash = hash;
+    search.message = message;
+    search.hash = hash;
 
-  search.match = NULL;
-  GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
-                                         iterate_search_session, &search);
+    search.match = NULL;
+    GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
+                                          iterate_search_session, &search);
 
-  return search.match;
+    return search.match;
+  }
 }
 
 
@@ -401,15 +467,15 @@ void
 add_member_session (struct GNUNET_MESSENGER_Member *member,
                     struct GNUNET_MESSENGER_MemberSession *session)
 {
+  const struct GNUNET_CRYPTO_PublicKey *public_key;
+  struct GNUNET_HashCode hash;
+
   if (! session)
     return;
 
   GNUNET_assert ((member) && (session->member == member));
 
-  const struct GNUNET_CRYPTO_PublicKey *public_key =
-    get_member_session_public_key (session);
-
-  struct GNUNET_HashCode hash;
+  public_key = get_member_session_public_key (session);
   GNUNET_CRYPTO_hash (public_key, sizeof(*public_key), &hash);
 
   if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (
@@ -425,12 +491,12 @@ void
 remove_member_session (struct GNUNET_MESSENGER_Member *member,
                        struct GNUNET_MESSENGER_MemberSession *session)
 {
-  GNUNET_assert ((member) && (session) && (session->member == member));
+  const struct GNUNET_CRYPTO_PublicKey *public_key;
+  struct GNUNET_HashCode hash;
 
-  const struct GNUNET_CRYPTO_PublicKey *public_key =
-    get_member_session_public_key (session);
+  GNUNET_assert ((member) && (session) && (session->member == member));
 
-  struct GNUNET_HashCode hash;
+  public_key = get_member_session_public_key (session);
   GNUNET_CRYPTO_hash (public_key, sizeof(*public_key), &hash);
 
   if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (member->sessions,
@@ -452,8 +518,13 @@ iterate_member_sessions_it (void *cls,
                             const struct GNUNET_HashCode *key,
                             void *value)
 {
-  struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls;
-  struct GNUNET_MESSENGER_MemberSession *session = value;
+  struct GNUNET_MESSENGER_ClosureIterateSessions *iterate;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
+  GNUNET_assert ((cls) && (value));
+
+  iterate = cls;
+  session = value;
 
   return iterate->it (iterate->cls, get_member_session_public_key (session),
                       session);
@@ -482,9 +553,10 @@ void
 add_member_subscription (struct GNUNET_MESSENGER_Member *member,
                          struct GNUNET_MESSENGER_Subscription *subscription)
 {
+  const struct GNUNET_ShortHashCode *discourse;
+
   GNUNET_assert ((member) && (member->subscriptions) && (subscription));
 
-  const struct GNUNET_ShortHashCode *discourse;
   discourse = get_subscription_discourse(subscription);
 
   if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put (
@@ -500,9 +572,10 @@ void
 remove_member_subscription (struct GNUNET_MESSENGER_Member *member,
                             struct GNUNET_MESSENGER_Subscription *subscription)
 {
+  const struct GNUNET_ShortHashCode *discourse;
+
   GNUNET_assert ((member) && (member->subscriptions) && (subscription));
 
-  const struct GNUNET_ShortHashCode *discourse;
   discourse = get_subscription_discourse(subscription);
 
   if (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove 
(member->subscriptions,
diff --git a/src/service/messenger/gnunet-service-messenger_member_session.c 
b/src/service/messenger/gnunet-service-messenger_member_session.c
index ed1fd75b7..5b73db1a8 100644
--- a/src/service/messenger/gnunet-service-messenger_member_session.c
+++ b/src/service/messenger/gnunet-service-messenger_member_session.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2021--2023 GNUnet e.V.
+   Copyright (C) 2021--2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -34,11 +34,12 @@ struct GNUNET_MESSENGER_MemberSession*
 create_member_session (struct GNUNET_MESSENGER_Member *member,
                        const struct GNUNET_CRYPTO_PublicKey *pubkey)
 {
+  struct GNUNET_MESSENGER_MemberSession *session;
+
   if ((! member) || (! pubkey) || (! (member->store)))
     return NULL;
 
-  struct GNUNET_MESSENGER_MemberSession *session = GNUNET_new (struct
-                                                               
GNUNET_MESSENGER_MemberSession);
+  session = GNUNET_new (struct GNUNET_MESSENGER_MemberSession);
   session->member = member;
 
   GNUNET_memcpy (&(session->public_key), pubkey, sizeof(session->public_key));
@@ -48,15 +49,18 @@ create_member_session (struct GNUNET_MESSENGER_Member 
*member,
     get_member_session_id (session),
     &(session->context)
     );
+  
+  {
+    struct GNUNET_MESSENGER_ContactStore *store;
 
-  struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store (
-    session->member->store);
+    store = get_member_contact_store (session->member->store);
 
-  session->contact = get_store_contact (
-    store,
-    get_member_session_context (session),
-    get_member_session_public_key (session)
-    );
+    session->contact = get_store_contact (
+      store,
+      get_member_session_context (session),
+      get_member_session_public_key (session)
+      );
+  }
 
   if (! (session->contact))
   {
@@ -85,6 +89,12 @@ create_member_session (struct GNUNET_MESSENGER_Member 
*member,
 static void
 check_member_session_completion (struct GNUNET_MESSENGER_MemberSession 
*session)
 {
+  const struct GNUNET_HashCode *start;
+  const struct GNUNET_HashCode *end;
+  struct GNUNET_MESSENGER_MessageStore *msg_store;
+  struct GNUNET_MESSENGER_ListMessages level;
+  struct GNUNET_MESSENGER_ListMessages list;
+
   GNUNET_assert (session);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -97,18 +107,14 @@ check_member_session_completion (struct 
GNUNET_MESSENGER_MemberSession *session)
     goto completion;
   }
 
-  const struct GNUNET_HashCode *start = &(session->messages.head->hash);
-  const struct GNUNET_HashCode *end = &(session->messages.tail->hash);
+  start = &(session->messages.head->hash);
+  end = &(session->messages.tail->hash);
 
-  struct GNUNET_MESSENGER_ListMessages level;
-  init_list_messages (&level);
+  msg_store = get_srv_room_message_store (session->member->store->room);
 
+  init_list_messages (&level);
   add_to_list_messages (&level, end);
 
-  struct GNUNET_MESSENGER_MessageStore *store = get_srv_room_message_store (
-    session->member->store->room);
-
-  struct GNUNET_MESSENGER_ListMessages list;
   init_list_messages (&list);
 
   while (level.head)
@@ -117,8 +123,10 @@ check_member_session_completion (struct 
GNUNET_MESSENGER_MemberSession *session)
 
     for (element = level.head; element; element = element->next)
     {
-      const struct GNUNET_MESSENGER_MessageLink *link = get_store_message_link 
(
-        store, &(element->hash), GNUNET_NO
+      const struct GNUNET_MESSENGER_MessageLink *link;
+
+      link = get_store_message_link (
+        msg_store, &(element->hash), GNUNET_NO
         );
 
       if (! link)
@@ -151,11 +159,12 @@ check_member_session_completion (struct 
GNUNET_MESSENGER_MemberSession *session)
 completion:
   if (GNUNET_YES == is_member_session_completed (session))
   {
+    struct GNUNET_MESSENGER_ContactStore *store;
+
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Completed session history (%s)\n",
                 GNUNET_sh2s (get_member_session_id (session)));
 
-    struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store (
-      session->member->store);
+    store = get_member_contact_store (session->member->store);
 
     if ((session->contact) && (GNUNET_YES == decrease_contact_rc (
                                  session->contact)))
@@ -175,7 +184,11 @@ iterate_copy_history (void *cls,
                       const struct GNUNET_HashCode *key,
                       void *value)
 {
-  struct GNUNET_MESSENGER_MemberSession *next = cls;
+  struct GNUNET_MESSENGER_MemberSession *next;
+
+  GNUNET_assert ((cls) && (key));
+  
+  next = cls;
 
   GNUNET_CONTAINER_multihashmap_put (next->history, key, (value? next : NULL),
                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
@@ -189,14 +202,15 @@ switch_member_session (struct 
GNUNET_MESSENGER_MemberSession *session,
                        const struct GNUNET_MESSENGER_Message *message,
                        const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_MemberSession *next;
+
   if ((! session) || (! message) || (! hash))
     return NULL;
 
   GNUNET_assert ((GNUNET_MESSENGER_KIND_ID == message->header.kind) ||
                  (GNUNET_MESSENGER_KIND_KEY == message->header.kind));
 
-  struct GNUNET_MESSENGER_MemberSession *next = GNUNET_new (struct
-                                                            
GNUNET_MESSENGER_MemberSession);
+  next = GNUNET_new (struct GNUNET_MESSENGER_MemberSession);
 
   if (GNUNET_MESSENGER_KIND_ID == message->header.kind)
     next->member = add_store_member (session->member->store,
@@ -264,14 +278,15 @@ switch_member_session (struct 
GNUNET_MESSENGER_MemberSession *session,
 void
 destroy_member_session (struct GNUNET_MESSENGER_MemberSession *session)
 {
+  struct GNUNET_MESSENGER_Contact *contact;
+
   GNUNET_assert (session);
 
   GNUNET_CONTAINER_multihashmap_destroy (session->history);
 
   clear_list_messages (&(session->messages));
 
-  struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact (
-    session);
+  contact = get_member_session_contact ( session);
 
   if ((contact) && (GNUNET_YES == decrease_contact_rc (contact)))
     remove_store_contact (
@@ -288,15 +303,20 @@ enum GNUNET_GenericReturnValue
 reset_member_session (struct GNUNET_MESSENGER_MemberSession *session,
                       const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Contact *contact;
+
   GNUNET_assert ((session) && (hash));
 
-  struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store (
-    session->member->store);
-  struct GNUNET_MESSENGER_Contact *contact = get_store_contact (
-    store,
-    get_member_session_context (session),
-    get_member_session_public_key (session)
-    );
+  {
+    struct GNUNET_MESSENGER_ContactStore *store;
+
+    store = get_member_contact_store (session->member->store);
+    contact = get_store_contact (
+      store,
+      get_member_session_context (session),
+      get_member_session_public_key (session)
+      );
+  }
 
   if (! contact)
     return GNUNET_SYSERR;
@@ -533,30 +553,30 @@ static void
 load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
                              const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+  enum GNUNET_GenericReturnValue status;
+
   GNUNET_assert ((session) && (path));
 
   if (GNUNET_YES != GNUNET_DISK_file_test (path))
     return;
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
 
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_READ, permission
-    );
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
+    handle = GNUNET_DISK_file_open (path, GNUNET_DISK_OPEN_READ, permission);
+  }
 
   if (! handle)
     return;
 
   GNUNET_DISK_file_seek (handle, 0, GNUNET_DISK_SEEK_SET);
 
-  struct GNUNET_MESSENGER_MemberSessionHistoryEntry entry;
-  ssize_t len;
-
-  enum GNUNET_GenericReturnValue status;
-
   do {
+    struct GNUNET_MESSENGER_MemberSessionHistoryEntry entry;
+    ssize_t len;
+
     len = GNUNET_DISK_file_read (handle, &(entry.hash), sizeof(entry.hash));
 
     if (len != sizeof(entry.hash))
@@ -582,12 +602,15 @@ void
 load_member_session (struct GNUNET_MESSENGER_Member *member,
                      const char *directory)
 {
+  char *config_file;
+  struct GNUNET_MESSENGER_MemberSession *session;
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+
   GNUNET_assert ((member) && (directory));
 
-  char *config_file;
   GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg");
 
-  struct GNUNET_MESSENGER_MemberSession *session = NULL;
+  session = NULL;
 
   if (GNUNET_YES != GNUNET_DISK_file_test (config_file))
     goto free_config;
@@ -595,30 +618,30 @@ load_member_session (struct GNUNET_MESSENGER_Member 
*member,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Load session configuration of member: %s\n", config_file);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    goto free_config;
 
   if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file))
   {
+    struct GNUNET_CRYPTO_PublicKey key;
+    enum GNUNET_GenericReturnValue key_result;
+    unsigned long long numeric_value;
     char *key_data;
 
     if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "session",
                                                             "key", &key_data))
       goto destroy_config;
 
-    struct GNUNET_CRYPTO_PublicKey key;
-
-    enum GNUNET_GenericReturnValue key_return =
-      GNUNET_CRYPTO_public_key_from_string (key_data, &key);
-
+    key_result = GNUNET_CRYPTO_public_key_from_string (key_data, &key);
     GNUNET_free (key_data);
 
-    if (GNUNET_OK != key_return)
+    if (GNUNET_OK != key_result)
       goto destroy_config;
 
     session = create_member_session (member, &key);
 
-    unsigned long long numeric_value;
-
     if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "session",
                                                             "start",
                                                             &numeric_value))
@@ -645,17 +668,21 @@ free_config:
   if (! session)
     return;
 
-  char *history_file;
-  GNUNET_asprintf (&history_file, "%s%s", directory, "history.map");
+  {
+    char *history_file;
+    GNUNET_asprintf (&history_file, "%s%s", directory, "history.map");
 
-  load_member_session_history (session, history_file);
-  GNUNET_free (history_file);
+    load_member_session_history (session, history_file);
+    GNUNET_free (history_file);
+  }
 
-  char *messages_file;
-  GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list");
+  {
+    char *messages_file;
+    GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list");
 
-  load_list_messages (&(session->messages), messages_file);
-  GNUNET_free (messages_file);
+    load_list_messages (&(session->messages), messages_file);
+    GNUNET_free (messages_file);
+  }
 
   add_member_session (member, session);
 }
@@ -665,10 +692,12 @@ static struct GNUNET_MESSENGER_MemberSession*
 get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session,
                              struct GNUNET_MESSENGER_MemberSession *next)
 {
+  struct GNUNET_MESSENGER_MemberSession *check;
+
   if (! next)
     return NULL;
 
-  struct GNUNET_MESSENGER_MemberSession *check = next;
+  check = next;
 
   do {
     if (check == session)
@@ -685,9 +714,12 @@ void
 load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session,
                           const char *directory)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  char *config_file;
+
+
   GNUNET_assert ((session) && (directory));
 
-  char *config_file;
   GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg");
 
   if (GNUNET_YES != GNUNET_DISK_file_test (config_file))
@@ -696,10 +728,16 @@ load_member_session_next (struct 
GNUNET_MESSENGER_MemberSession *session,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Load next session configuration of member: %s\n", config_file);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    goto free_config;
 
   if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file))
   {
+    struct GNUNET_CRYPTO_PublicKey next_key;
+    enum GNUNET_GenericReturnValue key_result;
+    struct GNUNET_ShortHashCode next_id;
     char *key_data;
 
     if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "session",
@@ -707,28 +745,25 @@ load_member_session_next (struct 
GNUNET_MESSENGER_MemberSession *session,
                                                             &key_data))
       goto destroy_config;
 
-    struct GNUNET_CRYPTO_PublicKey next_key;
-
-    enum GNUNET_GenericReturnValue key_return =
-      GNUNET_CRYPTO_public_key_from_string (key_data, &next_key);
-
+    key_result = GNUNET_CRYPTO_public_key_from_string (key_data, &next_key);
     GNUNET_free (key_data);
 
-    if (GNUNET_OK != key_return)
+    if (GNUNET_OK != key_result)
       goto destroy_config;
 
-    struct GNUNET_ShortHashCode next_id;
-
     if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "session", "next_id",
                                                     &next_id, sizeof(next_id)))
       goto destroy_config;
 
-    struct GNUNET_MESSENGER_Member *member = get_store_member (
-      session->member->store, &next_id);
+    {
+      struct GNUNET_MESSENGER_Member *member;
+      
+      member = get_store_member (session->member->store, &next_id);
 
-    session->next = get_cycle_safe_next_session (
-      session, member? get_member_session (member, &next_key) : NULL
-      );
+      session->next = get_cycle_safe_next_session (
+        session, member? get_member_session (member, &next_key) : NULL
+        );
+    }
 
     if (session->next)
       session->next->prev = session;
@@ -747,8 +782,13 @@ iterate_save_member_session_history_hentries (void *cls,
                                               const struct GNUNET_HashCode 
*key,
                                               void *value)
 {
-  struct GNUNET_DISK_FileHandle *handle = cls;
-  unsigned char ownership = value? GNUNET_YES : GNUNET_NO;
+  struct GNUNET_DISK_FileHandle *handle;
+  unsigned char ownership;
+
+  GNUNET_assert ((cls) && (key));
+  
+  handle = cls;
+  ownership = value? GNUNET_YES : GNUNET_NO;
 
   GNUNET_DISK_file_write (handle, key, sizeof(*key));
   GNUNET_DISK_file_write (handle, &ownership, sizeof(ownership));
@@ -761,15 +801,19 @@ static void
 save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
                              const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+
   GNUNET_assert ((session) && (path));
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
 
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
-    );
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
+
+    handle = GNUNET_DISK_file_open (
+      path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
+      );
+  }
 
   if (! handle)
     return;
@@ -791,23 +835,28 @@ void
 save_member_session (struct GNUNET_MESSENGER_MemberSession *session,
                      const char *directory)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  char *config_file;
+  char *key_data;
+
   GNUNET_assert ((session) && (directory));
 
-  char *config_file;
   GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg");
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Save session configuration of member: %s\n", config_file);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    goto free_config;
 
-  char *key_data = GNUNET_CRYPTO_public_key_to_string (
+  key_data = GNUNET_CRYPTO_public_key_to_string (
     get_member_session_public_key (session));
 
   if (key_data)
   {
     GNUNET_CONFIGURATION_set_value_string (cfg, "session", "key", key_data);
-
     GNUNET_free (key_data);
   }
 
@@ -823,7 +872,6 @@ save_member_session (struct GNUNET_MESSENGER_MemberSession 
*session,
     {
       GNUNET_CONFIGURATION_set_value_string (cfg, "session", "next_id",
                                              next_id_data);
-
       GNUNET_free (next_id_data);
     }
 
@@ -834,7 +882,6 @@ save_member_session (struct GNUNET_MESSENGER_MemberSession 
*session,
     {
       GNUNET_CONFIGURATION_set_value_string (cfg, "session", "next_key",
                                              key_data);
-
       GNUNET_free (key_data);
     }
   }
@@ -850,17 +897,22 @@ save_member_session (struct 
GNUNET_MESSENGER_MemberSession *session,
   GNUNET_CONFIGURATION_write (cfg, config_file);
   GNUNET_CONFIGURATION_destroy (cfg);
 
+free_config:
   GNUNET_free (config_file);
 
-  char *history_file;
-  GNUNET_asprintf (&history_file, "%s%s", directory, "history.map");
+  {
+    char *history_file;
+    GNUNET_asprintf (&history_file, "%s%s", directory, "history.map");
 
-  save_member_session_history (session, history_file);
-  GNUNET_free (history_file);
+    save_member_session_history (session, history_file);
+    GNUNET_free (history_file);
+  }
 
-  char *messages_file;
-  GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list");
+  {
+    char *messages_file;
+    GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list");
 
-  save_list_messages (&(session->messages), messages_file);
-  GNUNET_free (messages_file);
+    save_list_messages (&(session->messages), messages_file);
+    GNUNET_free (messages_file);
+  }
 }
diff --git a/src/service/messenger/gnunet-service-messenger_member_store.c 
b/src/service/messenger/gnunet-service-messenger_member_store.c
index 77e816c2e..5f6f2e6eb 100644
--- a/src/service/messenger/gnunet-service-messenger_member_store.c
+++ b/src/service/messenger/gnunet-service-messenger_member_store.c
@@ -48,7 +48,12 @@ iterate_destroy_members (void *cls,
                          const struct GNUNET_ShortHashCode *key,
                          void *value)
 {
-  struct GNUNET_MESSENGER_Member *member = value;
+  struct GNUNET_MESSENGER_Member *member;
+
+  GNUNET_assert (value);
+  
+  member = value;
+
   destroy_member (member);
   return GNUNET_YES;
 }
@@ -71,9 +76,11 @@ clear_member_store (struct GNUNET_MESSENGER_MemberStore 
*store)
 struct GNUNET_MESSENGER_ContactStore*
 get_member_contact_store (struct GNUNET_MESSENGER_MemberStore *store)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((store) && (store->room));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = store->room;
+  room = store->room;
 
   return get_service_contact_store (room->service);
 }
@@ -93,7 +100,11 @@ static enum GNUNET_GenericReturnValue
 callback_scan_for_members (void *cls,
                            const char *filename)
 {
-  struct GNUNET_MESSENGER_MemberStore *store = cls;
+  struct GNUNET_MESSENGER_MemberStore *store;
+
+  GNUNET_assert ((cls) && (filename));
+  
+  store = cls;
 
   if (GNUNET_YES == GNUNET_DISK_directory_test (filename, GNUNET_YES))
   {
@@ -115,14 +126,18 @@ iterate_load_next_member_sessions (void *cls,
                                    const struct GNUNET_ShortHashCode *id,
                                    void *value)
 {
-  const char *sync_dir = cls;
+  struct GNUNET_MESSENGER_Member *member;
+  const char *sync_dir;
+  char *member_dir;
 
-  struct GNUNET_MESSENGER_Member *member = value;
+  GNUNET_assert ((value) && (id) && (cls));
+  
+  member = value;
+  sync_dir = cls;
 
   if (! member)
     return GNUNET_YES;
 
-  char *member_dir;
   GNUNET_asprintf (&member_dir, "%s%s%c", sync_dir, GNUNET_sh2s (id),
                    DIR_SEPARATOR);
 
@@ -139,7 +154,11 @@ iterate_sync_member_contacts (void *cls,
                               const struct GNUNET_ShortHashCode *id,
                               void *value)
 {
-  struct GNUNET_MESSENGER_Member *member = value;
+  struct GNUNET_MESSENGER_Member *member;
+
+  GNUNET_assert (value);
+  
+  member = value;
 
   if (! member)
     return GNUNET_YES;
@@ -153,9 +172,10 @@ void
 load_member_store (struct GNUNET_MESSENGER_MemberStore *store,
                    const char *directory)
 {
+  char *scan_dir;
+
   GNUNET_assert ((store) && (directory));
 
-  char *scan_dir;
   GNUNET_asprintf (&scan_dir, "%s%s%c", directory, "members", DIR_SEPARATOR);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load member store from directory: 
%s\n",
@@ -179,14 +199,18 @@ iterate_save_members (void *cls,
                       const struct GNUNET_ShortHashCode *id,
                       void *value)
 {
-  const char *save_dir = cls;
+  struct GNUNET_MESSENGER_Member *member;
+  const char *save_dir;
+  char *member_dir;
 
-  struct GNUNET_MESSENGER_Member *member = value;
+  GNUNET_assert ((value) && (id) && (cls));
+  
+  member = value;
+  save_dir = cls;
 
   if (! member)
     return GNUNET_YES;
 
-  char *member_dir;
   GNUNET_asprintf (&member_dir, "%s%s%c", save_dir, GNUNET_sh2s (id),
                    DIR_SEPARATOR);
 
@@ -203,9 +227,10 @@ void
 save_member_store (struct GNUNET_MESSENGER_MemberStore *store,
                    const char *directory)
 {
+  char *save_dir;
+
   GNUNET_assert ((store) && (directory));
 
-  char *save_dir;
   GNUNET_asprintf (&save_dir, "%s%s%c", directory, "members", DIR_SEPARATOR);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save member store to directory: %s\n",
@@ -250,10 +275,11 @@ struct GNUNET_MESSENGER_Member*
 add_store_member (struct GNUNET_MESSENGER_MemberStore *store,
                   const struct GNUNET_ShortHashCode *id)
 {
+  struct GNUNET_MESSENGER_Member *member;
+
   GNUNET_assert ((store) && (store->members));
 
-  struct GNUNET_MESSENGER_Member *member = id? get_store_member (store, id) :
-                                           NULL;
+  member = id? get_store_member (store, id) : NULL;
 
   if (member)
     return member;
@@ -290,8 +316,13 @@ iterate_store_members_it (void *cls,
                           const struct GNUNET_ShortHashCode *key,
                           void *value)
 {
-  struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls;
-  struct GNUNET_MESSENGER_Member *member = value;
+  struct GNUNET_MESSENGER_ClosureIterateMembers *iterate;
+  struct GNUNET_MESSENGER_Member *member;
+
+  GNUNET_assert ((cls) && (value));
+
+  iterate = cls;
+  member = value;
 
   return iterate_member_sessions (member, iterate->it, iterate->cls);
 }
@@ -302,10 +333,10 @@ iterate_store_members (struct 
GNUNET_MESSENGER_MemberStore *store,
                        GNUNET_MESSENGER_MemberIteratorCallback it,
                        void *cls)
 {
-  GNUNET_assert ((store) && (store->members) && (it));
-
   struct GNUNET_MESSENGER_ClosureIterateMembers iterate;
 
+  GNUNET_assert ((store) && (store->members) && (it));
+
   iterate.it = it;
   iterate.cls = cls;
 
diff --git a/src/service/messenger/gnunet-service-messenger_message_handle.c 
b/src/service/messenger/gnunet-service-messenger_message_handle.c
index acda16d7d..aa16e0562 100644
--- a/src/service/messenger/gnunet-service-messenger_message_handle.c
+++ b/src/service/messenger/gnunet-service-messenger_message_handle.c
@@ -32,9 +32,11 @@ handle_member_session_switch (struct 
GNUNET_MESSENGER_MemberSession *session,
                               const struct GNUNET_MESSENGER_Message *message,
                               const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_MemberSession *next = switch_member_session (session,
-                                                                       message,
-                                                                       hash);
+  struct GNUNET_MESSENGER_MemberSession *next;
+
+  GNUNET_assert ((session) && (message) && (hash));
+  
+  next = switch_member_session (session, message, hash);
 
   if (next != session)
     add_member_session (next->member, next);
@@ -93,7 +95,9 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
                      const struct GNUNET_MESSENGER_Message *message,
                      const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_PeerStore *store = get_srv_room_peer_store (room);
+  struct GNUNET_MESSENGER_PeerStore *store;
+  
+  store = get_srv_room_peer_store (room);
 
   if (0 == GNUNET_memcmp (session->peer, &(message->body.peer.peer)))
     update_store_peer (store, &(message->body.peer.peer), GNUNET_YES);
@@ -130,13 +134,16 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom 
*room,
                      const struct GNUNET_MESSENGER_Message *message,
                      const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_PeerStore *store = get_srv_room_peer_store (room);
+  struct GNUNET_MESSENGER_PeerStore *store;
+  struct GNUNET_MESSENGER_ListTunnel *element;
+  
+  store = get_srv_room_peer_store (room);
 
   if (0 == GNUNET_memcmp (session->peer, &(message->body.miss.peer)))
     update_store_peer (store, &(message->body.miss.peer), GNUNET_NO);
 
-  struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (
-    &(room->basement), &(message->body.miss.peer), NULL);
+  element = find_list_tunnels (&(room->basement), 
+                               &(message->body.miss.peer), NULL);
 
   if (! element)
     return;
@@ -154,10 +161,11 @@ handle_message_delete (struct GNUNET_MESSENGER_SrvRoom 
*room,
                        const struct GNUNET_MESSENGER_Message *message,
                        const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (
-    message->body.deletion.delay);
-  struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (
-    message->header.timestamp);
+  struct GNUNET_TIME_Relative delay;
+  struct GNUNET_TIME_Absolute action;
+  
+  delay = GNUNET_TIME_relative_ntoh (message->body.deletion.delay);
+  action = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
 
   action = GNUNET_TIME_absolute_add (action, delay);
   delay = GNUNET_TIME_absolute_get_difference (GNUNET_TIME_absolute_get (),
@@ -174,8 +182,9 @@ handle_message_connection (struct GNUNET_MESSENGER_SrvRoom 
*room,
                            const struct GNUNET_MESSENGER_Message *message,
                            const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (
-    &(room->basement), session->peer, NULL);
+  struct GNUNET_MESSENGER_ListTunnel *element;
+  
+  element = find_list_tunnels (&(room->basement), session->peer, NULL);
 
   if (! element)
     return;
@@ -191,35 +200,38 @@ handle_message_subscribe (struct GNUNET_MESSENGER_SrvRoom 
*room,
                           const struct GNUNET_MESSENGER_Message *message,
                           const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_Member *member = session->member->member;
-
-  const struct GNUNET_TIME_Absolute timestamp =
-    GNUNET_TIME_absolute_ntoh (message->header.timestamp);
-
-  const struct GNUNET_ShortHashCode *discourse =
-    &(message->body.subscribe.discourse);
+  struct GNUNET_MESSENGER_Member *member;
+  const struct GNUNET_ShortHashCode *discourse;
+  struct GNUNET_MESSENGER_Subscription *subscription;
   
-  const struct GNUNET_TIME_Relative duration =
-    GNUNET_TIME_relative_ntoh (message->body.subscribe.time);
+  member = session->member->member;
 
-  struct GNUNET_MESSENGER_Subscription *subscription;
+  discourse = &(message->body.subscribe.discourse);
   subscription = get_member_subscription (member, discourse);
 
-  if (subscription)
-    update_subscription (subscription, 
-                         timestamp,
-                         duration);
-  else
   {
-    subscription =
-      create_subscription (room, member, discourse, 
-                           timestamp,
-                           duration);
-
-    if (! subscription)
-      return;
-
-    add_member_subscription (member, subscription);
+    struct GNUNET_TIME_Absolute timestamp;
+    struct GNUNET_TIME_Relative duration;
+
+    timestamp = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
+    duration = GNUNET_TIME_relative_ntoh (message->body.subscribe.time);
+
+    if (subscription)
+      update_subscription (subscription, 
+                          timestamp,
+                          duration);
+    else
+    {
+      subscription =
+        create_subscription (room, member, discourse, 
+                            timestamp,
+                            duration);
+
+      if (! subscription)
+        return;
+
+      add_member_subscription (member, subscription);
+    }
   }
 
   update_subscription_timing (subscription);
diff --git a/src/service/messenger/gnunet-service-messenger_message_kind.c 
b/src/service/messenger/gnunet-service-messenger_message_kind.c
index f1a79b321..1e9819195 100644
--- a/src/service/messenger/gnunet-service-messenger_message_kind.c
+++ b/src/service/messenger/gnunet-service-messenger_message_kind.c
@@ -32,11 +32,12 @@
 struct GNUNET_MESSENGER_Message*
 create_message_info (struct GNUNET_MESSENGER_Service *service)
 {
+  struct GNUNET_MESSENGER_Message *message;
+
   if (! service)
     return NULL;
 
-  struct GNUNET_MESSENGER_Message *message = create_message (
-    GNUNET_MESSENGER_KIND_INFO);
+  message = create_message (GNUNET_MESSENGER_KIND_INFO);
 
   if (! message)
     return NULL;
@@ -50,11 +51,12 @@ create_message_info (struct GNUNET_MESSENGER_Service 
*service)
 struct GNUNET_MESSENGER_Message*
 create_message_peer (struct GNUNET_MESSENGER_Service *service)
 {
+  struct GNUNET_MESSENGER_Message *message;
+
   if (! service)
     return NULL;
 
-  struct GNUNET_MESSENGER_Message *message = create_message (
-    GNUNET_MESSENGER_KIND_PEER);
+  message = create_message (GNUNET_MESSENGER_KIND_PEER);
 
   if (! message)
     return NULL;
@@ -73,11 +75,12 @@ create_message_peer (struct GNUNET_MESSENGER_Service 
*service)
 struct GNUNET_MESSENGER_Message*
 create_message_miss (const struct GNUNET_PeerIdentity *peer)
 {
+  struct GNUNET_MESSENGER_Message *message;
+
   if (! peer)
     return NULL;
 
-  struct GNUNET_MESSENGER_Message *message = create_message (
-    GNUNET_MESSENGER_KIND_MISS);
+  message = create_message (GNUNET_MESSENGER_KIND_MISS);
 
   if (! message)
   {
@@ -94,11 +97,12 @@ create_message_miss (const struct GNUNET_PeerIdentity *peer)
 struct GNUNET_MESSENGER_Message*
 create_message_merge (const struct GNUNET_HashCode *previous)
 {
+  struct GNUNET_MESSENGER_Message *message;
+
   if (! previous)
     return NULL;
 
-  struct GNUNET_MESSENGER_Message *message = create_message (
-    GNUNET_MESSENGER_KIND_MERGE);
+  message = create_message (GNUNET_MESSENGER_KIND_MERGE);
 
   if (! message)
     return NULL;
@@ -113,11 +117,12 @@ create_message_merge (const struct GNUNET_HashCode 
*previous)
 struct GNUNET_MESSENGER_Message*
 create_message_connection (const struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  struct GNUNET_MESSENGER_Message *message;
+
   if (! room)
     return NULL;
 
-  struct GNUNET_MESSENGER_Message *message = create_message (
-    GNUNET_MESSENGER_KIND_CONNECTION);
+  message = create_message (GNUNET_MESSENGER_KIND_CONNECTION);
 
   if (! message)
     return NULL;
diff --git a/src/service/messenger/gnunet-service-messenger_message_recv.c 
b/src/service/messenger/gnunet-service-messenger_message_recv.c
index 6d4d537b6..7c07a360d 100644
--- a/src/service/messenger/gnunet-service-messenger_message_recv.c
+++ b/src/service/messenger/gnunet-service-messenger_message_recv.c
@@ -35,15 +35,20 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom 
*room,
                        struct GNUNET_MESSENGER_MemberSession *session,
                        struct GNUNET_CONTAINER_MultiHashMap *map)
 {
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  struct GNUNET_MESSENGER_ListMessage *element;
+
+  GNUNET_assert ((room) && (tunnel) && (session) && (map));
+
   if (session->prev)
     forward_about_members (room, tunnel, session->prev, map);
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
-  struct GNUNET_MESSENGER_ListMessage *element;
+  message_store = get_srv_room_message_store (room);
 
   for (element = session->messages.head; element; element = element->next)
   {
+    const struct GNUNET_MESSENGER_Message *message;
+
     if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (map,
                                                               
&(element->hash)))
       continue;
@@ -55,11 +60,12 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom 
*room,
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   "Forwarding of session message could be duplicated!\n");
 
-    const struct GNUNET_MESSENGER_Message *message = get_store_message (
-      message_store, &(element->hash));
+    message = get_store_message (message_store, &(element->hash));
 
-    if (message)
-      forward_tunnel_message (tunnel, message, &(element->hash));
+    if (! message)
+      continue;
+
+    forward_tunnel_message (tunnel, message, &(element->hash));
   }
 }
 
@@ -69,17 +75,24 @@ iterate_forward_members (void *cls,
                          const struct GNUNET_CRYPTO_PublicKey *public_key,
                          struct GNUNET_MESSENGER_MemberSession *session)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
+  GNUNET_assert ((cls) && (session));
+  
+  tunnel = cls;
 
   if (GNUNET_YES == is_member_session_completed (session))
     return GNUNET_YES;
 
-  struct GNUNET_CONTAINER_MultiHashMap *map =
-    GNUNET_CONTAINER_multihashmap_create (4, GNUNET_NO);
+  {
+    struct GNUNET_CONTAINER_MultiHashMap *map;
+    map = GNUNET_CONTAINER_multihashmap_create (4, GNUNET_NO);
+
+    forward_about_members (tunnel->room, tunnel, session, map);
 
-  forward_about_members (tunnel->room, tunnel, session, map);
+    GNUNET_CONTAINER_multihashmap_destroy (map);
+  }
 
-  GNUNET_CONTAINER_multihashmap_destroy (map);
   return GNUNET_YES;
 }
 
@@ -90,7 +103,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
                    const struct GNUNET_MESSENGER_Message *message,
                    const struct GNUNET_HashCode *hash)
 {
-  const uint32_t version = get_tunnel_messenger_version (tunnel);
+  uint32_t version;
+  struct GNUNET_PeerIdentity peer;
+  
+  version = get_tunnel_messenger_version (tunnel);
 
   if (GNUNET_OK != update_tunnel_messenger_version (tunnel,
                                                     message->body.info.
@@ -106,33 +122,37 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
   if (room->host)
     send_tunnel_message (tunnel, room->host, create_message_info (
                            room->service));
-
-  struct GNUNET_PeerIdentity peer;
+  
   get_tunnel_peer_identity (tunnel, &peer);
 
   if (GNUNET_YES != contains_list_tunnels (&(room->basement), &peer))
   {
-    struct GNUNET_MESSENGER_MessageStore *message_store =
-      get_srv_room_message_store (room);
-
+    struct GNUNET_MESSENGER_MessageStore *message_store;
     struct GNUNET_MESSENGER_ListTunnel *element;
+    
+    message_store = get_srv_room_message_store (room);
+    
     for (element = room->basement.head; element; element = element->next)
     {
+      const struct GNUNET_MESSENGER_Message *message;
+
       if (! element->hash)
         continue;
 
-      const struct GNUNET_MESSENGER_Message *message = get_store_message (
-        message_store, element->hash);
+      message = get_store_message (message_store, element->hash);
+
+      if (! message)
+        continue;
 
-      if (message)
-        forward_tunnel_message (tunnel, message, element->hash);
+      forward_tunnel_message (tunnel, message, element->hash);
     }
   }
 
   if (GNUNET_YES != contains_list_tunnels (&(room->basement), &peer))
   {
-    struct GNUNET_MESSENGER_MemberStore *member_store =
-      get_srv_room_member_store (room);
+    struct GNUNET_MESSENGER_MemberStore *member_store;
+    
+    member_store = get_srv_room_member_store (room);
 
     iterate_store_members (member_store, iterate_forward_members, tunnel);
   }
@@ -149,6 +169,7 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
                    const struct GNUNET_HashCode *hash)
 {
   struct GNUNET_PeerIdentity peer;
+
   GNUNET_PEER_resolve (tunnel->peer, &peer);
 
   if (0 == GNUNET_memcmp (&peer, &(message->body.peer.peer)))
@@ -170,7 +191,9 @@ recv_message_miss (struct GNUNET_MESSENGER_SrvRoom *room,
                    const struct GNUNET_MESSENGER_Message *message,
                    const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_Service *service = room->service;
+  struct GNUNET_MESSENGER_Service *service;
+  
+  service = room->service;
 
   if ((GNUNET_YES == service->auto_routing) &&
       (service->min_routers > count_of_tunnels (&(room->basement))))
@@ -186,12 +209,17 @@ callback_found_message (void *cls,
                         const struct GNUNET_MESSENGER_Message *message,
                         const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
+  GNUNET_assert ((cls) && (room) && (hash));
+  
+  tunnel = cls;
 
   if (! message)
   {
-    struct GNUNET_MESSENGER_OperationStore *operation_store =
-      get_srv_room_operation_store (room);
+    struct GNUNET_MESSENGER_OperationStore *operation_store;
+    
+    operation_store = get_srv_room_operation_store (room);
 
     use_store_operation (
       operation_store,
@@ -215,10 +243,12 @@ recv_message_request (struct GNUNET_MESSENGER_SrvRoom 
*room,
                       const struct GNUNET_MESSENGER_Message *message,
                       const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_Member *member = get_store_member_of (member_store,
-                                                                message);
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_Member *member;
+  struct GNUNET_MESSENGER_MemberSession *session;
+  
+  member_store = get_srv_room_member_store (room);
+  member = get_store_member_of (member_store, message);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request for message (%s)\n",
               GNUNET_h2s (hash));
@@ -226,8 +256,7 @@ recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
   if (! member)
     return GNUNET_NO;
 
-  struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of (
-    member, message, hash);
+  session = get_member_session_of (member, message, hash);
 
   if ((! session) || (GNUNET_YES != check_member_session_history (session,
                                                                   &(message->
diff --git a/src/service/messenger/gnunet-service-messenger_message_send.c 
b/src/service/messenger/gnunet-service-messenger_message_send.c
index 05032e455..34531f8c5 100644
--- a/src/service/messenger/gnunet-service-messenger_message_send.c
+++ b/src/service/messenger/gnunet-service-messenger_message_send.c
@@ -46,12 +46,13 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify 
*notify,
                       struct GNUNET_CONTAINER_MultiHashMap *map,
                       enum GNUNET_GenericReturnValue check_permission)
 {
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  struct GNUNET_MESSENGER_ListMessage *element;
+
   if (session->prev)
     notify_about_members (notify, session->prev, map, GNUNET_YES);
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (notify->room);
-  struct GNUNET_MESSENGER_ListMessage *element;
+  message_store = get_srv_room_message_store (notify->room);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Notify through all of member session: %s\n",
@@ -59,6 +60,8 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify 
*notify,
 
   for (element = session->messages.head; element; element = element->next)
   {
+    const struct GNUNET_MESSENGER_Message *message;
+
     if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (map,
                                                               
&(element->hash)))
       continue;
@@ -80,8 +83,7 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify 
*notify,
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   "Notification of session message could be duplicated!\n");
 
-    const struct GNUNET_MESSENGER_Message *message = get_store_message (
-      message_store, &(element->hash));
+    message = get_store_message (message_store, &(element->hash));
 
     if ((! message) || (GNUNET_YES == is_peer_message (message)))
     {
@@ -90,11 +92,13 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify 
*notify,
       continue;
     }
 
-    struct GNUNET_MESSENGER_SenderSession sender;
-    sender.member = session;
+    {
+      struct GNUNET_MESSENGER_SenderSession sender;
+      sender.member = session;
 
-    notify_srv_handle_message (notify->handle, notify->room, &sender, message,
-                               &(element->hash), GNUNET_NO);
+      notify_srv_handle_message (notify->handle, notify->room, &sender, 
message,
+                                 &(element->hash), GNUNET_NO);
+    }
   }
 }
 
@@ -105,7 +109,11 @@ iterate_notify_about_members (void *cls,
                               GNUNET_CRYPTO_PublicKey *public_key,
                               struct GNUNET_MESSENGER_MemberSession *session)
 {
-  struct GNUNET_MESSENGER_MemberNotify *notify = cls;
+  struct GNUNET_MESSENGER_MemberNotify *notify;
+
+  GNUNET_assert ((cls) && (session));
+  
+  notify = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notify about member session: %s\n",
               GNUNET_sh2s (get_member_session_id (session)));
@@ -130,16 +138,17 @@ send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
                    const struct GNUNET_MESSENGER_Message *message,
                    const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_Member *member;
+  struct GNUNET_MESSENGER_MemberSession *session;
+
   set_srv_handle_key (handle, &(message->body.join.key));
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_Member *member = add_store_member (member_store,
-                                                             &(message->header.
-                                                               sender_id));
+  member_store = get_srv_room_member_store (room);
+  member = add_store_member (member_store,
+                             &(message->header.sender_id));
 
-  struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of (
-    member, message, hash);
+  session = get_member_session_of (member, message, hash);
 
   if (! session)
   {
@@ -148,18 +157,20 @@ send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
     goto skip_member_notification;
   }
 
-  struct GNUNET_MESSENGER_MemberNotify notify;
+  {
+    struct GNUNET_MESSENGER_MemberNotify notify;
 
-  notify.room = room;
-  notify.handle = handle;
-  notify.session = session;
+    notify.room = room;
+    notify.handle = handle;
+    notify.session = session;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Notify about all member sessions except: %s\n",
-              GNUNET_sh2s (get_member_session_id (session)));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Notify about all member sessions except: %s\n",
+                GNUNET_sh2s (get_member_session_id (session)));
 
-  iterate_store_members (get_srv_room_member_store (room),
-                         iterate_notify_about_members, &notify);
+    iterate_store_members (get_srv_room_member_store (room),
+                          iterate_notify_about_members, &notify);
+  }
 
 skip_member_notification:
   check_srv_room_peer_status (room, NULL);
@@ -208,8 +219,9 @@ send_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
                       const struct GNUNET_MESSENGER_Message *message,
                       const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_OperationStore *operation_store =
-    get_srv_room_operation_store (room);
+  struct GNUNET_MESSENGER_OperationStore *operation_store;
+  
+  operation_store = get_srv_room_operation_store (room);
 
   use_store_operation (
     operation_store,
diff --git a/src/service/messenger/gnunet-service-messenger_message_state.c 
b/src/service/messenger/gnunet-service-messenger_message_state.c
index 7fd39576d..7f85a9274 100644
--- a/src/service/messenger/gnunet-service-messenger_message_state.c
+++ b/src/service/messenger/gnunet-service-messenger_message_state.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2020--2023 GNUnet e.V.
+   Copyright (C) 2020--2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -98,9 +98,10 @@ void
 load_message_state (struct GNUNET_MESSENGER_MessageState *state,
                     const char *path)
 {
+  char *last_messages_file;
+
   GNUNET_assert ((state) && (path));
 
-  char *last_messages_file;
   GNUNET_asprintf (&last_messages_file, "%s%s", path, "last_messages.list");
 
   load_list_messages (&(state->last_messages), last_messages_file);
@@ -112,9 +113,10 @@ void
 save_message_state (const struct GNUNET_MESSENGER_MessageState *state,
                     const char *path)
 {
+  char *last_messages_file;
+  
   GNUNET_assert ((state) && (path));
 
-  char *last_messages_file;
   GNUNET_asprintf (&last_messages_file, "%s%s", path, "last_messages.list");
 
   save_list_messages (&(state->last_messages), last_messages_file);
diff --git a/src/service/messenger/gnunet-service-messenger_message_store.c 
b/src/service/messenger/gnunet-service-messenger_message_store.c
index 5e5f7caee..3647ada83 100644
--- a/src/service/messenger/gnunet-service-messenger_message_store.c
+++ b/src/service/messenger/gnunet-service-messenger_message_store.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2020--2023 GNUnet e.V.
+   Copyright (C) 2020--2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -51,10 +51,13 @@ iterate_destroy_entries (void *cls,
                          const struct GNUNET_HashCode *key,
                          void *value)
 {
-  struct GNUNET_MESSENGER_MessageEntry *entry = value;
+  struct GNUNET_MESSENGER_MessageEntry *entry;
 
-  GNUNET_free (entry);
+  GNUNET_assert (value);
+
+  entry = value;
 
+  GNUNET_free (entry);
   return GNUNET_YES;
 }
 
@@ -64,10 +67,13 @@ iterate_destroy_messages (void *cls,
                           const struct GNUNET_HashCode *key,
                           void *value)
 {
-  struct GNUNET_MESSENGER_Message *message = value;
+  struct GNUNET_MESSENGER_Message *message;
 
-  destroy_message (message);
+  GNUNET_assert (value);
+  
+  message = value;
 
+  destroy_message (message);
   return GNUNET_YES;
 }
 
@@ -77,10 +83,13 @@ iterate_destroy_links (void *cls,
                        const struct GNUNET_HashCode *key,
                        void *value)
 {
-  struct GNUNET_HashCode *previous = value;
+  struct GNUNET_HashCode *previous;
 
-  GNUNET_free (previous);
+  GNUNET_assert (value);
+
+  previous = value;
 
+  GNUNET_free (previous);
   return GNUNET_YES;
 }
 
@@ -131,18 +140,18 @@ static void
 load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store,
                             const char *filename)
 {
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
-
-  struct GNUNET_DISK_FileHandle *entries = GNUNET_DISK_file_open (filename,
-                                                                  
GNUNET_DISK_OPEN_READ,
-                                                                  permission);
+  enum GNUNET_DISK_AccessPermissions permission;
+  struct GNUNET_DISK_FileHandle *entries;
+  struct GNUNET_MESSENGER_MessageEntryStorage storage;
+  struct GNUNET_MESSENGER_MessageEntry *entry;
+  
+  permission = (GNUNET_DISK_PERM_USER_READ);
+  entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
+                                   permission);
 
   if (! entries)
     return;
 
-  struct GNUNET_MESSENGER_MessageEntryStorage storage;
-  struct GNUNET_MESSENGER_MessageEntry *entry;
-
   memset (&storage, 0, sizeof(storage));
 
   do
@@ -188,18 +197,19 @@ static void
 load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store,
                           const char *filename)
 {
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
+  enum GNUNET_DISK_AccessPermissions permission;
+  struct GNUNET_DISK_FileHandle *entries;
+  struct GNUNET_MESSENGER_MessageLinkStorage storage;
+  struct GNUNET_MESSENGER_MessageLink *link;
+  
+  permission = (GNUNET_DISK_PERM_USER_READ);
 
-  struct GNUNET_DISK_FileHandle *entries = GNUNET_DISK_file_open (filename,
-                                                                  
GNUNET_DISK_OPEN_READ,
-                                                                  permission);
+  entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
+                                   permission);
 
   if (! entries)
     return;
 
-  struct GNUNET_MESSENGER_MessageLinkStorage storage;
-  struct GNUNET_MESSENGER_MessageLink *link;
-
   memset (&storage, 0, sizeof(storage));
 
   do
@@ -240,16 +250,16 @@ void
 load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
                     const char *directory)
 {
+  enum GNUNET_DISK_AccessPermissions permission;
+  char *filename;
+
   GNUNET_assert ((store) && (directory));
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
 
   if (store->storage_messages)
     GNUNET_DISK_file_close (store->storage_messages);
 
-  char *filename;
   GNUNET_asprintf (&filename, "%s%s", directory, "messages.store");
 
   if (GNUNET_YES == GNUNET_DISK_file_test (filename))
@@ -292,8 +302,13 @@ iterate_save_links (void *cls,
                     const struct GNUNET_HashCode *key,
                     void *value)
 {
-  struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
-  struct GNUNET_MESSENGER_MessageLink *link = value;
+  struct GNUNET_MESSENGER_ClosureMessageSave *save;
+  struct GNUNET_MESSENGER_MessageLink *link;
+
+  GNUNET_assert ((cls) && (key) && (value));
+
+  save = cls;
+  link = value;
 
   if ((save_message_store_attribute_failed (save->storage, (*key))) ||
       (save_message_store_attribute_failed (save->storage, link->multiple)) ||
@@ -313,8 +328,13 @@ iterate_save_entries (void *cls,
                       const struct GNUNET_HashCode *key,
                       void *value)
 {
-  struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
-  struct GNUNET_MESSENGER_MessageEntry *entry = value;
+  struct GNUNET_MESSENGER_ClosureMessageSave *save;
+  struct GNUNET_MESSENGER_MessageEntry *entry;
+
+  GNUNET_assert ((cls) && (key) && (value));
+
+  save = cls;
+  entry = value;
 
   if ((save_message_store_attribute_failed (save->storage, (*key))) ||
       (save_message_store_attribute_failed (save->storage, entry->offset)) ||
@@ -330,14 +350,19 @@ iterate_save_messages (void *cls,
                        const struct GNUNET_HashCode *key,
                        void *value)
 {
-  struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
+  struct GNUNET_MESSENGER_MessageEntryStorage storage;;
+  struct GNUNET_MESSENGER_ClosureMessageSave *save;
+  struct GNUNET_MESSENGER_Message *message;
+
+  GNUNET_assert ((cls) && (key) && (value));
+  
+  save = cls;
 
   if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains 
(save->store->entries,
                                                             key))
     return GNUNET_YES;
 
-  struct GNUNET_MESSENGER_Message *message = value;
-  struct GNUNET_MESSENGER_MessageEntryStorage storage;
+  message = value;
 
   GNUNET_memcpy (&(storage.hash), key, sizeof(storage.hash));
 
@@ -356,14 +381,18 @@ iterate_save_messages (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Storing message with hash: %s\n",
               GNUNET_h2s (&(storage.hash)));
 
-  char *buffer = GNUNET_malloc (storage.entry.length);
+  {
+    char *buffer;
+    buffer = GNUNET_malloc (storage.entry.length);
 
-  encode_message (message, storage.entry.length, buffer, GNUNET_YES);
+    encode_message (message, storage.entry.length, buffer, GNUNET_YES);
 
-  GNUNET_DISK_file_write (save->store->storage_messages, buffer,
-                          storage.entry.length);
+    GNUNET_DISK_file_write (save->store->storage_messages, buffer,
+                            storage.entry.length);
+
+    GNUNET_free (buffer);
+  }
 
-  GNUNET_free (buffer);
   return GNUNET_YES;
 }
 
@@ -372,15 +401,13 @@ void
 save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
                     const char *directory)
 {
-  GNUNET_assert ((store) && (directory));
-
   struct GNUNET_MESSENGER_ClosureMessageSave save;
+  enum GNUNET_DISK_AccessPermissions permission;
+  char *filename;
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
+  GNUNET_assert ((store) && (directory));
 
-  char *filename;
+  permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
 
   if (GNUNET_YES != store->write_links)
     goto save_entries;
@@ -481,10 +508,15 @@ const struct GNUNET_MESSENGER_Message*
 get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
                    const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Message *message;
+  const struct GNUNET_MESSENGER_MessageEntry *entry;
+  enum GNUNET_GenericReturnValue decoding;
+  struct GNUNET_HashCode check;
+  char *buffer;
+
   GNUNET_assert ((store) && (hash));
 
-  struct GNUNET_MESSENGER_Message *message = GNUNET_CONTAINER_multihashmap_get 
(
-    store->messages, hash);
+  message = GNUNET_CONTAINER_multihashmap_get (store->messages, hash);
 
   if (message)
     return message;
@@ -497,8 +529,7 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore 
*store,
   if (! store->storage_messages)
     return NULL;
 
-  const struct GNUNET_MESSENGER_MessageEntry *entry =
-    GNUNET_CONTAINER_multihashmap_get (store->entries, hash);
+  entry = GNUNET_CONTAINER_multihashmap_get (store->entries, hash);
 
   if (! entry)
     return NULL;
@@ -508,7 +539,7 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore 
*store,
                                               GNUNET_DISK_SEEK_SET))
     return message;
 
-  char *buffer = GNUNET_malloc (entry->length);
+  buffer = GNUNET_malloc (entry->length);
 
   if (! buffer)
     return NULL;
@@ -520,12 +551,9 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore 
*store,
     goto free_buffer;
 
   message = create_message (GNUNET_MESSENGER_KIND_UNKNOWN);
-
-  enum GNUNET_GenericReturnValue decoding;
   decoding = decode_message (message, entry->length, buffer,
                              GNUNET_YES, NULL);
 
-  struct GNUNET_HashCode check;
   hash_message (message, entry->length, buffer, &check);
 
   if ((GNUNET_YES != decoding) || (GNUNET_CRYPTO_hash_cmp (hash, &check) != 0))
@@ -562,31 +590,32 @@ get_store_message_link (struct 
GNUNET_MESSENGER_MessageStore *store,
                         const struct GNUNET_HashCode *hash,
                         enum GNUNET_GenericReturnValue deleted_only)
 {
+  const struct GNUNET_MESSENGER_Message *message;
+
   if (deleted_only)
     goto get_link;
 
-  const struct GNUNET_MESSENGER_Message *message = get_store_message (store,
-                                                                      hash);
+  message = get_store_message (store, hash);
 
-  if (! message)
-    goto get_link;
-
-  static struct GNUNET_MESSENGER_MessageLink link;
+  if (message)
+  {
+    static struct GNUNET_MESSENGER_MessageLink link;
 
-  GNUNET_memcpy (&(link.first), &(message->header.previous),
-                 sizeof(link.first));
+    GNUNET_memcpy (&(link.first), &(message->header.previous),
+                  sizeof(link.first));
 
-  link.multiple = GNUNET_MESSENGER_KIND_MERGE == message->header.kind?
-                  GNUNET_YES : GNUNET_NO;
+    link.multiple = GNUNET_MESSENGER_KIND_MERGE == message->header.kind?
+                    GNUNET_YES : GNUNET_NO;
 
-  if (GNUNET_YES == link.multiple)
-    GNUNET_memcpy (&(link.second), &(message->body.merge.previous),
-                   sizeof(link.second));
-  else
-    GNUNET_memcpy (&(link.second), &(message->header.previous),
-                   sizeof(link.second));
+    if (GNUNET_YES == link.multiple)
+      GNUNET_memcpy (&(link.second), &(message->body.merge.previous),
+                    sizeof(link.second));
+    else
+      GNUNET_memcpy (&(link.second), &(message->header.previous),
+                    sizeof(link.second));
 
-  return &link;
+    return &link;
+  }
 
 get_link:
   return GNUNET_CONTAINER_multihashmap_get (store->links, hash);
@@ -598,8 +627,11 @@ add_link (struct GNUNET_MESSENGER_MessageStore *store,
           const struct GNUNET_HashCode *hash,
           const struct GNUNET_MESSENGER_Message *message)
 {
-  struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new (struct
-                                                          
GNUNET_MESSENGER_MessageLink);
+  struct GNUNET_MESSENGER_MessageLink *link;
+
+  GNUNET_assert ((store) && (hash) && (message));
+  
+  link = GNUNET_new (struct GNUNET_MESSENGER_MessageLink);
 
   GNUNET_memcpy (&(link->first), &(message->header.previous),
                  sizeof(link->first));
@@ -628,9 +660,11 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore 
*store,
                    const struct GNUNET_HashCode *hash,
                    struct GNUNET_MESSENGER_Message *message)
 {
+  struct GNUNET_CONTAINER_MultiHashMap *map;
+
   GNUNET_assert ((store) && (hash) && (message));
 
-  struct GNUNET_CONTAINER_MultiHashMap *map = store->messages;
+  map = store->messages;
 
   if (get_message_discourse (message))
     map = store->discourses;
@@ -644,19 +678,22 @@ enum GNUNET_GenericReturnValue
 delete_store_message (struct GNUNET_MESSENGER_MessageStore *store,
                       const struct GNUNET_HashCode *hash)
 {
+  const struct GNUNET_MESSENGER_MessageEntry *entry;
+
   GNUNET_assert ((store) && (hash));
 
-  const struct GNUNET_MESSENGER_MessageEntry *entry =
-    GNUNET_CONTAINER_multihashmap_get (store->entries, hash);
+  entry = GNUNET_CONTAINER_multihashmap_get (store->entries, hash);
 
   if (! entry)
     goto clear_memory;
 
-  const struct GNUNET_MESSENGER_Message *message = get_store_message (store,
-                                                                      hash);
+  {
+    const struct GNUNET_MESSENGER_Message *message;
+    message = get_store_message (store, hash);
 
-  if (message)
-    add_link (store, hash, message);
+    if (message)
+      add_link (store, hash, message);
+  }
 
   if (! store->storage_messages)
     goto clear_entry;
@@ -666,26 +703,29 @@ delete_store_message (struct 
GNUNET_MESSENGER_MessageStore *store,
                                               GNUNET_DISK_SEEK_SET))
     return GNUNET_SYSERR;
 
-  char *clear_buffer = GNUNET_malloc (entry->length);
+  {
+    char *clear_buffer;
+    clear_buffer = GNUNET_malloc (entry->length);
+
+    if (! clear_buffer)
+      return GNUNET_SYSERR;
 
-  if (! clear_buffer)
-    return GNUNET_SYSERR;
+    GNUNET_CRYPTO_zero_keys (clear_buffer, entry->length);
 
-  GNUNET_CRYPTO_zero_keys (clear_buffer, entry->length);
+    if ((entry->length != GNUNET_DISK_file_write (store->storage_messages,
+                                                  clear_buffer, 
entry->length)) ||
+        (GNUNET_OK
+        !=
+        GNUNET_DISK_file_sync (
+          store->storage_messages)))
+    {
+      GNUNET_free (clear_buffer);
+      return GNUNET_SYSERR;
+    }
 
-  if ((entry->length != GNUNET_DISK_file_write (store->storage_messages,
-                                                clear_buffer, entry->length)) 
||
-      (GNUNET_OK
-       !=
-       GNUNET_DISK_file_sync (
-         store->storage_messages)))
-  {
     GNUNET_free (clear_buffer);
-    return GNUNET_SYSERR;
   }
 
-  GNUNET_free (clear_buffer);
-
 clear_entry:
   if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (store->entries, hash,
                                                           entry))
@@ -709,19 +749,27 @@ iterate_flag_for_cleanup_discourse_message (void *cls,
                                             const struct GNUNET_HashCode *key,
                                             void *value)
 {
-  struct GNUNET_MESSENGER_CleanupDiscourseMessages *cleanup = cls;
-  struct GNUNET_MESSENGER_Message *message = value;
+  struct GNUNET_MESSENGER_CleanupDiscourseMessages *cleanup;
+  struct GNUNET_MESSENGER_Message *message;
+  const struct GNUNET_ShortHashCode *discourse;
+
+  GNUNET_assert ((cls) && (key) && (value));
+
+  cleanup = cls;
+  message = value;
 
-  const struct GNUNET_ShortHashCode *discourse = get_message_discourse 
(message);
+  discourse = get_message_discourse (message);
 
   if ((! discourse) || (0 != GNUNET_memcmp (discourse, &(cleanup->discourse))))
     return GNUNET_YES;
 
-  struct GNUNET_TIME_Absolute timestamp =
-    GNUNET_TIME_absolute_ntoh (message->header.timestamp);
+  {
+    struct GNUNET_TIME_Absolute timestamp;
+    timestamp = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
 
-  if (GNUNET_TIME_absolute_cmp(timestamp, >=, cleanup->timestamp))
-    return GNUNET_YES;
+    if (GNUNET_TIME_absolute_cmp(timestamp, >=, cleanup->timestamp))
+      return GNUNET_YES;
+  }
 
   add_to_list_messages (cleanup->list, key);
   destroy_message(message);
@@ -734,12 +782,13 @@ cleanup_store_discourse_messages_before (struct 
GNUNET_MESSENGER_MessageStore *s
                                          const struct GNUNET_ShortHashCode 
*discourse,
                                          const struct GNUNET_TIME_Absolute 
timestamp)
 {
-  GNUNET_assert ((store) && (discourse));
-  
   struct GNUNET_MESSENGER_ListMessages list;
+  struct GNUNET_MESSENGER_CleanupDiscourseMessages cleanup;
+
+  GNUNET_assert ((store) && (discourse));
+    
   init_list_messages (&list);
 
-  struct GNUNET_MESSENGER_CleanupDiscourseMessages cleanup;
   cleanup.list = &list;
   cleanup.timestamp = timestamp;
 
@@ -750,9 +799,11 @@ cleanup_store_discourse_messages_before (struct 
GNUNET_MESSENGER_MessageStore *s
                                          
iterate_flag_for_cleanup_discourse_message,
                                          &cleanup);
   
-  struct GNUNET_MESSENGER_ListMessage *element;
-  for (element = list.head; element; element = element->next)
-    GNUNET_CONTAINER_multihashmap_remove_all (store->discourses, 
&(element->hash));
-  
+  {
+    struct GNUNET_MESSENGER_ListMessage *element;
+    for (element = list.head; element; element = element->next)
+      GNUNET_CONTAINER_multihashmap_remove_all (store->discourses, 
&(element->hash));
+  }
+
   clear_list_messages (&list);
 }
diff --git a/src/service/messenger/gnunet-service-messenger_operation.c 
b/src/service/messenger/gnunet-service-messenger_operation.c
index 66cefb9ac..0c32b9942 100644
--- a/src/service/messenger/gnunet-service-messenger_operation.c
+++ b/src/service/messenger/gnunet-service-messenger_operation.c
@@ -1,6 +1,6 @@
 /*
    This file is part of GNUnet.
-   Copyright (C) 2021, 2023 GNUnet e.V.
+   Copyright (C) 2021, 2023, 2024 GNUnet e.V.
 
    GNUnet is free software: you can redistribute it and/or modify it
    under the terms of the GNU Affero General Public License as published
@@ -30,10 +30,11 @@
 struct GNUNET_MESSENGER_Operation*
 create_operation (const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Operation *op;
+
   GNUNET_assert (hash);
 
-  struct GNUNET_MESSENGER_Operation *op = GNUNET_new (struct
-                                                      
GNUNET_MESSENGER_Operation);
+  op = GNUNET_new (struct GNUNET_MESSENGER_Operation);
 
   op->type = GNUNET_MESSENGER_OP_UNKNOWN;
   GNUNET_memcpy (&(op->hash), hash, sizeof(*hash));
@@ -64,24 +65,33 @@ struct GNUNET_MESSENGER_Operation*
 load_operation (struct GNUNET_MESSENGER_OperationStore *store,
                 const char *path)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  struct GNUNET_MESSENGER_Operation *op;
+
   GNUNET_assert ((store) && (path));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load operation configuration: %s\n",
               path);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
-  struct GNUNET_MESSENGER_Operation *op = NULL;
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    return NULL;
+
+  op = NULL;
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, path))
     goto destroy_config;
 
-  struct GNUNET_HashCode hash;
+  {
+    struct GNUNET_HashCode hash;
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "operation", "hash",
-                                                  &hash, sizeof(hash)))
-    goto destroy_config;
+    if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "operation", "hash",
+                                                    &hash, sizeof(hash)))
+      goto destroy_config;
 
-  op = create_operation (&hash);
+    op = create_operation (&hash);
+  }
 
   unsigned long long type_number;
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "operation",
@@ -112,15 +122,17 @@ load_operation (struct GNUNET_MESSENGER_OperationStore 
*store,
     goto destroy_config;
   }
 
-  const struct GNUNET_TIME_Relative delay = GNUNET_TIME_absolute_get_remaining 
(
-    op->timestamp);
-
-  op->task = GNUNET_SCHEDULER_add_delayed_with_priority (
-    delay,
-    GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
-    callback_operation,
-    op
-    );
+  {
+    struct GNUNET_TIME_Relative delay;
+    delay = GNUNET_TIME_absolute_get_remaining (op->timestamp);
+
+    op->task = GNUNET_SCHEDULER_add_delayed_with_priority (
+      delay,
+      GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
+      callback_operation,
+      op
+      );
+  }
 
   op->store = store;
 
@@ -135,14 +147,20 @@ void
 save_operation (const struct GNUNET_MESSENGER_Operation *op,
                 const char *path)
 {
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+  char *hash_data;
+  char *timestamp_data;
+
   GNUNET_assert ((path) && (op));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save operation configuration: %s\n",
               path);
 
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
+  cfg = GNUNET_CONFIGURATION_create ();
+
+  if (! cfg)
+    return;
 
-  char *hash_data;
   hash_data = GNUNET_STRINGS_data_to_string_alloc (&(op->hash),
                                                    sizeof(op->hash));
 
@@ -155,7 +173,6 @@ save_operation (const struct GNUNET_MESSENGER_Operation *op,
 
   GNUNET_CONFIGURATION_set_value_number (cfg, "operation", "type", op->type);
 
-  char *timestamp_data;
   timestamp_data = GNUNET_STRINGS_data_to_string_alloc (&(op->timestamp),
                                                         sizeof(op->timestamp));
 
@@ -180,8 +197,11 @@ callback_store_operation (struct 
GNUNET_MESSENGER_OperationStore *store,
 static void
 callback_operation (void *cls)
 {
-  struct GNUNET_MESSENGER_Operation *op = cls;
+  struct GNUNET_MESSENGER_Operation *op;
 
+  GNUNET_assert (cls);
+  
+  op = cls;
   op->task = NULL;
 
   callback_store_operation (op->store, op->type, &(op->hash));
@@ -194,15 +214,14 @@ start_operation (struct GNUNET_MESSENGER_Operation *op,
                  struct GNUNET_MESSENGER_OperationStore *store,
                  struct GNUNET_TIME_Relative delay)
 {
+  struct GNUNET_TIME_Absolute timestamp;
+
   GNUNET_assert ((op) && (store));
 
   if (op->task)
     return GNUNET_SYSERR;
 
-  const struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_add (
-    GNUNET_TIME_absolute_get (),
-    delay
-    );
+  timestamp = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay);
 
   op->task = GNUNET_SCHEDULER_add_delayed_with_priority (
     delay,
diff --git a/src/service/messenger/gnunet-service-messenger_operation_store.c 
b/src/service/messenger/gnunet-service-messenger_operation_store.c
index 630ed6dbd..1bd823db3 100644
--- a/src/service/messenger/gnunet-service-messenger_operation_store.c
+++ b/src/service/messenger/gnunet-service-messenger_operation_store.c
@@ -45,10 +45,13 @@ iterate_destroy_operations (void *cls,
                             const struct GNUNET_HashCode *key,
                             void *value)
 {
-  struct GNUNET_MESSENGER_Operation *op = value;
+  struct GNUNET_MESSENGER_Operation *op;
 
-  destroy_operation (op);
+  GNUNET_assert (value);
+  
+  op = value;
 
+  destroy_operation (op);
   return GNUNET_YES;
 }
 
@@ -71,7 +74,12 @@ static enum GNUNET_GenericReturnValue
 callback_scan_for_operations (void *cls,
                               const char *filename)
 {
-  struct GNUNET_MESSENGER_OperationStore *store = cls;
+  struct GNUNET_MESSENGER_OperationStore *store;
+  struct GNUNET_MESSENGER_Operation *op;
+
+  GNUNET_assert ((cls) && (filename));
+  
+  store = cls;
 
   if (GNUNET_YES != GNUNET_DISK_file_test (filename))
     return GNUNET_OK;
@@ -80,7 +88,7 @@ callback_scan_for_operations (void *cls,
                                                 - 4, ".cfg")))
     return GNUNET_OK;
 
-  struct GNUNET_MESSENGER_Operation *op = load_operation (store, filename);
+  op = load_operation (store, filename);
 
   if ((op) && (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (
                  store->operations,
@@ -98,9 +106,10 @@ void
 load_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
                       const char *directory)
 {
+  char *load_dir;
+
   GNUNET_assert ((store) && (directory));
 
-  char *load_dir;
   GNUNET_asprintf (&load_dir, "%s%s%c", directory, "operations", 
DIR_SEPARATOR);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -119,14 +128,18 @@ iterate_save_operations (void *cls,
                          const struct GNUNET_HashCode *key,
                          void *value)
 {
-  const char *save_dir = cls;
+  struct GNUNET_MESSENGER_Operation *op;
+  const char *save_dir;
+  char *op_dir;
 
-  struct GNUNET_MESSENGER_Operation *op = value;
+  GNUNET_assert ((value) && (key) && (cls));
+
+  op = value;
+  save_dir = cls;
 
   if (! op)
     return GNUNET_YES;
 
-  char *op_dir;
   GNUNET_asprintf (&op_dir, "%s%s.cfg", save_dir, GNUNET_h2s (key));
   save_operation (op, op_dir);
 
@@ -139,9 +152,10 @@ void
 save_operation_store (const struct GNUNET_MESSENGER_OperationStore *store,
                       const char *directory)
 {
+  char *save_dir;
+
   GNUNET_assert ((store) && (directory));
 
-  char *save_dir;
   GNUNET_asprintf (&save_dir, "%s%s%c", directory, "operations", 
DIR_SEPARATOR);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -161,10 +175,11 @@ enum GNUNET_MESSENGER_OperationType
 get_store_operation_type (const struct GNUNET_MESSENGER_OperationStore *store,
                           const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Operation *op;
+
   GNUNET_assert ((store) && (hash));
 
-  struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get (
-    store->operations, hash);
+  op = GNUNET_CONTAINER_multihashmap_get (store->operations, hash);
 
   if (! op)
     return GNUNET_MESSENGER_OP_UNKNOWN;
@@ -179,10 +194,11 @@ use_store_operation (struct 
GNUNET_MESSENGER_OperationStore *store,
                      enum GNUNET_MESSENGER_OperationType type,
                      struct GNUNET_TIME_Relative delay)
 {
+  struct GNUNET_MESSENGER_Operation *op;
+
   GNUNET_assert ((store) && (hash));
 
-  struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get (
-    store->operations, hash);
+  op = GNUNET_CONTAINER_multihashmap_get (store->operations, hash);
 
   if (op)
     goto use_op;
@@ -211,10 +227,11 @@ void
 cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
                         const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Operation *op;
+
   GNUNET_assert ((store) && (hash));
 
-  struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get (
-    store->operations, hash);
+  op = GNUNET_CONTAINER_multihashmap_get (store->operations, hash);
 
   if (! op)
     return;
@@ -244,13 +261,15 @@ callback_store_operation (struct 
GNUNET_MESSENGER_OperationStore *store,
                           enum GNUNET_MESSENGER_OperationType type,
                           const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_HashCode op_hash;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((store) && (hash));
 
-  struct GNUNET_HashCode op_hash;
   GNUNET_memcpy (&op_hash, hash, sizeof(op_hash));
   cancel_store_operation (store, &op_hash);
 
-  struct GNUNET_MESSENGER_SrvRoom *room = store->room;
+  room = store->room;
 
   switch (type)
   {
diff --git a/src/service/messenger/gnunet-service-messenger_peer_store.c 
b/src/service/messenger/gnunet-service-messenger_peer_store.c
index fdfbf599b..fc5ef64ec 100644
--- a/src/service/messenger/gnunet-service-messenger_peer_store.c
+++ b/src/service/messenger/gnunet-service-messenger_peer_store.c
@@ -51,7 +51,12 @@ static enum GNUNET_GenericReturnValue
 iterate_destroy_peers (void *cls, const struct GNUNET_ShortHashCode *id,
                        void *value)
 {
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry = value;
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+
+  GNUNET_assert (value);
+  
+  entry = value;
+  
   GNUNET_free (entry);
   return GNUNET_YES;
 }
@@ -76,6 +81,11 @@ void
 load_peer_store (struct GNUNET_MESSENGER_PeerStore *store,
                  const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+  struct GNUNET_PeerIdentity peer;
+  ssize_t len;
+
   GNUNET_assert ((store) && (path));
 
   if (GNUNET_YES != GNUNET_DISK_file_test (path))
@@ -84,25 +94,21 @@ load_peer_store (struct GNUNET_MESSENGER_PeerStore *store,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load peer store from path: %s\n",
               path);
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
-
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_READ, permission
-    );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
+    
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
+    handle = GNUNET_DISK_file_open (path, GNUNET_DISK_OPEN_READ, permission);
+  }
 
   if (! handle)
     return;
 
   GNUNET_DISK_file_seek (handle, 0, GNUNET_DISK_SEEK_SET);
 
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
-  struct GNUNET_ShortHashCode peer_id;
-  struct GNUNET_PeerIdentity peer;
-  ssize_t len;
-
   do {
+    struct GNUNET_ShortHashCode peer_id;
+
     len = GNUNET_DISK_file_read (handle, &peer, sizeof(peer));
 
     if (len != sizeof(peer))
@@ -135,8 +141,13 @@ static enum GNUNET_GenericReturnValue
 iterate_save_peers (void *cls, const struct GNUNET_ShortHashCode *id,
                     void *value)
 {
-  struct GNUNET_DISK_FileHandle *handle = cls;
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry = value;
+  struct GNUNET_DISK_FileHandle *handle;
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+
+  GNUNET_assert ((cls) && (id) && (value));
+
+  handle = cls;
+  entry = value;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save peer store entry: %s\n",
               GNUNET_sh2s (id));
@@ -153,18 +164,21 @@ void
 save_peer_store (const struct GNUNET_MESSENGER_PeerStore *store,
                  const char *path)
 {
+  struct GNUNET_DISK_FileHandle *handle;
+
   GNUNET_assert ((store) && (path));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save peer store to path: %s\n",
               path);
 
-  enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
-                                                   | 
GNUNET_DISK_PERM_USER_WRITE
-                                                   );
-
-  struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
-    path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
-    );
+  {
+    enum GNUNET_DISK_AccessPermissions permission;
+    
+    permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
+    handle = GNUNET_DISK_file_open (
+      path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
+      );
+  }
 
   if (! handle)
     return;
@@ -189,8 +203,13 @@ static enum GNUNET_GenericReturnValue
 verify_store_peer (void *cls, const struct GNUNET_ShortHashCode *id,
                    void *value)
 {
-  struct GNUNET_MESSENGER_ClosureVerifyPeer *verify = cls;
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry = value;
+  struct GNUNET_MESSENGER_ClosureVerifyPeer *verify;
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+
+  GNUNET_assert ((cls) && (value));
+
+  verify = cls;
+  entry = value;
 
   if (! entry)
     return GNUNET_YES;
@@ -212,9 +231,10 @@ add_peer_store_entry (struct GNUNET_MESSENGER_PeerStore 
*store,
                       const struct GNUNET_ShortHashCode *id,
                       enum GNUNET_GenericReturnValue active)
 {
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+
   GNUNET_assert ((store) && (peer));
 
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
   entry = GNUNET_new (struct GNUNET_MESSENGER_PeerStoreEntry);
 
   if (! entry)
@@ -252,25 +272,28 @@ get_store_peer_of (struct GNUNET_MESSENGER_PeerStore 
*store,
                    const struct GNUNET_MESSENGER_Message *message,
                    const struct GNUNET_HashCode *hash)
 {
+  const struct GNUNET_PeerIdentity *peer;
+  enum GNUNET_GenericReturnValue active;
+  struct GNUNET_ShortHashCode peer_id;
+
   GNUNET_assert ((store) && (store->peers) && (message) && (hash));
 
   if (GNUNET_YES != is_peer_message (message))
     return NULL;
 
-  struct GNUNET_MESSENGER_ClosureVerifyPeer verify;
-  verify.message = message;
-  verify.hash = hash;
-  verify.sender = NULL;
-
-  GNUNET_CONTAINER_multishortmap_get_multiple (store->peers,
-                                               &(message->header.sender_id),
-                                               verify_store_peer, &verify);
+  {
+    struct GNUNET_MESSENGER_ClosureVerifyPeer verify;
+    verify.message = message;
+    verify.hash = hash;
+    verify.sender = NULL;
 
-  if (verify.sender)
-    return verify.sender;
+    GNUNET_CONTAINER_multishortmap_get_multiple (store->peers,
+                                                &(message->header.sender_id),
+                                                verify_store_peer, &verify);
 
-  const struct GNUNET_PeerIdentity *peer;
-  enum GNUNET_GenericReturnValue active;
+    if (verify.sender)
+      return verify.sender;
+  }
 
   if (GNUNET_MESSENGER_KIND_PEER == message->header.kind)
   {
@@ -294,7 +317,6 @@ get_store_peer_of (struct GNUNET_MESSENGER_PeerStore *store,
       return NULL;
   }
 
-  struct GNUNET_ShortHashCode peer_id;
   convert_peer_identity_to_id (peer, &peer_id);
 
   if (0 != GNUNET_memcmp (&peer_id, &(message->header.sender_id)))
@@ -310,19 +332,21 @@ get_store_peer_of (struct GNUNET_MESSENGER_PeerStore 
*store,
                 "Verification of message with peer identity failed!\n");
   }
 
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
-  entry = add_peer_store_entry (store, peer, &peer_id, active);
-
-  if (! entry)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Initialization of entry in peer store failed: %s\n",
-                GNUNET_sh2s (&peer_id));
+    struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+    entry = add_peer_store_entry (store, peer, &peer_id, active);
 
-    return NULL;
-  }
+    if (! entry)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Initialization of entry in peer store failed: %s\n",
+                  GNUNET_sh2s (&peer_id));
+
+      return NULL;
+    }
 
-  return &(entry->peer);
+    return &(entry->peer);
+  }
 }
 
 
@@ -335,8 +359,13 @@ struct GNUNET_MESSENGER_ClosureFindPeer
 static enum GNUNET_GenericReturnValue
 find_store_peer (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
 {
-  struct GNUNET_MESSENGER_ClosureFindPeer *find = cls;
-  struct GNUNET_MESSENGER_PeerStoreEntry *entry = value;
+  struct GNUNET_MESSENGER_ClosureFindPeer *find;
+  struct GNUNET_MESSENGER_PeerStoreEntry *entry;
+
+  GNUNET_assert ((cls) && (value));
+
+  find = cls;
+  entry = value;
 
   if (! entry)
     return GNUNET_YES;
@@ -356,25 +385,28 @@ update_store_peer (struct GNUNET_MESSENGER_PeerStore 
*store,
                    const struct GNUNET_PeerIdentity *peer,
                    enum GNUNET_GenericReturnValue active)
 {
+  struct GNUNET_ShortHashCode peer_id;
+
   GNUNET_assert ((store) && (store->peers) && (peer));
 
-  struct GNUNET_ShortHashCode peer_id;
   convert_peer_identity_to_id (peer, &peer_id);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Update peer store entry: %s\n",
               GNUNET_sh2s (&peer_id));
 
-  struct GNUNET_MESSENGER_ClosureFindPeer find;
-  find.requested = peer;
-  find.match = NULL;
-
-  GNUNET_CONTAINER_multishortmap_get_multiple (store->peers, &peer_id,
-                                               find_store_peer, &find);
-
-  if (find.match)
   {
-    find.match->active = active;
-    return;
+    struct GNUNET_MESSENGER_ClosureFindPeer find;
+    find.requested = peer;
+    find.match = NULL;
+
+    GNUNET_CONTAINER_multishortmap_get_multiple (store->peers, &peer_id,
+                                                find_store_peer, &find);
+
+    if (find.match)
+    {
+      find.match->active = active;
+      return;
+    }
   }
 
   if (! add_peer_store_entry (store, peer, &peer_id, active))
diff --git a/src/service/messenger/gnunet-service-messenger_room.c 
b/src/service/messenger/gnunet-service-messenger_room.c
index fecf7a545..44c3e4624 100644
--- a/src/service/messenger/gnunet-service-messenger_room.c
+++ b/src/service/messenger/gnunet-service-messenger_room.c
@@ -46,10 +46,11 @@ struct GNUNET_MESSENGER_SrvRoom*
 create_srv_room (struct GNUNET_MESSENGER_SrvHandle *handle,
                  const struct GNUNET_HashCode *key)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((handle) && (key));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = GNUNET_new (struct
-                                                      
GNUNET_MESSENGER_SrvRoom);
+  room = GNUNET_new (struct GNUNET_MESSENGER_SrvRoom);
 
   room->service = handle->service;
   room->host = handle;
@@ -87,7 +88,12 @@ iterate_destroy_tunnels (void *cls,
                          const struct GNUNET_PeerIdentity *key,
                          void *value)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
+  GNUNET_assert (value);
+  
+  tunnel = value;
+
   destroy_tunnel (tunnel);
   return GNUNET_YES;
 }
@@ -196,9 +202,13 @@ callback_room_connect (void *cls,
                        struct GNUNET_CADET_Channel *channel,
                        const struct GNUNET_PeerIdentity *source)
 {
-  struct GNUNET_MESSENGER_SrvRoom *room = cls;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
+  GNUNET_assert ((cls) && (channel) && (source));
 
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = create_tunnel (room, source);
+  room = cls;
+  tunnel = create_tunnel (room, source);
 
   if ((tunnel) &&
       (GNUNET_OK != GNUNET_CONTAINER_multipeermap_put (room->tunnels, source,
@@ -240,25 +250,30 @@ join_room (struct GNUNET_MESSENGER_SrvRoom *room,
            struct GNUNET_MESSENGER_Member *member,
            const struct GNUNET_ShortHashCode *id)
 {
+  const struct GNUNET_ShortHashCode *member_id;
+
   GNUNET_assert ((room) && (handle) && (member));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Joining room: %s (%s)\n", GNUNET_h2s (
                 get_srv_room_key (room)),
               GNUNET_sh2s (get_member_id (member)));
 
-  const struct GNUNET_ShortHashCode *member_id = get_member_id (member);
+  member_id = get_member_id (member);
 
   if (GNUNET_OK != change_srv_handle_member_id (handle, get_srv_room_key 
(room),
                                                 member_id))
     return GNUNET_NO;
 
-  enum GNUNET_GenericReturnValue reset;
-  if ((! id) || (0 != GNUNET_memcmp (id, member_id)))
-    reset = GNUNET_YES;
-  else
-    reset = GNUNET_NO;
+  {
+    enum GNUNET_GenericReturnValue reset;
+    if ((! id) || (0 != GNUNET_memcmp (id, member_id)))
+      reset = GNUNET_YES;
+    else
+      reset = GNUNET_NO;
+
+    notify_srv_handle_member_id (handle, room, member_id, reset);
+  }
 
-  notify_srv_handle_member_id (handle, room, member_id, reset);
   return GNUNET_YES;
 }
 
@@ -267,13 +282,13 @@ static enum GNUNET_GenericReturnValue
 join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room,
                    struct GNUNET_MESSENGER_SrvHandle *handle)
 {
-  const struct GNUNET_ShortHashCode *member_id = get_srv_handle_member_id (
-    handle, get_srv_room_key (room));
-
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_Member *member = add_store_member (member_store,
-                                                             member_id);
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  const struct GNUNET_ShortHashCode *member_id;
+  struct GNUNET_MESSENGER_Member *member;
+  
+  member_store = get_srv_room_member_store (room);
+  member_id = get_srv_handle_member_id (handle, get_srv_room_key (room));
+  member = add_store_member (member_store, member_id);
 
   if (GNUNET_NO == join_room (room, handle, member, member_id))
     return GNUNET_NO;
@@ -312,21 +327,26 @@ open_srv_room (struct GNUNET_MESSENGER_SrvRoom *room,
     return join_room_locally (room, handle);
   }
 
-  struct GNUNET_CADET_Handle *cadet = get_srv_room_cadet (room);
-  const struct GNUNET_HashCode *key = get_srv_room_key (room);
-
-  struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (
-                                                   tunnel_message,
-                                                   
GNUNET_MESSAGE_TYPE_CADET_CLI,
-                                                   struct
-                                                   GNUNET_MessageHeader, NULL),
-                                                 GNUNET_MQ_handler_end () };
-
-  struct GNUNET_HashCode port;
-  convert_messenger_key_to_port (key, &port);
-  room->port = GNUNET_CADET_open_port (cadet, &port, callback_room_connect,
-                                       room, NULL, callback_tunnel_disconnect,
-                                       handlers);
+  {
+    struct GNUNET_CADET_Handle *cadet;
+    const struct GNUNET_HashCode *key;
+    struct GNUNET_HashCode port;
+
+    struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (
+                                                    tunnel_message,
+                                                    
GNUNET_MESSAGE_TYPE_CADET_CLI,
+                                                    struct
+                                                    GNUNET_MessageHeader, 
NULL),
+                                                  GNUNET_MQ_handler_end () };
+
+    cadet = get_srv_room_cadet (room);
+    key = get_srv_room_key (room);
+
+    convert_messenger_key_to_port (key, &port);
+    room->port = GNUNET_CADET_open_port (cadet, &port, callback_room_connect,
+                                        room, NULL, callback_tunnel_disconnect,
+                                        handlers);
+  }
 
   if (room->port)
     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Port of room (%s) was opened!\n",
@@ -339,42 +359,56 @@ open_srv_room (struct GNUNET_MESSENGER_SrvRoom *room,
   if (! handle)
     goto complete_opening;
 
-  const struct GNUNET_ShortHashCode *member_id = get_srv_handle_member_id (
-    handle, get_srv_room_key (room));
+  {
+    struct GNUNET_MESSENGER_MemberStore *member_store;
+    const struct GNUNET_ShortHashCode *member_id;
+    struct GNUNET_MESSENGER_Member *member;
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_Member *member = add_store_member (member_store,
-                                                             member_id);
+    member_store = get_srv_room_member_store (room);
+    member_id = get_srv_handle_member_id (handle, get_srv_room_key (room));
+    member = add_store_member (member_store, member_id);
 
-  if ((GNUNET_NO == join_room (room, handle, member, member_id)) &&
-      (room->port))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "You could not join the room, therefore it keeps closed!\n");
+    if ((GNUNET_NO == join_room (room, handle, member, member_id)) &&
+        (room->port))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "You could not join the room, therefore it keeps closed!\n");
 
-    close_srv_room (room);
-    return GNUNET_NO;
+      close_srv_room (room);
+      return GNUNET_NO;
+    }
   }
 
 complete_opening:
   if (! room->port)
     return GNUNET_NO;
 
-  return send_srv_room_message (room, handle, create_message_peer (
-                                  room->service));
+  {
+    struct GNUNET_MESSENGER_Message *message;
+    message = create_message_peer (room->service);
+
+    if (! message)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Peer message could not be sent!\n");
+      return GNUNET_NO;
+    }
+
+    return send_srv_room_message (room, handle, message);
+  }
 }
 
 
 static void
 close_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  struct GNUNET_PeerIdentity peer;
+
   GNUNET_assert (room);
 
   if (! room->port)
     return;
 
-  struct GNUNET_PeerIdentity peer;
   if ((room->peer_message) &&
       (GNUNET_OK == get_service_peer_identity (room->service, &peer)))
     send_srv_room_message (room, room->host, create_message_miss (&peer));
@@ -389,16 +423,16 @@ enter_srv_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
                    struct GNUNET_MESSENGER_SrvHandle *handle,
                    const struct GNUNET_PeerIdentity *door)
 {
-  GNUNET_assert ((room) && (handle) && (door));
-
   struct GNUNET_PeerIdentity peer;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
+  GNUNET_assert ((room) && (handle) && (door));
 
   if ((GNUNET_OK == get_service_peer_identity (room->service, &peer)) &&
       (0 == GNUNET_memcmp (&peer, door)))
     return join_room_locally (room, handle);
 
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel =
-    GNUNET_CONTAINER_multipeermap_get (room->tunnels, door);
+  tunnel = GNUNET_CONTAINER_multipeermap_get (room->tunnels, door);
 
   if (! tunnel)
   {
@@ -435,9 +469,13 @@ sign_srv_room_message_by_peer (const void *cls,
                                char *buffer,
                                const struct GNUNET_HashCode *hash)
 {
-  const struct GNUNET_MESSENGER_SrvHandle *handle = cls;
+  const struct GNUNET_MESSENGER_SrvHandle *handle;
 
-  GNUNET_assert ((handle) && (handle->service));
+  GNUNET_assert ((cls) && (message) && (buffer) && (hash));
+  
+  handle = cls;
+
+  GNUNET_assert (handle->service);
 
   sign_message_by_peer (message, length, buffer, hash, 
handle->service->config);
 }
@@ -450,6 +488,8 @@ pack_srv_room_message (const struct 
GNUNET_MESSENGER_SrvRoom *room,
                        struct GNUNET_HashCode *hash,
                        enum GNUNET_MESSENGER_PackMode mode)
 {
+  struct GNUNET_PeerIdentity peer;
+
   GNUNET_assert ((room) && (handle) && (message) && (hash));
 
   if (GNUNET_YES != is_peer_message (message))
@@ -458,7 +498,6 @@ pack_srv_room_message (const struct 
GNUNET_MESSENGER_SrvRoom *room,
   message->header.timestamp = GNUNET_TIME_absolute_hton (
     GNUNET_TIME_absolute_get ());
 
-  struct GNUNET_PeerIdentity peer;
   if (GNUNET_OK != get_service_peer_identity (handle->service, &peer))
     return NULL;
 
@@ -490,18 +529,24 @@ iterate_send_room_message (void *cls,
                            const struct GNUNET_PeerIdentity *key,
                            void *value)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+  struct GNUNET_MESSENGER_ClosureSendRoom *closure;
+  struct GNUNET_MQ_Envelope *env;
+
+  GNUNET_assert ((cls) && (value));
+  
+  tunnel = value;
 
   if ((! is_tunnel_connected (tunnel)) ||
       (get_tunnel_messenger_version (tunnel) < GNUNET_MESSENGER_VERSION))
     return GNUNET_YES;
 
-  struct GNUNET_MESSENGER_ClosureSendRoom *closure = cls;
+  closure = cls;
 
   if (tunnel == closure->exclude)
     return GNUNET_YES;
-
-  struct GNUNET_MQ_Envelope *env = NULL;
+  
+  env = NULL;
 
   if (closure->packed == GNUNET_NO)
   {
@@ -538,6 +583,8 @@ send_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
                        struct GNUNET_MESSENGER_SrvHandle *handle,
                        struct GNUNET_MESSENGER_Message *message)
 {
+  struct GNUNET_HashCode hash;
+
   GNUNET_assert ((room) && (handle));
 
   if (! message)
@@ -548,30 +595,33 @@ send_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
               GNUNET_h2s (&(room->key)),
               GNUNET_MESSENGER_name_of_kind (message->header.kind));
 
-  struct GNUNET_HashCode hash;
-  struct GNUNET_MESSENGER_ClosureSendRoom closure;
-
-  closure.room = room;
-  closure.handle = handle;
-  closure.exclude = NULL;
-  closure.message = message;
-  closure.hash = &hash;
-  closure.packed = GNUNET_NO;
+  {
+    struct GNUNET_MESSENGER_ClosureSendRoom closure;
 
-  GNUNET_CONTAINER_multipeermap_iterate (room->tunnels,
-                                         iterate_send_room_message, &closure);
+    closure.room = room;
+    closure.handle = handle;
+    closure.exclude = NULL;
+    closure.message = message;
+    closure.hash = &hash;
+    closure.packed = GNUNET_NO;
 
-  if (GNUNET_NO == closure.packed)
-    pack_srv_room_message (room, handle, message, &hash,
-                           GNUNET_MESSENGER_PACK_MODE_UNKNOWN);
+    GNUNET_CONTAINER_multipeermap_iterate (room->tunnels,
+                                          iterate_send_room_message, &closure);
 
-  enum GNUNET_GenericReturnValue new_message;
-  new_message = update_room_message (room, message, &hash);
+    if (GNUNET_NO == closure.packed)
+      pack_srv_room_message (room, handle, message, &hash,
+                            GNUNET_MESSENGER_PACK_MODE_UNKNOWN);
+  }
 
-  if (GNUNET_YES != new_message)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending duplicate message 
failed!\n");
-    return GNUNET_SYSERR;
+    enum GNUNET_GenericReturnValue new_message;
+    new_message = update_room_message (room, message, &hash);
+
+    if (GNUNET_YES != new_message)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending duplicate message 
failed!\n");
+      return GNUNET_SYSERR;
+    }
   }
 
   switch (message->header.kind)
@@ -606,14 +656,14 @@ forward_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
                           struct GNUNET_MESSENGER_Message *message,
                           const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_ClosureSendRoom closure;
+  struct GNUNET_HashCode message_hash;
+
   GNUNET_assert ((room) && (tunnel));
 
   if (! message)
     return;
 
-  struct GNUNET_MESSENGER_ClosureSendRoom closure;
-  struct GNUNET_HashCode message_hash;
-
   GNUNET_memcpy (&message_hash, hash, sizeof(struct GNUNET_HashCode));
 
   closure.room = room;
@@ -632,14 +682,14 @@ void
 check_srv_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
                             struct GNUNET_MESSENGER_SrvTunnel *tunnel)
 {
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  const struct GNUNET_MESSENGER_Message *message;
+
   if (! room->peer_message)
     return;
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
-
-  const struct GNUNET_MESSENGER_Message *message = get_store_message (
-    message_store, room->peer_message);
+  message_store = get_srv_room_message_store (room);
+  message = get_store_message (message_store, room->peer_message);
 
   if (! message)
   {
@@ -657,6 +707,8 @@ void
 merge_srv_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room,
                               struct GNUNET_MESSENGER_SrvHandle *handle)
 {
+  const struct GNUNET_HashCode *hash;
+
   GNUNET_assert (room);
 
   if (! handle)
@@ -666,16 +718,27 @@ merge_srv_room_last_messages (struct 
GNUNET_MESSENGER_SrvRoom *room,
               "Merging messages by handle in room: %s\n",
               GNUNET_h2s (&(room->key)));
 
-  const struct GNUNET_HashCode *hash;
+  do
+  {
+    struct GNUNET_MESSENGER_Message *message;
 
-merge_next:
-  hash = get_message_state_merge_hash (&(room->state));
+    hash = get_message_state_merge_hash (&(room->state));
 
-  if (! hash)
-    return;
+    if (! hash)
+      break;
+
+    message = create_message_merge (hash);
+
+    if (! message)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Merging messages failed: %s\n",
+                  GNUNET_h2s (&(room->key)));
+    }
 
-  send_srv_room_message (room, handle, create_message_merge (hash));
-  goto merge_next;
+    send_srv_room_message (room, handle, message);
+  }
+  while (hash);
 }
 
 
@@ -710,10 +773,12 @@ delete_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
                          const struct GNUNET_HashCode *hash,
                          const struct GNUNET_TIME_Relative delay)
 {
+  const struct GNUNET_MESSENGER_Message *message;
+  struct GNUNET_TIME_Relative forever;
+
   GNUNET_assert ((room) && (session) && (hash));
 
-  const struct GNUNET_TIME_Relative forever =
-    GNUNET_TIME_relative_get_forever_ ();
+  forever = GNUNET_TIME_relative_get_forever_ ();
 
   if (0 == GNUNET_memcmp (&forever, &delay))
   {
@@ -722,11 +787,12 @@ delete_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
     return GNUNET_SYSERR;
   }
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
+  {
+    struct GNUNET_MESSENGER_MessageStore *message_store;
 
-  const struct GNUNET_MESSENGER_Message *message = get_store_message (
-    message_store, hash);
+    message_store = get_srv_room_message_store (room);
+    message = get_store_message (message_store, hash);
+  }
 
   if (! message)
     return GNUNET_YES;
@@ -741,15 +807,18 @@ delete_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
     return GNUNET_NO;
   }
 
-  struct GNUNET_MESSENGER_OperationStore *operation_store =
-    get_srv_room_operation_store (room);
-
-  if (GNUNET_OK != use_store_operation (operation_store, hash,
-                                        GNUNET_MESSENGER_OP_DELETE, delay))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Deletion has failed: operation denied!\n");
-    return GNUNET_SYSERR;
+    struct GNUNET_MESSENGER_OperationStore *operation_store;
+    
+    operation_store = get_srv_room_operation_store (room);
+
+    if (GNUNET_OK != use_store_operation (operation_store, hash,
+                                          GNUNET_MESSENGER_OP_DELETE, delay))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Deletion has failed: operation denied!\n");
+      return GNUNET_SYSERR;
+    }
   }
 
   return GNUNET_YES;
@@ -791,14 +860,14 @@ request_room_message_step (struct 
GNUNET_MESSENGER_SrvRoom *room,
                            GNUNET_MESSENGER_MessageRequestCallback callback,
                            void *cls)
 {
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  const struct GNUNET_MESSENGER_MessageLink *link;
   const struct GNUNET_MESSENGER_Message *message;
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
+  GNUNET_assert ((room) && (hash) && (session));
 
-  const struct GNUNET_MESSENGER_MessageLink *link = get_store_message_link (
-    message_store, hash, GNUNET_YES
-    );
+  message_store = get_srv_room_message_store (room);
+  link = get_store_message_link (message_store, hash, GNUNET_YES);
 
   if (! link)
     goto forward;
@@ -807,16 +876,18 @@ request_room_message_step (struct 
GNUNET_MESSENGER_SrvRoom *room,
               "Requesting link of message with hash: %s\n",
               GNUNET_h2s (hash));
 
-  enum GNUNET_GenericReturnValue result;
-  result = request_room_message_step (room, &(link->first), session,
-                                      callback, cls);
+  {
+    enum GNUNET_GenericReturnValue result;
+    result = request_room_message_step (room, &(link->first), session,
+                                        callback, cls);
 
-  if ((GNUNET_YES == link->multiple) &&
-      (GNUNET_YES == request_room_message_step (room, &(link->second), session,
-                                                callback, cls)))
-    return GNUNET_YES;
-  else
-    return result;
+    if ((GNUNET_YES == link->multiple) &&
+        (GNUNET_YES == request_room_message_step (room, &(link->second), 
session,
+                                                  callback, cls)))
+      return GNUNET_YES;
+    else
+      return result;
+  }
 
 forward:
   message = get_store_message (message_store, hash);
@@ -848,9 +919,10 @@ request_srv_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
                           GNUNET_MESSENGER_MessageRequestCallback callback,
                           void *cls)
 {
+  enum GNUNET_GenericReturnValue result;
+
   GNUNET_assert ((room) && (hash));
 
-  enum GNUNET_GenericReturnValue result;
   result = request_room_message_step (room, hash, session, callback, cls);
 
   if ((GNUNET_NO == result) && (callback))
@@ -864,12 +936,16 @@ void
 callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room,
                           void *cls)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+  struct GNUNET_PeerIdentity identity;
+
+  GNUNET_assert ((room) && (cls));
+  
+  tunnel = cls;
 
   if (! room->host)
     return;
 
-  struct GNUNET_PeerIdentity identity;
   get_tunnel_peer_identity (tunnel, &identity);
 
   if ((GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (room->tunnels,
@@ -886,13 +962,16 @@ callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom 
*room,
       (GNUNET_NO == room->service->auto_connecting))
     return;
 
-  struct GNUNET_MESSENGER_ListTunnel *element;
-  element = find_list_tunnels_alternate (&(room->basement), &identity);
+  {
+    struct GNUNET_MESSENGER_ListTunnel *element;
+    element = find_list_tunnels_alternate (&(room->basement), &identity);
 
-  if (! element)
-    return;
+    if (! element)
+      return;
+
+    GNUNET_PEER_resolve (element->peer, &identity);
+  }
 
-  GNUNET_PEER_resolve (element->peer, &identity);
   enter_srv_room_at (room, room->host, &identity);
 }
 
@@ -903,6 +982,10 @@ callback_verify_room_message (struct 
GNUNET_MESSENGER_SrvRoom *room,
                               struct GNUNET_MESSENGER_Message *message,
                               struct GNUNET_HashCode *hash)
 {
+  const struct GNUNET_MESSENGER_Message *previous;
+
+  GNUNET_assert ((room) && (message));
+
   if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -910,25 +993,31 @@ callback_verify_room_message (struct 
GNUNET_MESSENGER_SrvRoom *room,
     return GNUNET_SYSERR;
   }
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
+  {
+    struct GNUNET_MESSENGER_MessageStore *message_store;
 
-  const struct GNUNET_MESSENGER_Message *previous = get_store_message (
-    message_store, &(message->header.previous));
+    message_store = get_srv_room_message_store (room);
+
+    previous = get_store_message (
+      message_store, &(message->header.previous));
+  }
 
   if (! previous)
     goto skip_time_comparison;
 
-  struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_ntoh (
-    message->header.timestamp);
-  struct GNUNET_TIME_Absolute last = GNUNET_TIME_absolute_ntoh (
-    previous->header.timestamp);
-
-  if (GNUNET_TIME_relative_get_zero_ ().rel_value_us !=
-      GNUNET_TIME_absolute_get_difference (timestamp, last).rel_value_us)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Message warning: Timestamp does not check out!\n");
+    struct GNUNET_TIME_Absolute timestamp;
+    struct GNUNET_TIME_Absolute last;
+    
+    timestamp = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
+    last = GNUNET_TIME_absolute_ntoh (previous->header.timestamp);
+
+    if (GNUNET_TIME_relative_get_zero_ ().rel_value_us !=
+        GNUNET_TIME_absolute_get_difference (timestamp, last).rel_value_us)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Message warning: Timestamp does not check out!\n");
+    }
   }
 
 skip_time_comparison:
@@ -942,14 +1031,17 @@ skip_time_comparison:
 static void
 idle_request_room_messages (void *cls)
 {
-  struct GNUNET_MESSENGER_SrvRoom *room = cls;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+  struct GNUNET_MESSENGER_OperationStore *operation_store;
+  const struct GNUNET_HashCode *hash;
 
+  GNUNET_assert (cls);
+  
+  room = cls;
   room->idle = NULL;
 
-  struct GNUNET_MESSENGER_OperationStore *operation_store =
-    get_srv_room_operation_store (room);
-  const struct GNUNET_HashCode *hash = get_message_state_merge_hash (
-    &(room->state));
+  operation_store = get_srv_room_operation_store (room);
+  hash = get_message_state_merge_hash (&(room->state));
 
   if ((hash) &&
       (GNUNET_MESSENGER_OP_UNKNOWN == get_store_operation_type 
(operation_store,
@@ -977,24 +1069,27 @@ solve_srv_room_member_collisions (struct 
GNUNET_MESSENGER_SrvRoom *room,
                                   const struct GNUNET_ShortHashCode *member_id,
                                   struct GNUNET_TIME_Absolute timestamp)
 {
-  GNUNET_assert ((room) && (public_key) && (member_id));
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_Member *member;
+  struct GNUNET_MESSENGER_ListHandles *handles;
+  struct GNUNET_MESSENGER_ListHandle *element;
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_Member *member = get_store_member (member_store,
-                                                             member_id);
+  GNUNET_assert ((room) && (public_key) && (member_id));
+  
+  member_store = get_srv_room_member_store (room);
+  member = get_store_member (member_store, member_id);
 
   if ((! member) || (1 >= GNUNET_CONTAINER_multihashmap_size (
                        member->sessions)))
     return;
 
-  struct GNUNET_MESSENGER_ListHandles *handles = &(room->service->handles);
-  struct GNUNET_MESSENGER_ListHandle *element;
-
-  const struct GNUNET_CRYPTO_PublicKey *pubkey;
+  handles = &(room->service->handles);
 
   for (element = handles->head; element; element = element->next)
   {
+    const struct GNUNET_CRYPTO_PublicKey *pubkey;
+    struct GNUNET_MESSENGER_MemberSession *session;
+
     if (0 != GNUNET_memcmp (member_id, get_srv_handle_member_id (
                               element->handle, get_srv_room_key (room))))
       continue;
@@ -1004,22 +1099,26 @@ solve_srv_room_member_collisions (struct 
GNUNET_MESSENGER_SrvRoom *room,
     if (0 == GNUNET_memcmp (public_key, pubkey))
       continue;
 
-    struct GNUNET_MESSENGER_MemberSession *session = get_member_session 
(member,
-                                                                         
pubkey);
+    session = get_member_session (member, pubkey);
 
     if (! session)
       continue;
 
-    struct GNUNET_TIME_Absolute start = get_member_session_start (session);
-
-    if (GNUNET_TIME_relative_get_zero_ ().rel_value_us !=
-        GNUNET_TIME_absolute_get_difference (start, timestamp).rel_value_us)
-      continue;
+    {
+      struct GNUNET_TIME_Absolute start;
+      start = get_member_session_start (session);
 
-    struct GNUNET_ShortHashCode random_id;
-    generate_free_member_id (&random_id, member_store->members);
+      if (GNUNET_TIME_relative_get_zero_ ().rel_value_us !=
+          GNUNET_TIME_absolute_get_difference (start, timestamp).rel_value_us)
+        continue;
+    }
+    
+    {
+      struct GNUNET_ShortHashCode random_id;
+      generate_free_member_id (&random_id, member_store->members);
 
-    notify_srv_handle_member_id (element->handle, room, &random_id, GNUNET_NO);
+      notify_srv_handle_member_id (element->handle, room, &random_id, 
GNUNET_NO);
+    }
   }
 }
 
@@ -1027,15 +1126,18 @@ solve_srv_room_member_collisions (struct 
GNUNET_MESSENGER_SrvRoom *room,
 void
 rebuild_srv_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room)
 {
-  GNUNET_assert (room);
-
+  struct GNUNET_MESSENGER_ListTunnel *element;
   struct GNUNET_PeerIdentity peer;
+  size_t count;
   size_t src;
+  size_t dst;
+
+  GNUNET_assert (room);
 
   if (GNUNET_OK != get_service_peer_identity (room->service, &peer))
     return;
 
-  size_t count = count_of_tunnels (&(room->basement));
+  count = count_of_tunnels (&(room->basement));
 
   if (! find_list_tunnels (&(room->basement), &peer, &src))
     return;
@@ -1050,13 +1152,13 @@ rebuild_srv_room_basement_structure (struct 
GNUNET_MESSENGER_SrvRoom *room)
     return;
   }
 
-  struct GNUNET_MESSENGER_ListTunnel *element = room->basement.head;
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
-
-  size_t dst = 0;
+  element = room->basement.head;
+  dst = 0;
 
   while (element)
   {
+    struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
     GNUNET_PEER_resolve (element->peer, &peer);
 
     tunnel = GNUNET_CONTAINER_multipeermap_get (room->tunnels, &peer);
@@ -1096,9 +1198,11 @@ get_srv_room_amount_of_tunnels (const struct 
GNUNET_MESSENGER_SrvRoom *room)
 uint32_t
 get_srv_room_connection_flags (const struct GNUNET_MESSENGER_SrvRoom *room)
 {
-  GNUNET_assert (room);
+  uint32_t flags;
 
-  uint32_t flags = GNUNET_MESSENGER_FLAG_CONNECTION_NONE;
+  GNUNET_assert (room);
+  
+  flags = GNUNET_MESSENGER_FLAG_CONNECTION_NONE;
 
   if (GNUNET_YES == room->service->auto_routing)
     flags |= GNUNET_MESSENGER_FLAG_CONNECTION_AUTO;
@@ -1110,30 +1214,33 @@ get_srv_room_connection_flags (const struct 
GNUNET_MESSENGER_SrvRoom *room)
 static void
 handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room)
 {
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
-  struct GNUNET_MESSENGER_PeerStore *peer_store =
-    get_srv_room_peer_store (room);
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_PeerStore *peer_store;
+  const struct GNUNET_HashCode *key;
+
+  message_store = get_srv_room_message_store (room);
+  member_store = get_srv_room_member_store (room);
+  peer_store = get_srv_room_peer_store (room);
   
-  const struct GNUNET_HashCode *key = get_srv_room_key (room);
+  key = get_srv_room_key (room);
   
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Handling room messages: %s\n", GNUNET_h2s (key));
 
   while (room->handling.head)
   {
-    struct GNUNET_MESSENGER_ListMessage *element = room->handling.head;
-
-    const struct GNUNET_MESSENGER_Message *message = get_store_message (
+    struct GNUNET_MESSENGER_ListMessage *element;
+    struct GNUNET_MESSENGER_SenderSession session;
+    const struct GNUNET_MESSENGER_Message *message;
+    
+    element = room->handling.head;
+    message = get_store_message (
       message_store, &(element->hash));
 
     if (! message)
       goto finish_handling;
 
-    struct GNUNET_MESSENGER_SenderSession session;
-
     if (GNUNET_YES == is_peer_message (message))
     {
       session.peer = get_store_peer_of (peer_store, message, &(element->hash));
@@ -1143,8 +1250,9 @@ handle_room_messages (struct GNUNET_MESSENGER_SrvRoom 
*room)
     }
     else
     {
-      struct GNUNET_MESSENGER_Member *member = get_store_member_of (
-        member_store, message);
+      struct GNUNET_MESSENGER_Member *member;
+      
+      member = get_store_member_of (member_store, message);
 
       if (! member)
         goto finish_handling;
@@ -1172,12 +1280,14 @@ update_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
                      struct GNUNET_MESSENGER_Message *message,
                      const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_OperationStore *operation_store;
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+  enum GNUNET_GenericReturnValue requested;
+
   GNUNET_assert ((room) && (message) && (hash));
 
-  struct GNUNET_MESSENGER_OperationStore *operation_store =
-    get_srv_room_operation_store (room);
+  operation_store = get_srv_room_operation_store (room);
 
-  enum GNUNET_GenericReturnValue requested;
   requested = (GNUNET_MESSENGER_OP_REQUEST ==
                get_store_operation_type (operation_store, hash)?
                GNUNET_YES : GNUNET_NO);
@@ -1185,16 +1295,12 @@ update_room_message (struct GNUNET_MESSENGER_SrvRoom 
*room,
   if (GNUNET_YES == requested)
     cancel_store_operation (operation_store, hash);
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
-
-  enum GNUNET_GenericReturnValue duplicate;
-  duplicate = contains_store_message (message_store, hash);
+  message_store = get_srv_room_message_store (room);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handle a message in room (%s).\n",
               GNUNET_h2s (get_srv_room_key (room)));
   
-  if (GNUNET_YES == duplicate)
+  if (GNUNET_YES == contains_store_message (message_store, hash))
   {
     destroy_message (message);
 
@@ -1243,11 +1349,16 @@ iterate_member_for_subscription (void *cls,
                                  const struct GNUNET_CRYPTO_PublicKey 
*public_key,
                                  struct GNUNET_MESSENGER_MemberSession 
*session)
 {
-  struct GNUNET_MESSENGER_MemberSubscriptionIteration *it = cls;
-  struct GNUNET_MESSENGER_Member *member = session->member;
+  struct GNUNET_MESSENGER_MemberSubscriptionIteration *it;
+  struct GNUNET_MESSENGER_Member *member;
+  struct GNUNET_MESSENGER_Subscription *subscribtion;
 
-  struct GNUNET_MESSENGER_Subscription *subscribtion =
-    get_member_subscription (member, it->discourse);
+  GNUNET_assert ((cls) && (session));
+
+  it = cls;
+  member = session->member;
+
+  subscribtion = get_member_subscription (member, it->discourse);
   
   if (! subscribtion)
     return GNUNET_YES;
@@ -1262,19 +1373,20 @@ void
 cleanup_srv_room_discourse_messages (struct GNUNET_MESSENGER_SrvRoom *room,
                                      const struct GNUNET_ShortHashCode 
*discourse)
 {
+  struct GNUNET_MESSENGER_MemberSubscriptionIteration it;
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_MessageStore *message_store;
+
   GNUNET_assert ((room) && (discourse));
 
-  struct GNUNET_MESSENGER_MemberSubscriptionIteration it;
   it.discourse = discourse;
   it.start = GNUNET_TIME_absolute_get_forever_ ();
 
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
+  member_store = get_srv_room_member_store (room);
 
   iterate_store_members (member_store, iterate_member_for_subscription, &it);
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (room);
+  message_store = get_srv_room_message_store (room);
 
   cleanup_store_discourse_messages_before (message_store,
                                            discourse,
@@ -1305,16 +1417,19 @@ iterate_update_member_sessions (void *cls,
                                 GNUNET_CRYPTO_PublicKey *public_key,
                                 struct GNUNET_MESSENGER_MemberSession *session)
 {
-  struct GNUNET_MESSENGER_MemberUpdate *update = cls;
+  struct GNUNET_MESSENGER_MemberUpdate *update;
+
+  GNUNET_assert ((cls) && (session));
+  
+  update = cls;
 
   update_member_session_history (session, update->message, update->hash);
 
   if (GNUNET_YES == is_member_session_completed (session))
   {
-    struct GNUNET_MESSENGER_MemberSessionCompletion *element = GNUNET_new (
-      struct GNUNET_MESSENGER_MemberSessionCompletion
-      );
-
+    struct GNUNET_MESSENGER_MemberSessionCompletion *element;
+    
+    element = GNUNET_new (struct GNUNET_MESSENGER_MemberSessionCompletion);
     element->session = session;
 
     GNUNET_CONTAINER_DLL_insert_tail (update->head, update->tail, element);
@@ -1333,14 +1448,15 @@ callback_room_handle_message (struct 
GNUNET_MESSENGER_SrvRoom *room,
                               const struct GNUNET_MESSENGER_Message *message,
                               const struct GNUNET_HashCode *hash)
 {
-  GNUNET_assert ((room) && (message) && (hash));
+  struct GNUNET_MESSENGER_PeerStore *peer_store;
+  struct GNUNET_MESSENGER_MemberStore *member_store;
+  struct GNUNET_MESSENGER_SenderSession session;
+  enum GNUNET_GenericReturnValue start_handle;
 
-  struct GNUNET_MESSENGER_PeerStore *peer_store = get_srv_room_peer_store (
-    room);
-  struct GNUNET_MESSENGER_MemberStore *member_store =
-    get_srv_room_member_store (room);
+  GNUNET_assert ((room) && (message) && (hash));
 
-  struct GNUNET_MESSENGER_SenderSession session;
+  peer_store = get_srv_room_peer_store (room);
+  member_store = get_srv_room_member_store (room);
 
   if (GNUNET_YES == is_peer_message (message))
   {
@@ -1355,8 +1471,8 @@ callback_room_handle_message (struct 
GNUNET_MESSENGER_SrvRoom *room,
   }
   else
   {
-    struct GNUNET_MESSENGER_Member *member = get_store_member_of (member_store,
-                                                                  message);
+    struct GNUNET_MESSENGER_Member *member;
+    member = get_store_member_of (member_store, message);
 
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for message (%s)\n",
                 GNUNET_h2s (hash));
@@ -1378,26 +1494,27 @@ callback_room_handle_message (struct 
GNUNET_MESSENGER_SrvRoom *room,
     }
   }
 
-  struct GNUNET_MESSENGER_MemberUpdate update;
-  update.message = message;
-  update.hash = hash;
+  {
+    struct GNUNET_MESSENGER_MemberUpdate update;
+    update.message = message;
+    update.hash = hash;
 
-  update.head = NULL;
-  update.tail = NULL;
+    update.head = NULL;
+    update.tail = NULL;
 
-  iterate_store_members (member_store, iterate_update_member_sessions, 
&update);
+    iterate_store_members (member_store, iterate_update_member_sessions, 
&update);
 
-  while (update.head)
-  {
-    struct GNUNET_MESSENGER_MemberSessionCompletion *element = update.head;
+    while (update.head)
+    {
+      struct GNUNET_MESSENGER_MemberSessionCompletion *element = update.head;
 
-    remove_room_member_session (room, element->session);
+      remove_room_member_session (room, element->session);
 
-    GNUNET_CONTAINER_DLL_remove (update.head, update.tail, element);
-    GNUNET_free (element);
+      GNUNET_CONTAINER_DLL_remove (update.head, update.tail, element);
+      GNUNET_free (element);
+    }
   }
 
-  enum GNUNET_GenericReturnValue start_handle;
   start_handle = room->handling.head ? GNUNET_NO : GNUNET_YES;
 
   add_to_list_messages (&(room->handling), hash);
@@ -1455,9 +1572,10 @@ get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom 
*room,
 void
 load_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  char *room_dir;
+
   GNUNET_assert (room);
 
-  char *room_dir;
   get_room_data_subdir (room, &room_dir);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load room from directory: %s\n",
@@ -1475,11 +1593,13 @@ load_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
     load_message_store (get_srv_room_message_store (room), room_dir);
     load_operation_store (get_srv_room_operation_store (room), room_dir);
 
-    char *basement_file;
-    GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list");
+    {
+      char *basement_file;
+      GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list");
 
-    load_list_tunnels (&(room->basement), basement_file);
-    GNUNET_free (basement_file);
+      load_list_tunnels (&(room->basement), basement_file);
+      GNUNET_free (basement_file);
+    }
 
     load_message_state (&(room->state), room_dir);
   }
@@ -1491,9 +1611,10 @@ load_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 void
 save_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  char *room_dir;
+
   GNUNET_assert (room);
 
-  char *room_dir;
   get_room_data_subdir (room, &room_dir);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save room to directory: %s\n",
@@ -1512,11 +1633,13 @@ save_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
     save_message_store (get_srv_room_message_store (room), room_dir);
     save_operation_store (get_srv_room_operation_store (room), room_dir);
 
-    char *basement_file;
-    GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list");
+    {
+      char *basement_file;
+      GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list");
 
-    save_list_tunnels (&(room->basement), basement_file);
-    GNUNET_free (basement_file);
+      save_list_tunnels (&(room->basement), basement_file);
+      GNUNET_free (basement_file);
+    }
 
     save_message_state (&(room->state), room_dir);
   }
@@ -1528,9 +1651,10 @@ save_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 void
 remove_srv_room (struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  char *room_dir;
+
   GNUNET_assert (room);
 
-  char *room_dir;
   get_room_data_subdir (room, &room_dir);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove room from directory: %s\n",
@@ -1547,6 +1671,10 @@ static void
 remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
                             struct GNUNET_MESSENGER_MemberSession *session)
 {
+  struct GNUNET_HashCode hash;
+  char *session_dir;
+  char *room_dir;
+
   GNUNET_assert ((room) && (session));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1556,16 +1684,16 @@ remove_room_member_session (struct 
GNUNET_MESSENGER_SrvRoom *room,
 
   remove_member_session (session->member, session);
 
-  const struct GNUNET_CRYPTO_PublicKey *public_key =
-    get_member_session_public_key (session);
+  {
+    const struct GNUNET_CRYPTO_PublicKey *public_key;
+    public_key = get_member_session_public_key (session);
 
-  struct GNUNET_HashCode hash;
-  GNUNET_CRYPTO_hash (public_key, sizeof(*public_key), &hash);
+    GNUNET_CRYPTO_hash (public_key, sizeof(*public_key), &hash);
+  }
 
-  char *room_dir;
+  
   get_room_data_subdir (room, &room_dir);
 
-  char *session_dir;
   GNUNET_asprintf (
     &session_dir, "%s%s%c%s%c%s%c%s%c", room_dir,
     "members", DIR_SEPARATOR,
diff --git a/src/service/messenger/gnunet-service-messenger_service.c 
b/src/service/messenger/gnunet-service-messenger_service.c
index 11656d6b7..dceaa0274 100644
--- a/src/service/messenger/gnunet-service-messenger_service.c
+++ b/src/service/messenger/gnunet-service-messenger_service.c
@@ -34,7 +34,9 @@
 static void
 callback_shutdown_service (void *cls)
 {
-  struct GNUNET_MESSENGER_Service *service = cls;
+  struct GNUNET_MESSENGER_Service *service;
+  
+  service = cls;
 
   if (service)
   {
@@ -49,10 +51,11 @@ struct GNUNET_MESSENGER_Service*
 create_service (const struct GNUNET_CONFIGURATION_Handle *config,
                 struct GNUNET_SERVICE_Handle *service_handle)
 {
+  struct GNUNET_MESSENGER_Service *service;
+
   GNUNET_assert ((config) && (service_handle));
 
-  struct GNUNET_MESSENGER_Service *service = GNUNET_new (struct
-                                                         
GNUNET_MESSENGER_Service);
+  service = GNUNET_new (struct GNUNET_MESSENGER_Service);
 
   service->config = config;
   service->service = service_handle;
@@ -118,7 +121,12 @@ iterate_destroy_rooms (void *cls,
                        const struct GNUNET_HashCode *key,
                        void *value)
 {
-  struct GNUNET_MESSENGER_SrvRoom *room = value;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
+  GNUNET_assert (value);
+
+  room = value;
+
   destroy_srv_room (room, GNUNET_NO);
   return GNUNET_YES;
 }
@@ -184,14 +192,14 @@ struct GNUNET_MESSENGER_SrvHandle*
 add_service_handle (struct GNUNET_MESSENGER_Service *service,
                     struct GNUNET_MQ_Handle *mq)
 {
+  struct GNUNET_MESSENGER_SrvHandle *handle;
+
   GNUNET_assert ((service) && (mq));
 
-  struct GNUNET_MESSENGER_SrvHandle *handle = create_srv_handle (service, mq);
+  handle = create_srv_handle (service, mq);
 
   if (handle)
-  {
     add_list_handle (&(service->handles), handle);
-  }
 
   return handle;
 }
@@ -215,6 +223,8 @@ enum GNUNET_GenericReturnValue
 get_service_peer_identity (struct GNUNET_MESSENGER_Service *service,
                            struct GNUNET_PeerIdentity *peer)
 {
+  enum GNUNET_GenericReturnValue result;
+
   GNUNET_assert ((service) && (peer));
 
   if (service->peer)
@@ -223,7 +233,6 @@ get_service_peer_identity (struct GNUNET_MESSENGER_Service 
*service,
     return GNUNET_OK;
   }
 
-  enum GNUNET_GenericReturnValue result;
   result = GNUNET_CRYPTO_get_peer_identity (service->config, peer);
 
   if (GNUNET_OK != result)
@@ -259,18 +268,25 @@ find_member_session_in_room (void *cls,
                              const struct GNUNET_CRYPTO_PublicKey *public_key,
                              struct GNUNET_MESSENGER_MemberSession *session)
 {
-  struct HandleInitializationClosure *init = cls;
+  struct HandleInitializationClosure *init;
+  const struct GNUNET_ShortHashCode *id;
+
+  GNUNET_assert ((cls) && (session));
+  
+  init = cls;
 
   if (! public_key)
     return GNUNET_YES;
 
-  const struct GNUNET_CRYPTO_PublicKey *pubkey = get_srv_handle_key (
-    init->handle);
+  {
+    const struct GNUNET_CRYPTO_PublicKey *pubkey;
+    pubkey = get_srv_handle_key (init->handle);
 
-  if (0 != GNUNET_memcmp (pubkey, public_key))
-    return GNUNET_YES;
+    if (0 != GNUNET_memcmp (pubkey, public_key))
+      return GNUNET_YES;
+  }
 
-  const struct GNUNET_ShortHashCode *id = get_member_session_id (session);
+  id = get_member_session_id (session);
 
   if (! id)
   {
@@ -291,25 +307,30 @@ static void
 initialize_service_handle (struct GNUNET_MESSENGER_SrvHandle *handle,
                            struct GNUNET_MESSENGER_SrvRoom *room)
 {
+  struct GNUNET_MESSENGER_MemberStore *store;
+  const struct GNUNET_CRYPTO_PublicKey *pubkey;
+
   GNUNET_assert ((handle) && (room));
 
-  struct GNUNET_MESSENGER_MemberStore *store = get_srv_room_member_store 
(room);
+  store = get_srv_room_member_store (room);
   if (! store)
     return;
 
-  const struct GNUNET_CRYPTO_PublicKey *pubkey = get_srv_handle_key (handle);
+  pubkey = get_srv_handle_key (handle);
   if ((! pubkey) || (0 == GNUNET_memcmp (pubkey, get_anonymous_public_key ())))
     return;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Initialize member id of handle via matching member in room!\n");
 
-  struct HandleInitializationClosure init;
-  init.handle = handle;
-  init.room = room;
-  init.pubkey = pubkey;
+  {
+    struct HandleInitializationClosure init;
+    init.handle = handle;
+    init.room = room;
+    init.pubkey = pubkey;
 
-  iterate_store_members (store, find_member_session_in_room, &init);
+    iterate_store_members (store, find_member_session_in_room, &init);
+  }
 }
 
 
@@ -318,9 +339,11 @@ open_service_room (struct GNUNET_MESSENGER_Service 
*service,
                    struct GNUNET_MESSENGER_SrvHandle *handle,
                    const struct GNUNET_HashCode *key)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((service) && (handle) && (key));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key);
+  room = get_service_room (service, key);
 
   if (room)
   {
@@ -348,9 +371,11 @@ entry_service_room (struct GNUNET_MESSENGER_Service 
*service,
                     const struct GNUNET_PeerIdentity *door,
                     const struct GNUNET_HashCode *key)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+
   GNUNET_assert ((service) && (handle) && (door) && (key));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key);
+  room = get_service_room (service, key);
 
   if (room)
   {
@@ -387,29 +412,32 @@ close_service_room (struct GNUNET_MESSENGER_Service 
*service,
                     const struct GNUNET_HashCode *key,
                     enum GNUNET_GenericReturnValue deletion)
 {
+  struct GNUNET_MESSENGER_SrvRoom *room;
+  struct GNUNET_MESSENGER_SrvHandle *member_handle;
+
   GNUNET_assert ((service) && (handle) && (key));
 
-  struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key);
+  room = get_service_room (service, key);
 
   if (! room)
     return GNUNET_NO;
 
-  struct GNUNET_ShortHashCode *id = (struct GNUNET_ShortHashCode*) (
-    GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key));
+  {
+    struct GNUNET_ShortHashCode *id;
+    id = (struct GNUNET_ShortHashCode*) (
+      GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key));
 
-  GNUNET_assert (id);
+    GNUNET_assert (id);
 
-  if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (handle->member_ids,
-                                                          key, id))
-    return GNUNET_NO;
+    if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (handle->member_ids,
+                                                            key, id))
+      return GNUNET_NO;
 
-  GNUNET_free (id);
+    GNUNET_free (id);
+  }
 
-  struct GNUNET_MESSENGER_SrvHandle *member_handle = (struct
-                                                      
GNUNET_MESSENGER_SrvHandle
-                                                      *)
-                                                     
find_list_handle_by_member (
-    &(service->handles), key);
+  member_handle = (struct GNUNET_MESSENGER_SrvHandle*) (
+    find_list_handle_by_member (&(service->handles), key));
 
   if (! member_handle)
   {
@@ -443,6 +471,8 @@ handle_service_message (struct GNUNET_MESSENGER_Service 
*service,
                         const struct GNUNET_MESSENGER_Message *message,
                         const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_ListHandle *element;
+
   GNUNET_assert ((service) && (room) && (session) && (message) && (hash));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -450,8 +480,8 @@ handle_service_message (struct GNUNET_MESSENGER_Service 
*service,
               GNUNET_h2s (hash), GNUNET_MESSENGER_name_of_kind (
                 message->header.kind));
 
-  struct GNUNET_MESSENGER_ListHandle *element = service->handles.head;
-
+  element = service->handles.head;
+  
   while (element)
   {
     notify_srv_handle_message (element->handle, room, session, message, hash,
diff --git a/src/service/messenger/gnunet-service-messenger_subscription.c 
b/src/service/messenger/gnunet-service-messenger_subscription.c
index c6759800f..62664e005 100644
--- a/src/service/messenger/gnunet-service-messenger_subscription.c
+++ b/src/service/messenger/gnunet-service-messenger_subscription.c
@@ -36,9 +36,10 @@ create_subscription (struct GNUNET_MESSENGER_SrvRoom *room,
                      struct GNUNET_TIME_Absolute timestamp,
                      struct GNUNET_TIME_Relative duration)
 {
+  struct GNUNET_MESSENGER_Subscription *subscribtion;
+
   GNUNET_assert ((room) && (member) && (discourse));
 
-  struct GNUNET_MESSENGER_Subscription *subscribtion;
   subscribtion = GNUNET_new (struct GNUNET_MESSENGER_Subscription);
 
   if (! subscribtion)
@@ -93,9 +94,11 @@ update_subscription (struct GNUNET_MESSENGER_Subscription 
*subscribtion,
                      struct GNUNET_TIME_Absolute timestamp,
                      struct GNUNET_TIME_Relative duration)
 {
+  struct GNUNET_TIME_Absolute end;
+
   GNUNET_assert (subscribtion);
 
-  const struct GNUNET_TIME_Absolute end = GNUNET_TIME_absolute_add (timestamp, 
duration);
+  end = GNUNET_TIME_absolute_add (timestamp, duration);
 
   if (GNUNET_TIME_absolute_cmp (end, <, subscribtion->start))
     return;
@@ -109,18 +112,22 @@ update_subscription (struct GNUNET_MESSENGER_Subscription 
*subscribtion,
 static void
 task_subscription_exit (void *cls)
 {
+  struct GNUNET_MESSENGER_Subscription *subscribtion;
+  struct GNUNET_MESSENGER_Member *member;
+  struct GNUNET_MESSENGER_SrvRoom *room;
+  struct GNUNET_ShortHashCode discourse;
+
   GNUNET_assert (cls);
 
-  struct GNUNET_MESSENGER_Subscription *subscribtion = cls;
-  struct GNUNET_MESSENGER_Member *member = subscribtion->member;
+  subscribtion = cls;
+  member = subscribtion->member;
 
   subscribtion->task = NULL;
 
   if (! member)
     return;
 
-  struct GNUNET_MESSENGER_SrvRoom *room = subscribtion->room;
-  struct GNUNET_ShortHashCode discourse;
+  room = subscribtion->room;
 
   memcpy (&discourse, &(subscribtion->discourse), 
           sizeof (struct GNUNET_ShortHashCode));
@@ -134,12 +141,13 @@ task_subscription_exit (void *cls)
 void
 update_subscription_timing (struct GNUNET_MESSENGER_Subscription *subscribtion)
 {
-  GNUNET_assert (subscribtion);
+  struct GNUNET_TIME_Absolute current;
+  struct GNUNET_TIME_Relative time;
 
-  struct GNUNET_TIME_Absolute current = GNUNET_TIME_absolute_get ();
+  GNUNET_assert (subscribtion);
 
-  struct GNUNET_TIME_Relative time =
-    GNUNET_TIME_absolute_get_difference (current, subscribtion->end);
+  current = GNUNET_TIME_absolute_get ();
+  time = GNUNET_TIME_absolute_get_difference (current, subscribtion->end);
   
   if (subscribtion->task)
     GNUNET_SCHEDULER_cancel (subscribtion->task);
diff --git a/src/service/messenger/gnunet-service-messenger_tunnel.c 
b/src/service/messenger/gnunet-service-messenger_tunnel.c
index 98d0ab1ce..be74e0aa0 100644
--- a/src/service/messenger/gnunet-service-messenger_tunnel.c
+++ b/src/service/messenger/gnunet-service-messenger_tunnel.c
@@ -37,10 +37,11 @@ struct GNUNET_MESSENGER_SrvTunnel*
 create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room,
                const struct GNUNET_PeerIdentity *door)
 {
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+
   GNUNET_assert ((room) && (door));
 
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = GNUNET_new (struct
-                                                          
GNUNET_MESSENGER_SrvTunnel);
+  tunnel = GNUNET_new (struct GNUNET_MESSENGER_SrvTunnel);
 
   tunnel->room = room;
   tunnel->channel = NULL;
@@ -97,7 +98,9 @@ void
 callback_tunnel_disconnect (void *cls,
                             const struct GNUNET_CADET_Channel *channel)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+  
+  tunnel = cls;
 
   if (tunnel)
   {
@@ -118,15 +121,21 @@ enum GNUNET_GenericReturnValue
 check_tunnel_message (void *cls,
                       const struct GNUNET_MessageHeader *header)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+  struct GNUNET_MESSENGER_Message message;
+  struct GNUNET_HashCode hash;
+  uint16_t length;
+  const char *buffer;
+
+  GNUNET_assert (header);
+  
+  tunnel = cls;
 
   if (! tunnel)
     return GNUNET_SYSERR;
 
-  const uint16_t length = ntohs (header->size) - sizeof(*header);
-  const char *buffer = (const char*) &header[1];
-
-  struct GNUNET_MESSENGER_Message message;
+  length = ntohs (header->size) - sizeof(*header);
+  buffer = (const char*) &header[1];
 
   if (length < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN,
                                       GNUNET_YES))
@@ -136,17 +145,19 @@ check_tunnel_message (void *cls,
     return GNUNET_SYSERR;
   }
 
-  uint16_t padding = 0;
-
-  if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES,
-                                    &padding))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tunnel error: Decoding failed!\n");
-    return GNUNET_SYSERR;
-  }
+    uint16_t padding;
+    padding = 0;
 
-  struct GNUNET_HashCode hash;
-  hash_message (&message, length - padding, buffer, &hash);
+    if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES,
+                                      &padding))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Tunnel error: Decoding 
failed!\n");
+      return GNUNET_SYSERR;
+    }
+
+    hash_message (&message, length - padding, buffer, &hash);
+  }
 
   return callback_verify_room_message (tunnel->room, cls, &message, &hash);
 }
@@ -166,82 +177,102 @@ static void
 update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
                             const struct GNUNET_HashCode *hash)
 {
-  struct GNUNET_MESSENGER_OperationStore *operation_store =
-    get_srv_room_operation_store (tunnel->room);
-
+  struct GNUNET_MESSENGER_OperationStore *operation_store;
   enum GNUNET_GenericReturnValue requested;
+
+  GNUNET_assert ((tunnel) && (hash));
+
+  operation_store = get_srv_room_operation_store (tunnel->room);
+
   requested = (GNUNET_MESSENGER_OP_REQUEST ==
                get_store_operation_type (operation_store, hash)?
                GNUNET_YES : GNUNET_NO);
 
-  struct GNUNET_MESSENGER_MessageStore *message_store =
-    get_srv_room_message_store (tunnel->room);
+  {
+    struct GNUNET_MESSENGER_MessageStore *message_store;
+    const struct GNUNET_MESSENGER_Message *message;
+
+    message_store = get_srv_room_message_store (tunnel->room);
+    message = get_store_message (message_store, hash);
 
-  const struct GNUNET_MESSENGER_Message *message = get_store_message (
-    message_store, hash);
+    if (! message)
+      return;
 
-  if (message)
     update_message_state (&(tunnel->state), requested, message, hash);
+  }
 }
 
 
 void
 handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header)
 {
-  struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
+  struct GNUNET_MESSENGER_SrvTunnel *tunnel;
+  struct GNUNET_MESSENGER_Message message;
+  struct GNUNET_HashCode hash;
+  uint16_t length;
+  const char *buffer;
+
+  GNUNET_assert (header);
+  
+  tunnel = cls;
 
   if (! tunnel)
     return;
 
-  const uint16_t length = ntohs (header->size) - sizeof(*header);
-  const char *buffer = (const char*) &header[1];
-
-  struct GNUNET_MESSENGER_Message message;
-  struct GNUNET_HashCode hash;
+  length = ntohs (header->size) - sizeof(*header);
+  buffer = (const char*) &header[1];
 
-  uint16_t padding = 0;
+  {
+    uint16_t padding;
+    padding = 0;
 
-  decode_message (&message, length, buffer, GNUNET_YES, &padding);
-  hash_message (&message, length - padding, buffer, &hash);
+    decode_message (&message, length, buffer, GNUNET_YES, &padding);
+    hash_message (&message, length - padding, buffer, &hash);
+  }
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got message of kind: %s!\n",
               GNUNET_MESSENGER_name_of_kind (message.header.kind));
 
-  enum GNUNET_GenericReturnValue new_message;
-  new_message = update_room_message (tunnel->room,
-                                     copy_message (&message),
-                                     &hash);
+  {
+    enum GNUNET_GenericReturnValue new_message;
+    new_message = update_room_message (tunnel->room,
+                                      copy_message (&message),
+                                      &hash);
 
-  if (GNUNET_YES != new_message)
-    goto receive_done;
+    if (GNUNET_YES != new_message)
+      goto receive_done;
+  }
 
   update_tunnel_last_message (tunnel, &hash);
 
-  enum GNUNET_GenericReturnValue forward_message = GNUNET_YES;
-
-  switch (message.header.kind)
-  {
-  case GNUNET_MESSENGER_KIND_INFO:
-    forward_message = recv_message_info (tunnel->room, tunnel, &message, 
&hash);
-    break;
-  case GNUNET_MESSENGER_KIND_PEER:
-    forward_message = recv_message_peer (tunnel->room, tunnel, &message, 
&hash);
-    break;
-  case GNUNET_MESSENGER_KIND_MISS:
-    forward_message = recv_message_miss (tunnel->room, tunnel, &message, 
&hash);
-    break;
-  case GNUNET_MESSENGER_KIND_REQUEST:
-    forward_message = recv_message_request (tunnel->room, tunnel, &message,
-                                            &hash);
-    break;
-  default:
-    break;
-  }
-
-  if (GNUNET_YES == forward_message)
   {
-    forward_srv_room_message (tunnel->room, tunnel, &message, &hash);
-    callback_room_handle_message (tunnel->room, &message, &hash);
+    enum GNUNET_GenericReturnValue forward_message;
+    forward_message = GNUNET_YES;
+
+    switch (message.header.kind)
+    {
+    case GNUNET_MESSENGER_KIND_INFO:
+      forward_message = recv_message_info (tunnel->room, tunnel, &message, 
&hash);
+      break;
+    case GNUNET_MESSENGER_KIND_PEER:
+      forward_message = recv_message_peer (tunnel->room, tunnel, &message, 
&hash);
+      break;
+    case GNUNET_MESSENGER_KIND_MISS:
+      forward_message = recv_message_miss (tunnel->room, tunnel, &message, 
&hash);
+      break;
+    case GNUNET_MESSENGER_KIND_REQUEST:
+      forward_message = recv_message_request (tunnel->room, tunnel, &message,
+                                              &hash);
+      break;
+    default:
+      break;
+    }
+
+    if (GNUNET_YES == forward_message)
+    {
+      forward_srv_room_message (tunnel->room, tunnel, &message, &hash);
+      callback_room_handle_message (tunnel->room, &message, &hash);
+    }
   }
 
 receive_done:
@@ -254,29 +285,35 @@ receive_done:
 enum GNUNET_GenericReturnValue
 connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel)
 {
+  const struct GNUNET_PeerIdentity *door;
+  struct GNUNET_CADET_Handle *cadet;
+  const struct GNUNET_HashCode *key;
+
+
   GNUNET_assert (tunnel);
 
   if (tunnel->channel)
     return GNUNET_NO;
 
-  const struct GNUNET_PeerIdentity *door = GNUNET_PEER_resolve2 (tunnel->peer);
-
-  struct GNUNET_CADET_Handle *cadet = get_srv_room_cadet (tunnel->room);
-  const struct GNUNET_HashCode *key = get_srv_room_key (tunnel->room);
-
-  struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (
-                                                   tunnel_message,
-                                                   
GNUNET_MESSAGE_TYPE_CADET_CLI,
-                                                   struct
-                                                   GNUNET_MessageHeader, NULL),
-                                                 GNUNET_MQ_handler_end () };
+  door = GNUNET_PEER_resolve2 (tunnel->peer);
+  cadet = get_srv_room_cadet (tunnel->room);
+  key = get_srv_room_key (tunnel->room);
 
-  struct GNUNET_HashCode port;
-  convert_messenger_key_to_port (key, &port);
-  tunnel->channel = GNUNET_CADET_channel_create (cadet, tunnel, door, &port,
-                                                 NULL,
-                                                 callback_tunnel_disconnect,
-                                                 handlers);
+  {
+    struct GNUNET_HashCode port;
+    struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size (
+                                                    tunnel_message,
+                                                    
GNUNET_MESSAGE_TYPE_CADET_CLI,
+                                                    struct
+                                                    GNUNET_MessageHeader, 
NULL),
+                                                  GNUNET_MQ_handler_end () };
+    
+    convert_messenger_key_to_port (key, &port);
+    tunnel->channel = GNUNET_CADET_channel_create (cadet, tunnel, door, &port,
+                                                  NULL,
+                                                  callback_tunnel_disconnect,
+                                                  handlers);
+  }
 
   return GNUNET_YES;
 }
@@ -314,7 +351,11 @@ struct GNUNET_MESSENGER_MessageSent
 static void
 callback_tunnel_sent (void *cls)
 {
-  struct GNUNET_MESSENGER_MessageSent *sent = cls;
+  struct GNUNET_MESSENGER_MessageSent *sent;
+
+  GNUNET_assert (cls);
+  
+  sent = cls;
 
   if (sent->tunnel)
     update_tunnel_last_message (sent->tunnel, &(sent->hash));
@@ -328,12 +369,13 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel 
*tunnel,
                       struct GNUNET_MQ_Envelope *env,
                       const struct GNUNET_HashCode *hash)
 {
-  GNUNET_assert ((tunnel) && (env) && (hash));
+  struct GNUNET_MQ_Handle *mq;
+  struct GNUNET_MESSENGER_MessageSent *sent;
 
-  struct GNUNET_MQ_Handle *mq = GNUNET_CADET_get_mq (tunnel->channel);
+  GNUNET_assert ((tunnel) && (env) && (hash));
 
-  struct GNUNET_MESSENGER_MessageSent *sent = GNUNET_new (struct
-                                                          
GNUNET_MESSENGER_MessageSent);
+  mq = GNUNET_CADET_get_mq (tunnel->channel);
+  sent = GNUNET_new (struct GNUNET_MESSENGER_MessageSent);
 
   GNUNET_memcpy (&(sent->hash), hash, sizeof(struct GNUNET_HashCode));
 
@@ -349,13 +391,15 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel 
*tunnel,
                      void *handle,
                      struct GNUNET_MESSENGER_Message *message)
 {
+  struct GNUNET_HashCode hash;
+  struct GNUNET_MQ_Envelope *env;
+
   GNUNET_assert ((tunnel) && (handle));
 
   if (! message)
     return GNUNET_NO;
 
-  struct GNUNET_HashCode hash;
-  struct GNUNET_MQ_Envelope *env = pack_srv_room_message (
+  env = pack_srv_room_message (
     tunnel->room, (struct GNUNET_MESSENGER_SrvHandle*) handle,
     message, &hash, GNUNET_MESSENGER_PACK_MODE_ENVELOPE
     );
@@ -378,12 +422,14 @@ forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel 
*tunnel,
                         const struct GNUNET_MESSENGER_Message *message,
                         const struct GNUNET_HashCode *hash)
 {
+  struct GNUNET_MESSENGER_Message *copy;
+  struct GNUNET_MQ_Envelope *env;
+
   GNUNET_assert ((tunnel) && (message) && (hash));
 
-  struct GNUNET_MESSENGER_Message *copy = copy_message (message);
-  struct GNUNET_MQ_Envelope *env = pack_message (copy, NULL, NULL,
-                                                 
GNUNET_MESSENGER_PACK_MODE_ENVELOPE,
-                                                 NULL);
+  copy = copy_message (message);
+  env = pack_message (copy, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE,
+                      NULL);
 
   destroy_message (copy);
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]