aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-12 21:47:43 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-12 21:47:43 +0200
commit5e27a5874aa1437a1a9b9974d26750d5520017e2 (patch)
tree5a1553b0b864eecff2ff9509d9887b29a30313f4
parent8f5542e8e6c3a6ad511a51d8872c3a14430eff13 (diff)
tomsg_clientlib: Elide redundant assignments in nullify()
-rw-r--r--ssh/tomsg_clientlib.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/ssh/tomsg_clientlib.c b/ssh/tomsg_clientlib.c
index 0108a38..daa2cf5 100644
--- a/ssh/tomsg_clientlib.c
+++ b/ssh/tomsg_clientlib.c
@@ -252,22 +252,22 @@ void tomsg_event_nullify(struct tomsg_event event) {
case TOMSG_EV_REGISTER:
case TOMSG_EV_LOGIN:
- free(event.login.username); event.login.username = NULL;
+ free(event.login.username);
break;
case TOMSG_EV_INVITE:
case TOMSG_EV_PUSH_JOIN:
- free(event.join.room_name); event.join.room_name = NULL;
- free(event.join.username); event.join.username = NULL;
+ free(event.join.room_name);
+ free(event.join.username);
break;
case TOMSG_EV_IS_ONLINE:
case TOMSG_EV_PUSH_ONLINE:
- free(event.is_online.username); event.is_online.username = NULL;
+ free(event.is_online.username);
break;
case TOMSG_EV_CREATE_ROOM:
- free(event.create_room.room_name); event.create_room.room_name = NULL;
+ free(event.create_room.room_name);
break;
case TOMSG_EV_LIST_ROOMS:
@@ -277,7 +277,6 @@ void tomsg_event_nullify(struct tomsg_event event) {
}
}
free(event.list_rooms.rooms);
- event.list_rooms.rooms = NULL;
break;
case TOMSG_EV_LIST_MEMBERS:
@@ -287,28 +286,26 @@ void tomsg_event_nullify(struct tomsg_event event) {
}
}
free(event.list_members.members);
- event.list_members.members = NULL;
break;
case TOMSG_EV_HISTORY:
- free(event.history.room_name); event.history.room_name = NULL;
+ free(event.history.room_name);
if (event.history.messages != NULL) {
for (int64_t i = 0; i < event.history.count; i++) {
history_message_nullify(event.history.messages[i]);
}
}
free(event.history.messages);
- event.history.messages = NULL;
break;
case TOMSG_EV_PUSH_MESSAGE:
- free(event.push_message.room_name); event.push_message.room_name = NULL;
+ free(event.push_message.room_name);
history_message_nullify(event.push_message.message);
break;
case TOMSG_EV_PUSH_INVITE:
- free(event.push_invite.room_name); event.push_invite.room_name = NULL;
- free(event.push_invite.inviter); event.push_invite.inviter = NULL;
+ free(event.push_invite.room_name);
+ free(event.push_invite.inviter);
break;
}
}