Commit d67aa7c1 authored by Max Kellermann's avatar Max Kellermann

ClientNew: allocate/dispose client objects with new/delete

Prepare for adding non-trivial attributes.
parent 7a982169
...@@ -50,7 +50,6 @@ client_new(struct player_control *player_control, ...@@ -50,7 +50,6 @@ client_new(struct player_control *player_control,
int fd, const struct sockaddr *sa, size_t sa_length, int uid) int fd, const struct sockaddr *sa, size_t sa_length, int uid)
{ {
static unsigned int next_client_num; static unsigned int next_client_num;
Client *client;
char *remote; char *remote;
assert(player_control != NULL); assert(player_control != NULL);
...@@ -87,7 +86,7 @@ client_new(struct player_control *player_control, ...@@ -87,7 +86,7 @@ client_new(struct player_control *player_control,
return; return;
} }
client = g_new0(Client, 1); Client *client = new Client();
client->player_control = player_control; client->player_control = player_control;
client->channel = g_io_channel_new_socket(fd); client->channel = g_io_channel_new_socket(fd);
...@@ -163,5 +162,5 @@ client_close(Client *client) ...@@ -163,5 +162,5 @@ client_close(Client *client)
g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE, g_log(G_LOG_DOMAIN, LOG_LEVEL_SECURE,
"[%u] closed", client->num); "[%u] closed", client->num);
g_free(client); delete client;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment