From 65c2326592b7b1496c468459689904843e443b26 Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Thu, 20 Nov 2014 17:37:55 +0100 Subject: Release KIRO to GitHub under LGPL v2.1 Added kiro_*_free methods to all three units Added installation guide Added readme Added licence file --- src/kiro-client.c | 23 +++++++++++++++-------- src/kiro-client.h | 5 +++-- src/kiro-server.c | 21 +++++++++++++-------- src/kiro-server.h | 7 +++++-- src/kiro-trb.c | 17 ++++++++++++++++- src/kiro-trb.h | 4 +++- 6 files changed, 55 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/kiro-client.c b/src/kiro-client.c index 1175e7e..47f0d47 100644 --- a/src/kiro-client.c +++ b/src/kiro-client.c @@ -67,6 +67,19 @@ kiro_client_new (void) } +void +kiro_client_free (KiroClient *client) +{ + if (!client) + return; + + if (KIRO_IS_CLIENT (client)) + g_object_unref (client); + else + g_warning ("Trying to use kiro_client_free on an object which is not a KIRO client. Ignoring..."); +} + + static void kiro_client_init (KiroClient *self) { @@ -74,14 +87,14 @@ kiro_client_init (KiroClient *self) memset (priv, 0, sizeof (&priv)); } + static void kiro_client_finalize (GObject *object) { - //KiroClient *self = KIRO_CLIENT(object); - //KiroClientPrivate * priv = KIRO_CLIENT_GET_PRIVATE(self); //PASS } + static void kiro_client_class_init (KiroClientClass *klass) { @@ -91,7 +104,6 @@ kiro_client_class_init (KiroClientClass *klass) } - int kiro_client_connect (KiroClient *self, const char *address, const char *port) { @@ -203,7 +215,6 @@ kiro_client_connect (KiroClient *self, const char *address, const char *port) } - int kiro_client_sync (KiroClient *self) { @@ -286,7 +297,3 @@ kiro_client_get_memory_size (KiroClient *self) return ctx->rdma_mr->size; } - - - - diff --git a/src/kiro-client.h b/src/kiro-client.h index b4e1b09..8e99877 100644 --- a/src/kiro-client.h +++ b/src/kiro-client.h @@ -72,11 +72,12 @@ struct _KiroClientClass { /* GObject and GType functions */ GType kiro_client_get_type (void); -KiroClient *kiro_client_new (void); +KiroClient* kiro_client_new (void); -/* client functions */ +void kiro_client_free (KiroClient *client); +/* client functions */ int kiro_client_connect (KiroClient *client, const char *dest_addr, const char *dest_port); int kiro_client_sync (KiroClient *client); diff --git a/src/kiro-server.c b/src/kiro-server.c index 3913006..c544267 100644 --- a/src/kiro-server.c +++ b/src/kiro-server.c @@ -72,6 +72,19 @@ kiro_server_new (void) } +void +kiro_server_free (KiroServer *server) +{ + if (!server) + return; + + if (KIRO_IS_SERVER (server)) + g_object_unref (server); + else + g_warning ("Trying to use kiro_server_free on an object which is not a KIRO server. Ignoring..."); +} + + static void kiro_server_init (KiroServer *self) { @@ -272,8 +285,6 @@ event_loop (void *self) } - - int kiro_server_start (KiroServer *self, char *address, char *port, void *mem, size_t mem_size) { @@ -395,9 +406,3 @@ kiro_server_stop (KiroServer *self) g_message ("Server stopped successfully"); } - - - - - - diff --git a/src/kiro-server.h b/src/kiro-server.h index e0de71c..78b2cf4 100644 --- a/src/kiro-server.h +++ b/src/kiro-server.h @@ -72,7 +72,10 @@ struct _KiroServerClass { /* GObject and GType functions */ GType kiro_server_get_type (void); -KiroServer* kiro_server_new (void); +KiroServer *kiro_server_new (void); + +void kiro_server_free (KiroServer *server); + /* server functions */ @@ -113,4 +116,4 @@ void kiro_server_stop (KiroServer *server); G_END_DECLS -#endif //__KIRO_SERVER_H \ No newline at end of file +#endif //__KIRO_SERVER_H diff --git a/src/kiro-trb.c b/src/kiro-trb.c index 6737f83..e26d12a 100644 --- a/src/kiro-trb.c +++ b/src/kiro-trb.c @@ -70,6 +70,19 @@ kiro_trb_new (void) } +void +kiro_trb_free (KiroTrb *trb) +{ + if (!trb) + return; + + if (KIRO_IS_TRB (trb)) + g_object_unref (trb); + else + g_warning ("Trying to use kiro_trb_free on an object which is not a KIRO TRB. Ignoring..."); +} + + static void kiro_trb_init (KiroTrb *self) { @@ -77,6 +90,7 @@ void kiro_trb_init (KiroTrb *self) priv->initialized = 0; } + static void kiro_trb_finalize (GObject *object) { @@ -87,6 +101,7 @@ kiro_trb_finalize (GObject *object) free (priv->mem); } + static void kiro_trb_class_init (KiroTrbClass *klass) { @@ -164,7 +179,6 @@ kiro_trb_get_raw_buffer (KiroTrb *self) } - void * kiro_trb_get_element (KiroTrb *self, uint64_t element) { @@ -345,3 +359,4 @@ kiro_trb_clone (KiroTrb *self, void *buff_in) kiro_trb_refresh (self); return 0; } + diff --git a/src/kiro-trb.h b/src/kiro-trb.h index 36d3b5e..ff8d418 100644 --- a/src/kiro-trb.h +++ b/src/kiro-trb.h @@ -82,6 +82,8 @@ GType kiro_trb_get_type (void); KiroTrb* kiro_trb_new (void); +void kiro_trb_free (KiroTrb *trb); + /* trb functions */ @@ -360,4 +362,4 @@ void kiro_trb_adopt (KiroTrb *trb, void *source); G_END_DECLS -#endif //__KIRO_TRB_H \ No newline at end of file +#endif //__KIRO_TRB_H -- cgit v1.2.3