1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Manual allocation of socket memory.

This commit is contained in:
Bartosz Taudul
2017-10-18 19:49:17 +02:00
parent fc94378e0c
commit 51013dc0e6
4 changed files with 15 additions and 6 deletions
+6 -2
View File
@@ -1,9 +1,11 @@
#include <assert.h>
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "TracyAlloc.hpp"
#include "TracySocket.hpp"
#ifdef _MSC_VER
@@ -226,7 +228,7 @@ bool ListenSocket::Listen( const char* port, int backlog )
return true;
}
std::unique_ptr<Socket> ListenSocket::Accept()
Socket* ListenSocket::Accept()
{
struct sockaddr_storage remote;
socklen_t sz = sizeof( remote );
@@ -249,7 +251,9 @@ std::unique_ptr<Socket> ListenSocket::Accept()
}
else
{
return std::make_unique<Socket>( sock );
auto ptr = (Socket*)tracy_malloc( sizeof( Socket ) );
new(ptr) Socket( sock );
return ptr;
}
}
else