chiark / gitweb /
Don't link against -lgc if not using garbage collection.
[disorder] / disobedience / disobedience.c
index 8826f4c8a46dd65051a92db6b9269503af76435b..e0a987aa746f96f5cd0983cebc30bbe0e9c3cf25 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder.
- * Copyright (C) 2006 Richard Kettlewell
+ * Copyright (C) 2006, 2007 Richard Kettlewell
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -58,15 +58,6 @@ int volume_l, volume_r;                 /* volume */
 double goesupto = 10;                   /* volume upper bound */
 int choosealpha;                        /* break up choose by letter */
 
-static const GMemVTable glib_memvtable = {
-  xmalloc,
-  xrealloc,
-  xfree,
-  0,                                    /* calloc */
-  0,                                    /* try_malloc */
-  0                                     /* try_realloc */
-};
-
 static const disorder_eclient_log_callbacks gdisorder_log_callbacks = {
   log_connected,
   log_completed,
@@ -328,10 +319,8 @@ int main(int argc, char **argv) {
   int n;
   disorder_eclient *logclient;
 
-  mem_init(1);
+  mem_init();
   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
-  /* GLib sucks - not const-correct */
-  g_mem_set_vtable((GMemVTable *)&glib_memvtable);
   gtk_init(&argc, &argv);
   gtk_rc_parse_string(style);
   while((n = getopt_long(argc, argv, "hVc:dtH", options, 0)) >= 0) {
@@ -345,13 +334,15 @@ int main(int argc, char **argv) {
     default: fatal(0, "invalid option");
     }
   }
+  signal(SIGPIPE, SIG_IGN);
   /* create the event loop */
   D(("create main loop"));
   mainloop = g_main_loop_new(0, 0);
   if(config_read()) fatal(0, "cannot read configuration");
   /* create the clients */
-  client = gtkclient();
-  logclient = gtkclient();
+  if(!(client = gtkclient())
+     || !(logclient = gtkclient()))
+    return 1;                           /* already reported an error */
   disorder_eclient_log(logclient, &gdisorder_log_callbacks, 0);
   /* periodic operations (e.g. expiring the cache) */
   g_timeout_add(600000/*milliseconds*/, periodic, 0);