Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
High-Voltaged committed Feb 1, 2022
1 parent 8f0c243 commit b5fedc9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions client/src/request_handlers/get_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ t_msg* handle_get_msg_response() {

int error_code = get_response_code(json);
if (error_code != R_SUCCESS) {
printf("not success -- %d\n", error_code);
cJSON_Delete(json);
logger(get_response_str(error_code), ERROR_LOG);
return NULL;
Expand All @@ -41,7 +40,6 @@ t_msg* handle_get_msg_response() {
t_msg* new_msg = get_msg_from_json(msg_json);

if (new_msg == NULL || new_msg->sender_id == utils->current_user->user_id) {
printf("not valid msg\n");
cJSON_Delete(json);
logger(get_response_str(R_JSON_FAILURE), ERROR_LOG);
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions client/src/request_handlers/server_updates.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ void* handle_server_updates(void* arg) {
(void)arg;
while (1) {

if (utils && utils->is_suspended)
continue;

if (!utils)
break;

if (utils && utils->is_suspended)
continue;

pthread_mutex_lock(&utils->lock);
t_chat* curr_chat = utils->chatlist;
Expand Down
2 changes: 1 addition & 1 deletion utils/src/db_lists/chat_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void mx_clear_chat_list(t_chat **list)
{
next = node->next;
mx_clear_msg_list(&node->messages);
// mx_clear_msg_list(&node->last_new_msg);
mx_clear_msg_list(&node->new_messages);
mx_clear_chat(&node);
node = next;
}
Expand Down

0 comments on commit b5fedc9

Please sign in to comment.