From f4c630f613e23d40f661a03f82923c4e7ffdd30c Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Thu, 31 Jul 2014 15:22:48 +0100 Subject: [PATCH] initialize static instance creation --- include/tr/remote_data.h | 2 ++ include/tr/socket.h | 6 ++++++ include/tr/stream.h | 1 + 3 files changed, 9 insertions(+) diff --git a/include/tr/remote_data.h b/include/tr/remote_data.h index 2433b98..9576f44 100644 --- a/include/tr/remote_data.h +++ b/include/tr/remote_data.h @@ -38,6 +38,8 @@ TR_CLASS(TR_RemoteData) { socklen_t addrlen; }; +TR_INSTANCE_INIT(TR_RemoteData); + extern TR_RemoteData TR_emptyRemoteData; void TR_remoteDataSetData(TR_RemoteData, unsigned char *, size_t); diff --git a/include/tr/socket.h b/include/tr/socket.h index 78c0042..1079fd7 100644 --- a/include/tr/socket.h +++ b/include/tr/socket.h @@ -58,6 +58,8 @@ TR_CLASS(TR_Socket) { TR_SocketFin fin_state; }; +TR_INSTANCE_INIT(TR_Socket); + #define TR_socketLog(socket) (((TR_Socket)(socket))->log) #define TR_socketFlags(socket) (((TR_Socket)(socket))->flags) #define TR_socketType(socket) (((TR_Socket)(socket))->type) @@ -82,10 +84,14 @@ TR_CLASS(TR_TcpSocket) { int connected; }; +TR_INSTANCE_INIT(TR_TcpSocket); + TR_CLASS(TR_UdpSocket) { TR_EXTENDS(TR_Socket); }; +TR_INSTANCE_INIT(TR_UdpSocket); + typedef int (* TR_socketAction_fptr)(void *); int TR_socketInit(TR_Socket, TR_socketAction_fptr); diff --git a/include/tr/stream.h b/include/tr/stream.h index 1c707cc..5d115c8 100644 --- a/include/tr/stream.h +++ b/include/tr/stream.h @@ -40,6 +40,7 @@ TR_CLASS(TR_Stream) { SSL * ssl; } handle; }; +TR_INSTANCE_INIT(TR_Stream); ssize_t TR_streamRead(TR_Stream, void *, size_t); ssize_t TR_streamWrite(TR_Stream, void *, size_t);