Pass int directly as pointer

This commit is contained in:
topjohnwu 2019-09-19 00:13:42 -04:00
parent 17981730a4
commit b44f5122fd

View File

@ -39,8 +39,7 @@ static void remove_modules() {
} }
static void *request_handler(void *args) { static void *request_handler(void *args) {
int client = *((int *) args); int client = reinterpret_cast<intptr_t>(args);
delete (int *) args;
struct ucred credential; struct ucred credential;
get_client_cred(client, &credential); get_client_cred(client, &credential);
@ -173,9 +172,8 @@ static void main_daemon() {
// Loop forever to listen for requests // Loop forever to listen for requests
for (;;) { for (;;) {
int *client = new int; int client = xaccept4(fd, nullptr, nullptr, SOCK_CLOEXEC);
*client = xaccept4(fd, nullptr, nullptr, SOCK_CLOEXEC); new_daemon_thread(request_handler, reinterpret_cast<void*>(client));
new_daemon_thread(request_handler, client);
} }
} }