diff options
author | Timo Dritschler <timo.dritschler@kit.edu> | 2014-08-28 18:39:37 +0200 |
---|---|---|
committer | Timo Dritschler <timo.dritschler@kit.edu> | 2014-08-28 18:40:38 +0200 |
commit | 933637e8a1ee376ffccb8ca6ac2c5fc350c6eb99 (patch) | |
tree | 5bc6ee9921031d3d27489c2b8133599940d4ac2b | |
parent | c126f452df5d29acd0eee8e6ef9f7aaa4b0358a5 (diff) | |
download | kiro-933637e8a1ee376ffccb8ca6ac2c5fc350c6eb99.tar.gz kiro-933637e8a1ee376ffccb8ca6ac2c5fc350c6eb99.tar.bz2 kiro-933637e8a1ee376ffccb8ca6ac2c5fc350c6eb99.tar.xz kiro-933637e8a1ee376ffccb8ca6ac2c5fc350c6eb99.zip |
Fix #5: Added kiro_CLASS_new methods to all KIRO classes
Changed test software to use the new kiro_CLASS_new functions
-rw-r--r-- | src/kiro-client.c | 6 | ||||
-rw-r--r-- | src/kiro-client.h | 2 | ||||
-rw-r--r-- | src/kiro-server.c | 8 | ||||
-rw-r--r-- | src/kiro-server.h | 4 | ||||
-rw-r--r-- | src/kiro-trb.c | 6 | ||||
-rw-r--r-- | src/kiro-trb.h | 2 | ||||
-rw-r--r-- | test/test-client.c | 4 | ||||
-rw-r--r-- | test/test-server.c | 4 |
8 files changed, 27 insertions, 9 deletions
diff --git a/src/kiro-client.c b/src/kiro-client.c index 0e2d486..1fd7860 100644 --- a/src/kiro-client.c +++ b/src/kiro-client.c @@ -60,6 +60,12 @@ struct _KiroClientPrivate { G_DEFINE_TYPE (KiroClient, kiro_client, G_TYPE_OBJECT); +KiroClient* +kiro_client_new (void) { + return g_object_new (KIRO_TYPE_CLIENT, NULL); +} + + static void kiro_client_init (KiroClient *self) { KiroClientPrivate *priv = KIRO_CLIENT_GET_PRIVATE(self); diff --git a/src/kiro-client.h b/src/kiro-client.h index e3e60de..fc98b3f 100644 --- a/src/kiro-client.h +++ b/src/kiro-client.h @@ -72,7 +72,7 @@ struct _KiroClientClass { /* GObject and GType functions */ GType kiro_client_get_type (void); -GObject kiro_client_new (void); +KiroClient* kiro_client_new (void); /* client functions */ diff --git a/src/kiro-server.c b/src/kiro-server.c index c1d099e..15a8ccb 100644 --- a/src/kiro-server.c +++ b/src/kiro-server.c @@ -65,6 +65,12 @@ struct _KiroServerPrivate { G_DEFINE_TYPE (KiroServer, kiro_server, G_TYPE_OBJECT); +KiroServer* +kiro_server_new (void) { + return g_object_new (KIRO_TYPE_SERVER, NULL); +} + + static void kiro_server_init (KiroServer *self) { KiroServerPrivate *priv = KIRO_SERVER_GET_PRIVATE(self); @@ -246,7 +252,7 @@ void * event_loop (void *self) GList *client = g_list_find (priv->clients, (gconstpointer) ev->id); if (client) { struct kiro_connection_context *ctx = (struct kiro_connection_context *)(ev->id->context); - printf ("Got disconnect request from client %s.\n", ctx->identifier); + printf ("Got disconnect request from client %u.\n", ctx->identifier); priv->clients = g_list_delete_link (priv->clients, client); } else diff --git a/src/kiro-server.h b/src/kiro-server.h index ea853c3..9a70488 100644 --- a/src/kiro-server.h +++ b/src/kiro-server.h @@ -70,9 +70,9 @@ struct _KiroServerClass { /* GObject and GType functions */ -GType kiro_server_get_type (void); +GType kiro_server_get_type (void); -GObject kiro_server_new (void); +KiroServer* kiro_server_new (void); /* server functions */ diff --git a/src/kiro-trb.c b/src/kiro-trb.c index aa71648..bb4a769 100644 --- a/src/kiro-trb.c +++ b/src/kiro-trb.c @@ -63,6 +63,12 @@ struct _KiroTrbPrivate { G_DEFINE_TYPE (KiroTrb, kiro_trb, G_TYPE_OBJECT); +KiroTrb* +kiro_trb_new (void) { + return g_object_new (KIRO_TYPE_TRB, NULL); +} + + static void kiro_trb_init (KiroTrb *self) { diff --git a/src/kiro-trb.h b/src/kiro-trb.h index 1853966..3753b29 100644 --- a/src/kiro-trb.h +++ b/src/kiro-trb.h @@ -80,7 +80,7 @@ struct KiroTrbInfo { /* GObject and GType functions */ GType kiro_trb_get_type (void); -GObject kiro_trb_new (void); +KiroTrb* kiro_trb_new (void); /* trb functions */ diff --git a/test/test-client.c b/test/test-client.c index 469aa5e..cdac3ee 100644 --- a/test/test-client.c +++ b/test/test-client.c @@ -37,7 +37,7 @@ int main ( int argc, char *argv[] ) printf("Not enough aruments. Usage: ./client <address> <port>\n"); return -1; } - KiroClient *client = g_object_new(KIRO_TYPE_CLIENT, NULL); + KiroClient *client = kiro_client_new (); if(-1 == kiro_client_connect(client, argv[1], argv[2])) { g_object_unref(client); @@ -45,7 +45,7 @@ int main ( int argc, char *argv[] ) } kiro_client_sync(client); - KiroTrb *trb = g_object_new(KIRO_TYPE_TRB, NULL); + KiroTrb *trb = kiro_trb_new (); kiro_trb_adopt(trb, kiro_client_get_memory(client)); _Bool ok = diff --git a/test/test-server.c b/test/test-server.c index 7755015..9161122 100644 --- a/test/test-server.c +++ b/test/test-server.c @@ -141,8 +141,8 @@ print_current_frame (gchar *buffer, guint number, guint width, guint height, GRa int main(void) { - KiroServer *server = g_object_new(KIRO_TYPE_SERVER, NULL); - KiroTrb *rb = g_object_new(KIRO_TYPE_TRB, NULL); + KiroServer *server = kiro_server_new (); + KiroTrb *rb = kiro_trb_new (); kiro_trb_reshape(rb, 512*512, 15); GRand *rand = g_rand_new(); if(0 > kiro_server_start(server, NULL, "60010", kiro_trb_get_raw_buffer(rb), kiro_trb_get_raw_size(rb))) |