diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2023-11-23 22:31:22 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2023-11-23 22:31:22 +0100 |
commit | 578391d1acb501fb81248f339d2c1a9672684517 (patch) | |
tree | 330bb4f7b693ae960f8d97f310095842ead73cd2 | |
parent | e8161df3c3fc2aaeef4adb81abb5eed3505c9409 (diff) | |
download | libgnunetchat-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.c | 17 |
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 | ||
29 | static const unsigned int initial_map_size_of_handle = 8; | ||
30 | static const unsigned int minimum_amount_of_other_members_in_group = 2; | ||
31 | |||
29 | struct GNUNET_CHAT_Handle* | 32 | struct GNUNET_CHAT_Handle* |
30 | handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, | 33 | handle_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); |