aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2023-11-23 22:31:22 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2023-11-23 22:31:22 +0100
commit578391d1acb501fb81248f339d2c1a9672684517 (patch)
tree330bb4f7b693ae960f8d97f310095842ead73cd2
parente8161df3c3fc2aaeef4adb81abb5eed3505c9409 (diff)
downloadlibgnunetchat-578391d1acb501fb81248f339d2c1a9672684517.tar.gz
libgnunetchat-578391d1acb501fb81248f339d2c1a9672684517.zip
Define magic numbers as constants
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--src/gnunet_chat_handle.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gnunet_chat_handle.c b/src/gnunet_chat_handle.c
index 96c5a84..ed8686f 100644
--- a/src/gnunet_chat_handle.c
+++ b/src/gnunet_chat_handle.c
@@ -26,6 +26,9 @@
26 26
27#include "gnunet_chat_handle_intern.c" 27#include "gnunet_chat_handle_intern.c"
28 28
29static const unsigned int initial_map_size_of_handle = 8;
30static const unsigned int minimum_amount_of_other_members_in_group = 2;
31
29struct GNUNET_CHAT_Handle* 32struct GNUNET_CHAT_Handle*
30handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, 33handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg,
31 GNUNET_CHAT_ContextMessageCallback msg_cb, 34 GNUNET_CHAT_ContextMessageCallback msg_cb,
@@ -279,10 +282,14 @@ handle_connect (struct GNUNET_CHAT_Handle *handle,
279 handle->monitor = NULL; 282 handle->monitor = NULL;
280 } 283 }
281 284
282 handle->files = GNUNET_CONTAINER_multihashmap_create(8, GNUNET_NO); 285 handle->files = GNUNET_CONTAINER_multihashmap_create(
283 handle->contexts = GNUNET_CONTAINER_multihashmap_create(8, GNUNET_NO); 286 initial_map_size_of_handle, GNUNET_NO);
284 handle->contacts = GNUNET_CONTAINER_multishortmap_create(8, GNUNET_NO); 287 handle->contexts = GNUNET_CONTAINER_multihashmap_create(
285 handle->groups = GNUNET_CONTAINER_multihashmap_create(8, GNUNET_NO); 288 initial_map_size_of_handle, GNUNET_NO);
289 handle->contacts = GNUNET_CONTAINER_multishortmap_create(
290 initial_map_size_of_handle, GNUNET_NO);
291 handle->groups = GNUNET_CONTAINER_multihashmap_create(
292 initial_map_size_of_handle, GNUNET_NO);
286 293
287 const char *name = account->name; 294 const char *name = account->name;
288 295
@@ -760,7 +767,7 @@ check_type:
760 767
761 context_write_records(context); 768 context_write_records(context);
762 } 769 }
763 else if (checks >= 2) 770 else if (checks >= minimum_amount_of_other_members_in_group)
764 { 771 {
765 context->deleted = GNUNET_YES; 772 context->deleted = GNUNET_YES;
766 context_write_records(context); 773 context_write_records(context);