diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-31 18:20:05 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-10-31 18:20:05 +0100 |
commit | 5a08e8a921163dc0dcd57d73e6ce76b98e5cc29e (patch) | |
tree | ce4d162423553bc5bdc1a085b7fca9a9ad811e27 /src/gnunet_chat_context.c | |
parent | aa9014fd46c64142fb087d7a7288f5347532e2fe (diff) | |
download | libgnunetchat-5a08e8a921163dc0dcd57d73e6ce76b98e5cc29e.tar.gz libgnunetchat-5a08e8a921163dc0dcd57d73e6ce76b98e5cc29e.zip |
Added assertions to ensure code safety
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/gnunet_chat_context.c')
-rw-r--r-- | src/gnunet_chat_context.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c index 06f9c88..458063f 100644 --- a/src/gnunet_chat_context.c +++ b/src/gnunet_chat_context.c | |||
@@ -32,6 +32,8 @@ struct GNUNET_CHAT_Context* | |||
32 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, | 32 | context_create_from_room (struct GNUNET_CHAT_Handle *handle, |
33 | struct GNUNET_MESSENGER_Room *room) | 33 | struct GNUNET_MESSENGER_Room *room) |
34 | { | 34 | { |
35 | GNUNET_assert((handle) && (room)); | ||
36 | |||
35 | struct GNUNET_CHAT_Context* context = GNUNET_new(struct GNUNET_CHAT_Context); | 37 | struct GNUNET_CHAT_Context* context = GNUNET_new(struct GNUNET_CHAT_Context); |
36 | 38 | ||
37 | context->handle = handle; | 39 | context->handle = handle; |
@@ -54,6 +56,12 @@ context_create_from_room (struct GNUNET_CHAT_Handle *handle, | |||
54 | void | 56 | void |
55 | context_destroy (struct GNUNET_CHAT_Context* context) | 57 | context_destroy (struct GNUNET_CHAT_Context* context) |
56 | { | 58 | { |
59 | GNUNET_assert((context) && | ||
60 | (context->timestamps) && | ||
61 | (context->messages) && | ||
62 | (context->invites) && | ||
63 | (context->files)); | ||
64 | |||
57 | GNUNET_CONTAINER_multishortmap_iterate( | 65 | GNUNET_CONTAINER_multishortmap_iterate( |
58 | context->timestamps, it_destroy_context_timestamps, NULL | 66 | context->timestamps, it_destroy_context_timestamps, NULL |
59 | ); | 67 | ); |
@@ -80,6 +88,10 @@ context_destroy (struct GNUNET_CHAT_Context* context) | |||
80 | void | 88 | void |
81 | context_load_config (struct GNUNET_CHAT_Context *context) | 89 | context_load_config (struct GNUNET_CHAT_Context *context) |
82 | { | 90 | { |
91 | GNUNET_assert((context) && | ||
92 | (context->handle) && | ||
93 | (context->room)); | ||
94 | |||
83 | const char *directory = context->handle->directory; | 95 | const char *directory = context->handle->directory; |
84 | 96 | ||
85 | if (!directory) | 97 | if (!directory) |
@@ -119,6 +131,10 @@ free_filename: | |||
119 | void | 131 | void |
120 | context_save_config (const struct GNUNET_CHAT_Context *context) | 132 | context_save_config (const struct GNUNET_CHAT_Context *context) |
121 | { | 133 | { |
134 | GNUNET_assert((context) && | ||
135 | (context->handle) && | ||
136 | (context->room)); | ||
137 | |||
122 | const char *directory = context->handle->directory; | 138 | const char *directory = context->handle->directory; |
123 | 139 | ||
124 | if (!directory) | 140 | if (!directory) |