static void cleanup_crawlers (GMainContext *context);
-gboolean
+static gboolean
read_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_read = 0;
return TRUE;
}
-gboolean
+static gboolean
write_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_written = 0;
return TRUE;
}
-gboolean
+static gboolean
adder_callback (GIOChannel *source,
GIOCondition condition,
gpointer data)
char buf1[32];
char buf2[32];
- char result[32];
+ char result[32] = { 0, };
AddrData *addr_data = data;
return TRUE;
}
-gboolean
+static gboolean
timeout_callback (gpointer data)
{
AddrData *addr_data = data;
return TRUE;
}
-gpointer
+static gpointer
adder_thread (gpointer data)
{
GMainContext *context;
g_mutex_unlock (&context_array_mutex);
cleanup_crawlers (context);
+ g_main_context_unref (context);
return NULL;
}
-void
+static void
io_pipe (GIOChannel **channels)
{
gint fds[2];
g_io_channel_set_close_on_unref (channels[1], TRUE);
}
-void
+static void
do_add (GIOChannel *in, gint a, gint b)
{
- char buf1[32];
- char buf2[32];
+ char buf1[32] = { 0, };
+ char buf2[32] = { 0, };
sprintf (buf1, "%d", a);
sprintf (buf2, "%d", b);
write_all (in, buf2, 32);
}
-gboolean
+static gboolean
adder_response (GIOChannel *source,
GIOCondition condition,
gpointer data)
return TRUE;
}
-void
+static void
create_adder_thread (void)
{
GError *err = NULL;
return TRUE;
}
-int
+int
main (int argc,
char *argv[])
{
gint i;
- g_thread_init (NULL);
-
context_array = g_ptr_array_new ();
crawler_array = g_ptr_array_new ();
g_main_loop_run (main_loop);
g_main_loop_unref (main_loop);
+ g_ptr_array_unref (crawler_array);
+ g_ptr_array_unref (context_array);
+
return 0;
}